{"version":3,"file":"BrowserConfigurationAuthError.js","sources":["../../src/error/BrowserConfigurationAuthError.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"@azure/msal-common\";\r\n\r\n/**\r\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nexport const BrowserConfigurationAuthErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n storageNotSupportedError: {\r\n code: \"storage_not_supported\",\r\n desc: \"Given storage configuration option was not supported.\"\r\n },\r\n noRedirectCallbacksSet: {\r\n code: \"no_redirect_callbacks\",\r\n desc: \"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n invalidCallbackObject: {\r\n code: \"invalid_callback_object\",\r\n desc: \"The object passed for the callback was invalid. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n stubPcaInstanceCalled: {\r\n code: \"stubbed_public_client_application_called\",\r\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\"\r\n },\r\n inMemRedirectUnavailable: {\r\n code: \"in_mem_redirect_unavailable\",\r\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.\"\r\n },\r\n entropyNotProvided: {\r\n code: \"entropy_not_provided\",\r\n desc: \"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option.\"\r\n }\r\n};\r\n\r\n/**\r\n * Browser library error class thrown by the MSAL.js library for SPAs\r\n */\r\nexport class BrowserConfigurationAuthError extends AuthError {\r\n\r\n constructor(errorCode: string, errorMessage?: string) {\r\n super(errorCode, errorMessage);\r\n this.name = \"BrowserConfigurationAuthError\";\r\n\r\n Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n static createRedirectUriEmptyError(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code,\r\n BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n static createPostLogoutRedirectUriEmptyError(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code,\r\n BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);\r\n }\r\n\r\n /**\r\n * Creates error thrown when given storage location is not supported.\r\n * @param givenStorageLocation \r\n */\r\n static createStorageNotSupportedError(givenStorageLocation: string): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, `${BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc} Given Location: ${givenStorageLocation}`);\r\n }\r\n\r\n /**\r\n * Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().\r\n */\r\n static createRedirectCallbacksNotSetError(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, \r\n BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);\r\n }\r\n\r\n /**\r\n * Creates error thrown when the stub instance of PublicClientApplication is called.\r\n */\r\n static createStubPcaInstanceCalledError(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code,\r\n BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);\r\n }\r\n\r\n /*\r\n * Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.\r\n */\r\n static createInMemoryRedirectUnavailableError(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);\r\n }\r\n \r\n /**\r\n * Creates an error thrown when a crypto interface that requires entropy is initialized without entropy\r\n */\r\n static createEntropyNotProvided(): BrowserConfigurationAuthError {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);\r\n }\r\n}\r\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;QA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