@azure/msal-browser 2.36.0 → 2.37.1
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.js +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.js +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.js +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/CryptoKeyStore.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.js +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.js +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/ModernBrowserCrypto.js +1 -1
- package/dist/crypto/MsBrowserCrypto.js +1 -1
- package/dist/crypto/MsrBrowserCrypto.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.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.js +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.d.ts.map +1 -1
- package/dist/event/EventMessage.js +2 -1
- package/dist/event/EventMessage.js.map +1 -1
- package/dist/event/EventType.d.ts +2 -1
- package/dist/event/EventType.d.ts.map +1 -1
- package/dist/event/EventType.js +2 -1
- package/dist/event/EventType.js.map +1 -1
- package/dist/index.cjs.js +229 -113
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +33 -7
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +22 -15
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.js +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +3 -2
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
- package/dist/interaction_client/SilentCacheClient.js +2 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +2 -2
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/internals.js +1 -1
- 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/telemetry/BrowserPerformanceClient.js +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +229 -113
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +35 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export declare abstract class BaseInteractionClient {
|
|
|
27
27
|
* Initializer function for all request APIs
|
|
28
28
|
* @param request
|
|
29
29
|
*/
|
|
30
|
-
protected initializeBaseRequest(request: Partial<BaseAuthRequest
|
|
30
|
+
protected initializeBaseRequest(request: Partial<BaseAuthRequest>, account?: AccountInfo): Promise<BaseAuthRequest>;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
33
|
* Use to get the redirect uri configured in MSAL or null.
|
|
@@ -36,6 +36,7 @@ export declare abstract class BaseInteractionClient {
|
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
38
|
getRedirectUri(requestRedirectUri?: string): string;
|
|
39
|
+
validateRequestAuthority(authority: string, account: AccountInfo): Promise<void>;
|
|
39
40
|
/**
|
|
40
41
|
*
|
|
41
42
|
* @param apiId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAiB,eAAe,EAAmC,sBAAsB,EAAiE,SAAS,EAAsC,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC;AACtV,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC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import { AccountEntity,
|
|
4
|
+
import { AccountEntity, AuthenticationScheme, ClientConfigurationError, StringUtils, PerformanceEvents, UrlString, ServerTelemetryManager, AuthorityFactory } from '@azure/msal-common';
|
|
5
5
|
import { version } from '../packageMetadata.js';
|
|
6
6
|
import { BrowserConstants } from '../utils/BrowserConstants.js';
|
|
7
7
|
import { BrowserUtils } from '../utils/BrowserUtils.js';
|
|
@@ -73,7 +73,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
73
73
|
* Initializer function for all request APIs
|
|
74
74
|
* @param request
|
|
75
75
|
*/
|
|
76
|
-
BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
|
|
76
|
+
BaseInteractionClient.prototype.initializeBaseRequest = function (request, account) {
|
|
77
77
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
78
|
var authority, scopes, validatedRequest, _a;
|
|
79
79
|
return __generator(this, function (_b) {
|
|
@@ -82,6 +82,12 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
82
82
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
83
83
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
84
84
|
authority = request.authority || this.config.auth.authority;
|
|
85
|
+
if (!account) return [3 /*break*/, 2];
|
|
86
|
+
return [4 /*yield*/, this.validateRequestAuthority(authority, account)];
|
|
87
|
+
case 1:
|
|
88
|
+
_b.sent();
|
|
89
|
+
_b.label = 2;
|
|
90
|
+
case 2:
|
|
85
91
|
scopes = __spread(((request && request.scopes) || []));
|
|
86
92
|
validatedRequest = __assign(__assign({}, request), { correlationId: this.correlationId, authority: authority,
|
|
87
93
|
scopes: scopes });
|
|
@@ -101,13 +107,13 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
101
107
|
}
|
|
102
108
|
this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
|
|
103
109
|
}
|
|
104
|
-
if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/,
|
|
110
|
+
if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 4];
|
|
105
111
|
_a = validatedRequest;
|
|
106
112
|
return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
|
|
107
|
-
case
|
|
113
|
+
case 3:
|
|
108
114
|
_a.requestedClaimsHash = _b.sent();
|
|
109
|
-
_b.label =
|
|
110
|
-
case
|
|
115
|
+
_b.label = 4;
|
|
116
|
+
case 4: return [2 /*return*/, validatedRequest];
|
|
111
117
|
}
|
|
112
118
|
});
|
|
113
119
|
});
|
|
@@ -124,6 +130,26 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
124
130
|
var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();
|
|
125
131
|
return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
|
|
126
132
|
};
|
|
133
|
+
/*
|
|
134
|
+
* If authority provided in the request does not match environment/authority specified
|
|
135
|
+
* in the account or MSAL config, we throw an error.
|
|
136
|
+
*/
|
|
137
|
+
BaseInteractionClient.prototype.validateRequestAuthority = function (authority, account) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
var discoveredAuthority;
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, this.getDiscoveredAuthority(authority)];
|
|
143
|
+
case 1:
|
|
144
|
+
discoveredAuthority = _a.sent();
|
|
145
|
+
if (!discoveredAuthority.isAlias(account.environment)) {
|
|
146
|
+
throw ClientConfigurationError.createAuthorityMismatchError();
|
|
147
|
+
}
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
127
153
|
/**
|
|
128
154
|
*
|
|
129
155
|
* @param apiId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInteractionClient.js","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, AccountEntity, BaseAuthRequest, AuthenticationScheme, UrlString, ServerTelemetryManager, ServerTelemetryRequest, ClientConfigurationError, StringUtils, Authority, AuthorityOptions, AuthorityFactory, IPerformanceClient, PerformanceEvents } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { version } from \"../packageMetadata\";\nimport { BrowserConstants } from \"../utils/BrowserConstants\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\n\nexport abstract class BaseInteractionClient {\n\n protected config: BrowserConfiguration;\n protected browserStorage: BrowserCacheManager;\n protected browserCrypto: ICrypto;\n protected networkClient: INetworkModule;\n protected logger: Logger;\n protected eventHandler: EventHandler;\n protected navigationClient: INavigationClient;\n protected nativeMessageHandler: NativeMessageHandler | undefined;\n protected correlationId: string;\n protected performanceClient: IPerformanceClient;\n\n constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string) {\n this.config = config;\n this.browserStorage = storageImpl;\n this.browserCrypto = browserCrypto;\n this.networkClient = this.config.system.networkClient;\n this.eventHandler = eventHandler;\n this.navigationClient = navigationClient;\n this.nativeMessageHandler = nativeMessageHandler;\n this.correlationId = correlationId || this.browserCrypto.createNewGuid();\n this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);\n this.performanceClient = performanceClient;\n }\n\n abstract acquireToken(request: RedirectRequest|PopupRequest|SsoSilentRequest): Promise<AuthenticationResult|void>;\n\n abstract logout(request: EndSessionRequest): Promise<void>;\n\n protected async clearCacheOnLogout(account?: AccountInfo| null): Promise<void> {\n if (account) {\n if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {\n this.logger.verbose(\"Setting active account to null\");\n this.browserStorage.setActiveAccount(null);\n }\n // Clear given account.\n try {\n await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account));\n this.logger.verbose(\"Cleared cache items belonging to the account provided in the logout request.\");\n } catch (error) {\n this.logger.error(\"Account provided in logout request was not found. Local cache unchanged.\");\n }\n } else {\n try {\n this.logger.verbose(\"No account provided in logout request, clearing all cache items.\", this.correlationId);\n // Clear all accounts and tokens\n await this.browserStorage.clear();\n // Clear any stray keys from IndexedDB\n await this.browserCrypto.clearKeystore();\n } catch(e) {\n this.logger.error(\"Attempted to clear all MSAL cache items and failed. Local cache unchanged.\");\n }\n }\n }\n\n /**\n * Initializer function for all request APIs\n * @param request\n */\n protected async initializeBaseRequest(request: Partial<BaseAuthRequest>): Promise<BaseAuthRequest> {\n this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);\n this.logger.verbose(\"Initializing BaseAuthRequest\");\n const authority = request.authority || this.config.auth.authority;\n\n const scopes = [...((request && request.scopes) || [])];\n\n const validatedRequest: BaseAuthRequest = {\n ...request,\n correlationId: this.correlationId,\n authority,\n scopes\n };\n\n // Set authenticationScheme to BEARER if not explicitly set in the request\n if (!validatedRequest.authenticationScheme) {\n validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;\n this.logger.verbose(\"Authentication Scheme wasn't explicitly set in request, defaulting to \\\"Bearer\\\" request\");\n } else {\n if (validatedRequest.authenticationScheme === AuthenticationScheme.SSH) {\n if (!request.sshJwk) {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n if(!request.sshKid) {\n throw ClientConfigurationError.createMissingSshKidError();\n }\n }\n this.logger.verbose(`Authentication Scheme set to \"${validatedRequest.authenticationScheme}\" as configured in Auth request`);\n }\n\n // Set requested claims hash if claims were requested\n if (request.claims && !StringUtils.isEmpty(request.claims)) {\n validatedRequest.requestedClaimsHash = await this.browserCrypto.hashString(request.claims);\n }\n\n return validatedRequest;\n }\n\n /**\n *\n * Use to get the redirect uri configured in MSAL or null.\n * @param requestRedirectUri\n * @returns Redirect URL\n *\n */\n getRedirectUri(requestRedirectUri?: string): string {\n this.logger.verbose(\"getRedirectUri called\");\n const redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();\n return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());\n }\n\n /**\n *\n * @param apiId\n * @param correlationId\n * @param forceRefresh\n */\n protected initializeServerTelemetryManager(apiId: number, forceRefresh?: boolean): ServerTelemetryManager {\n this.logger.verbose(\"initializeServerTelemetryManager called\");\n const telemetryPayload: ServerTelemetryRequest = {\n clientId: this.config.auth.clientId,\n correlationId: this.correlationId,\n apiId: apiId,\n forceRefresh: forceRefresh || false,\n wrapperSKU: this.browserStorage.getWrapperMetadata()[0],\n wrapperVer: this.browserStorage.getWrapperMetadata()[1]\n };\n\n return new ServerTelemetryManager(telemetryPayload, this.browserStorage);\n }\n\n /**\n * Used to get a discovered version of the default authority.\n * @param requestAuthority\n * @param requestCorrelationId\n */\n protected async getDiscoveredAuthority(requestAuthority?: string): Promise<Authority> {\n this.logger.verbose(\"getDiscoveredAuthority called\");\n const authorityOptions: AuthorityOptions = {\n protocolMode: this.config.auth.protocolMode,\n knownAuthorities: this.config.auth.knownAuthorities,\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\n authorityMetadata: this.config.auth.authorityMetadata\n };\n\n if (requestAuthority) {\n this.logger.verbose(\"Creating discovered authority with request authority\");\n return await AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger);\n }\n\n this.logger.verbose(\"Creating discovered authority with configured authority\");\n return await AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;IAgCI,+BAAY,MAA4B,EAAE,WAAgC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,iBAAqC,EAAE,oBAA2C,EAAE,aAAsB;QAC3R,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;QACzE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACnF,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;IAMe,kDAAkB,GAAlC,UAAmC,OAA2B;;;;;6BACtD,OAAO,EAAP,wBAAO;wBACP,IAAI,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,EAAE,KAAK,CAAC,EAAE;4BAC1F,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;4BACt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M,gBAAgB,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,EAAA;4BAAxK,sBAAO,SAAiK,EAAC;;;;KAC5K;IACL,4BAAC;AAAD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseInteractionClient.js","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, AccountEntity, BaseAuthRequest, AuthenticationScheme, UrlString, ServerTelemetryManager, ServerTelemetryRequest, ClientConfigurationError, StringUtils, Authority, AuthorityOptions, AuthorityFactory, IPerformanceClient, PerformanceEvents } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { version } from \"../packageMetadata\";\nimport { BrowserConstants } from \"../utils/BrowserConstants\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\n\nexport abstract class BaseInteractionClient {\n\n protected config: BrowserConfiguration;\n protected browserStorage: BrowserCacheManager;\n protected browserCrypto: ICrypto;\n protected networkClient: INetworkModule;\n protected logger: Logger;\n protected eventHandler: EventHandler;\n protected navigationClient: INavigationClient;\n protected nativeMessageHandler: NativeMessageHandler | undefined;\n protected correlationId: string;\n protected performanceClient: IPerformanceClient;\n\n constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string) {\n this.config = config;\n this.browserStorage = storageImpl;\n this.browserCrypto = browserCrypto;\n this.networkClient = this.config.system.networkClient;\n this.eventHandler = eventHandler;\n this.navigationClient = navigationClient;\n this.nativeMessageHandler = nativeMessageHandler;\n this.correlationId = correlationId || this.browserCrypto.createNewGuid();\n this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);\n this.performanceClient = performanceClient;\n }\n\n abstract acquireToken(request: RedirectRequest|PopupRequest|SsoSilentRequest): Promise<AuthenticationResult|void>;\n\n abstract logout(request: EndSessionRequest): Promise<void>;\n\n protected async clearCacheOnLogout(account?: AccountInfo| null): Promise<void> {\n if (account) {\n if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {\n this.logger.verbose(\"Setting active account to null\");\n this.browserStorage.setActiveAccount(null);\n }\n // Clear given account.\n try {\n await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account));\n this.logger.verbose(\"Cleared cache items belonging to the account provided in the logout request.\");\n } catch (error) {\n this.logger.error(\"Account provided in logout request was not found. Local cache unchanged.\");\n }\n } else {\n try {\n this.logger.verbose(\"No account provided in logout request, clearing all cache items.\", this.correlationId);\n // Clear all accounts and tokens\n await this.browserStorage.clear();\n // Clear any stray keys from IndexedDB\n await this.browserCrypto.clearKeystore();\n } catch(e) {\n this.logger.error(\"Attempted to clear all MSAL cache items and failed. Local cache unchanged.\");\n }\n }\n }\n\n /**\n * Initializer function for all request APIs\n * @param request\n */\n protected async initializeBaseRequest(request: Partial<BaseAuthRequest>, account?: AccountInfo): Promise<BaseAuthRequest> {\n this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);\n this.logger.verbose(\"Initializing BaseAuthRequest\");\n const authority = request.authority || this.config.auth.authority;\n\n if (account) {\n await this.validateRequestAuthority(authority, account);\n }\n\n const scopes = [...((request && request.scopes) || [])];\n\n const validatedRequest: BaseAuthRequest = {\n ...request,\n correlationId: this.correlationId,\n authority,\n scopes\n };\n\n // Set authenticationScheme to BEARER if not explicitly set in the request\n if (!validatedRequest.authenticationScheme) {\n validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;\n this.logger.verbose(\"Authentication Scheme wasn't explicitly set in request, defaulting to \\\"Bearer\\\" request\");\n } else {\n if (validatedRequest.authenticationScheme === AuthenticationScheme.SSH) {\n if (!request.sshJwk) {\n throw ClientConfigurationError.createMissingSshJwkError();\n }\n if(!request.sshKid) {\n throw ClientConfigurationError.createMissingSshKidError();\n }\n }\n this.logger.verbose(`Authentication Scheme set to \"${validatedRequest.authenticationScheme}\" as configured in Auth request`);\n }\n\n // Set requested claims hash if claims were requested\n if (request.claims && !StringUtils.isEmpty(request.claims)) {\n validatedRequest.requestedClaimsHash = await this.browserCrypto.hashString(request.claims);\n }\n\n return validatedRequest;\n }\n\n /**\n *\n * Use to get the redirect uri configured in MSAL or null.\n * @param requestRedirectUri\n * @returns Redirect URL\n *\n */\n getRedirectUri(requestRedirectUri?: string): string {\n this.logger.verbose(\"getRedirectUri called\");\n const redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();\n return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());\n }\n\n /*\n * If authority provided in the request does not match environment/authority specified \n * in the account or MSAL config, we throw an error.\n */\n async validateRequestAuthority(authority: string, account: AccountInfo): Promise<void> {\n const discoveredAuthority = await this.getDiscoveredAuthority(authority);\n \n if(!discoveredAuthority.isAlias(account.environment)) {\n throw ClientConfigurationError.createAuthorityMismatchError();\n }\n }\n\n /**\n *\n * @param apiId\n * @param correlationId\n * @param forceRefresh\n */\n protected initializeServerTelemetryManager(apiId: number, forceRefresh?: boolean): ServerTelemetryManager {\n this.logger.verbose(\"initializeServerTelemetryManager called\");\n const telemetryPayload: ServerTelemetryRequest = {\n clientId: this.config.auth.clientId,\n correlationId: this.correlationId,\n apiId: apiId,\n forceRefresh: forceRefresh || false,\n wrapperSKU: this.browserStorage.getWrapperMetadata()[0],\n wrapperVer: this.browserStorage.getWrapperMetadata()[1]\n };\n\n return new ServerTelemetryManager(telemetryPayload, this.browserStorage);\n }\n\n /**\n * Used to get a discovered version of the default authority.\n * @param requestAuthority\n * @param requestCorrelationId\n */\n protected async getDiscoveredAuthority(requestAuthority?: string): Promise<Authority> {\n this.logger.verbose(\"getDiscoveredAuthority called\");\n const authorityOptions: AuthorityOptions = {\n protocolMode: this.config.auth.protocolMode,\n knownAuthorities: this.config.auth.knownAuthorities,\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\n authorityMetadata: this.config.auth.authorityMetadata\n };\n\n if (requestAuthority) {\n this.logger.verbose(\"Creating discovered authority with request authority\");\n return await AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger);\n }\n\n this.logger.verbose(\"Creating discovered authority with configured authority\");\n return await AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;IAgCI,+BAAY,MAA4B,EAAE,WAAgC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,iBAAqC,EAAE,oBAA2C,EAAE,aAAsB;QAC3R,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,gBAAgB,GA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;;KAC5K;IACL,4BAAC;AAAD,CAAC;;;;"}
|
|
@@ -121,7 +121,7 @@ export declare class NativeInteractionClient extends BaseInteractionClient {
|
|
|
121
121
|
* @param tenantId
|
|
122
122
|
* @param reqTimestamp
|
|
123
123
|
*/
|
|
124
|
-
cacheNativeTokens(response: NativeResponse, request: NativeTokenRequest, homeAccountIdentifier: string, idTokenObj: AuthToken, responseAccessToken: string, tenantId: string, reqTimestamp: number): void;
|
|
124
|
+
cacheNativeTokens(response: NativeResponse, request: NativeTokenRequest, homeAccountIdentifier: string, accountEntity: AccountEntity, idTokenObj: AuthToken, responseAccessToken: string, tenantId: string, reqTimestamp: number): void;
|
|
125
125
|
protected addTelemetryFromNativeResponse(response: NativeResponse): MATS | null;
|
|
126
126
|
/**
|
|
127
127
|
* Validates native platform response before processing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/NativeInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAe,SAAS,EAAa,aAAa,EAAiB,QAAQ,EAAmH,kBAAkB,
|
|
1
|
+
{"version":3,"file":"NativeInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/NativeInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,OAAO,EAAe,SAAS,EAAa,aAAa,EAAiB,QAAQ,EAAmH,kBAAkB,EAAsI,MAAM,oBAAoB,CAAC;AAC/Z,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD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;;;OAGG;IACH,YAAY,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAUhD;;;;;;;;;OASG;IACH,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IA6CvO,SAAS,CAAC,8BAA8B,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI;IA6B/E;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IASlD;;;OAGG;cACa,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAC,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAsF/G"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.37.1 2023-06-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __extends, __awaiter, __generator, __rest, __assign } from '../_virtual/_tslib.js';
|
|
4
|
-
import { ScopeSet, AuthToken, Constants, AccountEntity, AuthorityType, IdTokenEntity, AccessTokenEntity, PerformanceEvents, TimeUtils, ClientAuthError, AuthenticationScheme, PopTokenGenerator, UrlString, OIDC_DEFAULT_SCOPES, PromptValue } from '@azure/msal-common';
|
|
4
|
+
import { ScopeSet, AuthToken, Constants, AccountEntity, AuthorityType, IdTokenEntity, AccessTokenEntity, CacheRecord, PerformanceEvents, TimeUtils, ClientAuthError, AuthenticationScheme, PopTokenGenerator, UrlString, OIDC_DEFAULT_SCOPES, PromptValue } from '@azure/msal-common';
|
|
5
5
|
import { BaseInteractionClient } from './BaseInteractionClient.js';
|
|
6
6
|
import { TemporaryCacheKeys, NativeExtensionMethod, NativeConstants, ApiId } from '../utils/BrowserConstants.js';
|
|
7
7
|
import { NativeAuthError } from '../error/NativeAuthError.js';
|
|
@@ -273,7 +273,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
273
273
|
result = _a.sent();
|
|
274
274
|
// cache accounts and tokens in the appropriate storage
|
|
275
275
|
this.cacheAccount(accountEntity);
|
|
276
|
-
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
276
|
+
this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
277
277
|
return [2 /*return*/, result];
|
|
278
278
|
}
|
|
279
279
|
});
|
|
@@ -429,10 +429,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
429
429
|
* @param tenantId
|
|
430
430
|
* @param reqTimestamp
|
|
431
431
|
*/
|
|
432
|
-
NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
433
|
-
|
|
434
|
-
var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
435
|
-
this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
|
|
432
|
+
NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
433
|
+
var cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
436
434
|
// cache accessToken in inmemory storage
|
|
437
435
|
var expiresIn = (request.tokenType === AuthenticationScheme.POP)
|
|
438
436
|
? Constants.SHR_NONCE_VALIDITY
|
|
@@ -441,8 +439,11 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
441
439
|
: response.expires_in) || 0;
|
|
442
440
|
var tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
443
441
|
var responseScopes = this.generateScopes(response, request);
|
|
444
|
-
var
|
|
445
|
-
|
|
442
|
+
var cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
|
|
443
|
+
? idTokenObj.claims.tid || Constants.EMPTY_STRING
|
|
444
|
+
: tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
445
|
+
var nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
|
|
446
|
+
this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
|
|
446
447
|
};
|
|
447
448
|
NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {
|
|
448
449
|
var mats = this.getMATSFromResponse(response);
|
|
@@ -526,6 +527,12 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
526
527
|
case 0:
|
|
527
528
|
this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
|
|
528
529
|
authority = request.authority || this.config.auth.authority;
|
|
530
|
+
if (!request.account) return [3 /*break*/, 2];
|
|
531
|
+
return [4 /*yield*/, this.validateRequestAuthority(authority, request.account)];
|
|
532
|
+
case 1:
|
|
533
|
+
_a.sent();
|
|
534
|
+
_a.label = 2;
|
|
535
|
+
case 2:
|
|
529
536
|
canonicalAuthority = new UrlString(authority);
|
|
530
537
|
canonicalAuthority.validateAsUri();
|
|
531
538
|
scopes = request.scopes, remainingProperties = __rest(request, ["scopes"]);
|
|
@@ -558,7 +565,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
558
565
|
};
|
|
559
566
|
validatedRequest = __assign(__assign({}, remainingProperties), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scope: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign(__assign(__assign({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
|
|
560
567
|
});
|
|
561
|
-
if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/,
|
|
568
|
+
if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 4];
|
|
562
569
|
shrParameters = {
|
|
563
570
|
resourceRequestUri: request.resourceRequestUri,
|
|
564
571
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
@@ -567,13 +574,13 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
567
574
|
};
|
|
568
575
|
popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
|
569
576
|
return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];
|
|
570
|
-
case
|
|
577
|
+
case 3:
|
|
571
578
|
reqCnfData = _a.sent();
|
|
572
|
-
// to reduce the URL length, it is recommended to send the
|
|
573
|
-
validatedRequest.reqCnf = reqCnfData.
|
|
579
|
+
// to reduce the URL length, it is recommended to send the short form of the req_cnf
|
|
580
|
+
validatedRequest.reqCnf = reqCnfData.reqCnfString;
|
|
574
581
|
validatedRequest.keyId = reqCnfData.kid;
|
|
575
|
-
_a.label =
|
|
576
|
-
case
|
|
582
|
+
_a.label = 4;
|
|
583
|
+
case 4: return [2 /*return*/, validatedRequest];
|
|
577
584
|
}
|
|
578
585
|
});
|
|
579
586
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeInteractionClient.js","sources":["../../src/interaction_client/NativeInteractionClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, Logger, ICrypto, PromptValue, AuthToken, Constants, AccountEntity, AuthorityType, ScopeSet, TimeUtils, AuthenticationScheme, UrlString, OIDC_DEFAULT_SCOPES, PopTokenGenerator, SignedHttpRequestParameters, IPerformanceClient, PerformanceEvents, IdTokenEntity, AccessTokenEntity, ClientAuthError, AuthError, CommonSilentFlowRequest, AccountInfo } from \"@azure/msal-common\";\nimport { BaseInteractionClient } from \"./BaseInteractionClient\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\nimport { NativeExtensionMethod, ApiId, TemporaryCacheKeys, NativeConstants } from \"../utils/BrowserConstants\";\nimport { NativeExtensionRequestBody, NativeTokenRequest } from \"../broker/nativeBroker/NativeRequest\";\nimport { MATS, NativeResponse } from \"../broker/nativeBroker/NativeResponse\";\nimport { NativeAuthError } from \"../error/NativeAuthError\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { SilentCacheClient } from \"./SilentCacheClient\";\n\nexport class NativeInteractionClient extends BaseInteractionClient {\n protected apiId: ApiId;\n protected accountId: string;\n protected nativeMessageHandler: NativeMessageHandler;\n protected silentCacheClient: SilentCacheClient;\n protected nativeStorageManager: BrowserCacheManager;\n\n constructor(config: BrowserConfiguration, browserStorage: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, provider: NativeMessageHandler, accountId: string, nativeStorageImpl: BrowserCacheManager, correlationId?: string) {\n super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);\n this.apiId = apiId;\n this.accountId = accountId;\n this.nativeMessageHandler = provider;\n this.nativeStorageManager = nativeStorageImpl;\n this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);\n }\n\n /**\n * Acquire token from native platform via browser extension\n * @param request\n */\n async acquireToken(request: PopupRequest|SilentRequest|SsoSilentRequest): Promise<AuthenticationResult> {\n this.logger.trace(\"NativeInteractionClient - acquireToken called.\");\n\n // start the perf measurement\n const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);\n const reqTimestamp = TimeUtils.nowSeconds();\n\n // initialize native request\n const nativeRequest = await this.initializeNativeRequest(request);\n \n // check if the tokens can be retrieved from internal cache\n try {\n const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);\n nativeATMeasurement.endMeasurement({\n success: true,\n isNativeBroker: false, // Should be true only when the result is coming directly from the broker\n fromCache: true\n });\n return result;\n } catch (e) {\n // continue with a native call for any and all errors\n this.logger.info(\"MSAL internal Cache does not contain tokens, proceed to make a native call\");\n }\n\n // fall back to native calls\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: nativeRequest\n };\n\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n const validatedResponse: NativeResponse = this.validateNativeResponse(response);\n\n return this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)\n .then((result: AuthenticationResult) => {\n nativeATMeasurement.endMeasurement({\n success: true,\n isNativeBroker: true,\n requestId: result.requestId\n });\n return result;\n })\n .catch((error: AuthError) => {\n nativeATMeasurement.endMeasurement({\n success: false,\n errorCode: error.errorCode,\n subErrorCode: error.subError,\n isNativeBroker: true\n });\n throw error;\n });\n }\n\n /**\n * Creates silent flow request\n * @param request\n * @param cachedAccount\n * @returns CommonSilentFlowRequest\n */\n private createSilentCacheRequest(request: NativeTokenRequest, cachedAccount: AccountInfo): CommonSilentFlowRequest {\n return {\n authority: request.authority,\n correlationId: this.correlationId,\n scopes: ScopeSet.fromString(request.scope).asArray(),\n account: cachedAccount,\n forceRefresh: false,\n };\n }\n\n /**\n * Fetches the tokens from the cache if un-expired\n * @param nativeAccountId\n * @param request\n * @returns authenticationResult\n */\n protected async acquireTokensFromCache(nativeAccountId: string, request: NativeTokenRequest): Promise<AuthenticationResult> {\n if (!nativeAccountId) {\n this.logger.warning(\"NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided\");\n throw ClientAuthError.createNoAccountFoundError();\n }\n // fetch the account from in-memory cache\n const account = this.browserStorage.getAccountInfoFilteredBy({nativeAccountId});\n if (!account) {\n throw ClientAuthError.createNoAccountFoundError();\n }\n\n // leverage silent flow for cached tokens retrieval\n try {\n const silentRequest = this.createSilentCacheRequest(request, account);\n const result = await this.silentCacheClient.acquireToken(silentRequest);\n return result;\n } catch (e) {\n throw e;\n }\n }\n\n /**\n * Acquires a token from native platform then redirects to the redirectUri instead of returning the response\n * @param request\n */\n async acquireTokenRedirect(request: RedirectRequest): Promise<void> {\n this.logger.trace(\"NativeInteractionClient - acquireTokenRedirect called.\");\n const nativeRequest = await this.initializeNativeRequest(request);\n\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: nativeRequest\n };\n\n try {\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n this.validateNativeResponse(response);\n } catch (e) {\n // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise\n if (e instanceof NativeAuthError && e.isFatal()) {\n throw e;\n }\n }\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);\n\n const navigationOptions: NavigationOptions = {\n apiId: ApiId.acquireTokenRedirect,\n timeout: this.config.system.redirectNavigationTimeout,\n noHistory: false\n };\n const redirectUri = this.config.auth.navigateToLoginRequestUrl ? window.location.href : this.getRedirectUri(request.redirectUri);\n await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again\n }\n\n /**\n * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response\n */\n async handleRedirectPromise(): Promise<AuthenticationResult | null> {\n this.logger.trace(\"NativeInteractionClient - handleRedirectPromise called.\");\n if (!this.browserStorage.isInteractionInProgress(true)) {\n this.logger.info(\"handleRedirectPromise called but there is no interaction in progress, returning null.\");\n return null;\n }\n\n // remove prompt from the request to prevent WAM from prompting twice\n const cachedRequest = this.browserStorage.getCachedNativeRequest();\n if (!cachedRequest) {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null.\");\n return null;\n }\n\n const { prompt, ...request} = cachedRequest;\n if (prompt) {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window.\");\n }\n\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));\n\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: request\n };\n\n const reqTimestamp = TimeUtils.nowSeconds();\n\n try {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise sending message to native broker.\");\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n this.validateNativeResponse(response);\n const result = this.handleNativeResponse(response as NativeResponse, request, reqTimestamp);\n this.browserStorage.setInteractionInProgress(false);\n return result;\n } catch (e) {\n this.browserStorage.setInteractionInProgress(false);\n throw e;\n }\n }\n\n /**\n * Logout from native platform via browser extension\n * @param request\n */\n logout(): Promise<void> {\n this.logger.trace(\"NativeInteractionClient - logout called.\");\n return Promise.reject(\"Logout not implemented yet\");\n }\n\n /**\n * Transform response from native platform into AuthenticationResult object which will be returned to the end user\n * @param response\n * @param request\n * @param reqTimestamp\n */\n protected async handleNativeResponse(response: NativeResponse, request: NativeTokenRequest, reqTimestamp: number): Promise<AuthenticationResult> {\n this.logger.trace(\"NativeInteractionClient - handleNativeResponse called.\");\n\n if (response.account.id !== request.accountId) {\n // User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync\n throw NativeAuthError.createUserSwitchError();\n }\n\n // Get the preferred_cache domain for the given authority\n const authority = await this.getDiscoveredAuthority(request.authority);\n const authorityPreferredCache = authority.getPreferredCache();\n\n // generate identifiers\n const idTokenObj = this.createIdTokenObj(response);\n const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenObj);\n const accountEntity = this.createAccountEntity(response, homeAccountIdentifier, idTokenObj, authorityPreferredCache);\n\n // generate authenticationResult\n const result = await this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp);\n\n // cache accounts and tokens in the appropriate storage\n this.cacheAccount(accountEntity);\n this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);\n \n return result;\n }\n\n /**\n * Create an idToken Object (not entity)\n * @param response \n * @returns \n */\n protected createIdTokenObj(response: NativeResponse): AuthToken {\n return new AuthToken(response.id_token || Constants.EMPTY_STRING, this.browserCrypto);\n }\n\n /**\n * creates an homeAccountIdentifier for the account\n * @param response \n * @param idTokenObj \n * @returns \n */\n protected createHomeAccountIdentifier(response: NativeResponse, idTokenObj: AuthToken): string {\n // Save account in browser storage\n const homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);\n\n return homeAccountIdentifier;\n }\n\n /**\n * Creates account entity\n * @param response \n * @param homeAccountIdentifier \n * @param idTokenObj \n * @param authority \n * @returns \n */\n protected createAccountEntity(response: NativeResponse, homeAccountIdentifier: string, idTokenObj: AuthToken, authority: string): AccountEntity {\n\n return AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authority, response.account.id);\n }\n\n /**\n * Helper to generate scopes\n * @param response \n * @param request \n * @returns \n */\n generateScopes(response: NativeResponse, request: NativeTokenRequest): ScopeSet {\n return response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\n }\n\n /**\n * If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser\n * @param request \n * @param response \n */\n async generatePopAccessToken(response: NativeResponse, request: NativeTokenRequest): Promise<string> {\n \n if(request.tokenType === AuthenticationScheme.POP) {\n /** \n * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT \n * is still received, SHR is calculated locally\n */\n \n // Check if native layer returned an SHR token\n if (response.shr) {\n this.logger.trace(\"handleNativeServerResponse: SHR is enabled in native layer\");\n return response.shr;\n }\n\n // Generate SHR in msal js if WAM does not compute it when POP is enabled\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(this.browserCrypto);\n const shrParameters: SignedHttpRequestParameters = {\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n shrNonce: request.shrNonce\n };\n\n /**\n * KeyID must be present in the native request from when the PoP key was generated in order for\n * PopTokenGenerator to query the full key for signing\n */\n if (!request.keyId) {\n throw ClientAuthError.createKeyIdMissingError();\n }\n return await popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters);\n } else {\n return response.access_token;\n }\n }\n\n /**\n * Generates authentication result\n * @param response \n * @param request \n * @param idTokenObj \n * @param accountEntity \n * @param authority \n * @param reqTimestamp \n * @returns \n */\n protected async generateAuthenticationResult(response: NativeResponse, request: NativeTokenRequest, idTokenObj: AuthToken, accountEntity: AccountEntity, authority: string, reqTimestamp: number): Promise<AuthenticationResult> {\n\n // Add Native Broker fields to Telemetry\n const mats = this.addTelemetryFromNativeResponse(response);\n\n // If scopes not returned in server response, use request scopes\n const responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\n\n const accountProperties = response.account.properties || {};\n const uid = accountProperties[\"UID\"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;\n const tid = accountProperties[\"TenantId\"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;\n\n // generate PoP token as needed\n const responseAccessToken = await this.generatePopAccessToken(response, request);\n const tokenType = (request.tokenType === AuthenticationScheme.POP) ? AuthenticationScheme.POP : AuthenticationScheme.BEARER;\n\n const result: AuthenticationResult = {\n authority: authority,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes.asArray(),\n account: accountEntity.getAccountInfo(),\n idToken: response.id_token,\n idTokenClaims: idTokenObj.claims,\n accessToken: responseAccessToken,\n fromCache: mats ? this.isResponseFromCache(mats) : false,\n expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),\n tokenType: tokenType,\n correlationId: this.correlationId,\n state: response.state,\n fromNativeBroker: true\n };\n\n return result;\n }\n\n /**\n * cache the account entity in browser storage\n * @param accountEntity \n */\n cacheAccount(accountEntity: AccountEntity): void{\n // Store the account info and hence `nativeAccountId` in browser cache\n this.browserStorage.setAccount(accountEntity);\n\n // Remove any existing cached tokens for this account in browser storage\n this.browserStorage.removeAccountContext(accountEntity).catch((e) => {\n this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);\n });\n }\n\n /**\n * Stores the access_token and id_token in inmemory storage\n * @param response \n * @param request \n * @param homeAccountIdentifier \n * @param idTokenObj \n * @param responseAccessToken \n * @param tenantId \n * @param reqTimestamp \n */\n cacheNativeTokens(response: NativeResponse, request: NativeTokenRequest, homeAccountIdentifier: string, idTokenObj: AuthToken, responseAccessToken: string, tenantId: string, reqTimestamp: number): void {\n\n // cache idToken in inmemory storage\n const idTokenEntity = IdTokenEntity.createIdTokenEntity(\n homeAccountIdentifier,\n request.authority,\n response.id_token || Constants.EMPTY_STRING,\n request.clientId,\n idTokenObj.claims.tid || Constants.EMPTY_STRING,\n );\n this.nativeStorageManager.setIdTokenCredential(idTokenEntity);\n\n // cache accessToken in inmemory storage\n const expiresIn: number = (request.tokenType === AuthenticationScheme.POP)\n ? Constants.SHR_NONCE_VALIDITY\n : (\n typeof response.expires_in === \"string\"\n ? parseInt(response.expires_in, 10)\n : response.expires_in\n ) || 0;\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\n const responseScopes = this.generateScopes(response, request);\n const accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(\n homeAccountIdentifier,\n request.authority,\n responseAccessToken,\n request.clientId,\n tenantId,\n responseScopes.printScopes(),\n tokenExpirationSeconds,\n 0,\n this.browserCrypto\n );\n this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);\n }\n\n protected addTelemetryFromNativeResponse(response: NativeResponse): MATS | null {\n\n const mats = this.getMATSFromResponse(response);\n\n if (!mats){\n return null;\n }\n \n this.performanceClient.addStaticFields({\n extensionId: this.nativeMessageHandler.getExtensionId(),\n extensionVersion: this.nativeMessageHandler.getExtensionVersion(),\n matsBrokerVersion: mats.broker_version,\n matsAccountJoinOnStart: mats.account_join_on_start,\n matsAccountJoinOnEnd: mats.account_join_on_end,\n matsDeviceJoin: mats.device_join,\n matsPromptBehavior: mats.prompt_behavior,\n matsApiErrorCode: mats.api_error_code,\n matsUiVisible: mats.ui_visible,\n matsSilentCode: mats.silent_code,\n matsSilentBiSubCode: mats.silent_bi_sub_code,\n matsSilentMessage: mats.silent_message,\n matsSilentStatus: mats.silent_status,\n matsHttpStatus: mats.http_status,\n matsHttpEventCount: mats.http_event_count\n }, this.correlationId);\n\n return mats;\n }\n\n /**\n * Validates native platform response before processing\n * @param response\n */\n private validateNativeResponse(response: object): NativeResponse {\n if (\n response.hasOwnProperty(\"access_token\") &&\n response.hasOwnProperty(\"id_token\") &&\n response.hasOwnProperty(\"client_info\") &&\n response.hasOwnProperty(\"account\") &&\n response.hasOwnProperty(\"scope\") &&\n response.hasOwnProperty(\"expires_in\")\n ) {\n return response as NativeResponse;\n } else {\n throw NativeAuthError.createUnexpectedError(\"Response missing expected properties.\");\n }\n }\n\n /**\n * Gets MATS telemetry from native response\n * @param response\n * @returns\n */\n private getMATSFromResponse(response: NativeResponse): MATS|null {\n if (response.properties.MATS) {\n try {\n return JSON.parse(response.properties.MATS);\n } catch (e) {\n this.logger.error(\"NativeInteractionClient - Error parsing MATS telemetry, returning null instead\");\n }\n }\n\n return null;\n }\n\n /**\n * Returns whether or not response came from native cache\n * @param response\n * @returns\n */\n protected isResponseFromCache(mats: MATS): boolean {\n if (typeof mats.is_cached === \"undefined\") {\n this.logger.verbose(\"NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false.\");\n return false;\n }\n\n return !!mats.is_cached;\n }\n\n /**\n * Translates developer provided request object into NativeRequest object\n * @param request\n */\n protected async initializeNativeRequest(request: PopupRequest|SsoSilentRequest): Promise<NativeTokenRequest> {\n this.logger.trace(\"NativeInteractionClient - initializeNativeRequest called\");\n\n const authority = request.authority || this.config.auth.authority;\n const canonicalAuthority = new UrlString(authority);\n canonicalAuthority.validateAsUri();\n\n // scopes are expected to be received by the native broker as \"scope\" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.\n const { scopes, ...remainingProperties } = request; \n const scopeSet = new ScopeSet(scopes || []);\n scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);\n\n const getPrompt = () => {\n // If request is silent, prompt is always none\n switch (this.apiId) {\n case ApiId.ssoSilent:\n case ApiId.acquireTokenSilent_silentFlow:\n this.logger.trace(\"initializeNativeRequest: silent request sets prompt to none\");\n return PromptValue.NONE;\n default:\n break;\n }\n\n // Prompt not provided, request may proceed and native broker decides if it needs to prompt\n if (!request.prompt) {\n this.logger.trace(\"initializeNativeRequest: prompt was not provided\");\n return undefined;\n }\n\n // If request is interactive, check if prompt provided is allowed to go directly to native broker\n switch (request.prompt) {\n case PromptValue.NONE:\n case PromptValue.CONSENT:\n case PromptValue.LOGIN:\n this.logger.trace(\"initializeNativeRequest: prompt is compatible with native flow\");\n return request.prompt;\n default:\n this.logger.trace(`initializeNativeRequest: prompt = ${request.prompt} is not compatible with native flow`);\n throw BrowserAuthError.createNativePromptParameterNotSupportedError();\n }\n };\n \n const validatedRequest: NativeTokenRequest = {\n ...remainingProperties,\n accountId: this.accountId,\n clientId: this.config.auth.clientId,\n authority: canonicalAuthority.urlString,\n scope: scopeSet.printScopes(),\n redirectUri: this.getRedirectUri(request.redirectUri),\n prompt: getPrompt(),\n correlationId: this.correlationId,\n tokenType: request.authenticationScheme,\n windowTitleSubstring: document.title,\n extraParameters: {\n ...request.extraQueryParameters,\n ...request.tokenQueryParameters,\n telemetry: NativeConstants.MATS_TELEMETRY\n },\n extendedExpiryToken: false // Make this configurable?\n };\n\n if (request.authenticationScheme === AuthenticationScheme.POP) {\n\n // add POP request type\n const shrParameters: SignedHttpRequestParameters = {\n resourceRequestUri: request.resourceRequestUri,\n resourceRequestMethod: request.resourceRequestMethod,\n shrClaims: request.shrClaims,\n shrNonce: request.shrNonce\n };\n\n const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);\n const reqCnfData = await popTokenGenerator.generateCnf(shrParameters);\n\n // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string\n validatedRequest.reqCnf = reqCnfData.reqCnfHash;\n validatedRequest.keyId = reqCnfData.kid;\n }\n\n return validatedRequest;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;IAwB6C,2CAAqB;IAO9D,iCAAY,MAA4B,EAAE,cAAmC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,KAAY,EAAE,iBAAqC,EAAE,QAA8B,EAAE,SAAiB,EAAE,iBAAsC,EAAE,aAAsB;QAA9V,YACI,kBAAM,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,CAAC,SAMnI;QALG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,oBAAoB,GAAG,QAAQ,CA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IAAI,CAAC,aAAa,EACjC,SAAS,EAAE,OAAO,CAAC,oBAAoB,EACvC,oBAAoB,EAAE,QAAQ,CAAC,KAAK,EACpC,eAAe,iCACR,OAAO,CAAC,oBAAoB,GAC5B,OAAO,CAAC,oBAAoB,KAC/B,SAAS,EAAE,eAAe,CAAC,cAAc,KAE7C,mBAAmB,EAAE,KAAK;2BAC7B,CAAC;8BAEE,OAAO,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,GAAG,CAAA,EAAzD,wBAAyD;wBAGnD,aAAa,GAAgC;4BAC/C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;4BAC9C,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;4BACpD,SAAS,EAAE,OAAO,CAAC,SAAS;4BAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;yBAC7B,CAAC;wBAEI,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;wBACjD,qBAAM,iBAAiB,CAAC,WAAW,CAAC,aAAa,CAAC,EAAA;;wBAA/D,UAAU,GAAG,SAAkD;;wBAGrE,gBAAgB,CAAC,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;wBAChD,gBAAgB,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC;;4BAG5C,sBAAO,gBAAgB,EAAC;;;;KAC3B;IACL,8BAAC;AAAD,CA/kBA,CAA6C,qBAAqB;;;;"}
|
|
1
|
+
{"version":3,"file":"NativeInteractionClient.js","sources":["../../src/interaction_client/NativeInteractionClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, Logger, ICrypto, PromptValue, AuthToken, Constants, AccountEntity, AuthorityType, ScopeSet, TimeUtils, AuthenticationScheme, UrlString, OIDC_DEFAULT_SCOPES, PopTokenGenerator, SignedHttpRequestParameters, IPerformanceClient, PerformanceEvents, IdTokenEntity, AccessTokenEntity, ClientAuthError, AuthError, CommonSilentFlowRequest, AccountInfo, CacheRecord } from \"@azure/msal-common\";\nimport { BaseInteractionClient } from \"./BaseInteractionClient\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\nimport { NativeExtensionMethod, ApiId, TemporaryCacheKeys, NativeConstants } from \"../utils/BrowserConstants\";\nimport { NativeExtensionRequestBody, NativeTokenRequest } from \"../broker/nativeBroker/NativeRequest\";\nimport { MATS, NativeResponse } from \"../broker/nativeBroker/NativeResponse\";\nimport { NativeAuthError } from \"../error/NativeAuthError\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { SilentCacheClient } from \"./SilentCacheClient\";\n\nexport class NativeInteractionClient extends BaseInteractionClient {\n protected apiId: ApiId;\n protected accountId: string;\n protected nativeMessageHandler: NativeMessageHandler;\n protected silentCacheClient: SilentCacheClient;\n protected nativeStorageManager: BrowserCacheManager;\n\n constructor(config: BrowserConfiguration, browserStorage: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, provider: NativeMessageHandler, accountId: string, nativeStorageImpl: BrowserCacheManager, correlationId?: string) {\n super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);\n this.apiId = apiId;\n this.accountId = accountId;\n this.nativeMessageHandler = provider;\n this.nativeStorageManager = nativeStorageImpl;\n this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);\n }\n\n /**\n * Acquire token from native platform via browser extension\n * @param request\n */\n async acquireToken(request: PopupRequest|SilentRequest|SsoSilentRequest): Promise<AuthenticationResult> {\n this.logger.trace(\"NativeInteractionClient - acquireToken called.\");\n\n // start the perf measurement\n const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);\n const reqTimestamp = TimeUtils.nowSeconds();\n\n // initialize native request\n const nativeRequest = await this.initializeNativeRequest(request);\n \n // check if the tokens can be retrieved from internal cache\n try {\n const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);\n nativeATMeasurement.endMeasurement({\n success: true,\n isNativeBroker: false, // Should be true only when the result is coming directly from the broker\n fromCache: true\n });\n return result;\n } catch (e) {\n // continue with a native call for any and all errors\n this.logger.info(\"MSAL internal Cache does not contain tokens, proceed to make a native call\");\n }\n\n // fall back to native calls\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: nativeRequest\n };\n\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n const validatedResponse: NativeResponse = this.validateNativeResponse(response);\n\n return this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)\n .then((result: AuthenticationResult) => {\n nativeATMeasurement.endMeasurement({\n success: true,\n isNativeBroker: true,\n requestId: result.requestId\n });\n return result;\n })\n .catch((error: AuthError) => {\n nativeATMeasurement.endMeasurement({\n success: false,\n errorCode: error.errorCode,\n subErrorCode: error.subError,\n isNativeBroker: true\n });\n throw error;\n });\n }\n\n /**\n * Creates silent flow request\n * @param request\n * @param cachedAccount\n * @returns CommonSilentFlowRequest\n */\n private createSilentCacheRequest(request: NativeTokenRequest, cachedAccount: AccountInfo): CommonSilentFlowRequest {\n return {\n authority: request.authority,\n correlationId: this.correlationId,\n scopes: ScopeSet.fromString(request.scope).asArray(),\n account: cachedAccount,\n forceRefresh: false,\n };\n }\n\n /**\n * Fetches the tokens from the cache if un-expired\n * @param nativeAccountId\n * @param request\n * @returns authenticationResult\n */\n protected async acquireTokensFromCache(nativeAccountId: string, request: NativeTokenRequest): Promise<AuthenticationResult> {\n if (!nativeAccountId) {\n this.logger.warning(\"NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided\");\n throw ClientAuthError.createNoAccountFoundError();\n }\n // fetch the account from browser cache\n const account = this.browserStorage.getAccountInfoFilteredBy({nativeAccountId});\n if (!account) {\n throw ClientAuthError.createNoAccountFoundError();\n }\n\n // leverage silent flow for cached tokens retrieval\n try {\n const silentRequest = this.createSilentCacheRequest(request, account);\n const result = await this.silentCacheClient.acquireToken(silentRequest);\n return result;\n } catch (e) {\n throw e;\n }\n }\n\n /**\n * Acquires a token from native platform then redirects to the redirectUri instead of returning the response\n * @param request\n */\n async acquireTokenRedirect(request: RedirectRequest): Promise<void> {\n this.logger.trace(\"NativeInteractionClient - acquireTokenRedirect called.\");\n const nativeRequest = await this.initializeNativeRequest(request);\n\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: nativeRequest\n };\n\n try {\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n this.validateNativeResponse(response);\n } catch (e) {\n // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise\n if (e instanceof NativeAuthError && e.isFatal()) {\n throw e;\n }\n }\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);\n\n const navigationOptions: NavigationOptions = {\n apiId: ApiId.acquireTokenRedirect,\n timeout: this.config.system.redirectNavigationTimeout,\n noHistory: false\n };\n const redirectUri = this.config.auth.navigateToLoginRequestUrl ? window.location.href : this.getRedirectUri(request.redirectUri);\n await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again\n }\n\n /**\n * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response\n */\n async handleRedirectPromise(): Promise<AuthenticationResult | null> {\n this.logger.trace(\"NativeInteractionClient - handleRedirectPromise called.\");\n if (!this.browserStorage.isInteractionInProgress(true)) {\n this.logger.info(\"handleRedirectPromise called but there is no interaction in progress, returning null.\");\n return null;\n }\n\n // remove prompt from the request to prevent WAM from prompting twice\n const cachedRequest = this.browserStorage.getCachedNativeRequest();\n if (!cachedRequest) {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null.\");\n return null;\n }\n\n const { prompt, ...request} = cachedRequest;\n if (prompt) {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window.\");\n }\n\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));\n\n const messageBody: NativeExtensionRequestBody = {\n method: NativeExtensionMethod.GetToken,\n request: request\n };\n\n const reqTimestamp = TimeUtils.nowSeconds();\n\n try {\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise sending message to native broker.\");\n const response: object = await this.nativeMessageHandler.sendMessage(messageBody);\n this.validateNativeResponse(response);\n const result = this.handleNativeResponse(response as NativeResponse, request, reqTimestamp);\n this.browserStorage.setInteractionInProgress(false);\n return result;\n } catch (e) {\n this.browserStorage.setInteractionInProgress(false);\n throw e;\n }\n }\n\n /**\n * Logout from native platform via browser extension\n * @param request\n */\n logout(): Promise<void> {\n this.logger.trace(\"NativeInteractionClient - logout called.\");\n return Promise.reject(\"Logout not implemented yet\");\n }\n\n /**\n * Transform response from native platform into AuthenticationResult object which will be returned to the end user\n * @param response\n * @param request\n * @param reqTimestamp\n */\n protected async handleNativeResponse(response: NativeResponse, request: NativeTokenRequest, reqTimestamp: number): Promise<AuthenticationResult> {\n this.logger.trace(\"NativeInteractionClient - handleNativeResponse called.\");\n\n if (response.account.id !== request.accountId) {\n // User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync\n throw NativeAuthError.createUserSwitchError();\n }\n\n // Get the preferred_cache domain for the given authority\n const authority = await this.getDiscoveredAuthority(request.authority);\n const authorityPreferredCache = authority.getPreferredCache();\n\n // generate identifiers\n const idTokenObj = this.createIdTokenObj(response);\n const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenObj);\n const accountEntity = this.createAccountEntity(response, homeAccountIdentifier, idTokenObj, authorityPreferredCache);\n\n // generate authenticationResult\n const result = await this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp);\n\n // cache accounts and tokens in the appropriate storage\n this.cacheAccount(accountEntity);\n this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);\n \n return result;\n }\n\n /**\n * Create an idToken Object (not entity)\n * @param response \n * @returns \n */\n protected createIdTokenObj(response: NativeResponse): AuthToken {\n return new AuthToken(response.id_token || Constants.EMPTY_STRING, this.browserCrypto);\n }\n\n /**\n * creates an homeAccountIdentifier for the account\n * @param response \n * @param idTokenObj \n * @returns \n */\n protected createHomeAccountIdentifier(response: NativeResponse, idTokenObj: AuthToken): string {\n // Save account in browser storage\n const homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);\n\n return homeAccountIdentifier;\n }\n\n /**\n * Creates account entity\n * @param response \n * @param homeAccountIdentifier \n * @param idTokenObj \n * @param authority \n * @returns \n */\n protected createAccountEntity(response: NativeResponse, homeAccountIdentifier: string, idTokenObj: AuthToken, authority: string): AccountEntity {\n\n return AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authority, response.account.id);\n }\n\n /**\n * Helper to generate scopes\n * @param response \n * @param request \n * @returns \n */\n generateScopes(response: NativeResponse, request: NativeTokenRequest): ScopeSet {\n return response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\n }\n\n /**\n * If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser\n * @param request \n * @param response \n */\n async generatePopAccessToken(response: NativeResponse, request: NativeTokenRequest): Promise<string> {\n \n if(request.tokenType === AuthenticationScheme.POP) {\n /** \n * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT \n * is still received, SHR is calculated locally\n */\n \n // Check if native layer returned an SHR token\n if (response.shr) {\n this.logger.trace(\"handleNativeServerResponse: SHR is enabled in native layer\");\n return response.shr;\n }\n\n // Generate SHR in msal js if WAM does not compute it when POP is enabled\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(this.browserCrypto);\n const shrParameters: SignedHttpRequestParameters = {\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n shrNonce: request.shrNonce\n };\n\n /**\n * KeyID must be present in the native request from when the PoP key was generated in order for\n * PopTokenGenerator to query the full key for signing\n */\n if (!request.keyId) {\n throw ClientAuthError.createKeyIdMissingError();\n }\n return await popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters);\n } else {\n return response.access_token;\n }\n }\n\n /**\n * Generates authentication result\n * @param response \n * @param request \n * @param idTokenObj \n * @param accountEntity \n * @param authority \n * @param reqTimestamp \n * @returns \n */\n protected async generateAuthenticationResult(response: NativeResponse, request: NativeTokenRequest, idTokenObj: AuthToken, accountEntity: AccountEntity, authority: string, reqTimestamp: number): Promise<AuthenticationResult> {\n\n // Add Native Broker fields to Telemetry\n const mats = this.addTelemetryFromNativeResponse(response);\n\n // If scopes not returned in server response, use request scopes\n const responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\n\n const accountProperties = response.account.properties || {};\n const uid = accountProperties[\"UID\"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;\n const tid = accountProperties[\"TenantId\"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;\n\n // generate PoP token as needed\n const responseAccessToken = await this.generatePopAccessToken(response, request);\n const tokenType = (request.tokenType === AuthenticationScheme.POP) ? AuthenticationScheme.POP : AuthenticationScheme.BEARER;\n\n const result: AuthenticationResult = {\n authority: authority,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes.asArray(),\n account: accountEntity.getAccountInfo(),\n idToken: response.id_token,\n idTokenClaims: idTokenObj.claims,\n accessToken: responseAccessToken,\n fromCache: mats ? this.isResponseFromCache(mats) : false,\n expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),\n tokenType: tokenType,\n correlationId: this.correlationId,\n state: response.state,\n fromNativeBroker: true\n };\n\n return result;\n }\n\n /**\n * cache the account entity in browser storage\n * @param accountEntity \n */\n cacheAccount(accountEntity: AccountEntity): void{\n // Store the account info and hence `nativeAccountId` in browser cache\n this.browserStorage.setAccount(accountEntity);\n\n // Remove any existing cached tokens for this account in browser storage\n this.browserStorage.removeAccountContext(accountEntity).catch((e) => {\n this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);\n });\n }\n\n /**\n * Stores the access_token and id_token in inmemory storage\n * @param response \n * @param request \n * @param homeAccountIdentifier \n * @param idTokenObj \n * @param responseAccessToken \n * @param tenantId \n * @param reqTimestamp \n */\n cacheNativeTokens(response: NativeResponse, request: NativeTokenRequest, homeAccountIdentifier: string, accountEntity: AccountEntity, idTokenObj: AuthToken, responseAccessToken: string, tenantId: string, reqTimestamp: number): void {\n\n const cachedIdToken: IdTokenEntity | null =\n IdTokenEntity.createIdTokenEntity(\n homeAccountIdentifier,\n request.authority,\n response.id_token || Constants.EMPTY_STRING,\n request.clientId,\n idTokenObj.claims.tid || Constants.EMPTY_STRING\n );\n\n // cache accessToken in inmemory storage\n const expiresIn: number = (request.tokenType === AuthenticationScheme.POP)\n ? Constants.SHR_NONCE_VALIDITY\n : (\n typeof response.expires_in === \"string\"\n ? parseInt(response.expires_in, 10)\n : response.expires_in\n ) || 0;\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\n const responseScopes = this.generateScopes(response, request);\n const cachedAccessToken: AccessTokenEntity | null =\n AccessTokenEntity.createAccessTokenEntity(\n homeAccountIdentifier,\n request.authority,\n responseAccessToken,\n request.clientId,\n idTokenObj\n ? idTokenObj.claims.tid || Constants.EMPTY_STRING\n : tenantId,\n responseScopes.printScopes(),\n tokenExpirationSeconds,\n 0,\n this.browserCrypto\n );\n\n const nativeCacheRecord = new CacheRecord(\n accountEntity,\n cachedIdToken,\n cachedAccessToken\n );\n\n this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);\n }\n\n protected addTelemetryFromNativeResponse(response: NativeResponse): MATS | null {\n\n const mats = this.getMATSFromResponse(response);\n\n if (!mats){\n return null;\n }\n \n this.performanceClient.addStaticFields({\n extensionId: this.nativeMessageHandler.getExtensionId(),\n extensionVersion: this.nativeMessageHandler.getExtensionVersion(),\n matsBrokerVersion: mats.broker_version,\n matsAccountJoinOnStart: mats.account_join_on_start,\n matsAccountJoinOnEnd: mats.account_join_on_end,\n matsDeviceJoin: mats.device_join,\n matsPromptBehavior: mats.prompt_behavior,\n matsApiErrorCode: mats.api_error_code,\n matsUiVisible: mats.ui_visible,\n matsSilentCode: mats.silent_code,\n matsSilentBiSubCode: mats.silent_bi_sub_code,\n matsSilentMessage: mats.silent_message,\n matsSilentStatus: mats.silent_status,\n matsHttpStatus: mats.http_status,\n matsHttpEventCount: mats.http_event_count\n }, this.correlationId);\n\n return mats;\n }\n\n /**\n * Validates native platform response before processing\n * @param response\n */\n private validateNativeResponse(response: object): NativeResponse {\n if (\n response.hasOwnProperty(\"access_token\") &&\n response.hasOwnProperty(\"id_token\") &&\n response.hasOwnProperty(\"client_info\") &&\n response.hasOwnProperty(\"account\") &&\n response.hasOwnProperty(\"scope\") &&\n response.hasOwnProperty(\"expires_in\")\n ) {\n return response as NativeResponse;\n } else {\n throw NativeAuthError.createUnexpectedError(\"Response missing expected properties.\");\n }\n }\n\n /**\n * Gets MATS telemetry from native response\n * @param response\n * @returns\n */\n private getMATSFromResponse(response: NativeResponse): MATS|null {\n if (response.properties.MATS) {\n try {\n return JSON.parse(response.properties.MATS);\n } catch (e) {\n this.logger.error(\"NativeInteractionClient - Error parsing MATS telemetry, returning null instead\");\n }\n }\n\n return null;\n }\n\n /**\n * Returns whether or not response came from native cache\n * @param response\n * @returns\n */\n protected isResponseFromCache(mats: MATS): boolean {\n if (typeof mats.is_cached === \"undefined\") {\n this.logger.verbose(\"NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false.\");\n return false;\n }\n\n return !!mats.is_cached;\n }\n\n /**\n * Translates developer provided request object into NativeRequest object\n * @param request\n */\n protected async initializeNativeRequest(request: PopupRequest|SsoSilentRequest): Promise<NativeTokenRequest> {\n this.logger.trace(\"NativeInteractionClient - initializeNativeRequest called\");\n\n const authority = request.authority || this.config.auth.authority;\n\n if (request.account) {\n await this.validateRequestAuthority(authority, request.account);\n }\n\n const canonicalAuthority = new UrlString(authority);\n canonicalAuthority.validateAsUri();\n\n // scopes are expected to be received by the native broker as \"scope\" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.\n const { scopes, ...remainingProperties } = request; \n const scopeSet = new ScopeSet(scopes || []);\n scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);\n\n const getPrompt = () => {\n // If request is silent, prompt is always none\n switch (this.apiId) {\n case ApiId.ssoSilent:\n case ApiId.acquireTokenSilent_silentFlow:\n this.logger.trace(\"initializeNativeRequest: silent request sets prompt to none\");\n return PromptValue.NONE;\n default:\n break;\n }\n\n // Prompt not provided, request may proceed and native broker decides if it needs to prompt\n if (!request.prompt) {\n this.logger.trace(\"initializeNativeRequest: prompt was not provided\");\n return undefined;\n }\n\n // If request is interactive, check if prompt provided is allowed to go directly to native broker\n switch (request.prompt) {\n case PromptValue.NONE:\n case PromptValue.CONSENT:\n case PromptValue.LOGIN:\n this.logger.trace(\"initializeNativeRequest: prompt is compatible with native flow\");\n return request.prompt;\n default:\n this.logger.trace(`initializeNativeRequest: prompt = ${request.prompt} is not compatible with native flow`);\n throw BrowserAuthError.createNativePromptParameterNotSupportedError();\n }\n };\n \n const validatedRequest: NativeTokenRequest = {\n ...remainingProperties,\n accountId: this.accountId,\n clientId: this.config.auth.clientId,\n authority: canonicalAuthority.urlString,\n scope: scopeSet.printScopes(),\n redirectUri: this.getRedirectUri(request.redirectUri),\n prompt: getPrompt(),\n correlationId: this.correlationId,\n tokenType: request.authenticationScheme,\n windowTitleSubstring: document.title,\n extraParameters: {\n ...request.extraQueryParameters,\n ...request.tokenQueryParameters,\n telemetry: NativeConstants.MATS_TELEMETRY\n },\n extendedExpiryToken: false // Make this configurable?\n };\n\n if (request.authenticationScheme === AuthenticationScheme.POP) {\n\n // add POP request type\n const shrParameters: SignedHttpRequestParameters = {\n resourceRequestUri: request.resourceRequestUri,\n resourceRequestMethod: request.resourceRequestMethod,\n shrClaims: request.shrClaims,\n shrNonce: request.shrNonce\n };\n\n const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);\n const reqCnfData = await popTokenGenerator.generateCnf(shrParameters);\n\n // to reduce the URL length, it is recommended to send the short form of the req_cnf \n validatedRequest.reqCnf = reqCnfData.reqCnfString;\n validatedRequest.keyId = reqCnfData.kid;\n }\n\n return validatedRequest;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;IAwB6C,2CAAqB;IAO9D,iCAAY,MAA4B,EAAE,cAAmC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,KAAY,EAAE,iBAAqC,EAAE,QAA8B,EAAE,SAAiB,EAAE,iBAAsC,EAAE,aAAsB;QAA9V,YACI,kBAAM,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,CAAC,SAMnI;QALG,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,KAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC;QACrC,KAAI,CA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07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
|
|
4
4
|
import { OIDC_DEFAULT_SCOPES, StringUtils, UrlString, Constants, AuthError, ThrottlingUtils, ProtocolUtils, PerformanceEvents } from '@azure/msal-common';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/RedirectClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAiF,sBAAsB,EAA8E,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAqB,MAAM,oBAAoB,CAAC;AACrS,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAIxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,qBAAa,cAAe,SAAQ,yBAAyB;IACzD,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC;gBAEjC,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,mBAAmB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,aAAa,CAAC,EAAE,MAAM;IAKvU;;;OAGG;IACG,YAAY,CAAC,OAAO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IG;IACH,SAAS,CAAC,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkB9D;;;;OAIG;cACa,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAmCtI;;;;OAIG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8D9D;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;CAIpE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.37.1 2023-06-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
|
|
4
4
|
import { UrlString, AuthError, PerformanceEvents, Constants, ThrottlingUtils, ProtocolUtils } from '@azure/msal-common';
|
|
@@ -44,6 +44,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
44
44
|
if (event.persisted) {
|
|
45
45
|
_this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
|
46
46
|
_this.browserStorage.cleanRequestByState(validRequest.state);
|
|
47
|
+
_this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, InteractionType.Redirect);
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
_a.label = 2;
|
|
@@ -235,7 +236,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
235
236
|
if (!this.nativeMessageHandler) {
|
|
236
237
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
237
238
|
}
|
|
238
|
-
nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.
|
|
239
|
+
nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, cachedRequest.correlationId);
|
|
239
240
|
userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
|
|
240
241
|
return [2 /*return*/, nativeInteractionClient.acquireToken(__assign(__assign({}, cachedRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently
|
|
241
242
|
})).finally(function () {
|