@azure/msal-browser 3.11.1 → 3.14.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/dist/app/IPublicClientApplication.d.ts +2 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +4 -1
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +10 -2
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +31 -3
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +2 -3
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +3 -8
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +14 -0
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +213 -117
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +2 -2
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +4 -5
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +5 -8
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +2 -1
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.d.ts +0 -2
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +4 -10
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +10 -11
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.d.ts +3 -0
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +2 -1
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +486 -257
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +486 -257
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -66
- package/package.json +4 -4
- package/src/app/IPublicClientApplication.ts +5 -0
- package/src/cache/BrowserCacheManager.ts +49 -1
- package/src/controllers/ControllerFactory.ts +1 -4
- package/src/controllers/NestedAppAuthController.ts +7 -6
- package/src/controllers/StandardController.ts +380 -263
- package/src/controllers/UnknownOperatingContextController.ts +3 -1
- package/src/interaction_client/RedirectClient.ts +6 -12
- package/src/interaction_handler/SilentHandler.ts +1 -0
- package/src/naa/BridgeProxy.ts +3 -12
- package/src/operatingcontext/TeamsAppOperatingContext.ts +14 -8
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserUtils.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardController.d.ts","sourceRoot":"","sources":["../../src/controllers/StandardController.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,WAAW,EAEX,cAAc,EACd,MAAM,EACN,uBAAuB,EACvB,OAAO,EAIP,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EAQf,aAAa,EAGhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,mBAAmB,EAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAgB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAEH,KAAK,EAEL,UAAU,EAEV,iBAAiB,EAIpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAc,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA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G;IACG,kBAAkB,CACpB,OAAO,EAAE,aAAa,GACvB,OAAO,CAAC,oBAAoB,CAAC;IAkGhC;;;;;OAKG;cACa,uBAAuB,CACnC,OAAO,EAAE,aAAa,GAAG;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,EAClD,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,oBAAoB,CAAC;IAwKhC;;;;;OAKG;YACW,0BAA0B;CAmE3C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.14.0 2024-05-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { CryptoOps } from '../crypto/CryptoOps.mjs';
|
|
4
4
|
import { DEFAULT_CRYPTO_IMPLEMENTATION, buildStaticAuthorityOptions, PerformanceEvents, invokeAsync, InteractionRequiredAuthError, createClientAuthError, ClientAuthErrorCodes, AccountEntity, PromptValue, Constants, InteractionRequiredAuthErrorCodes } from '@azure/msal-common';
|
|
@@ -26,6 +26,19 @@ import { spaCodeAndNativeAccountIdPresent, unableToAcquireTokenFromNativePlatfor
|
|
|
26
26
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
27
27
|
* Licensed under the MIT License.
|
|
28
28
|
*/
|
|
29
|
+
function getAccountType(account) {
|
|
30
|
+
const idTokenClaims = account?.idTokenClaims;
|
|
31
|
+
if (idTokenClaims?.tfp || idTokenClaims?.acr) {
|
|
32
|
+
return "B2C";
|
|
33
|
+
}
|
|
34
|
+
if (!idTokenClaims?.tid) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
else if (idTokenClaims?.tid === "9188040d-6c67-4c5b-b112-36a304b66dad") {
|
|
38
|
+
return "MSA";
|
|
39
|
+
}
|
|
40
|
+
return "AAD";
|
|
41
|
+
}
|
|
29
42
|
class StandardController {
|
|
30
43
|
/**
|
|
31
44
|
* @constructor
|
|
@@ -74,7 +87,7 @@ class StandardController {
|
|
|
74
87
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
75
88
|
// Initialize the browser storage class.
|
|
76
89
|
this.browserStorage = this.isBrowserEnvironment
|
|
77
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth))
|
|
90
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth), this.performanceClient)
|
|
78
91
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
79
92
|
// initialize in memory storage for native flows
|
|
80
93
|
const nativeCacheOptions = {
|
|
@@ -85,7 +98,7 @@ class StandardController {
|
|
|
85
98
|
cacheMigrationEnabled: false,
|
|
86
99
|
claimsBasedCachingEnabled: false,
|
|
87
100
|
};
|
|
88
|
-
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
101
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, undefined, this.performanceClient);
|
|
89
102
|
// Initialize the token cache
|
|
90
103
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
91
104
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -148,7 +161,6 @@ class StandardController {
|
|
|
148
161
|
this.logger.verbose("handleRedirectPromise called");
|
|
149
162
|
// Block token acquisition before initialize has been called
|
|
150
163
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
151
|
-
const loggedInAccounts = this.getAllAccounts();
|
|
152
164
|
if (this.isBrowserEnvironment) {
|
|
153
165
|
/**
|
|
154
166
|
* Store the promise on the PublicClientApplication instance if this is the first invocation of handleRedirectPromise,
|
|
@@ -158,64 +170,9 @@ class StandardController {
|
|
|
158
170
|
const redirectResponseKey = hash || "";
|
|
159
171
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
160
172
|
if (typeof response === "undefined") {
|
|
161
|
-
|
|
162
|
-
const useNative = request &&
|
|
163
|
-
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
164
|
-
this.nativeExtensionProvider &&
|
|
165
|
-
!hash;
|
|
166
|
-
const correlationId = useNative
|
|
167
|
-
? request?.correlationId
|
|
168
|
-
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
169
|
-
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
170
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);
|
|
171
|
-
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
172
|
-
let redirectResponse;
|
|
173
|
-
if (useNative && this.nativeExtensionProvider) {
|
|
174
|
-
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
175
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
176
|
-
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
180
|
-
const redirectClient = this.createRedirectClient(correlationId);
|
|
181
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
182
|
-
}
|
|
183
|
-
response = redirectResponse
|
|
184
|
-
.then((result) => {
|
|
185
|
-
if (result) {
|
|
186
|
-
// Emit login event if number of accounts change
|
|
187
|
-
const isLoggingIn = loggedInAccounts.length <
|
|
188
|
-
this.getAllAccounts().length;
|
|
189
|
-
if (isLoggingIn) {
|
|
190
|
-
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);
|
|
191
|
-
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);
|
|
195
|
-
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
196
|
-
}
|
|
197
|
-
rootMeasurement.end({ success: true });
|
|
198
|
-
}
|
|
199
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
|
|
200
|
-
rootMeasurement.end({ success: false });
|
|
201
|
-
return result;
|
|
202
|
-
})
|
|
203
|
-
.catch((e) => {
|
|
204
|
-
const eventError = e;
|
|
205
|
-
// Emit login event if there is an account
|
|
206
|
-
if (loggedInAccounts.length > 0) {
|
|
207
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, eventError);
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, eventError);
|
|
211
|
-
}
|
|
212
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
|
|
213
|
-
rootMeasurement.end({
|
|
214
|
-
success: false,
|
|
215
|
-
}, eventError);
|
|
216
|
-
throw e;
|
|
217
|
-
});
|
|
173
|
+
response = this.handleRedirectPromiseInternal(hash);
|
|
218
174
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
175
|
+
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
219
176
|
}
|
|
220
177
|
else {
|
|
221
178
|
this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");
|
|
@@ -225,6 +182,83 @@ class StandardController {
|
|
|
225
182
|
this.logger.verbose("handleRedirectPromise returns null, not browser environment");
|
|
226
183
|
return null;
|
|
227
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* The internal details of handleRedirectPromise. This is separated out to a helper to allow handleRedirectPromise to memoize requests
|
|
187
|
+
* @param hash
|
|
188
|
+
* @returns
|
|
189
|
+
*/
|
|
190
|
+
async handleRedirectPromiseInternal(hash) {
|
|
191
|
+
const loggedInAccounts = this.getAllAccounts();
|
|
192
|
+
const request = this.browserStorage.getCachedNativeRequest();
|
|
193
|
+
const useNative = request &&
|
|
194
|
+
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
195
|
+
this.nativeExtensionProvider &&
|
|
196
|
+
!hash;
|
|
197
|
+
const correlationId = useNative
|
|
198
|
+
? request?.correlationId
|
|
199
|
+
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
200
|
+
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
201
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);
|
|
202
|
+
let redirectResponse;
|
|
203
|
+
if (useNative && this.nativeExtensionProvider) {
|
|
204
|
+
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
205
|
+
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
206
|
+
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
210
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
211
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, rootMeasurement);
|
|
212
|
+
}
|
|
213
|
+
return redirectResponse
|
|
214
|
+
.then((result) => {
|
|
215
|
+
if (result) {
|
|
216
|
+
// Emit login event if number of accounts change
|
|
217
|
+
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
218
|
+
if (isLoggingIn) {
|
|
219
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);
|
|
220
|
+
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);
|
|
224
|
+
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
225
|
+
}
|
|
226
|
+
rootMeasurement.end({
|
|
227
|
+
success: true,
|
|
228
|
+
accountType: getAccountType(result.account),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
/*
|
|
233
|
+
* Instrument an event only if an error code is set. Otherwise, discard it when the redirect response
|
|
234
|
+
* is empty and the error code is missing.
|
|
235
|
+
*/
|
|
236
|
+
if (rootMeasurement.event.errorCode) {
|
|
237
|
+
rootMeasurement.end({ success: false });
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
rootMeasurement.discard();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
|
|
244
|
+
return result;
|
|
245
|
+
})
|
|
246
|
+
.catch((e) => {
|
|
247
|
+
const eventError = e;
|
|
248
|
+
// Emit login event if there is an account
|
|
249
|
+
if (loggedInAccounts.length > 0) {
|
|
250
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, eventError);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, eventError);
|
|
254
|
+
}
|
|
255
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
|
|
256
|
+
rootMeasurement.end({
|
|
257
|
+
success: false,
|
|
258
|
+
}, eventError);
|
|
259
|
+
throw e;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
228
262
|
/**
|
|
229
263
|
* Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects
|
|
230
264
|
* the page, so any code that follows this function will not execute.
|
|
@@ -296,6 +330,10 @@ class StandardController {
|
|
|
296
330
|
acquireTokenPopup(request) {
|
|
297
331
|
const correlationId = this.getRequestCorrelationId(request);
|
|
298
332
|
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
333
|
+
atPopupMeasurement.add({
|
|
334
|
+
scenarioId: request.scenarioId,
|
|
335
|
+
accountType: getAccountType(request.account),
|
|
336
|
+
});
|
|
299
337
|
try {
|
|
300
338
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
301
339
|
preflightCheck(this.initialized);
|
|
@@ -325,6 +363,7 @@ class StandardController {
|
|
|
325
363
|
success: true,
|
|
326
364
|
isNativeBroker: true,
|
|
327
365
|
requestId: response.requestId,
|
|
366
|
+
accountType: getAccountType(response.account),
|
|
328
367
|
});
|
|
329
368
|
return response;
|
|
330
369
|
})
|
|
@@ -360,13 +399,12 @@ class StandardController {
|
|
|
360
399
|
else {
|
|
361
400
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);
|
|
362
401
|
}
|
|
363
|
-
atPopupMeasurement.add({
|
|
364
|
-
accessTokenSize: result.accessToken.length,
|
|
365
|
-
idTokenSize: result.idToken.length,
|
|
366
|
-
});
|
|
367
402
|
atPopupMeasurement.end({
|
|
368
403
|
success: true,
|
|
369
404
|
requestId: result.requestId,
|
|
405
|
+
accessTokenSize: result.accessToken.length,
|
|
406
|
+
idTokenSize: result.idToken.length,
|
|
407
|
+
accountType: getAccountType(result.account),
|
|
370
408
|
});
|
|
371
409
|
return result;
|
|
372
410
|
})
|
|
@@ -425,6 +463,10 @@ class StandardController {
|
|
|
425
463
|
this.ssoSilentMeasurement?.increment({
|
|
426
464
|
visibilityChangeCount: 0,
|
|
427
465
|
});
|
|
466
|
+
this.ssoSilentMeasurement?.add({
|
|
467
|
+
scenarioId: request.scenarioId,
|
|
468
|
+
accountType: getAccountType(request.account),
|
|
469
|
+
});
|
|
428
470
|
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
429
471
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
430
472
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, validRequest);
|
|
@@ -447,14 +489,13 @@ class StandardController {
|
|
|
447
489
|
return result
|
|
448
490
|
.then((response) => {
|
|
449
491
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, response);
|
|
450
|
-
this.ssoSilentMeasurement?.add({
|
|
451
|
-
accessTokenSize: response.accessToken.length,
|
|
452
|
-
idTokenSize: response.idToken.length,
|
|
453
|
-
});
|
|
454
492
|
this.ssoSilentMeasurement?.end({
|
|
455
493
|
success: true,
|
|
456
494
|
isNativeBroker: response.fromNativeBroker,
|
|
457
495
|
requestId: response.requestId,
|
|
496
|
+
accessTokenSize: response.accessToken.length,
|
|
497
|
+
idTokenSize: response.idToken.length,
|
|
498
|
+
accountType: getAccountType(response.account),
|
|
458
499
|
});
|
|
459
500
|
return response;
|
|
460
501
|
})
|
|
@@ -485,6 +526,7 @@ class StandardController {
|
|
|
485
526
|
preflightCheck(this.initialized);
|
|
486
527
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, InteractionType.Silent, request);
|
|
487
528
|
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
|
|
529
|
+
atbcMeasurement.add({ scenarioId: request.scenarioId });
|
|
488
530
|
try {
|
|
489
531
|
if (request.code && request.nativeAccountId) {
|
|
490
532
|
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
@@ -502,14 +544,13 @@ class StandardController {
|
|
|
502
544
|
.then((result) => {
|
|
503
545
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);
|
|
504
546
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
505
|
-
atbcMeasurement.add({
|
|
506
|
-
accessTokenSize: result.accessToken.length,
|
|
507
|
-
idTokenSize: result.idToken.length,
|
|
508
|
-
});
|
|
509
547
|
atbcMeasurement.end({
|
|
510
548
|
success: true,
|
|
511
549
|
isNativeBroker: result.fromNativeBroker,
|
|
512
550
|
requestId: result.requestId,
|
|
551
|
+
accessTokenSize: result.accessToken.length,
|
|
552
|
+
idTokenSize: result.idToken.length,
|
|
553
|
+
accountType: getAccountType(result.account),
|
|
513
554
|
});
|
|
514
555
|
return result;
|
|
515
556
|
})
|
|
@@ -531,7 +572,7 @@ class StandardController {
|
|
|
531
572
|
}
|
|
532
573
|
else if (request.nativeAccountId) {
|
|
533
574
|
if (this.canUseNative(request, request.nativeAccountId)) {
|
|
534
|
-
|
|
575
|
+
const result = await this.acquireTokenNative({
|
|
535
576
|
...request,
|
|
536
577
|
correlationId,
|
|
537
578
|
}, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
|
|
@@ -542,6 +583,11 @@ class StandardController {
|
|
|
542
583
|
}
|
|
543
584
|
throw e;
|
|
544
585
|
});
|
|
586
|
+
atbcMeasurement.end({
|
|
587
|
+
accountType: getAccountType(result.account),
|
|
588
|
+
success: true,
|
|
589
|
+
});
|
|
590
|
+
return result;
|
|
545
591
|
}
|
|
546
592
|
else {
|
|
547
593
|
throw createBrowserAuthError(unableToAcquireTokenFromNativePlatform);
|
|
@@ -1104,6 +1150,7 @@ class StandardController {
|
|
|
1104
1150
|
const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
1105
1151
|
atsMeasurement.add({
|
|
1106
1152
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
1153
|
+
scenarioId: request.scenarioId,
|
|
1107
1154
|
});
|
|
1108
1155
|
preflightCheck(this.initialized);
|
|
1109
1156
|
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
@@ -1111,6 +1158,7 @@ class StandardController {
|
|
|
1111
1158
|
if (!account) {
|
|
1112
1159
|
throw createBrowserAuthError(noAccountError);
|
|
1113
1160
|
}
|
|
1161
|
+
atsMeasurement.add({ accountType: getAccountType(account) });
|
|
1114
1162
|
const thumbprint = {
|
|
1115
1163
|
clientId: this.config.auth.clientId,
|
|
1116
1164
|
authority: request.authority || Constants.EMPTY_STRING,
|
|
@@ -1134,16 +1182,14 @@ class StandardController {
|
|
|
1134
1182
|
}, account)
|
|
1135
1183
|
.then((result) => {
|
|
1136
1184
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
1137
|
-
atsMeasurement.add({
|
|
1138
|
-
accessTokenSize: result.accessToken.length,
|
|
1139
|
-
idTokenSize: result.idToken.length,
|
|
1140
|
-
});
|
|
1141
1185
|
atsMeasurement.end({
|
|
1142
1186
|
success: true,
|
|
1143
1187
|
fromCache: result.fromCache,
|
|
1144
1188
|
isNativeBroker: result.fromNativeBroker,
|
|
1145
1189
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
1146
1190
|
requestId: result.requestId,
|
|
1191
|
+
accessTokenSize: result.accessToken.length,
|
|
1192
|
+
idTokenSize: result.idToken.length,
|
|
1147
1193
|
});
|
|
1148
1194
|
return result;
|
|
1149
1195
|
})
|
|
@@ -1183,49 +1229,67 @@ class StandardController {
|
|
|
1183
1229
|
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
1184
1230
|
}
|
|
1185
1231
|
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
return
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
throw cacheError;
|
|
1232
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
1233
|
+
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
1234
|
+
const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
|
|
1235
|
+
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy);
|
|
1236
|
+
if (shouldTryToResolveSilently) {
|
|
1237
|
+
if (!this.activeIframeRequest) {
|
|
1238
|
+
let _resolve;
|
|
1239
|
+
// Always set the active request tracker immediately after checking it to prevent races
|
|
1240
|
+
this.activeIframeRequest = [
|
|
1241
|
+
new Promise((resolve) => {
|
|
1242
|
+
_resolve = resolve;
|
|
1243
|
+
}),
|
|
1244
|
+
silentRequest.correlationId,
|
|
1245
|
+
];
|
|
1246
|
+
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", silentRequest.correlationId);
|
|
1247
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest)
|
|
1248
|
+
.then((iframeResult) => {
|
|
1249
|
+
_resolve(true);
|
|
1250
|
+
return iframeResult;
|
|
1251
|
+
})
|
|
1252
|
+
.catch((e) => {
|
|
1253
|
+
_resolve(false);
|
|
1254
|
+
throw e;
|
|
1255
|
+
})
|
|
1256
|
+
.finally(() => {
|
|
1257
|
+
this.activeIframeRequest = undefined;
|
|
1258
|
+
});
|
|
1214
1259
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1260
|
+
else if (cacheLookupPolicy !== CacheLookupPolicy.Skip) {
|
|
1261
|
+
const [activePromise, activeCorrelationId] = this.activeIframeRequest;
|
|
1262
|
+
this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${activeCorrelationId}`, silentRequest.correlationId);
|
|
1263
|
+
const awaitConcurrentIframeMeasure = this.performanceClient.startMeasurement(PerformanceEvents.AwaitConcurrentIframe, silentRequest.correlationId);
|
|
1264
|
+
awaitConcurrentIframeMeasure.add({
|
|
1265
|
+
awaitIframeCorrelationId: activeCorrelationId,
|
|
1266
|
+
});
|
|
1267
|
+
const activePromiseResult = await activePromise;
|
|
1268
|
+
awaitConcurrentIframeMeasure.end({
|
|
1269
|
+
success: activePromiseResult,
|
|
1270
|
+
});
|
|
1271
|
+
if (activePromiseResult) {
|
|
1272
|
+
this.logger.verbose(`Parallel iframe request with correlationId: ${activeCorrelationId} succeeded. Retrying cache and/or RT redemption`, silentRequest.correlationId);
|
|
1273
|
+
// Retry cache lookup and/or RT exchange after iframe completes
|
|
1274
|
+
return this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy);
|
|
1221
1275
|
}
|
|
1222
1276
|
else {
|
|
1223
|
-
|
|
1277
|
+
this.logger.info(`Iframe request with correlationId: ${activeCorrelationId} failed. Interaction is required.`);
|
|
1278
|
+
// If previous iframe request failed, it's unlikely to succeed this time. Throw original error.
|
|
1224
1279
|
throw refreshTokenError;
|
|
1225
1280
|
}
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1281
|
+
}
|
|
1282
|
+
else {
|
|
1283
|
+
// Cache policy set to skip and another iframe request is already in progress
|
|
1284
|
+
this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.", silentRequest.correlationId);
|
|
1285
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
else {
|
|
1289
|
+
// Error cannot be silently resolved or iframe renewal is not allowed, interaction required
|
|
1290
|
+
throw refreshTokenError;
|
|
1291
|
+
}
|
|
1292
|
+
});
|
|
1229
1293
|
return result
|
|
1230
1294
|
.then((response) => {
|
|
1231
1295
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, response);
|
|
@@ -1246,6 +1310,38 @@ class StandardController {
|
|
|
1246
1310
|
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
1247
1311
|
});
|
|
1248
1312
|
}
|
|
1313
|
+
/**
|
|
1314
|
+
* AcquireTokenSilent without the iframe fallback. This is used to enable the correct fallbacks in cases where there's a potential for multiple silent requests to be made in parallel and prevent those requests from making concurrent iframe requests.
|
|
1315
|
+
* @param silentRequest
|
|
1316
|
+
* @param cacheLookupPolicy
|
|
1317
|
+
* @returns
|
|
1318
|
+
*/
|
|
1319
|
+
async acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy) {
|
|
1320
|
+
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, silentRequest.authenticationScheme) &&
|
|
1321
|
+
silentRequest.account.nativeAccountId) {
|
|
1322
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
1323
|
+
return this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
1324
|
+
// If native token acquisition fails for availability reasons fallback to web flow
|
|
1325
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
1326
|
+
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
1327
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
1328
|
+
// Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal
|
|
1329
|
+
throw createClientAuthError(ClientAuthErrorCodes.tokenRefreshRequired);
|
|
1330
|
+
}
|
|
1331
|
+
throw e;
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
else {
|
|
1335
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
1336
|
+
return invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
1337
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
1338
|
+
throw cacheError;
|
|
1339
|
+
}
|
|
1340
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, silentRequest);
|
|
1341
|
+
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy);
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1249
1345
|
}
|
|
1250
1346
|
/**
|
|
1251
1347
|
* Determines whether an error thrown by the refresh token endpoint can be resolved without interaction
|
|
@@ -1254,7 +1350,7 @@ class StandardController {
|
|
|
1254
1350
|
* @param cacheLookupPolicy
|
|
1255
1351
|
* @returns
|
|
1256
1352
|
*/
|
|
1257
|
-
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError,
|
|
1353
|
+
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy) {
|
|
1258
1354
|
const noInteractionRequired = !(refreshTokenError instanceof InteractionRequiredAuthError &&
|
|
1259
1355
|
// For refresh token errors, bad_token does not always require interaction (silently resolvable)
|
|
1260
1356
|
refreshTokenError.subError !==
|