@azure/msal-browser 2.23.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +58 -1
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +290 -75
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.d.ts +1 -0
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +4 -1
- package/dist/app/IPublicClientApplication.js.map +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +48 -42
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +49 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.js +246 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts +44 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -0
- package/dist/broker/nativeBroker/NativeResponse.d.ts +24 -0
- package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -0
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +11 -0
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +44 -2
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.d.ts +1 -0
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +2 -2
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +99 -38
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +4 -3
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +7 -10
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.d.ts +58 -0
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.js +75 -3
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.d.ts +47 -0
- package/dist/error/NativeAuthError.d.ts.map +1 -0
- package/dist/error/NativeAuthError.js +83 -0
- package/dist/error/NativeAuthError.js.map +1 -0
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.d.ts +2 -0
- package/dist/event/EventType.d.ts.map +1 -1
- package/dist/event/EventType.js +3 -1
- package/dist/event/EventType.js.map +1 -1
- package/dist/index.cjs.js +6130 -4824
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -13
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +12 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +35 -3
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +57 -0
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -0
- package/dist/interaction_client/NativeInteractionClient.js +337 -0
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -0
- package/dist/interaction_client/PopupClient.d.ts +75 -2
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +315 -46
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +38 -9
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +2 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +3 -3
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +2 -4
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +5 -3
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +38 -25
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +2 -8
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +5 -9
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +3 -8
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +19 -8
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +2 -2
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +27 -20
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +5 -5
- package/dist/interaction_handler/SilentHandler.js.map +1 -1
- package/dist/internals.d.ts +17 -0
- package/dist/internals.d.ts.map +1 -0
- package/dist/internals.js +19 -0
- package/dist/internals.js.map +1 -0
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +2 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +2 -2
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/PopupWindowAttributes.d.ts +16 -0
- package/dist/request/PopupWindowAttributes.d.ts.map +1 -0
- package/dist/request/RedirectRequest.d.ts +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/SsoSilentRequest.d.ts +2 -2
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.d.ts +12 -1
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +14 -2
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.d.ts +6 -0
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.js +11 -1
- package/dist/utils/BrowserUtils.js.map +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +6130 -4824
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +40 -40
- package/package.json +2 -2
- package/dist/interaction_handler/PopupHandler.d.ts +0 -29
- package/dist/interaction_handler/PopupHandler.d.ts.map +0 -1
- package/dist/interaction_handler/PopupHandler.js +0 -69
- package/dist/interaction_handler/PopupHandler.js.map +0 -1
- package/dist/utils/PopupUtils.d.ts +0 -73
- package/dist/utils/PopupUtils.d.ts.map +0 -1
- package/dist/utils/PopupUtils.js +0 -185
- package/dist/utils/PopupUtils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAqC,YAAY,EAAsD,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEhO,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAC9C,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,2BAA2B,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../src/config/Configuration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAqC,YAAY,EAAsD,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEhO,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAC9C,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAA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|
|
1
|
+
/*! @azure/msal-browser v2.25.0 2022-06-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __assign } from '../_virtual/_tslib.js';
|
|
4
4
|
import { DEFAULT_SYSTEM_OPTIONS, StubbedNetworkModule, Constants, ProtocolMode, AzureCloudInstance, LogLevel } from '@azure/msal-common';
|
|
@@ -14,6 +14,7 @@ import { NavigationClient } from '../navigation/NavigationClient.js';
|
|
|
14
14
|
var DEFAULT_POPUP_TIMEOUT_MS = 60000;
|
|
15
15
|
var DEFAULT_IFRAME_TIMEOUT_MS = 6000;
|
|
16
16
|
var DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
17
|
+
var DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;
|
|
17
18
|
/**
|
|
18
19
|
* MSAL function that sets the default options when not explicitly configured from app developer
|
|
19
20
|
*
|
|
@@ -58,7 +59,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
58
59
|
// Default system options for browser
|
|
59
60
|
var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0,
|
|
60
61
|
// If loadFrameTimeout is provided, use that as default.
|
|
61
|
-
windowHashTimeout: (userInputSystem
|
|
62
|
+
windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS });
|
|
62
63
|
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
63
64
|
application: {
|
|
64
65
|
appName: Constants.EMPTY_STRING,
|
|
@@ -74,5 +75,5 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
74
75
|
return overlayedConfig;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
export { DEFAULT_IFRAME_TIMEOUT_MS, DEFAULT_POPUP_TIMEOUT_MS, DEFAULT_REDIRECT_TIMEOUT_MS, buildConfiguration };
|
|
78
|
+
export { DEFAULT_IFRAME_TIMEOUT_MS, DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, DEFAULT_POPUP_TIMEOUT_MS, DEFAULT_REDIRECT_TIMEOUT_MS, buildConfiguration };
|
|
78
79
|
//# sourceMappingURL=Configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.js","sources":["../../src/config/Configuration.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SystemOptions, LoggerOptions, INetworkModule, DEFAULT_SYSTEM_OPTIONS, Constants, ProtocolMode, LogLevel, StubbedNetworkModule, AzureCloudInstance, AzureCloudOptions, ApplicationTelemetry } from \"@azure/msal-common\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { BrowserCacheLocation } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NavigationClient } from \"../navigation/NavigationClient\";\n\n// Default timeout for popup windows and iframes in milliseconds\nexport const DEFAULT_POPUP_TIMEOUT_MS = 60000;\nexport const DEFAULT_IFRAME_TIMEOUT_MS = 6000;\nexport const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\n\n/**\n * Use this to configure the auth options in the Configuration object\n *\n * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\n * - authority - You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\n * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.\n * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.\n * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.\n * - postLogoutRedirectUri - The redirect URI where the window navigates after a successful logout.\n * - navigateToLoginRequestUrl - Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.\n * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\n * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\n */\nexport type BrowserAuthOptions = {\n clientId: string;\n authority?: string;\n knownAuthorities?: Array<string>;\n cloudDiscoveryMetadata?: string;\n authorityMetadata?: string;\n redirectUri?: string;\n postLogoutRedirectUri?: string | null;\n navigateToLoginRequestUrl?: boolean;\n clientCapabilities?: Array<string>;\n protocolMode?: ProtocolMode;\n azureCloudOptions?: AzureCloudOptions;\n};\n\n/**\n * Use this to configure the below cache configuration options:\n *\n * - cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are \"localStorage\" and \"sessionStorage\"\n * - storeAuthStateInCookie - If set, MSAL stores the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.\n * - secureCookies - If set, MSAL sets the \"Secure\" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.\n */\nexport type CacheOptions = {\n cacheLocation?: BrowserCacheLocation | string;\n storeAuthStateInCookie?: boolean;\n secureCookies?: boolean;\n};\n\n/**\n * Library Specific Options\n *\n * - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry\n * - loggerOptions - Used to initialize the Logger object (See ClientConfiguration.ts)\n * - networkClient - Network interface implementation\n * - windowHashTimeout - Sets the timeout for waiting for a response hash in a popup. Will take precedence over loadFrameTimeout if both are set.\n * - iframeHashTimeout - Sets the timeout for waiting for a response hash in an iframe. Will take precedence over loadFrameTimeout if both are set.\n * - loadFrameTimeout - Sets the timeout for waiting for a response hash in an iframe or popup\n * - navigateFrameWait - Maximum time the library should wait for a frame to load\n * - redirectNavigationTimeout - Time to wait for redirection to occur before resolving promise\n * - asyncPopups - Sets whether popups are opened asynchronously. By default, this flag is set to false. When set to false, blank popups are opened before anything else happens. When set to true, popups are opened when making the network request.\n * - allowRedirectInIframe - Flag to enable redirect opertaions when the app is rendered in an iframe (to support scenarios such as embedded B2C login).\n */\nexport type BrowserSystemOptions = SystemOptions & {\n loggerOptions?: LoggerOptions;\n networkClient?: INetworkModule;\n navigationClient?: INavigationClient;\n windowHashTimeout?: number;\n iframeHashTimeout?: number;\n loadFrameTimeout?: number;\n navigateFrameWait?: number;\n redirectNavigationTimeout?: number;\n asyncPopups?: boolean;\n allowRedirectInIframe?: boolean;\n};\n\n/**\n * Telemetry Options\n * - application: Telemetry information sent on request\n * - appName: Unique string name of an application\n * - appVersion: Version of the application using MSAL\n */\nexport type BrowserTelemetryOptions = {\n application?: ApplicationTelemetry;\n};\n\n/**\n * Use the configuration object to configure MSAL and initialize the UserAgentApplication.\n *\n * This object allows you to configure important elements of MSAL functionality:\n * - auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform\n * - cache: this is where you configure cache location and whether to store cache in cookies\n * - system: this is where you can configure the network client, logger, token renewal offset\n * - telemetry: this is where you can configure telemetry data and options\n */\nexport type Configuration = {\n auth: BrowserAuthOptions,\n cache?: CacheOptions,\n system?: BrowserSystemOptions,\n telemetry?: BrowserTelemetryOptions\n};\n\nexport type BrowserConfiguration = {\n auth: Required<BrowserAuthOptions>,\n cache: Required<CacheOptions>,\n system: Required<BrowserSystemOptions>,\n telemetry: Required<BrowserTelemetryOptions>\n};\n\n/**\n * MSAL function that sets the default options when not explicitly configured from app developer\n *\n * @param auth\n * @param cache\n * @param system\n *\n * @returns Configuration object\n */\nexport function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, telemetry: userInputTelemetry }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration {\n\n // Default auth options for browser\n const DEFAULT_AUTH_OPTIONS: Required<BrowserAuthOptions> = {\n clientId: Constants.EMPTY_STRING,\n authority: `${Constants.DEFAULT_AUTHORITY}`,\n knownAuthorities: [],\n cloudDiscoveryMetadata: Constants.EMPTY_STRING,\n authorityMetadata: Constants.EMPTY_STRING,\n redirectUri: Constants.EMPTY_STRING,\n postLogoutRedirectUri: Constants.EMPTY_STRING,\n navigateToLoginRequestUrl: true,\n clientCapabilities: [],\n protocolMode: ProtocolMode.AAD,\n azureCloudOptions: {\n azureCloudInstance: AzureCloudInstance.None,\n tenant: Constants.EMPTY_STRING\n },\n };\n\n // Default cache options for browser\n const DEFAULT_CACHE_OPTIONS: Required<CacheOptions> = {\n cacheLocation: BrowserCacheLocation.SessionStorage,\n storeAuthStateInCookie: false,\n secureCookies: false\n };\n\n // Default logger options for browser\n const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n loggerCallback: (): void => {},\n logLevel: LogLevel.Info,\n piiLoggingEnabled: false\n };\n\n // Default system options for browser\n const DEFAULT_BROWSER_SYSTEM_OPTIONS: Required<BrowserSystemOptions> = {\n ...DEFAULT_SYSTEM_OPTIONS,\n loggerOptions: DEFAULT_LOGGER_OPTIONS,\n networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule,\n navigationClient: new NavigationClient(),\n loadFrameTimeout: 0,\n // If loadFrameTimeout is provided, use that as default.\n windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS,\n iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS,\n navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0,\n redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,\n asyncPopups: false,\n allowRedirectInIframe: false\n };\n\n const DEFAULT_TELEMETRY_OPTIONS: Required<BrowserTelemetryOptions> = {\n application: {\n appName: Constants.EMPTY_STRING,\n appVersion: Constants.EMPTY_STRING\n }\n };\n\n const overlayedConfig: BrowserConfiguration = {\n auth: { ...DEFAULT_AUTH_OPTIONS, ...userInputAuth },\n cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },\n system: { ...DEFAULT_BROWSER_SYSTEM_OPTIONS, ...userInputSystem },\n telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry }\n };\n return overlayedConfig;\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAWA;IACa,wBAAwB,GAAG,MAAM;IACjC,yBAAyB,GAAG,KAAK;IACjC,2BAA2B,GAAG,MAAM;AAsGjD;;;;;;;;;SASgB,kBAAkB,CAAC,EAAqH,EAAE,oBAA6B;QAA5I,aAAa,UAAA,EAAS,cAAc,WAAA,EAAU,eAAe,YAAA,EAAa,kBAAkB,eAAA;;IAGnI,IAAM,oBAAoB,GAAiC;QACvD,QAAQ,EAAE,SAAS,CAAC,YAAY;QAChC,SAAS,EAAE,KAAG,SAAS,CAAC,iBAAmB;QAC3C,gBAAgB,EAAE,EAAE;QACpB,sBAAsB,EAAE,SAAS,CAAC,YAAY;QAC9C,iBAAiB,EAAE,SAAS,CAAC,YAAY;QACzC,WAAW,EAAE,SAAS,CAAC,YAAY;QACnC,qBAAqB,EAAE,SAAS,CAAC,YAAY;QAC7C,yBAAyB,EAAE,IAAI;QAC/B,kBAAkB,EAAE,EAAE;QACtB,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,iBAAiB,EAAE;YACf,kBAAkB,EAAE,kBAAkB,CAAC,IAAI;YAC3C,MAAM,EAAE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
|
1
|
+
{"version":3,"file":"Configuration.js","sources":["../../src/config/Configuration.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SystemOptions, LoggerOptions, INetworkModule, DEFAULT_SYSTEM_OPTIONS, Constants, ProtocolMode, LogLevel, StubbedNetworkModule, AzureCloudInstance, AzureCloudOptions, ApplicationTelemetry } from \"@azure/msal-common\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { BrowserCacheLocation } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NavigationClient } from \"../navigation/NavigationClient\";\n\n// Default timeout for popup windows and iframes in milliseconds\nexport const DEFAULT_POPUP_TIMEOUT_MS = 60000;\nexport const DEFAULT_IFRAME_TIMEOUT_MS = 6000;\nexport const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\nexport const DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;\n\n/**\n * Use this to configure the auth options in the Configuration object\n */\nexport type BrowserAuthOptions = {\n /**\n * Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\n */\n clientId: string;\n /**\n * You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\n */\n authority?: string;\n /**\n * An array of URIs that are known to be valid. Used in B2C scenarios.\n */\n knownAuthorities?: Array<string>;\n /**\n * A string containing the cloud discovery response. Used in AAD scenarios.\n */\n cloudDiscoveryMetadata?: string;\n /**\n * A string containing the .well-known/openid-configuration endpoint response\n */\n authorityMetadata?: string;\n /**\n * The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.\n */\n redirectUri?: string;\n /**\n * The redirect URI where the window navigates after a successful logout.\n */\n postLogoutRedirectUri?: string | null;\n /**\n * Boolean indicating whether to navigate to the original request URL after the auth server navigates to the redirect URL.\n */\n navigateToLoginRequestUrl?: boolean;\n /**\n * Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\n */\n clientCapabilities?: Array<string>;\n /**\n * Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\n */\n protocolMode?: ProtocolMode;\n /**\n * Enum that represents the Azure Cloud to use.\n */\n azureCloudOptions?: AzureCloudOptions;\n};\n\n/**\n * Use this to configure the below cache configuration options:\n */\nexport type CacheOptions = {\n /**\n * Used to specify the cacheLocation user wants to set. Valid values are \"localStorage\" and \"sessionStorage\"\n */\n cacheLocation?: BrowserCacheLocation | string;\n /**\n * If set, MSAL stores the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.\n */\n storeAuthStateInCookie?: boolean;\n /**\n * If set, MSAL sets the \"Secure\" flag on cookies so they can only be sent over HTTPS. By default this flag is set to false.\n */\n secureCookies?: boolean;\n};\n\nexport type BrowserSystemOptions = SystemOptions & {\n /**\n * Used to initialize the Logger object (See ClientConfiguration.ts)\n */\n loggerOptions?: LoggerOptions;\n /**\n * Network interface implementation\n */\n networkClient?: INetworkModule;\n /**\n * Override the methods used to navigate to other webpages. Particularly useful if you are using a client-side router\n */\n navigationClient?: INavigationClient;\n /**\n * Sets the timeout for waiting for a response hash in a popup. Will take precedence over loadFrameTimeout if both are set.\n */\n windowHashTimeout?: number;\n /**\n * Sets the timeout for waiting for a response hash in an iframe. Will take precedence over loadFrameTimeout if both are set.\n */\n iframeHashTimeout?: number;\n /**\n * Sets the timeout for waiting for a response hash in an iframe or popup\n */\n loadFrameTimeout?: number;\n /**\n * Maximum time the library should wait for a frame to load\n */\n navigateFrameWait?: number;\n /**\n * Time to wait for redirection to occur before resolving promise\n */\n redirectNavigationTimeout?: number;\n /**\n * Sets whether popups are opened asynchronously. By default, this flag is set to false. When set to false, blank popups are opened before anything else happens. When set to true, popups are opened when making the network request.\n */\n asyncPopups?: boolean;\n /**\n * Flag to enable redirect opertaions when the app is rendered in an iframe (to support scenarios such as embedded B2C login).\n */\n allowRedirectInIframe?: boolean;\n /**\n * Flag to enable native broker support (e.g. acquiring tokens from WAM on Windows)\n */\n allowNativeBroker?: boolean;\n /**\n * Sets the timeout for waiting for the native broker handshake to resolve\n */\n nativeBrokerHandshakeTimeout?: number;\n};\n\n/**\n * Telemetry Options\n */\nexport type BrowserTelemetryOptions = {\n /**\n * Telemetry information sent on request\n * - appName: Unique string name of an application\n * - appVersion: Version of the application using MSAL\n */\n application?: ApplicationTelemetry;\n};\n\n/**\n * This object allows you to configure important elements of MSAL functionality and is passed into the constructor of PublicClientApplication\n */\nexport type Configuration = {\n /**\n * This is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform\n */\n auth: BrowserAuthOptions,\n /**\n * This is where you configure cache location and whether to store cache in cookies\n */\n cache?: CacheOptions,\n /**\n * This is where you can configure the network client, logger, token renewal offset\n */\n system?: BrowserSystemOptions,\n /**\n * This is where you can configure telemetry data and options\n */\n telemetry?: BrowserTelemetryOptions\n};\n\nexport type BrowserConfiguration = {\n auth: Required<BrowserAuthOptions>,\n cache: Required<CacheOptions>,\n system: Required<BrowserSystemOptions>,\n telemetry: Required<BrowserTelemetryOptions>\n};\n\n/**\n * MSAL function that sets the default options when not explicitly configured from app developer\n *\n * @param auth\n * @param cache\n * @param system\n *\n * @returns Configuration object\n */\nexport function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, telemetry: userInputTelemetry }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration {\n\n // Default auth options for browser\n const DEFAULT_AUTH_OPTIONS: Required<BrowserAuthOptions> = {\n clientId: Constants.EMPTY_STRING,\n authority: `${Constants.DEFAULT_AUTHORITY}`,\n knownAuthorities: [],\n cloudDiscoveryMetadata: Constants.EMPTY_STRING,\n authorityMetadata: Constants.EMPTY_STRING,\n redirectUri: Constants.EMPTY_STRING,\n postLogoutRedirectUri: Constants.EMPTY_STRING,\n navigateToLoginRequestUrl: true,\n clientCapabilities: [],\n protocolMode: ProtocolMode.AAD,\n azureCloudOptions: {\n azureCloudInstance: AzureCloudInstance.None,\n tenant: Constants.EMPTY_STRING\n },\n };\n\n // Default cache options for browser\n const DEFAULT_CACHE_OPTIONS: Required<CacheOptions> = {\n cacheLocation: BrowserCacheLocation.SessionStorage,\n storeAuthStateInCookie: false,\n secureCookies: false\n };\n\n // Default logger options for browser\n const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n loggerCallback: (): void => {},\n logLevel: LogLevel.Info,\n piiLoggingEnabled: false\n };\n\n // Default system options for browser\n const DEFAULT_BROWSER_SYSTEM_OPTIONS: Required<BrowserSystemOptions> = {\n ...DEFAULT_SYSTEM_OPTIONS,\n loggerOptions: DEFAULT_LOGGER_OPTIONS,\n networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule,\n navigationClient: new NavigationClient(),\n loadFrameTimeout: 0,\n // If loadFrameTimeout is provided, use that as default.\n windowHashTimeout: userInputSystem?.loadFrameTimeout || DEFAULT_POPUP_TIMEOUT_MS,\n iframeHashTimeout: userInputSystem?.loadFrameTimeout || DEFAULT_IFRAME_TIMEOUT_MS,\n navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0,\n redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,\n asyncPopups: false,\n allowRedirectInIframe: false,\n allowNativeBroker: false,\n nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS\n };\n\n const DEFAULT_TELEMETRY_OPTIONS: Required<BrowserTelemetryOptions> = {\n application: {\n appName: Constants.EMPTY_STRING,\n appVersion: Constants.EMPTY_STRING\n }\n };\n\n const overlayedConfig: BrowserConfiguration = {\n auth: { ...DEFAULT_AUTH_OPTIONS, ...userInputAuth },\n cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },\n system: { ...DEFAULT_BROWSER_S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BAAoB,GAAG,YAAY,CAAC,uBAAuB,EAAE,GAAG,oBAAoB,EACnG,gBAAgB,EAAE,IAAI,gBAAgB,EAAE,EACxC,gBAAgB,EAAE,CAAC;;QAEnB,iBAAiB,EAAE,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,KAAI,wBAAwB,EAChF,iBAAiB,EAAE,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,gBAAgB,KAAI,yBAAyB,EACjF,iBAAiB,EAAE,oBAAoB,IAAI,YAAY,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,CAAC,EAClF,yBAAyB,EAAE,2BAA2B,EACtD,WAAW,EAAE,KAAK,EAClB,qBAAqB,EAAE,KAAK,EAC5B,iBAAiB,EAAE,KAAK,EACxB,4BAA4B,EAAE,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,4BAA4B,KAAI,0CAA0C,GAC5H,CAAC;IAEF,IAAM,yBAAyB,GAAsC;QACjE,WAAW,EAAE;YACT,OAAO,EAAE,SAAS,CAAC,YAAY;YAC/B,UAAU,EAAE,SAAS,CAAC,YAAY;SACrC;KACJ,CAAC;IAEF,IAAM,eAAe,GAAyB;QAC1C,IAAI,wBAAO,oBAAoB,GAAK,aAAa,CAAE;QACnD,KAAK,wBAAO,qBAAqB,GAAK,cAAc,CAAE;QACtD,MAAM,wBAAO,8BAA8B,GAAK,eAAe,CAAE;QACjE,SAAS,wBAAO,yBAAyB,GAAK,kBAAkB,CAAE;KACrE,CAAC;IACF,OAAO,eAAe,CAAC;AAC3B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoOps.d.ts","sourceRoot":"","sources":["../../src/crypto/CryptoOps.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CryptoOps.d.ts","sourceRoot":"","sources":["../../src/crypto/CryptoOps.ts"],"names":[],"mappings":"AAKA,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IAI7C;;;OAGG;IACG,sBAAsB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC;IA2CnF;;;OAGG;IACG,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM1D;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAoBvC;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA4C/F;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAKvD"}
|
package/dist/crypto/CryptoOps.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.25.0 2022-06-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
4
|
-
import { PerformanceEvents } from '@azure/msal-common';
|
|
4
|
+
import { PerformanceEvents, JoseHeader } from '@azure/msal-common';
|
|
5
5
|
import { GuidGenerator } from './GuidGenerator.js';
|
|
6
6
|
import { Base64Encode } from '../encode/Base64Encode.js';
|
|
7
7
|
import { Base64Decode } from '../encode/Base64Decode.js';
|
|
8
8
|
import { PkceGenerator } from './PkceGenerator.js';
|
|
9
9
|
import { BrowserCrypto } from './BrowserCrypto.js';
|
|
10
10
|
import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';
|
|
11
|
-
import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';
|
|
12
11
|
import { BrowserAuthError } from '../error/BrowserAuthError.js';
|
|
13
12
|
import { AsyncMemoryStorage } from '../cache/AsyncMemoryStorage.js';
|
|
14
13
|
|
|
@@ -187,7 +186,7 @@ var CryptoOps = /** @class */ (function () {
|
|
|
187
186
|
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
188
187
|
var _a;
|
|
189
188
|
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
-
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString,
|
|
189
|
+
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, encodedKeyIdThumbprint, shrHeader, encodedShrHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
|
|
191
190
|
return __generator(this, function (_b) {
|
|
192
191
|
switch (_b.label) {
|
|
193
192
|
case 0:
|
|
@@ -202,17 +201,15 @@ var CryptoOps = /** @class */ (function () {
|
|
|
202
201
|
case 2:
|
|
203
202
|
publicKeyJwk = _b.sent();
|
|
204
203
|
publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
};
|
|
209
|
-
encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));
|
|
204
|
+
encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));
|
|
205
|
+
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
206
|
+
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
210
207
|
// Generate payload
|
|
211
208
|
payload.cnf = {
|
|
212
209
|
jwk: JSON.parse(publicKeyJwkString)
|
|
213
210
|
};
|
|
214
211
|
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
215
|
-
tokenString =
|
|
212
|
+
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
216
213
|
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
217
214
|
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
218
215
|
case 3:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoOps.js","sources":["../../src/crypto/CryptoOps.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, IPerformanceClient, Logger, PerformanceEvents, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from \"@azure/msal-common\";\nimport { GuidGenerator } from \"./GuidGenerator\";\nimport { Base64Encode } from \"../encode/Base64Encode\";\nimport { Base64Decode } from \"../encode/Base64Decode\";\nimport { PkceGenerator } from \"./PkceGenerator\";\nimport { BrowserCrypto } from \"./BrowserCrypto\";\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { KEY_FORMAT_JWK } from \"../utils/BrowserConstants\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { AsyncMemoryStorage } from \"../cache/AsyncMemoryStorage\";\n\nexport type CachedKeyPair = {\n publicKey: CryptoKey,\n privateKey: CryptoKey,\n requestMethod?: string,\n requestUri?: string\n};\n\n/**\n * MSAL CryptoKeyStore DB Version 2\n */\nexport type CryptoKeyStore = {\n asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;\n symmetricKeys: AsyncMemoryStorage<CryptoKey>;\n};\n\nexport enum CryptoKeyStoreNames {\n asymmetricKeys = \"asymmetricKeys\",\n symmetricKeys = \"symmetricKeys\"\n}\n\n/**\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and \n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\n */\nexport class CryptoOps implements ICrypto {\n\n private browserCrypto: BrowserCrypto;\n private guidGenerator: GuidGenerator;\n private b64Encode: Base64Encode;\n private b64Decode: Base64Decode;\n private pkceGenerator: PkceGenerator;\n private logger: Logger;\n\n /**\n * CryptoOps can be used in contexts outside a PCA instance,\n * meaning there won't be a performance manager available.\n */\n private performanceClient: IPerformanceClient | undefined;\n\n private static POP_KEY_USAGES: Array<KeyUsage> = [\"sign\", \"verify\"];\n private static EXTRACTABLE: boolean = true;\n private cache: CryptoKeyStore;\n\n constructor(logger: Logger, performanceClient?: IPerformanceClient) {\n this.logger = logger;\n // Browser crypto needs to be validated first before any other classes can be set.\n this.browserCrypto = new BrowserCrypto(this.logger);\n this.b64Encode = new Base64Encode();\n this.b64Decode = new Base64Decode();\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\n this.cache = {\n asymmetricKeys: new AsyncMemoryStorage<CachedKeyPair>(this.logger, CryptoKeyStoreNames.asymmetricKeys),\n symmetricKeys: new AsyncMemoryStorage<CryptoKey>(this.logger, CryptoKeyStoreNames.symmetricKeys)\n };\n this.performanceClient = performanceClient;\n }\n\n /**\n * Creates a new random GUID - used to populate state and nonce.\n * @returns string (GUID)\n */\n createNewGuid(): string {\n return this.guidGenerator.generateGuid();\n }\n\n /**\n * Encodes input string to base64.\n * @param input \n */\n base64Encode(input: string): string {\n return this.b64Encode.encode(input);\n } \n \n /**\n * Decodes input string from base64.\n * @param input \n */\n base64Decode(input: string): string {\n return this.b64Decode.decode(input);\n }\n\n /**\n * Generates PKCE codes used in Authorization Code Flow.\n */\n async generatePkceCodes(): Promise<PkceCodes> {\n return this.pkceGenerator.generateCodes();\n }\n\n /**\n * Generates a keypair, stores it and returns a thumbprint\n * @param request\n */\n async getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string> {\n const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);\n\n // Generate Keypair\n const keyPair: CryptoKeyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);\n\n // Generate Thumbprint for Public Key\n const publicKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.publicKey);\n \n const pubKeyThumprintObj: JsonWebKey = {\n e: publicKeyJwk.e,\n kty: publicKeyJwk.kty,\n n: publicKeyJwk.n\n };\n\n const publicJwkString: string = BrowserCrypto.getJwkString(pubKeyThumprintObj);\n const publicJwkHash = await this.hashString(publicJwkString);\n\n // Generate Thumbprint for Private Key\n const privateKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.privateKey);\n // Re-import private key to make it unextractable\n const unextractablePrivateKey: CryptoKey = await this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"]);\n\n // Store Keypair data in keystore\n await this.cache.asymmetricKeys.setItem(\n publicJwkHash, \n {\n privateKey: unextractablePrivateKey,\n publicKey: keyPair.publicKey,\n requestMethod: request.resourceRequestMethod,\n requestUri: request.resourceRequestUri\n }\n );\n\n if (publicKeyThumbMeasurement) {\n publicKeyThumbMeasurement.endMeasurement({\n success: true\n });\n }\n\n return publicJwkHash;\n }\n\n /**\n * Removes cryptographic keypair from key store matching the keyId passed in\n * @param kid \n */\n async removeTokenBindingKey(kid: string): Promise<boolean> {\n await this.cache.asymmetricKeys.removeItem(kid);\n const keyFound = await this.cache.asymmetricKeys.containsKey(kid);\n return !keyFound;\n }\n\n /**\n * Removes all cryptographic keys from IndexedDB storage\n */\n async clearKeystore(): Promise<boolean> {\n try {\n this.logger.verbose(\"Deleting in-memory and persistent asymmetric key stores\");\n await this.cache.asymmetricKeys.clear();\n this.logger.verbose(\"Successfully deleted asymmetric key stores\");\n this.logger.verbose(\"Deleting in-memory and persistent symmetric key stores\");\n await this.cache.symmetricKeys.clear();\n this.logger.verbose(\"Successfully deleted symmetric key stores\");\n return true;\n } catch (e) {\n if (e instanceof Error) {\n this.logger.error(`Clearing keystore failed with error: ${e.message}`);\n } else {\n this.logger.error(\"Clearing keystore failed with unknown error\");\n }\n \n return false;\n }\n }\n\n /**\n * Signs the given object as a jwt payload with private key retrieved by given kid.\n * @param payload \n * @param kid \n */\n async signJwt(payload: SignedHttpRequest, kid: string, correlationId?: string): Promise<string> {\n const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);\n const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);\n \n if (!cachedKeyPair) {\n throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);\n }\n\n // Get public key as JWK\n const publicKeyJwk = await this.browserCrypto.exportJwk(cachedKeyPair.publicKey);\n const publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);\n\n // Generate header\n const header = {\n alg: publicKeyJwk.alg,\n type: KEY_FORMAT_JWK\n };\n const encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));\n\n // Generate payload\n payload.cnf = {\n jwk: JSON.parse(publicKeyJwkString)\n };\n const encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\n\n // Form token string\n const tokenString = `${encodedHeader}.${encodedPayload}`;\n\n // Sign token\n const tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\n const signatureBuffer = await this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer);\n const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\n\n const signedJwt = `${tokenString}.${encodedSignature}`;\n\n if (signJwtMeasurement) {\n signJwtMeasurement.endMeasurement({\n success: true\n });\n }\n\n return signedJwt;\n }\n\n /**\n * Returns the SHA-256 hash of an input string\n * @param plainText\n */\n async hashString(plainText: string): Promise<string> {\n const hashBuffer: ArrayBuffer = await this.browserCrypto.sha256Digest(plainText);\n const hashBytes = new Uint8Array(hashBuffer);\n return this.b64Encode.urlEncodeArr(hashBytes);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;IA+BY;AAAZ,WAAY,mBAAmB;IAC3B,wDAAiC,CAAA;IACjC,sDAA+B,CAAA;AACnC,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED;;;;;IAuBI,mBAAY,MAAc,EAAE,iBAAsC;QAC9D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;QAErB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IA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YAAY,CAAC,SAAS,CAAC,EAAA;;wBAA1E,UAAU,GAAgB,SAAgD;wBAC1E,SAAS,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;wBAC7C,sBAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,EAAC;;;;KACjD;IA3Lc,wBAAc,GAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,qBAAW,GAAY,IAAI,CAAC;IA2L/C,gBAAC;CA3MD;;;;"}
|
|
1
|
+
{"version":3,"file":"CryptoOps.js","sources":["../../src/crypto/CryptoOps.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, IPerformanceClient, JoseHeader, Logger, PerformanceEvents, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from \"@azure/msal-common\";\nimport { GuidGenerator } from \"./GuidGenerator\";\nimport { Base64Encode } from \"../encode/Base64Encode\";\nimport { Base64Decode } from \"../encode/Base64Decode\";\nimport { PkceGenerator } from \"./PkceGenerator\";\nimport { BrowserCrypto } from \"./BrowserCrypto\";\nimport { BrowserStringUtils } from \"../utils/BrowserStringUtils\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { AsyncMemoryStorage } from \"../cache/AsyncMemoryStorage\";\n\nexport type CachedKeyPair = {\n publicKey: CryptoKey,\n privateKey: CryptoKey,\n requestMethod?: string,\n requestUri?: string\n};\n\n/**\n * MSAL CryptoKeyStore DB Version 2\n */\nexport type CryptoKeyStore = {\n asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;\n symmetricKeys: AsyncMemoryStorage<CryptoKey>;\n};\n\nexport enum CryptoKeyStoreNames {\n asymmetricKeys = \"asymmetricKeys\",\n symmetricKeys = \"symmetricKeys\"\n}\n\n/**\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and \n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\n */\nexport class CryptoOps implements ICrypto {\n\n private browserCrypto: BrowserCrypto;\n private guidGenerator: GuidGenerator;\n private b64Encode: Base64Encode;\n private b64Decode: Base64Decode;\n private pkceGenerator: PkceGenerator;\n private logger: Logger;\n\n /**\n * CryptoOps can be used in contexts outside a PCA instance,\n * meaning there won't be a performance manager available.\n */\n private performanceClient: IPerformanceClient | undefined;\n\n private static POP_KEY_USAGES: Array<KeyUsage> = [\"sign\", \"verify\"];\n private static EXTRACTABLE: boolean = true;\n private cache: CryptoKeyStore;\n\n constructor(logger: Logger, performanceClient?: IPerformanceClient) {\n this.logger = logger;\n // Browser crypto needs to be validated first before any other classes can be set.\n this.browserCrypto = new BrowserCrypto(this.logger);\n this.b64Encode = new Base64Encode();\n this.b64Decode = new Base64Decode();\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\n this.cache = {\n asymmetricKeys: new AsyncMemoryStorage<CachedKeyPair>(this.logger, CryptoKeyStoreNames.asymmetricKeys),\n symmetricKeys: new AsyncMemoryStorage<CryptoKey>(this.logger, CryptoKeyStoreNames.symmetricKeys)\n };\n this.performanceClient = performanceClient;\n }\n\n /**\n * Creates a new random GUID - used to populate state and nonce.\n * @returns string (GUID)\n */\n createNewGuid(): string {\n return this.guidGenerator.generateGuid();\n }\n\n /**\n * Encodes input string to base64.\n * @param input \n */\n base64Encode(input: string): string {\n return this.b64Encode.encode(input);\n } \n \n /**\n * Decodes input string from base64.\n * @param input \n */\n base64Decode(input: string): string {\n return this.b64Decode.decode(input);\n }\n\n /**\n * Generates PKCE codes used in Authorization Code Flow.\n */\n async generatePkceCodes(): Promise<PkceCodes> {\n return this.pkceGenerator.generateCodes();\n }\n\n /**\n * Generates a keypair, stores it and returns a thumbprint\n * @param request\n */\n async getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise<string> {\n const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);\n\n // Generate Keypair\n const keyPair: CryptoKeyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);\n\n // Generate Thumbprint for Public Key\n const publicKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.publicKey);\n \n const pubKeyThumprintObj: JsonWebKey = {\n e: publicKeyJwk.e,\n kty: publicKeyJwk.kty,\n n: publicKeyJwk.n\n };\n\n const publicJwkString: string = BrowserCrypto.getJwkString(pubKeyThumprintObj);\n const publicJwkHash = await this.hashString(publicJwkString);\n\n // Generate Thumbprint for Private Key\n const privateKeyJwk: JsonWebKey = await this.browserCrypto.exportJwk(keyPair.privateKey);\n // Re-import private key to make it unextractable\n const unextractablePrivateKey: CryptoKey = await this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"]);\n\n // Store Keypair data in keystore\n await this.cache.asymmetricKeys.setItem(\n publicJwkHash, \n {\n privateKey: unextractablePrivateKey,\n publicKey: keyPair.publicKey,\n requestMethod: request.resourceRequestMethod,\n requestUri: request.resourceRequestUri\n }\n );\n\n if (publicKeyThumbMeasurement) {\n publicKeyThumbMeasurement.endMeasurement({\n success: true\n });\n }\n\n return publicJwkHash;\n }\n\n /**\n * Removes cryptographic keypair from key store matching the keyId passed in\n * @param kid \n */\n async removeTokenBindingKey(kid: string): Promise<boolean> {\n await this.cache.asymmetricKeys.removeItem(kid);\n const keyFound = await this.cache.asymmetricKeys.containsKey(kid);\n return !keyFound;\n }\n\n /**\n * Removes all cryptographic keys from IndexedDB storage\n */\n async clearKeystore(): Promise<boolean> {\n try {\n this.logger.verbose(\"Deleting in-memory and persistent asymmetric key stores\");\n await this.cache.asymmetricKeys.clear();\n this.logger.verbose(\"Successfully deleted asymmetric key stores\");\n this.logger.verbose(\"Deleting in-memory and persistent symmetric key stores\");\n await this.cache.symmetricKeys.clear();\n this.logger.verbose(\"Successfully deleted symmetric key stores\");\n return true;\n } catch (e) {\n if (e instanceof Error) {\n this.logger.error(`Clearing keystore failed with error: ${e.message}`);\n } else {\n this.logger.error(\"Clearing keystore failed with unknown error\");\n }\n \n return false;\n }\n }\n\n /**\n * Signs the given object as a jwt payload with private key retrieved by given kid.\n * @param payload \n * @param kid \n */\n async signJwt(payload: SignedHttpRequest, kid: string, correlationId?: string): Promise<string> {\n const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);\n const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);\n \n if (!cachedKeyPair) {\n throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);\n }\n\n // Get public key as JWK\n const publicKeyJwk = await this.browserCrypto.exportJwk(cachedKeyPair.publicKey);\n const publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);\n \n // Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: \"FULL_PUBLIC_KEY_HASH\" })\n const encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));\n\n // Generate header\n const shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });\n const encodedShrHeader = this.b64Encode.urlEncode(shrHeader);\n\n // Generate payload\n payload.cnf = {\n jwk: JSON.parse(publicKeyJwkString)\n };\n const encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\n\n // Form token string\n const tokenString = `${encodedShrHeader}.${encodedPayload}`;\n\n // Sign token\n const tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\n const signatureBuffer = await this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer);\n const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\n\n const signedJwt = `${tokenString}.${encodedSignature}`;\n\n if (signJwtMeasurement) {\n signJwtMeasurement.endMeasurement({\n success: true\n });\n }\n\n return signedJwt;\n }\n\n /**\n * Returns the SHA-256 hash of an input string\n * @param plainText\n */\n async hashString(plainText: string): Promise<string> {\n const hashBuffer: ArrayBuffer = await this.browserCrypto.sha256Digest(plainText);\n const hashBytes = new Uint8Array(hashBuffer);\n return this.b64Encode.urlEncodeArr(hashBytes);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;IA8BY;AAAZ,WAAY,mBAAmB;IAC3B,wDAAiC,CAAA;IACjC,sDAA+B,CAAA;AACnC,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED;;;;;IAuBI,mBAAY,MAAc,EAAE,iBAAsC;QAC9D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;QAErB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3D,IAAI,CAAC,KAAK,GAAG;YACT,cAAc,EAAE,IAAI,kBAAkB,CAAgB,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,cAAc,CAAC;YACtG,aAAa,EAAE,IAAI,kBAAkB,CAAY,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,aAAa,CAAC;SACnG,CAAC;QACF,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;;;;;IAMD,iCAAa,GAAb;QACI,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;KAC5C;;;;;IAMD,gCAAY,GAAZ,UAAa,KAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACvC;;;;;IAMD,gCAAY,GAAZ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C,CAAC;wBAGnE,WAAW,GAAM,gBAAgB,SAAI,cAAgB,CAAC;wBAGtD,WAAW,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;wBAChD,qBAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,WAAW,CAAC,EAAA;;wBAAtF,eAAe,GAAG,SAAoE;wBACtF,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;wBAEhF,SAAS,GAAM,WAAW,SAAI,gBAAkB,CAAC;wBAEvD,IAAI,kBAAkB,EAAE;4BACpB,kBAAkB,CAAC,cAAc,CAAC;gCAC9B,OAAO,EAAE,IAAI;6BAChB,CAAC,CAAC;yBACN;wBAED,sBAAO,SAAS,EAAC;;;;KACpB;;;;;IAMK,8BAAU,GAAhB,UAAiB,SAAiB;;;;;4BACE,qBAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,SAAS,CAAC,EAAA;;wBAA1E,UAAU,GAAgB,SAAgD;wBAC1E,SAAS,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;wBAC7C,sBAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,EAAC;;;;KACjD;IA3Lc,wBAAc,GAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrD,qBAAW,GAAY,IAAI,CAAC;IA2L/C,gBAAC;CA3MD;;;;"}
|
|
@@ -147,10 +147,38 @@ export declare const BrowserAuthErrorMessage: {
|
|
|
147
147
|
code: string;
|
|
148
148
|
desc: string;
|
|
149
149
|
};
|
|
150
|
+
authCodeOrNativeAccountRequired: {
|
|
151
|
+
code: string;
|
|
152
|
+
desc: string;
|
|
153
|
+
};
|
|
150
154
|
databaseUnavailable: {
|
|
151
155
|
code: string;
|
|
152
156
|
desc: string;
|
|
153
157
|
};
|
|
158
|
+
unableToAcquireTokenFromNativePlatform: {
|
|
159
|
+
code: string;
|
|
160
|
+
desc: string;
|
|
161
|
+
};
|
|
162
|
+
nativeHandshakeTimeout: {
|
|
163
|
+
code: string;
|
|
164
|
+
desc: string;
|
|
165
|
+
};
|
|
166
|
+
nativeExtensionNotInstalled: {
|
|
167
|
+
code: string;
|
|
168
|
+
desc: string;
|
|
169
|
+
};
|
|
170
|
+
nativeConnectionNotEstablished: {
|
|
171
|
+
code: string;
|
|
172
|
+
desc: string;
|
|
173
|
+
};
|
|
174
|
+
nativeBrokerCalledBeforeInitialize: {
|
|
175
|
+
code: string;
|
|
176
|
+
desc: string;
|
|
177
|
+
};
|
|
178
|
+
nativePromptNotSupported: {
|
|
179
|
+
code: string;
|
|
180
|
+
desc: string;
|
|
181
|
+
};
|
|
154
182
|
};
|
|
155
183
|
/**
|
|
156
184
|
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
@@ -309,9 +337,39 @@ export declare class BrowserAuthError extends AuthError {
|
|
|
309
337
|
* Create an error when an authorization code is required but not provided
|
|
310
338
|
*/
|
|
311
339
|
static createAuthCodeRequiredError(): BrowserAuthError;
|
|
340
|
+
/**
|
|
341
|
+
* Create an error when an authorization code or native account ID is required but not provided
|
|
342
|
+
*/
|
|
343
|
+
static createAuthCodeOrNativeAccountIdRequiredError(): BrowserAuthError;
|
|
312
344
|
/**
|
|
313
345
|
* Create an error when IndexedDB is unavailable
|
|
314
346
|
*/
|
|
315
347
|
static createDatabaseUnavailableError(): BrowserAuthError;
|
|
348
|
+
/**
|
|
349
|
+
* Create an error when native token acquisition is not possible
|
|
350
|
+
*/
|
|
351
|
+
static createUnableToAcquireTokenFromNativePlatformError(): BrowserAuthError;
|
|
352
|
+
/**
|
|
353
|
+
* Create an error thrown when Handshake with browser extension times out
|
|
354
|
+
*/
|
|
355
|
+
static createNativeHandshakeTimeoutError(): BrowserAuthError;
|
|
356
|
+
/**
|
|
357
|
+
* Create an error thrown when browser extension is not installed
|
|
358
|
+
*/
|
|
359
|
+
static createNativeExtensionNotInstalledError(): BrowserAuthError;
|
|
360
|
+
/**
|
|
361
|
+
* Create an error when native connection has not been established
|
|
362
|
+
* @returns
|
|
363
|
+
*/
|
|
364
|
+
static createNativeConnectionNotEstablishedError(): BrowserAuthError;
|
|
365
|
+
/**
|
|
366
|
+
* Create an error thrown when the initialize function hasn't been called
|
|
367
|
+
*/
|
|
368
|
+
static createNativeBrokerCalledBeforeInitialize(): BrowserAuthError;
|
|
369
|
+
/**
|
|
370
|
+
* Create an error thrown when requesting a token directly from the native platform with an unsupported prompt parameter e.g. select_account, login or create
|
|
371
|
+
* These requests must go through eSTS to ensure eSTS is aware of the new account
|
|
372
|
+
*/
|
|
373
|
+
static createNativePromptParameterNotSupportedError(): BrowserAuthError;
|
|
316
374
|
}
|
|
317
375
|
//# sourceMappingURL=BrowserAuthError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthError.d.ts","sourceRoot":"","sources":["../../src/error/BrowserAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAe,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"BrowserAuthError.d.ts","sourceRoot":"","sources":["../../src/error/BrowserAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAe,MAAM,oBAAoB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiLnC,CAAC;AAEF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;gBAE/B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,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,IAAI,gBAAgB;IAI5E;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,gBAAgB;IAI5D;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,gBAAgB;IAIjE;;;OAGG;IACH,MAAM,CAAC,yCAAyC,IAAI,gBAAgB;IAIpE;;OAEG;IACH,MAAM,CAAC,wCAAwC,IAAI,gBAAgB;IAInE;;;OAGG;IACH,MAAM,CAAC,4CAA4C,IAAI,gBAAgB;CAG1E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.25.0 2022-06-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __extends } from '../_virtual/_tslib.js';
|
|
4
4
|
import { StringUtils, AuthError } from '@azure/msal-common';
|
|
@@ -29,7 +29,7 @@ var BrowserAuthErrorMessage = {
|
|
|
29
29
|
},
|
|
30
30
|
hashEmptyError: {
|
|
31
31
|
code: "hash_empty_error",
|
|
32
|
-
desc: "Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash."
|
|
32
|
+
desc: "Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. For more visit: aka.ms/msaljs/browser-errors."
|
|
33
33
|
},
|
|
34
34
|
hashDoesNotContainStateError: {
|
|
35
35
|
code: "no_state_in_hash",
|
|
@@ -37,7 +37,7 @@ var BrowserAuthErrorMessage = {
|
|
|
37
37
|
},
|
|
38
38
|
hashDoesNotContainKnownPropertiesError: {
|
|
39
39
|
code: "hash_does_not_contain_known_properties",
|
|
40
|
-
desc: "Hash does not contain known properites. Please verify that your redirectUri is not changing the hash."
|
|
40
|
+
desc: "Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. For more visit: aka.ms/msaljs/browser-errors."
|
|
41
41
|
},
|
|
42
42
|
unableToParseStateError: {
|
|
43
43
|
code: "unable_to_parse_state",
|
|
@@ -155,9 +155,37 @@ var BrowserAuthErrorMessage = {
|
|
|
155
155
|
code: "auth_code_required",
|
|
156
156
|
desc: "An authorization code must be provided (as the `code` property on the request) to this flow."
|
|
157
157
|
},
|
|
158
|
+
authCodeOrNativeAccountRequired: {
|
|
159
|
+
code: "auth_code_or_nativeAccountId_required",
|
|
160
|
+
desc: "An authorization code or nativeAccountId must be provided to this flow."
|
|
161
|
+
},
|
|
158
162
|
databaseUnavailable: {
|
|
159
163
|
code: "database_unavailable",
|
|
160
164
|
desc: "IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."
|
|
165
|
+
},
|
|
166
|
+
unableToAcquireTokenFromNativePlatform: {
|
|
167
|
+
code: "unable_to_acquire_token_from_native_platform",
|
|
168
|
+
desc: "Unable to acquire token from native platform. For a list of possible reasons visit aka.ms/msaljs/browser-errors."
|
|
169
|
+
},
|
|
170
|
+
nativeHandshakeTimeout: {
|
|
171
|
+
code: "native_handshake_timeout",
|
|
172
|
+
desc: "Timed out while attempting to establish connection to browser extension"
|
|
173
|
+
},
|
|
174
|
+
nativeExtensionNotInstalled: {
|
|
175
|
+
code: "native_extension_not_installed",
|
|
176
|
+
desc: "Native extension is not installed. If you think this is a mistake call the initialize function."
|
|
177
|
+
},
|
|
178
|
+
nativeConnectionNotEstablished: {
|
|
179
|
+
code: "native_connection_not_established",
|
|
180
|
+
desc: "Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). For more please visit aka.ms/msaljs/browser-errors."
|
|
181
|
+
},
|
|
182
|
+
nativeBrokerCalledBeforeInitialize: {
|
|
183
|
+
code: "native_broker_called_before_initialize",
|
|
184
|
+
desc: "You must call and await the initialize function before attempting to call any other MSAL API when native brokering is enabled. For more please visit aka.ms/msaljs/browser-errors."
|
|
185
|
+
},
|
|
186
|
+
nativePromptNotSupported: {
|
|
187
|
+
code: "native_prompt_not_supported",
|
|
188
|
+
desc: "The provided prompt is not supported by the native platform. This request should be routed to the web based flow."
|
|
161
189
|
}
|
|
162
190
|
};
|
|
163
191
|
/**
|
|
@@ -397,12 +425,56 @@ var BrowserAuthError = /** @class */ (function (_super) {
|
|
|
397
425
|
BrowserAuthError.createAuthCodeRequiredError = function () {
|
|
398
426
|
return new BrowserAuthError(BrowserAuthErrorMessage.authCodeRequired.code, BrowserAuthErrorMessage.authCodeRequired.desc);
|
|
399
427
|
};
|
|
428
|
+
/**
|
|
429
|
+
* Create an error when an authorization code or native account ID is required but not provided
|
|
430
|
+
*/
|
|
431
|
+
BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError = function () {
|
|
432
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.code, BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.desc);
|
|
433
|
+
};
|
|
400
434
|
/**
|
|
401
435
|
* Create an error when IndexedDB is unavailable
|
|
402
436
|
*/
|
|
403
437
|
BrowserAuthError.createDatabaseUnavailableError = function () {
|
|
404
438
|
return new BrowserAuthError(BrowserAuthErrorMessage.databaseUnavailable.code, BrowserAuthErrorMessage.databaseUnavailable.desc);
|
|
405
439
|
};
|
|
440
|
+
/**
|
|
441
|
+
* Create an error when native token acquisition is not possible
|
|
442
|
+
*/
|
|
443
|
+
BrowserAuthError.createUnableToAcquireTokenFromNativePlatformError = function () {
|
|
444
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.unableToAcquireTokenFromNativePlatform.code, BrowserAuthErrorMessage.unableToAcquireTokenFromNativePlatform.desc);
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Create an error thrown when Handshake with browser extension times out
|
|
448
|
+
*/
|
|
449
|
+
BrowserAuthError.createNativeHandshakeTimeoutError = function () {
|
|
450
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.nativeHandshakeTimeout.code, BrowserAuthErrorMessage.nativeHandshakeTimeout.desc);
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* Create an error thrown when browser extension is not installed
|
|
454
|
+
*/
|
|
455
|
+
BrowserAuthError.createNativeExtensionNotInstalledError = function () {
|
|
456
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.nativeExtensionNotInstalled.code, BrowserAuthErrorMessage.nativeExtensionNotInstalled.desc);
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* Create an error when native connection has not been established
|
|
460
|
+
* @returns
|
|
461
|
+
*/
|
|
462
|
+
BrowserAuthError.createNativeConnectionNotEstablishedError = function () {
|
|
463
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.nativeConnectionNotEstablished.code, BrowserAuthErrorMessage.nativeConnectionNotEstablished.desc);
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* Create an error thrown when the initialize function hasn't been called
|
|
467
|
+
*/
|
|
468
|
+
BrowserAuthError.createNativeBrokerCalledBeforeInitialize = function () {
|
|
469
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.nativeBrokerCalledBeforeInitialize.code, BrowserAuthErrorMessage.nativeBrokerCalledBeforeInitialize.desc);
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Create an error thrown when requesting a token directly from the native platform with an unsupported prompt parameter e.g. select_account, login or create
|
|
473
|
+
* These requests must go through eSTS to ensure eSTS is aware of the new account
|
|
474
|
+
*/
|
|
475
|
+
BrowserAuthError.createNativePromptParameterNotSupportedError = function () {
|
|
476
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.nativePromptNotSupported.code, BrowserAuthErrorMessage.nativePromptNotSupported.desc);
|
|
477
|
+
};
|
|
406
478
|
return BrowserAuthError;
|
|
407
479
|
}(AuthError));
|
|
408
480
|
|