@azure/msal-browser 2.25.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +12 -7
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +77 -24
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +11 -3
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts +26 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +40 -9
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +4 -3
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +2 -1
- package/dist/config/Configuration.js.map +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/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.d.ts +1 -1
- package/dist/error/BrowserAuthError.js +3 -3
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.d.ts +11 -1
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.js +15 -1
- package/dist/error/NativeAuthError.js.map +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/index.cjs.js +698 -306
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +30 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +151 -30
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +2 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +4 -3
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +8 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +6 -4
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +4 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +2 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +6 -3
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +3 -1
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +4 -1
- package/dist/interaction_client/StandardInteractionClient.js.map +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.d.ts +1 -0
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +3 -2
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +698 -306
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +42 -40
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ npm install @azure/msal-browser
|
|
|
59
59
|
|
|
60
60
|
<!-- CDN_LATEST -->
|
|
61
61
|
```html
|
|
62
|
-
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.
|
|
62
|
+
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.28.0/js/msal-browser.min.js"></script>
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/cdn-usage.md) for more info on how to use this package from the Microsoft CDN.
|
package/dist/_virtual/_tslib.js
CHANGED
|
@@ -23,6 +23,7 @@ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
|
|
|
23
23
|
export declare abstract class ClientApplication {
|
|
24
24
|
protected readonly browserCrypto: ICrypto;
|
|
25
25
|
protected readonly browserStorage: BrowserCacheManager;
|
|
26
|
+
protected readonly nativeInternalStorage: BrowserCacheManager;
|
|
26
27
|
protected readonly networkClient: INetworkModule;
|
|
27
28
|
protected navigationClient: INavigationClient;
|
|
28
29
|
protected config: BrowserConfiguration;
|
|
@@ -192,15 +193,19 @@ export declare abstract class ClientApplication {
|
|
|
192
193
|
getActiveAccount(): AccountInfo | null;
|
|
193
194
|
/**
|
|
194
195
|
* Helper to validate app environment before making an auth request
|
|
195
|
-
*
|
|
196
|
+
*
|
|
197
|
+
* @protected
|
|
198
|
+
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
199
|
+
* @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag
|
|
196
200
|
*/
|
|
197
|
-
protected preflightBrowserEnvironmentCheck(interactionType: InteractionType): void;
|
|
201
|
+
protected preflightBrowserEnvironmentCheck(interactionType: InteractionType, setInteractionInProgress?: boolean): void;
|
|
198
202
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* @
|
|
203
|
+
* Preflight check for interactive requests
|
|
204
|
+
*
|
|
205
|
+
* @protected
|
|
206
|
+
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
|
|
202
207
|
*/
|
|
203
|
-
protected preflightInteractiveRequest(): void;
|
|
208
|
+
protected preflightInteractiveRequest(setInteractionInProgress: boolean): void;
|
|
204
209
|
/**
|
|
205
210
|
* Acquire a token from native device (e.g. WAM)
|
|
206
211
|
* @param request
|
|
@@ -223,7 +228,7 @@ export declare abstract class ClientApplication {
|
|
|
223
228
|
*/
|
|
224
229
|
protected createPopupClient(correlationId?: string): PopupClient;
|
|
225
230
|
/**
|
|
226
|
-
* Returns new instance of the
|
|
231
|
+
* Returns new instance of the Redirect Interaction Client
|
|
227
232
|
* @param correlationId
|
|
228
233
|
*/
|
|
229
234
|
protected createRedirectClient(correlationId?: string): RedirectClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/ClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0D,WAAW,EAAa,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAE,uBAAuB,EAAE,OAAO,EAA+D,2BAA2B,EAAyB,kBAAkB,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AACvW,OAAO,EAAE,mBAAmB,EAAiC,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/ClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0D,WAAW,EAAa,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAE,uBAAuB,EAAE,OAAO,EAA+D,2BAA2B,EAAyB,kBAAkB,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AACvW,OAAO,EAAE,mBAAmB,EAAiC,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAoC,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,KAAK,EAA0C,UAAU,EAAsB,MAAM,2BAA2B,CAAC;AAE3I,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCA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B,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAI5E;;OAEG;IACH,SAAS,CAAC,yBAAyB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,mBAAmB;IAIhF;;OAEG;IACH,SAAS,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,oBAAoB;IAIlF;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI;IAIhE;;;OAGG;IACH,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI7C;;;;;OAKG;IACH,sBAAsB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;IAIrE;;;;;OAKG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACH,0BAA0B,IAAI,IAAI;IAIlC;;OAEG;IACH,2BAA2B,IAAI,IAAI;IAInC;;OAEG;IACH,aAAa,IAAI,WAAW;IAI5B;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACH,wBAAwB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKhE;;;OAGG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI;IAI9D;;OAEG;IACH,gBAAgB,IAAI,oBAAoB;IAIxC;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM;CAiBhF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.28.0 2022-07-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
|
|
4
4
|
import { CryptoOps } from '../crypto/CryptoOps.js';
|
|
5
|
-
import { Constants, PerformanceEvents, PromptValue, StringUtils, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION, ServerError
|
|
5
|
+
import { Constants, InteractionRequiredAuthError, PerformanceEvents, PromptValue, AuthError, StringUtils, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION, ServerError } from '@azure/msal-common';
|
|
6
6
|
import { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.js';
|
|
7
7
|
import { buildConfiguration } from '../config/Configuration.js';
|
|
8
8
|
import { InteractionType, ApiId, TemporaryCacheKeys, BrowserCacheLocation, BrowserConstants } from '../utils/BrowserConstants.js';
|
|
@@ -81,6 +81,13 @@ var ClientApplication = /** @class */ (function () {
|
|
|
81
81
|
this.browserStorage = this.isBrowserEnvironment ?
|
|
82
82
|
new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :
|
|
83
83
|
DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
84
|
+
// initialize in memory storage for native flows
|
|
85
|
+
var nativeCacheOptions = {
|
|
86
|
+
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
87
|
+
storeAuthStateInCookie: false,
|
|
88
|
+
secureCookies: false
|
|
89
|
+
};
|
|
90
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
84
91
|
// Initialize the token cache
|
|
85
92
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
86
93
|
}
|
|
@@ -147,7 +154,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
147
154
|
redirectResponse = void 0;
|
|
148
155
|
if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {
|
|
149
156
|
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
150
|
-
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, request.correlationId);
|
|
157
|
+
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);
|
|
151
158
|
redirectResponse = nativeClient.handleRedirectPromise();
|
|
152
159
|
}
|
|
153
160
|
else {
|
|
@@ -219,13 +226,19 @@ var ClientApplication = /** @class */ (function () {
|
|
|
219
226
|
this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);
|
|
220
227
|
}
|
|
221
228
|
if (this.nativeExtensionProvider && this.canUseNative(request)) {
|
|
222
|
-
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), request.correlationId);
|
|
229
|
+
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
|
|
223
230
|
result = nativeClient.acquireTokenRedirect(request).catch(function (e) {
|
|
224
231
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
225
232
|
_this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
226
233
|
var redirectClient = _this.createRedirectClient(request.correlationId);
|
|
227
234
|
return redirectClient.acquireToken(request);
|
|
228
235
|
}
|
|
236
|
+
else if (e instanceof InteractionRequiredAuthError) {
|
|
237
|
+
_this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
238
|
+
var redirectClient = _this.createRedirectClient(request.correlationId);
|
|
239
|
+
return redirectClient.acquireToken(request);
|
|
240
|
+
}
|
|
241
|
+
_this.browserStorage.setInteractionInProgress(false);
|
|
229
242
|
throw e;
|
|
230
243
|
});
|
|
231
244
|
}
|
|
@@ -281,7 +294,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
281
294
|
_this.browserStorage.setInteractionInProgress(false);
|
|
282
295
|
atPopupMeasurement.endMeasurement({
|
|
283
296
|
success: true,
|
|
284
|
-
isNativeBroker: true
|
|
297
|
+
isNativeBroker: true,
|
|
298
|
+
accessTokenSize: response.accessToken.length,
|
|
299
|
+
idTokenSize: response.idToken.length,
|
|
285
300
|
});
|
|
286
301
|
atPopupMeasurement.flushMeasurement();
|
|
287
302
|
return response;
|
|
@@ -291,6 +306,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
291
306
|
var popupClient = _this.createPopupClient(request.correlationId);
|
|
292
307
|
return popupClient.acquireToken(request);
|
|
293
308
|
}
|
|
309
|
+
else if (e instanceof InteractionRequiredAuthError) {
|
|
310
|
+
_this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
311
|
+
var popupClient = _this.createPopupClient(request.correlationId);
|
|
312
|
+
return popupClient.acquireToken(request);
|
|
313
|
+
}
|
|
314
|
+
_this.browserStorage.setInteractionInProgress(false);
|
|
294
315
|
throw e;
|
|
295
316
|
});
|
|
296
317
|
}
|
|
@@ -299,7 +320,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
299
320
|
result = popupClient.acquireToken(request);
|
|
300
321
|
}
|
|
301
322
|
return result.then(function (result) {
|
|
302
|
-
|
|
323
|
+
/*
|
|
324
|
+
* If logged in, emit acquire token events
|
|
325
|
+
*/
|
|
303
326
|
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
|
|
304
327
|
if (isLoggingIn) {
|
|
305
328
|
_this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Popup, result);
|
|
@@ -308,7 +331,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
308
331
|
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);
|
|
309
332
|
}
|
|
310
333
|
atPopupMeasurement.endMeasurement({
|
|
311
|
-
success: true
|
|
334
|
+
success: true,
|
|
335
|
+
accessTokenSize: result.accessToken.length,
|
|
336
|
+
idTokenSize: result.idToken.length,
|
|
312
337
|
});
|
|
313
338
|
atPopupMeasurement.flushMeasurement();
|
|
314
339
|
return result;
|
|
@@ -320,6 +345,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
320
345
|
_this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Popup, null, e);
|
|
321
346
|
}
|
|
322
347
|
atPopupMeasurement.endMeasurement({
|
|
348
|
+
errorCode: e.errorCode,
|
|
349
|
+
subErrorCode: e.subError,
|
|
323
350
|
success: false
|
|
324
351
|
});
|
|
325
352
|
atPopupMeasurement.flushMeasurement();
|
|
@@ -373,13 +400,18 @@ var ClientApplication = /** @class */ (function () {
|
|
|
373
400
|
return [2 /*return*/, result.then(function (response) {
|
|
374
401
|
_this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, response);
|
|
375
402
|
ssoSilentMeasurement.endMeasurement({
|
|
376
|
-
success: true
|
|
403
|
+
success: true,
|
|
404
|
+
isNativeBroker: response.fromNativeBroker,
|
|
405
|
+
accessTokenSize: response.accessToken.length,
|
|
406
|
+
idTokenSize: response.idToken.length
|
|
377
407
|
});
|
|
378
408
|
ssoSilentMeasurement.flushMeasurement();
|
|
379
409
|
return response;
|
|
380
410
|
}).catch(function (e) {
|
|
381
411
|
_this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e);
|
|
382
412
|
ssoSilentMeasurement.endMeasurement({
|
|
413
|
+
errorCode: e.errorCode,
|
|
414
|
+
subErrorCode: e.subError,
|
|
383
415
|
success: false
|
|
384
416
|
});
|
|
385
417
|
ssoSilentMeasurement.flushMeasurement();
|
|
@@ -419,7 +451,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
419
451
|
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);
|
|
420
452
|
_this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
|
|
421
453
|
atbcMeasurement.endMeasurement({
|
|
422
|
-
success: true
|
|
454
|
+
success: true,
|
|
455
|
+
accessTokenSize: result.accessToken.length,
|
|
456
|
+
idTokenSize: result.idToken.length,
|
|
457
|
+
isNativeBroker: result.fromNativeBroker
|
|
423
458
|
});
|
|
424
459
|
atbcMeasurement.flushMeasurement();
|
|
425
460
|
return result;
|
|
@@ -428,6 +463,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
428
463
|
_this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
|
|
429
464
|
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);
|
|
430
465
|
atbcMeasurement.endMeasurement({
|
|
466
|
+
errorCode: error.errorCode,
|
|
467
|
+
subErrorCode: error.subError,
|
|
431
468
|
success: false
|
|
432
469
|
});
|
|
433
470
|
atbcMeasurement.flushMeasurement();
|
|
@@ -465,6 +502,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
465
502
|
catch (e) {
|
|
466
503
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);
|
|
467
504
|
atbcMeasurement.endMeasurement({
|
|
505
|
+
errorCode: e instanceof AuthError && e.errorCode || undefined,
|
|
506
|
+
subErrorCode: e instanceof AuthError && e.subError || undefined,
|
|
468
507
|
success: false
|
|
469
508
|
});
|
|
470
509
|
throw e;
|
|
@@ -519,7 +558,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
519
558
|
.then(function (result) {
|
|
520
559
|
atbrtMeasurement.endMeasurement({
|
|
521
560
|
success: true,
|
|
522
|
-
fromCache: result.fromCache
|
|
561
|
+
fromCache: result.fromCache,
|
|
562
|
+
accessTokenSize: result.accessToken.length,
|
|
563
|
+
idTokenSize: result.idToken.length,
|
|
523
564
|
});
|
|
524
565
|
return result;
|
|
525
566
|
})
|
|
@@ -534,12 +575,16 @@ var ClientApplication = /** @class */ (function () {
|
|
|
534
575
|
.then(function (result) {
|
|
535
576
|
atbrtMeasurement.endMeasurement({
|
|
536
577
|
success: true,
|
|
537
|
-
fromCache: result.fromCache
|
|
578
|
+
fromCache: result.fromCache,
|
|
579
|
+
accessTokenSize: result.accessToken.length,
|
|
580
|
+
idTokenSize: result.idToken.length,
|
|
538
581
|
});
|
|
539
582
|
return result;
|
|
540
583
|
})
|
|
541
584
|
.catch(function (error) {
|
|
542
585
|
atbrtMeasurement.endMeasurement({
|
|
586
|
+
errorCode: error.errorCode,
|
|
587
|
+
subErrorCode: error.subError,
|
|
543
588
|
success: false
|
|
544
589
|
});
|
|
545
590
|
throw error;
|
|
@@ -689,9 +734,13 @@ var ClientApplication = /** @class */ (function () {
|
|
|
689
734
|
// #region Helpers
|
|
690
735
|
/**
|
|
691
736
|
* Helper to validate app environment before making an auth request
|
|
692
|
-
*
|
|
737
|
+
*
|
|
738
|
+
* @protected
|
|
739
|
+
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
740
|
+
* @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag
|
|
693
741
|
*/
|
|
694
|
-
ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType) {
|
|
742
|
+
ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType, setInteractionInProgress) {
|
|
743
|
+
if (setInteractionInProgress === void 0) { setInteractionInProgress = true; }
|
|
695
744
|
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
696
745
|
// Block request if not in browser environment
|
|
697
746
|
BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
@@ -710,20 +759,23 @@ var ClientApplication = /** @class */ (function () {
|
|
|
710
759
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
711
760
|
}
|
|
712
761
|
if (interactionType === InteractionType.Redirect || interactionType === InteractionType.Popup) {
|
|
713
|
-
this.preflightInteractiveRequest();
|
|
762
|
+
this.preflightInteractiveRequest(setInteractionInProgress);
|
|
714
763
|
}
|
|
715
764
|
};
|
|
716
765
|
/**
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
* @
|
|
766
|
+
* Preflight check for interactive requests
|
|
767
|
+
*
|
|
768
|
+
* @protected
|
|
769
|
+
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
|
|
720
770
|
*/
|
|
721
|
-
ClientApplication.prototype.preflightInteractiveRequest = function () {
|
|
771
|
+
ClientApplication.prototype.preflightInteractiveRequest = function (setInteractionInProgress) {
|
|
722
772
|
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
723
773
|
// block the reload if it occurred inside a hidden iframe
|
|
724
774
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
725
775
|
// Set interaction in progress temporary cache or throw if alread set.
|
|
726
|
-
|
|
776
|
+
if (setInteractionInProgress) {
|
|
777
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
778
|
+
}
|
|
727
779
|
};
|
|
728
780
|
/**
|
|
729
781
|
* Acquire a token from native device (e.g. WAM)
|
|
@@ -737,7 +789,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
737
789
|
if (!this.nativeExtensionProvider) {
|
|
738
790
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
739
791
|
}
|
|
740
|
-
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), request.correlationId);
|
|
792
|
+
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
|
|
741
793
|
return [2 /*return*/, nativeClient.acquireToken(request)];
|
|
742
794
|
});
|
|
743
795
|
});
|
|
@@ -756,6 +808,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
756
808
|
switch (request.prompt) {
|
|
757
809
|
case PromptValue.NONE:
|
|
758
810
|
case PromptValue.CONSENT:
|
|
811
|
+
case PromptValue.LOGIN:
|
|
759
812
|
this.logger.trace("canUseNative: prompt is compatible with native flow");
|
|
760
813
|
break;
|
|
761
814
|
default:
|
|
@@ -783,21 +836,21 @@ var ClientApplication = /** @class */ (function () {
|
|
|
783
836
|
* @param correlationId
|
|
784
837
|
*/
|
|
785
838
|
ClientApplication.prototype.createPopupClient = function (correlationId) {
|
|
786
|
-
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
839
|
+
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
|
|
787
840
|
};
|
|
788
841
|
/**
|
|
789
|
-
* Returns new instance of the
|
|
842
|
+
* Returns new instance of the Redirect Interaction Client
|
|
790
843
|
* @param correlationId
|
|
791
844
|
*/
|
|
792
845
|
ClientApplication.prototype.createRedirectClient = function (correlationId) {
|
|
793
|
-
return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
846
|
+
return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
|
|
794
847
|
};
|
|
795
848
|
/**
|
|
796
849
|
* Returns new instance of the Silent Iframe Interaction Client
|
|
797
850
|
* @param correlationId
|
|
798
851
|
*/
|
|
799
852
|
ClientApplication.prototype.createSilentIframeClient = function (correlationId) {
|
|
800
|
-
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
853
|
+
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
|
|
801
854
|
};
|
|
802
855
|
/**
|
|
803
856
|
* Returns new instance of the Silent Cache Interaction Client
|