{"version":3,"file":"BrowserConfigurationAuthError.js","sources":["../../src/error/BrowserConfigurationAuthError.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthError } from \"@azure/msal-common\";\n\n/**\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\n */\nexport const BrowserConfigurationAuthErrorMessage = {\n redirectUriNotSet: {\n code: \"redirect_uri_empty\",\n desc: \"A redirect URI is required for all calls, and none has been set.\"\n },\n postLogoutUriNotSet: {\n code: \"post_logout_uri_empty\",\n desc: \"A post logout redirect has not been set.\"\n },\n storageNotSupportedError: {\n code: \"storage_not_supported\",\n desc: \"Given storage configuration option was not supported.\"\n },\n noRedirectCallbacksSet: {\n code: \"no_redirect_callbacks\",\n desc: \"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. \" +\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\n },\n invalidCallbackObject: {\n code: \"invalid_callback_object\",\n desc: \"The object passed for the callback was invalid. \" +\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\n },\n stubPcaInstanceCalled: {\n code: \"stubbed_public_client_application_called\",\n desc: \"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors\"\n },\n inMemRedirectUnavailable: {\n code: \"in_mem_redirect_unavailable\",\n desc: \"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true.\"\n },\n entropyNotProvided: {\n code: \"entropy_not_provided\",\n desc: \"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option.\"\n }\n};\n\n/**\n * Browser library error class thrown by the MSAL.js library for SPAs\n */\nexport class BrowserConfigurationAuthError extends AuthError {\n\n constructor(errorCode: string, errorMessage?: string) {\n super(errorCode, errorMessage);\n this.name = \"BrowserConfigurationAuthError\";\n\n Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);\n }\n\n /**\n * Creates an error thrown when the redirect uri is empty (not set by caller)\n */\n static createRedirectUriEmptyError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code,\n BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);\n }\n\n /**\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\n */\n static createPostLogoutRedirectUriEmptyError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code,\n BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);\n }\n\n /**\n * Creates error thrown when given storage location is not supported.\n * @param givenStorageLocation \n */\n static createStorageNotSupportedError(givenStorageLocation: string): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, `${BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc} Given Location: ${givenStorageLocation}`);\n }\n\n /**\n * Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().\n */\n static createRedirectCallbacksNotSetError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, \n BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);\n }\n\n /**\n * Creates error thrown when the stub instance of PublicClientApplication is called.\n */\n static createStubPcaInstanceCalledError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code,\n BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);\n }\n\n /*\n * Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.\n */\n static createInMemoryRedirectUnavailableError(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);\n }\n \n /**\n * Creates an error thrown when a crypto interface that requires entropy is initialized without entropy\n */\n static createEntropyNotProvided(): BrowserConfigurationAuthError {\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;;;;AAOA;;;IAGa,oCAAoC,GAAG;IAChD,iBAAiB,EAAE;QACf,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,kEAAkE;KAC3E;IACD,mBAAmB,EAAE;QACjB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,0CAA0C;KACnD;IACD,wBAAwB,EAAE;QACtB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,uDAAuD;KAChE;IACD,sBAAsB,EAAE;QACpB,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,qIAAqI;YACvI,0HAA0H;KACjI;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,kDAAkD;YACtD,0HAA0H;KAC/H;IACD,qBAAqB,EAAE;QACnB,IAAI,EAAE,0CAA0C;QAChD,IAAI,EAAE,gLAAgL;KACzL;IACD,wBAAwB,EAAE;QACtB,IAAI,EAAE,6BAA6B;QACnC,IAAI,EAAE,uRAAuR;KAChS;IACD,kBAAkB,EAAE;QAChB,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,oHAAoH;KAC7H;EACH;AAEF;;;;IAGmD,iDAAS;IAExD,uCAAY,SAAiB,EAAE,YAAqB;QAApD,YACI,kBAAM,SAAS,EAAE,YAAY,CAAC,SAIjC;QAHG,KAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAE5C,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,6BAA6B,CAAC,SAAS,CAAC,CAAC;;KACxE;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