@azure/msal-browser 3.11.0 → 3.13.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.mjs +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.mjs +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 +162 -103
- 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.mjs +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.mjs +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.mjs +1 -1
- package/lib/msal-browser.cjs +364 -207
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +364 -207
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +67 -66
- package/package.json +4 -4
- package/src/cache/BrowserCacheManager.ts +49 -1
- package/src/controllers/NestedAppAuthController.ts +7 -6
- package/src/controllers/StandardController.ts +329 -246
- package/src/controllers/UnknownOperatingContextController.ts +3 -1
- package/src/interaction_handler/SilentHandler.ts +1 -0
- package/src/naa/BridgeProxy.ts +3 -12
- package/src/packageMetadata.ts +1 -1
package/lib/msal-browser.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.13.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v14.
|
|
5
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -67,11 +67,20 @@ const Constants = {
|
|
|
67
67
|
};
|
|
68
68
|
const HttpStatus = {
|
|
69
69
|
SUCCESS_RANGE_START: 200,
|
|
70
|
+
SUCCESS: 200,
|
|
70
71
|
SUCCESS_RANGE_END: 299,
|
|
71
72
|
REDIRECT: 302,
|
|
72
73
|
CLIENT_ERROR_RANGE_START: 400,
|
|
74
|
+
BAD_REQUEST: 400,
|
|
75
|
+
UNAUTHORIZED: 401,
|
|
76
|
+
NOT_FOUND: 404,
|
|
77
|
+
REQUEST_TIMEOUT: 408,
|
|
78
|
+
TOO_MANY_REQUESTS: 429,
|
|
73
79
|
CLIENT_ERROR_RANGE_END: 499,
|
|
74
80
|
SERVER_ERROR_RANGE_START: 500,
|
|
81
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
82
|
+
SERVICE_UNAVAILABLE: 503,
|
|
83
|
+
GATEWAY_TIMEOUT: 504,
|
|
75
84
|
SERVER_ERROR_RANGE_END: 599,
|
|
76
85
|
};
|
|
77
86
|
const OIDC_DEFAULT_SCOPES = [
|
|
@@ -296,8 +305,10 @@ const JsonWebTokenTypes = {
|
|
|
296
305
|
Jwk: "JWK",
|
|
297
306
|
Pop: "pop",
|
|
298
307
|
};
|
|
308
|
+
// Token renewal offset default in seconds
|
|
309
|
+
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
299
310
|
|
|
300
|
-
/*! @azure/msal-common v14.
|
|
311
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
301
312
|
/*
|
|
302
313
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
303
314
|
* Licensed under the MIT License.
|
|
@@ -314,7 +325,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
314
325
|
unexpectedError: unexpectedError
|
|
315
326
|
});
|
|
316
327
|
|
|
317
|
-
/*! @azure/msal-common v14.
|
|
328
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
318
329
|
|
|
319
330
|
/*
|
|
320
331
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -363,7 +374,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
363
374
|
: AuthErrorMessages[code]);
|
|
364
375
|
}
|
|
365
376
|
|
|
366
|
-
/*! @azure/msal-common v14.
|
|
377
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
367
378
|
/*
|
|
368
379
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
369
380
|
* Licensed under the MIT License.
|
|
@@ -461,7 +472,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
461
472
|
userTimeoutReached: userTimeoutReached
|
|
462
473
|
});
|
|
463
474
|
|
|
464
|
-
/*! @azure/msal-common v14.
|
|
475
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
465
476
|
|
|
466
477
|
/*
|
|
467
478
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -713,7 +724,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
713
724
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
714
725
|
}
|
|
715
726
|
|
|
716
|
-
/*! @azure/msal-common v14.
|
|
727
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
717
728
|
|
|
718
729
|
/*
|
|
719
730
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -746,7 +757,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
746
757
|
},
|
|
747
758
|
};
|
|
748
759
|
|
|
749
|
-
/*! @azure/msal-common v14.
|
|
760
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
750
761
|
|
|
751
762
|
/*
|
|
752
763
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -937,12 +948,12 @@ class Logger {
|
|
|
937
948
|
}
|
|
938
949
|
}
|
|
939
950
|
|
|
940
|
-
/*! @azure/msal-common v14.
|
|
951
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
941
952
|
/* eslint-disable header/header */
|
|
942
953
|
const name$1 = "@azure/msal-common";
|
|
943
|
-
const version$1 = "14.
|
|
954
|
+
const version$1 = "14.9.0";
|
|
944
955
|
|
|
945
|
-
/*! @azure/msal-common v14.
|
|
956
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
946
957
|
/*
|
|
947
958
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
948
959
|
* Licensed under the MIT License.
|
|
@@ -962,7 +973,7 @@ const AzureCloudInstance = {
|
|
|
962
973
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
963
974
|
};
|
|
964
975
|
|
|
965
|
-
/*! @azure/msal-common v14.
|
|
976
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
966
977
|
|
|
967
978
|
/*
|
|
968
979
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1023,7 +1034,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1023
1034
|
}
|
|
1024
1035
|
}
|
|
1025
1036
|
|
|
1026
|
-
/*! @azure/msal-common v14.
|
|
1037
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1027
1038
|
/*
|
|
1028
1039
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1029
1040
|
* Licensed under the MIT License.
|
|
@@ -1060,7 +1071,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1060
1071
|
return cachedAtSec > nowSeconds();
|
|
1061
1072
|
}
|
|
1062
1073
|
|
|
1063
|
-
/*! @azure/msal-common v14.
|
|
1074
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1064
1075
|
|
|
1065
1076
|
/*
|
|
1066
1077
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1387,7 +1398,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1387
1398
|
return metadata.expiresAt <= nowSeconds();
|
|
1388
1399
|
}
|
|
1389
1400
|
|
|
1390
|
-
/*! @azure/msal-common v14.
|
|
1401
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1391
1402
|
/*
|
|
1392
1403
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1393
1404
|
* Licensed under the MIT License.
|
|
@@ -1441,7 +1452,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1441
1452
|
urlParseError: urlParseError
|
|
1442
1453
|
});
|
|
1443
1454
|
|
|
1444
|
-
/*! @azure/msal-common v14.
|
|
1455
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1445
1456
|
|
|
1446
1457
|
/*
|
|
1447
1458
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1579,7 +1590,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1579
1590
|
return new ClientConfigurationError(errorCode);
|
|
1580
1591
|
}
|
|
1581
1592
|
|
|
1582
|
-
/*! @azure/msal-common v14.
|
|
1593
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1583
1594
|
/*
|
|
1584
1595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1585
1596
|
* Licensed under the MIT License.
|
|
@@ -1676,7 +1687,7 @@ class StringUtils {
|
|
|
1676
1687
|
}
|
|
1677
1688
|
}
|
|
1678
1689
|
|
|
1679
|
-
/*! @azure/msal-common v14.
|
|
1690
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1680
1691
|
|
|
1681
1692
|
/*
|
|
1682
1693
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1876,7 +1887,7 @@ class ScopeSet {
|
|
|
1876
1887
|
}
|
|
1877
1888
|
}
|
|
1878
1889
|
|
|
1879
|
-
/*! @azure/msal-common v14.
|
|
1890
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1880
1891
|
|
|
1881
1892
|
/*
|
|
1882
1893
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1916,7 +1927,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1916
1927
|
};
|
|
1917
1928
|
}
|
|
1918
1929
|
|
|
1919
|
-
/*! @azure/msal-common v14.
|
|
1930
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1920
1931
|
/*
|
|
1921
1932
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1922
1933
|
* Licensed under the MIT License.
|
|
@@ -1978,7 +1989,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
1978
1989
|
return updatedAccountInfo;
|
|
1979
1990
|
}
|
|
1980
1991
|
|
|
1981
|
-
/*! @azure/msal-common v14.
|
|
1992
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1982
1993
|
/*
|
|
1983
1994
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1984
1995
|
* Licensed under the MIT License.
|
|
@@ -1993,7 +2004,7 @@ const AuthorityType = {
|
|
|
1993
2004
|
Ciam: 3,
|
|
1994
2005
|
};
|
|
1995
2006
|
|
|
1996
|
-
/*! @azure/msal-common v14.
|
|
2007
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1997
2008
|
/*
|
|
1998
2009
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1999
2010
|
* Licensed under the MIT License.
|
|
@@ -2015,7 +2026,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2015
2026
|
return null;
|
|
2016
2027
|
}
|
|
2017
2028
|
|
|
2018
|
-
/*! @azure/msal-common v14.
|
|
2029
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2019
2030
|
/*
|
|
2020
2031
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2021
2032
|
* Licensed under the MIT License.
|
|
@@ -2028,7 +2039,7 @@ const ProtocolMode = {
|
|
|
2028
2039
|
OIDC: "OIDC",
|
|
2029
2040
|
};
|
|
2030
2041
|
|
|
2031
|
-
/*! @azure/msal-common v14.
|
|
2042
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2032
2043
|
|
|
2033
2044
|
/*
|
|
2034
2045
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2275,7 +2286,7 @@ class AccountEntity {
|
|
|
2275
2286
|
}
|
|
2276
2287
|
}
|
|
2277
2288
|
|
|
2278
|
-
/*! @azure/msal-common v14.
|
|
2289
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2279
2290
|
|
|
2280
2291
|
/*
|
|
2281
2292
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2322,7 +2333,7 @@ function getDeserializedResponse(responseString) {
|
|
|
2322
2333
|
return null;
|
|
2323
2334
|
}
|
|
2324
2335
|
|
|
2325
|
-
/*! @azure/msal-common v14.
|
|
2336
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2326
2337
|
|
|
2327
2338
|
/*
|
|
2328
2339
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2486,7 +2497,7 @@ class UrlString {
|
|
|
2486
2497
|
}
|
|
2487
2498
|
}
|
|
2488
2499
|
|
|
2489
|
-
/*! @azure/msal-common v14.
|
|
2500
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2490
2501
|
|
|
2491
2502
|
/*
|
|
2492
2503
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2626,7 +2637,42 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2626
2637
|
return null;
|
|
2627
2638
|
}
|
|
2628
2639
|
|
|
2629
|
-
/*! @azure/msal-common v14.
|
|
2640
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2641
|
+
/*
|
|
2642
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2643
|
+
* Licensed under the MIT License.
|
|
2644
|
+
*/
|
|
2645
|
+
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2646
|
+
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2647
|
+
|
|
2648
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2649
|
+
|
|
2650
|
+
/*
|
|
2651
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2652
|
+
* Licensed under the MIT License.
|
|
2653
|
+
*/
|
|
2654
|
+
const CacheErrorMessages = {
|
|
2655
|
+
[cacheQuotaExceededErrorCode]: "Exceeded cache storage capacity.",
|
|
2656
|
+
[cacheUnknownErrorCode]: "Unexpected error occurred when using cache storage.",
|
|
2657
|
+
};
|
|
2658
|
+
/**
|
|
2659
|
+
* Error thrown when there is an error with the cache
|
|
2660
|
+
*/
|
|
2661
|
+
class CacheError extends Error {
|
|
2662
|
+
constructor(errorCode, errorMessage) {
|
|
2663
|
+
const message = errorMessage ||
|
|
2664
|
+
(CacheErrorMessages[errorCode]
|
|
2665
|
+
? CacheErrorMessages[errorCode]
|
|
2666
|
+
: CacheErrorMessages[cacheUnknownErrorCode]);
|
|
2667
|
+
super(`${errorCode}: ${message}`);
|
|
2668
|
+
Object.setPrototypeOf(this, CacheError.prototype);
|
|
2669
|
+
this.name = "CacheError";
|
|
2670
|
+
this.errorCode = errorCode;
|
|
2671
|
+
this.errorMessage = message;
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2630
2676
|
|
|
2631
2677
|
/*
|
|
2632
2678
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2790,27 +2836,51 @@ class CacheManager {
|
|
|
2790
2836
|
}
|
|
2791
2837
|
/**
|
|
2792
2838
|
* saves a cache record
|
|
2793
|
-
* @param cacheRecord
|
|
2839
|
+
* @param cacheRecord {CacheRecord}
|
|
2840
|
+
* @param storeInCache {?StoreInCache}
|
|
2841
|
+
* @param correlationId {?string} correlation id
|
|
2794
2842
|
*/
|
|
2795
|
-
async saveCacheRecord(cacheRecord, storeInCache) {
|
|
2843
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
2796
2844
|
if (!cacheRecord) {
|
|
2797
2845
|
throw createClientAuthError(invalidCacheRecord);
|
|
2798
2846
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2847
|
+
try {
|
|
2848
|
+
if (!!cacheRecord.account) {
|
|
2849
|
+
this.setAccount(cacheRecord.account);
|
|
2850
|
+
}
|
|
2851
|
+
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2852
|
+
this.setIdTokenCredential(cacheRecord.idToken);
|
|
2853
|
+
}
|
|
2854
|
+
if (!!cacheRecord.accessToken &&
|
|
2855
|
+
storeInCache?.accessToken !== false) {
|
|
2856
|
+
await this.saveAccessToken(cacheRecord.accessToken);
|
|
2857
|
+
}
|
|
2858
|
+
if (!!cacheRecord.refreshToken &&
|
|
2859
|
+
storeInCache?.refreshToken !== false) {
|
|
2860
|
+
this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2861
|
+
}
|
|
2862
|
+
if (!!cacheRecord.appMetadata) {
|
|
2863
|
+
this.setAppMetadata(cacheRecord.appMetadata);
|
|
2864
|
+
}
|
|
2811
2865
|
}
|
|
2812
|
-
|
|
2813
|
-
this.
|
|
2866
|
+
catch (e) {
|
|
2867
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
|
|
2868
|
+
if (e instanceof Error) {
|
|
2869
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);
|
|
2870
|
+
if (e.name === "QuotaExceededError" ||
|
|
2871
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
2872
|
+
e.message.includes("exceeded the quota")) {
|
|
2873
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
|
|
2874
|
+
throw new CacheError(cacheQuotaExceededErrorCode);
|
|
2875
|
+
}
|
|
2876
|
+
else {
|
|
2877
|
+
throw new CacheError(e.name, e.message);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
else {
|
|
2881
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);
|
|
2882
|
+
throw new CacheError(cacheUnknownErrorCode);
|
|
2883
|
+
}
|
|
2814
2884
|
}
|
|
2815
2885
|
}
|
|
2816
2886
|
/**
|
|
@@ -3857,14 +3927,12 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3857
3927
|
}
|
|
3858
3928
|
}
|
|
3859
3929
|
|
|
3860
|
-
/*! @azure/msal-common v14.
|
|
3930
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3861
3931
|
|
|
3862
3932
|
/*
|
|
3863
3933
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3864
3934
|
* Licensed under the MIT License.
|
|
3865
3935
|
*/
|
|
3866
|
-
// Token renewal offset default in seconds
|
|
3867
|
-
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3868
3936
|
const DEFAULT_SYSTEM_OPTIONS = {
|
|
3869
3937
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3870
3938
|
preventCorsPreflight: false,
|
|
@@ -3957,7 +4025,7 @@ function isOidcProtocolMode(config) {
|
|
|
3957
4025
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3958
4026
|
}
|
|
3959
4027
|
|
|
3960
|
-
/*! @azure/msal-common v14.
|
|
4028
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3961
4029
|
|
|
3962
4030
|
/*
|
|
3963
4031
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3974,7 +4042,7 @@ class ServerError extends AuthError {
|
|
|
3974
4042
|
}
|
|
3975
4043
|
}
|
|
3976
4044
|
|
|
3977
|
-
/*! @azure/msal-common v14.
|
|
4045
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3978
4046
|
|
|
3979
4047
|
/*
|
|
3980
4048
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4072,7 +4140,7 @@ class ThrottlingUtils {
|
|
|
4072
4140
|
}
|
|
4073
4141
|
}
|
|
4074
4142
|
|
|
4075
|
-
/*! @azure/msal-common v14.
|
|
4143
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4076
4144
|
|
|
4077
4145
|
/*
|
|
4078
4146
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4109,7 +4177,7 @@ class NetworkManager {
|
|
|
4109
4177
|
}
|
|
4110
4178
|
}
|
|
4111
4179
|
|
|
4112
|
-
/*! @azure/msal-common v14.
|
|
4180
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4113
4181
|
/*
|
|
4114
4182
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4115
4183
|
* Licensed under the MIT License.
|
|
@@ -4119,7 +4187,7 @@ const CcsCredentialType = {
|
|
|
4119
4187
|
UPN: "UPN",
|
|
4120
4188
|
};
|
|
4121
4189
|
|
|
4122
|
-
/*! @azure/msal-common v14.
|
|
4190
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4123
4191
|
/*
|
|
4124
4192
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4125
4193
|
* Licensed under the MIT License.
|
|
@@ -4166,7 +4234,7 @@ const SID = "sid";
|
|
|
4166
4234
|
const LOGIN_HINT = "login_hint";
|
|
4167
4235
|
const DOMAIN_HINT = "domain_hint";
|
|
4168
4236
|
|
|
4169
|
-
/*! @azure/msal-common v14.
|
|
4237
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4170
4238
|
|
|
4171
4239
|
/*
|
|
4172
4240
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4250,7 +4318,7 @@ class RequestValidator {
|
|
|
4250
4318
|
}
|
|
4251
4319
|
}
|
|
4252
4320
|
|
|
4253
|
-
/*! @azure/msal-common v14.
|
|
4321
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4254
4322
|
|
|
4255
4323
|
/*
|
|
4256
4324
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4634,7 +4702,7 @@ class RequestParameterBuilder {
|
|
|
4634
4702
|
}
|
|
4635
4703
|
}
|
|
4636
4704
|
|
|
4637
|
-
/*! @azure/msal-common v14.
|
|
4705
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4638
4706
|
/*
|
|
4639
4707
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4640
4708
|
* Licensed under the MIT License.
|
|
@@ -4646,7 +4714,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
4646
4714
|
response.hasOwnProperty("jwks_uri"));
|
|
4647
4715
|
}
|
|
4648
4716
|
|
|
4649
|
-
/*! @azure/msal-common v14.
|
|
4717
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4650
4718
|
/*
|
|
4651
4719
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4652
4720
|
* Licensed under the MIT License.
|
|
@@ -4656,7 +4724,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
4656
4724
|
response.hasOwnProperty("metadata"));
|
|
4657
4725
|
}
|
|
4658
4726
|
|
|
4659
|
-
/*! @azure/msal-common v14.
|
|
4727
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4660
4728
|
/*
|
|
4661
4729
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4662
4730
|
* Licensed under the MIT License.
|
|
@@ -4666,7 +4734,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
4666
4734
|
response.hasOwnProperty("error_description"));
|
|
4667
4735
|
}
|
|
4668
4736
|
|
|
4669
|
-
/*! @azure/msal-common v14.
|
|
4737
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4670
4738
|
/*
|
|
4671
4739
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4672
4740
|
* Licensed under the MIT License.
|
|
@@ -4728,6 +4796,7 @@ const PerformanceEvents = {
|
|
|
4728
4796
|
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4729
4797
|
*/
|
|
4730
4798
|
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4799
|
+
AwaitConcurrentIframe: "awaitConcurrentIframe",
|
|
4731
4800
|
/**
|
|
4732
4801
|
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4733
4802
|
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
@@ -5140,7 +5209,7 @@ const IntFields = new Set([
|
|
|
5140
5209
|
"multiMatchedRT",
|
|
5141
5210
|
]);
|
|
5142
5211
|
|
|
5143
|
-
/*! @azure/msal-common v14.
|
|
5212
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5144
5213
|
/*
|
|
5145
5214
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5146
5215
|
* Licensed under the MIT License.
|
|
@@ -5236,7 +5305,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5236
5305
|
};
|
|
5237
5306
|
};
|
|
5238
5307
|
|
|
5239
|
-
/*! @azure/msal-common v14.
|
|
5308
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5240
5309
|
|
|
5241
5310
|
/*
|
|
5242
5311
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5345,7 +5414,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5345
5414
|
},
|
|
5346
5415
|
};
|
|
5347
5416
|
|
|
5348
|
-
/*! @azure/msal-common v14.
|
|
5417
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5349
5418
|
|
|
5350
5419
|
/*
|
|
5351
5420
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5357,7 +5426,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5357
5426
|
* @internal
|
|
5358
5427
|
*/
|
|
5359
5428
|
class Authority {
|
|
5360
|
-
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
|
|
5429
|
+
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient, managedIdentity) {
|
|
5361
5430
|
this.canonicalAuthority = authority;
|
|
5362
5431
|
this._canonicalAuthority.validateAsUri();
|
|
5363
5432
|
this.networkInterface = networkInterface;
|
|
@@ -5371,6 +5440,7 @@ class Authority {
|
|
|
5371
5440
|
this.logger = logger;
|
|
5372
5441
|
this.performanceClient = performanceClient;
|
|
5373
5442
|
this.correlationId = correlationId;
|
|
5443
|
+
this.managedIdentity = managedIdentity || false;
|
|
5374
5444
|
this.regionDiscovery = new RegionDiscovery(networkInterface, this.logger, this.performanceClient, this.correlationId);
|
|
5375
5445
|
}
|
|
5376
5446
|
/**
|
|
@@ -5576,7 +5646,7 @@ class Authority {
|
|
|
5576
5646
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
5577
5647
|
}
|
|
5578
5648
|
/**
|
|
5579
|
-
* Boolean that returns
|
|
5649
|
+
* Boolean that returns whether or not tenant discovery has been completed.
|
|
5580
5650
|
*/
|
|
5581
5651
|
discoveryComplete() {
|
|
5582
5652
|
return !!this.metadata;
|
|
@@ -6028,7 +6098,10 @@ class Authority {
|
|
|
6028
6098
|
* helper function to generate environment from authority object
|
|
6029
6099
|
*/
|
|
6030
6100
|
getPreferredCache() {
|
|
6031
|
-
if (this.
|
|
6101
|
+
if (this.managedIdentity) {
|
|
6102
|
+
return Constants.DEFAULT_AUTHORITY_HOST;
|
|
6103
|
+
}
|
|
6104
|
+
else if (this.discoveryComplete()) {
|
|
6032
6105
|
return this.metadata.preferred_cache;
|
|
6033
6106
|
}
|
|
6034
6107
|
else {
|
|
@@ -6180,7 +6253,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
6180
6253
|
};
|
|
6181
6254
|
}
|
|
6182
6255
|
|
|
6183
|
-
/*! @azure/msal-common v14.
|
|
6256
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6184
6257
|
|
|
6185
6258
|
/*
|
|
6186
6259
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6211,7 +6284,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
6211
6284
|
}
|
|
6212
6285
|
}
|
|
6213
6286
|
|
|
6214
|
-
/*! @azure/msal-common v14.
|
|
6287
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6215
6288
|
|
|
6216
6289
|
/*
|
|
6217
6290
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6314,7 +6387,7 @@ class BaseClient {
|
|
|
6314
6387
|
}
|
|
6315
6388
|
}
|
|
6316
6389
|
|
|
6317
|
-
/*! @azure/msal-common v14.
|
|
6390
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6318
6391
|
/*
|
|
6319
6392
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6320
6393
|
* Licensed under the MIT License.
|
|
@@ -6340,7 +6413,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6340
6413
|
refreshTokenExpired: refreshTokenExpired
|
|
6341
6414
|
});
|
|
6342
6415
|
|
|
6343
|
-
/*! @azure/msal-common v14.
|
|
6416
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6344
6417
|
|
|
6345
6418
|
/*
|
|
6346
6419
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6427,7 +6500,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6427
6500
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6428
6501
|
}
|
|
6429
6502
|
|
|
6430
|
-
/*! @azure/msal-common v14.
|
|
6503
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6431
6504
|
/*
|
|
6432
6505
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6433
6506
|
* Licensed under the MIT License.
|
|
@@ -6443,7 +6516,7 @@ class CacheRecord {
|
|
|
6443
6516
|
}
|
|
6444
6517
|
}
|
|
6445
6518
|
|
|
6446
|
-
/*! @azure/msal-common v14.
|
|
6519
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6447
6520
|
|
|
6448
6521
|
/*
|
|
6449
6522
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6515,7 +6588,7 @@ class ProtocolUtils {
|
|
|
6515
6588
|
}
|
|
6516
6589
|
}
|
|
6517
6590
|
|
|
6518
|
-
/*! @azure/msal-common v14.
|
|
6591
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6519
6592
|
|
|
6520
6593
|
/*
|
|
6521
6594
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6600,7 +6673,7 @@ class PopTokenGenerator {
|
|
|
6600
6673
|
}
|
|
6601
6674
|
}
|
|
6602
6675
|
|
|
6603
|
-
/*! @azure/msal-common v14.
|
|
6676
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6604
6677
|
/*
|
|
6605
6678
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6606
6679
|
* Licensed under the MIT License.
|
|
@@ -6627,7 +6700,7 @@ class PopTokenGenerator {
|
|
|
6627
6700
|
}
|
|
6628
6701
|
}
|
|
6629
6702
|
|
|
6630
|
-
/*! @azure/msal-common v14.
|
|
6703
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6631
6704
|
|
|
6632
6705
|
/*
|
|
6633
6706
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6782,7 +6855,7 @@ class ResponseHandler {
|
|
|
6782
6855
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
6783
6856
|
}
|
|
6784
6857
|
}
|
|
6785
|
-
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache);
|
|
6858
|
+
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
|
|
6786
6859
|
}
|
|
6787
6860
|
finally {
|
|
6788
6861
|
if (this.persistencePlugin &&
|
|
@@ -6980,7 +7053,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
|
|
|
6980
7053
|
return baseAccount;
|
|
6981
7054
|
}
|
|
6982
7055
|
|
|
6983
|
-
/*! @azure/msal-common v14.
|
|
7056
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6984
7057
|
|
|
6985
7058
|
/*
|
|
6986
7059
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7265,7 +7338,11 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7265
7338
|
}
|
|
7266
7339
|
else if (request.account) {
|
|
7267
7340
|
const accountSid = this.extractAccountSid(request.account);
|
|
7268
|
-
|
|
7341
|
+
let accountLoginHintClaim = this.extractLoginHint(request.account);
|
|
7342
|
+
if (accountLoginHintClaim && request.domainHint) {
|
|
7343
|
+
this.logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`);
|
|
7344
|
+
accountLoginHintClaim = null;
|
|
7345
|
+
}
|
|
7269
7346
|
// If login_hint claim is present, use it over sid/username
|
|
7270
7347
|
if (accountLoginHintClaim) {
|
|
7271
7348
|
this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
|
|
@@ -7385,7 +7462,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7385
7462
|
}
|
|
7386
7463
|
}
|
|
7387
7464
|
|
|
7388
|
-
/*! @azure/msal-common v14.
|
|
7465
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7389
7466
|
|
|
7390
7467
|
/*
|
|
7391
7468
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7592,7 +7669,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7592
7669
|
}
|
|
7593
7670
|
}
|
|
7594
7671
|
|
|
7595
|
-
/*! @azure/msal-common v14.
|
|
7672
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7596
7673
|
|
|
7597
7674
|
/*
|
|
7598
7675
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7728,7 +7805,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7728
7805
|
}
|
|
7729
7806
|
}
|
|
7730
7807
|
|
|
7731
|
-
/*! @azure/msal-common v14.
|
|
7808
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7732
7809
|
|
|
7733
7810
|
/*
|
|
7734
7811
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7743,7 +7820,7 @@ const StubbedNetworkModule = {
|
|
|
7743
7820
|
},
|
|
7744
7821
|
};
|
|
7745
7822
|
|
|
7746
|
-
/*! @azure/msal-common v14.
|
|
7823
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7747
7824
|
/*
|
|
7748
7825
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7749
7826
|
* Licensed under the MIT License.
|
|
@@ -7751,7 +7828,7 @@ const StubbedNetworkModule = {
|
|
|
7751
7828
|
const missingKidError = "missing_kid_error";
|
|
7752
7829
|
const missingAlgError = "missing_alg_error";
|
|
7753
7830
|
|
|
7754
|
-
/*! @azure/msal-common v14.
|
|
7831
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7755
7832
|
|
|
7756
7833
|
/*
|
|
7757
7834
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7776,7 +7853,7 @@ function createJoseHeaderError(code) {
|
|
|
7776
7853
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7777
7854
|
}
|
|
7778
7855
|
|
|
7779
|
-
/*! @azure/msal-common v14.
|
|
7856
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7780
7857
|
|
|
7781
7858
|
/*
|
|
7782
7859
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7816,7 +7893,7 @@ class JoseHeader {
|
|
|
7816
7893
|
}
|
|
7817
7894
|
}
|
|
7818
7895
|
|
|
7819
|
-
/*! @azure/msal-common v14.
|
|
7896
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7820
7897
|
|
|
7821
7898
|
/*
|
|
7822
7899
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7874,7 +7951,7 @@ class AuthenticationHeaderParser {
|
|
|
7874
7951
|
}
|
|
7875
7952
|
}
|
|
7876
7953
|
|
|
7877
|
-
/*! @azure/msal-common v14.
|
|
7954
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7878
7955
|
|
|
7879
7956
|
/*
|
|
7880
7957
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8078,7 +8155,7 @@ class ServerTelemetryManager {
|
|
|
8078
8155
|
}
|
|
8079
8156
|
}
|
|
8080
8157
|
|
|
8081
|
-
/*! @azure/msal-common v14.
|
|
8158
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
8082
8159
|
|
|
8083
8160
|
/*
|
|
8084
8161
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8157,7 +8234,7 @@ class StubPerformanceClient {
|
|
|
8157
8234
|
}
|
|
8158
8235
|
}
|
|
8159
8236
|
|
|
8160
|
-
/*! @azure/msal-common v14.
|
|
8237
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
8161
8238
|
|
|
8162
8239
|
/*
|
|
8163
8240
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8257,6 +8334,10 @@ function addError(error, logger, event, stackMaxSize = 5) {
|
|
|
8257
8334
|
event.subErrorCode = error.subError;
|
|
8258
8335
|
return;
|
|
8259
8336
|
}
|
|
8337
|
+
else if (error instanceof CacheError) {
|
|
8338
|
+
event.errorCode = error.errorCode;
|
|
8339
|
+
return;
|
|
8340
|
+
}
|
|
8260
8341
|
else if (event.errorStack?.length) {
|
|
8261
8342
|
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
|
|
8262
8343
|
return;
|
|
@@ -8530,7 +8611,7 @@ class PerformanceClient {
|
|
|
8530
8611
|
manuallyCompletedCount: 0,
|
|
8531
8612
|
};
|
|
8532
8613
|
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
|
|
8533
|
-
const context = endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error);
|
|
8614
|
+
const context = JSON.stringify(endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error));
|
|
8534
8615
|
if (isRoot) {
|
|
8535
8616
|
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8536
8617
|
this.discardCache(rootEvent.correlationId);
|
|
@@ -10013,7 +10094,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
10013
10094
|
|
|
10014
10095
|
/* eslint-disable header/header */
|
|
10015
10096
|
const name = "@azure/msal-browser";
|
|
10016
|
-
const version = "3.
|
|
10097
|
+
const version = "3.13.0";
|
|
10017
10098
|
|
|
10018
10099
|
/*
|
|
10019
10100
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10148,11 +10229,7 @@ class BridgeProxy {
|
|
|
10148
10229
|
if (window.nestedAppAuthBridge === undefined) {
|
|
10149
10230
|
throw new Error("window.nestedAppAuthBridge is undefined");
|
|
10150
10231
|
}
|
|
10151
|
-
if (window.crypto === undefined) {
|
|
10152
|
-
throw new Error("window.crypto is undefined");
|
|
10153
|
-
}
|
|
10154
10232
|
try {
|
|
10155
|
-
BridgeProxy.crypto = window.crypto;
|
|
10156
10233
|
window.nestedAppAuthBridge.addEventListener("message", (response) => {
|
|
10157
10234
|
const responsePayload = typeof response === "string" ? response : response.data;
|
|
10158
10235
|
const responseEnvelope = JSON.parse(responsePayload);
|
|
@@ -10171,7 +10248,7 @@ class BridgeProxy {
|
|
|
10171
10248
|
const message = {
|
|
10172
10249
|
messageType: "NestedAppAuthRequest",
|
|
10173
10250
|
method: "GetInitContext",
|
|
10174
|
-
requestId:
|
|
10251
|
+
requestId: createNewGuid(),
|
|
10175
10252
|
};
|
|
10176
10253
|
const request = {
|
|
10177
10254
|
requestId: message.requestId,
|
|
@@ -10189,9 +10266,6 @@ class BridgeProxy {
|
|
|
10189
10266
|
throw error;
|
|
10190
10267
|
}
|
|
10191
10268
|
}
|
|
10192
|
-
static getRandomId() {
|
|
10193
|
-
return BridgeProxy.crypto.randomUUID();
|
|
10194
|
-
}
|
|
10195
10269
|
/**
|
|
10196
10270
|
* getTokenInteractive - Attempts to get a token interactively from the bridge
|
|
10197
10271
|
* @param request A token request
|
|
@@ -10233,7 +10307,7 @@ class BridgeProxy {
|
|
|
10233
10307
|
const message = {
|
|
10234
10308
|
messageType: "NestedAppAuthRequest",
|
|
10235
10309
|
method: method,
|
|
10236
|
-
requestId:
|
|
10310
|
+
requestId: createNewGuid(),
|
|
10237
10311
|
...requestParams,
|
|
10238
10312
|
};
|
|
10239
10313
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -11068,7 +11142,7 @@ function extractBrowserRequestState(browserCrypto, state) {
|
|
|
11068
11142
|
* parameters such as state and nonce, generally.
|
|
11069
11143
|
*/
|
|
11070
11144
|
class BrowserCacheManager extends CacheManager {
|
|
11071
|
-
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions) {
|
|
11145
|
+
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions, performanceClient) {
|
|
11072
11146
|
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
11073
11147
|
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
11074
11148
|
this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
@@ -11082,6 +11156,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11082
11156
|
this.migrateCacheEntries();
|
|
11083
11157
|
this.createKeyMaps();
|
|
11084
11158
|
}
|
|
11159
|
+
this.performanceClient = performanceClient;
|
|
11085
11160
|
}
|
|
11086
11161
|
/**
|
|
11087
11162
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
@@ -12302,6 +12377,33 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12302
12377
|
const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
|
|
12303
12378
|
return this.saveCacheRecord(cacheRecord);
|
|
12304
12379
|
}
|
|
12380
|
+
/**
|
|
12381
|
+
* saves a cache record
|
|
12382
|
+
* @param cacheRecord {CacheRecord}
|
|
12383
|
+
* @param storeInCache {?StoreInCache}
|
|
12384
|
+
* @param correlationId {?string} correlation id
|
|
12385
|
+
*/
|
|
12386
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
12387
|
+
try {
|
|
12388
|
+
await super.saveCacheRecord(cacheRecord, storeInCache, correlationId);
|
|
12389
|
+
}
|
|
12390
|
+
catch (e) {
|
|
12391
|
+
if (e instanceof CacheError &&
|
|
12392
|
+
this.performanceClient &&
|
|
12393
|
+
correlationId) {
|
|
12394
|
+
try {
|
|
12395
|
+
const tokenKeys = this.getTokenKeys();
|
|
12396
|
+
this.performanceClient.addFields({
|
|
12397
|
+
cacheRtCount: tokenKeys.refreshToken.length,
|
|
12398
|
+
cacheIdCount: tokenKeys.idToken.length,
|
|
12399
|
+
cacheAtCount: tokenKeys.accessToken.length,
|
|
12400
|
+
}, correlationId);
|
|
12401
|
+
}
|
|
12402
|
+
catch (e) { }
|
|
12403
|
+
}
|
|
12404
|
+
throw e;
|
|
12405
|
+
}
|
|
12406
|
+
}
|
|
12305
12407
|
}
|
|
12306
12408
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
12307
12409
|
const cacheOptions = {
|
|
@@ -14960,6 +15062,7 @@ function loadFrameSync(urlNavigate) {
|
|
|
14960
15062
|
*/
|
|
14961
15063
|
function createHiddenIframe() {
|
|
14962
15064
|
const authFrame = document.createElement("iframe");
|
|
15065
|
+
authFrame.className = "msalSilentIframe";
|
|
14963
15066
|
authFrame.style.visibility = "hidden";
|
|
14964
15067
|
authFrame.style.position = "absolute";
|
|
14965
15068
|
authFrame.style.width = authFrame.style.height = "0";
|
|
@@ -15471,7 +15574,7 @@ class StandardController {
|
|
|
15471
15574
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
15472
15575
|
// Initialize the browser storage class.
|
|
15473
15576
|
this.browserStorage = this.isBrowserEnvironment
|
|
15474
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth))
|
|
15577
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth), this.performanceClient)
|
|
15475
15578
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
15476
15579
|
// initialize in memory storage for native flows
|
|
15477
15580
|
const nativeCacheOptions = {
|
|
@@ -15482,7 +15585,7 @@ class StandardController {
|
|
|
15482
15585
|
cacheMigrationEnabled: false,
|
|
15483
15586
|
claimsBasedCachingEnabled: false,
|
|
15484
15587
|
};
|
|
15485
|
-
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
15588
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, undefined, this.performanceClient);
|
|
15486
15589
|
// Initialize the token cache
|
|
15487
15590
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
15488
15591
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -15545,7 +15648,6 @@ class StandardController {
|
|
|
15545
15648
|
this.logger.verbose("handleRedirectPromise called");
|
|
15546
15649
|
// Block token acquisition before initialize has been called
|
|
15547
15650
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
15548
|
-
const loggedInAccounts = this.getAllAccounts();
|
|
15549
15651
|
if (this.isBrowserEnvironment) {
|
|
15550
15652
|
/**
|
|
15551
15653
|
* Store the promise on the PublicClientApplication instance if this is the first invocation of handleRedirectPromise,
|
|
@@ -15555,64 +15657,9 @@ class StandardController {
|
|
|
15555
15657
|
const redirectResponseKey = hash || "";
|
|
15556
15658
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
15557
15659
|
if (typeof response === "undefined") {
|
|
15558
|
-
|
|
15559
|
-
const useNative = request &&
|
|
15560
|
-
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15561
|
-
this.nativeExtensionProvider &&
|
|
15562
|
-
!hash;
|
|
15563
|
-
const correlationId = useNative
|
|
15564
|
-
? request?.correlationId
|
|
15565
|
-
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15566
|
-
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15567
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15568
|
-
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15569
|
-
let redirectResponse;
|
|
15570
|
-
if (useNative && this.nativeExtensionProvider) {
|
|
15571
|
-
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15572
|
-
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);
|
|
15573
|
-
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15574
|
-
}
|
|
15575
|
-
else {
|
|
15576
|
-
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15577
|
-
const redirectClient = this.createRedirectClient(correlationId);
|
|
15578
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
15579
|
-
}
|
|
15580
|
-
response = redirectResponse
|
|
15581
|
-
.then((result) => {
|
|
15582
|
-
if (result) {
|
|
15583
|
-
// Emit login event if number of accounts change
|
|
15584
|
-
const isLoggingIn = loggedInAccounts.length <
|
|
15585
|
-
this.getAllAccounts().length;
|
|
15586
|
-
if (isLoggingIn) {
|
|
15587
|
-
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15588
|
-
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15589
|
-
}
|
|
15590
|
-
else {
|
|
15591
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15592
|
-
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15593
|
-
}
|
|
15594
|
-
rootMeasurement.end({ success: true });
|
|
15595
|
-
}
|
|
15596
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15597
|
-
rootMeasurement.end({ success: false });
|
|
15598
|
-
return result;
|
|
15599
|
-
})
|
|
15600
|
-
.catch((e) => {
|
|
15601
|
-
const eventError = e;
|
|
15602
|
-
// Emit login event if there is an account
|
|
15603
|
-
if (loggedInAccounts.length > 0) {
|
|
15604
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15605
|
-
}
|
|
15606
|
-
else {
|
|
15607
|
-
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15608
|
-
}
|
|
15609
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15610
|
-
rootMeasurement.end({
|
|
15611
|
-
success: false,
|
|
15612
|
-
}, eventError);
|
|
15613
|
-
throw e;
|
|
15614
|
-
});
|
|
15660
|
+
response = this.handleRedirectPromiseInternal(hash);
|
|
15615
15661
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
15662
|
+
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15616
15663
|
}
|
|
15617
15664
|
else {
|
|
15618
15665
|
this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");
|
|
@@ -15622,6 +15669,69 @@ class StandardController {
|
|
|
15622
15669
|
this.logger.verbose("handleRedirectPromise returns null, not browser environment");
|
|
15623
15670
|
return null;
|
|
15624
15671
|
}
|
|
15672
|
+
/**
|
|
15673
|
+
* The internal details of handleRedirectPromise. This is separated out to a helper to allow handleRedirectPromise to memoize requests
|
|
15674
|
+
* @param hash
|
|
15675
|
+
* @returns
|
|
15676
|
+
*/
|
|
15677
|
+
async handleRedirectPromiseInternal(hash) {
|
|
15678
|
+
const loggedInAccounts = this.getAllAccounts();
|
|
15679
|
+
const request = this.browserStorage.getCachedNativeRequest();
|
|
15680
|
+
const useNative = request &&
|
|
15681
|
+
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15682
|
+
this.nativeExtensionProvider &&
|
|
15683
|
+
!hash;
|
|
15684
|
+
const correlationId = useNative
|
|
15685
|
+
? request?.correlationId
|
|
15686
|
+
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15687
|
+
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15688
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15689
|
+
let redirectResponse;
|
|
15690
|
+
if (useNative && this.nativeExtensionProvider) {
|
|
15691
|
+
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15692
|
+
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);
|
|
15693
|
+
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15694
|
+
}
|
|
15695
|
+
else {
|
|
15696
|
+
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15697
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15698
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
15699
|
+
}
|
|
15700
|
+
return redirectResponse
|
|
15701
|
+
.then((result) => {
|
|
15702
|
+
if (result) {
|
|
15703
|
+
// Emit login event if number of accounts change
|
|
15704
|
+
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
15705
|
+
if (isLoggingIn) {
|
|
15706
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15707
|
+
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15708
|
+
}
|
|
15709
|
+
else {
|
|
15710
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15711
|
+
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15712
|
+
}
|
|
15713
|
+
rootMeasurement.end({ success: true });
|
|
15714
|
+
}
|
|
15715
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15716
|
+
rootMeasurement.end({ success: false });
|
|
15717
|
+
return result;
|
|
15718
|
+
})
|
|
15719
|
+
.catch((e) => {
|
|
15720
|
+
const eventError = e;
|
|
15721
|
+
// Emit login event if there is an account
|
|
15722
|
+
if (loggedInAccounts.length > 0) {
|
|
15723
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15724
|
+
}
|
|
15725
|
+
else {
|
|
15726
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15727
|
+
}
|
|
15728
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15729
|
+
rootMeasurement.end({
|
|
15730
|
+
success: false,
|
|
15731
|
+
}, eventError);
|
|
15732
|
+
throw e;
|
|
15733
|
+
});
|
|
15734
|
+
}
|
|
15625
15735
|
/**
|
|
15626
15736
|
* 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
|
|
15627
15737
|
* the page, so any code that follows this function will not execute.
|
|
@@ -16580,49 +16690,69 @@ class StandardController {
|
|
|
16580
16690
|
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
16581
16691
|
}
|
|
16582
16692
|
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
|
|
16693
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
16694
|
+
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
16695
|
+
const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
|
|
16696
|
+
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy);
|
|
16697
|
+
if (shouldTryToResolveSilently) {
|
|
16698
|
+
if (!this.activeIframeRequest) {
|
|
16699
|
+
let _resolve, _reject;
|
|
16700
|
+
// Always set the active request tracker immediately after checking it to prevent races
|
|
16701
|
+
this.activeIframeRequest = [
|
|
16702
|
+
new Promise((resolve, reject) => {
|
|
16703
|
+
_resolve = resolve;
|
|
16704
|
+
_reject = reject;
|
|
16705
|
+
}),
|
|
16706
|
+
silentRequest.correlationId,
|
|
16707
|
+
];
|
|
16708
|
+
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", silentRequest.correlationId);
|
|
16709
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest)
|
|
16710
|
+
.then((iframeResult) => {
|
|
16711
|
+
_resolve();
|
|
16712
|
+
return iframeResult;
|
|
16713
|
+
})
|
|
16714
|
+
.catch((e) => {
|
|
16715
|
+
_reject(e);
|
|
16716
|
+
throw e;
|
|
16717
|
+
})
|
|
16718
|
+
.finally(() => {
|
|
16719
|
+
this.activeIframeRequest = undefined;
|
|
16720
|
+
});
|
|
16611
16721
|
}
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
}
|
|
16619
|
-
|
|
16620
|
-
|
|
16722
|
+
else if (cacheLookupPolicy !== CacheLookupPolicy.Skip) {
|
|
16723
|
+
const [activePromise, activeCorrelationId] = this.activeIframeRequest;
|
|
16724
|
+
this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${activeCorrelationId}`, silentRequest.correlationId);
|
|
16725
|
+
const awaitConcurrentIframeMeasure = this.performanceClient.startMeasurement(PerformanceEvents.AwaitConcurrentIframe, silentRequest.correlationId);
|
|
16726
|
+
awaitConcurrentIframeMeasure.add({
|
|
16727
|
+
awaitIframeCorrelationId: activeCorrelationId,
|
|
16728
|
+
});
|
|
16729
|
+
// Await for errors first so we can distinguish errors thrown by activePromise versus errors thrown by .then below
|
|
16730
|
+
await activePromise.catch(() => {
|
|
16731
|
+
awaitConcurrentIframeMeasure.end({
|
|
16732
|
+
success: false,
|
|
16733
|
+
});
|
|
16734
|
+
this.logger.info(`Iframe request with correlationId: ${activeCorrelationId} failed. Interaction is required.`);
|
|
16735
|
+
// If previous iframe request failed, it's unlikely to succeed this time. Throw original error.
|
|
16621
16736
|
throw refreshTokenError;
|
|
16622
|
-
}
|
|
16623
|
-
|
|
16624
|
-
|
|
16625
|
-
|
|
16737
|
+
});
|
|
16738
|
+
return activePromise.then(() => {
|
|
16739
|
+
awaitConcurrentIframeMeasure.end({ success: true });
|
|
16740
|
+
this.logger.verbose(`Parallel iframe request with correlationId: ${activeCorrelationId} succeeded. Retrying cache and/or RT redemption`, silentRequest.correlationId);
|
|
16741
|
+
// Retry cache lookup and/or RT exchange after iframe completes
|
|
16742
|
+
return this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy);
|
|
16743
|
+
});
|
|
16744
|
+
}
|
|
16745
|
+
else {
|
|
16746
|
+
// Cache policy set to skip and another iframe request is already in progress
|
|
16747
|
+
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);
|
|
16748
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
16749
|
+
}
|
|
16750
|
+
}
|
|
16751
|
+
else {
|
|
16752
|
+
// Error cannot be silently resolved or iframe renewal is not allowed, interaction required
|
|
16753
|
+
throw refreshTokenError;
|
|
16754
|
+
}
|
|
16755
|
+
});
|
|
16626
16756
|
return result
|
|
16627
16757
|
.then((response) => {
|
|
16628
16758
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
@@ -16643,6 +16773,38 @@ class StandardController {
|
|
|
16643
16773
|
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16644
16774
|
});
|
|
16645
16775
|
}
|
|
16776
|
+
/**
|
|
16777
|
+
* 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.
|
|
16778
|
+
* @param silentRequest
|
|
16779
|
+
* @param cacheLookupPolicy
|
|
16780
|
+
* @returns
|
|
16781
|
+
*/
|
|
16782
|
+
async acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy) {
|
|
16783
|
+
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, silentRequest.authenticationScheme) &&
|
|
16784
|
+
silentRequest.account.nativeAccountId) {
|
|
16785
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
16786
|
+
return this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
16787
|
+
// If native token acquisition fails for availability reasons fallback to web flow
|
|
16788
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
16789
|
+
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
16790
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
16791
|
+
// Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal
|
|
16792
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
16793
|
+
}
|
|
16794
|
+
throw e;
|
|
16795
|
+
});
|
|
16796
|
+
}
|
|
16797
|
+
else {
|
|
16798
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16799
|
+
return invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
16800
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
16801
|
+
throw cacheError;
|
|
16802
|
+
}
|
|
16803
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
16804
|
+
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy);
|
|
16805
|
+
});
|
|
16806
|
+
}
|
|
16807
|
+
}
|
|
16646
16808
|
}
|
|
16647
16809
|
/**
|
|
16648
16810
|
* Determines whether an error thrown by the refresh token endpoint can be resolved without interaction
|
|
@@ -16651,7 +16813,7 @@ class StandardController {
|
|
|
16651
16813
|
* @param cacheLookupPolicy
|
|
16652
16814
|
* @returns
|
|
16653
16815
|
*/
|
|
16654
|
-
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError,
|
|
16816
|
+
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy) {
|
|
16655
16817
|
const noInteractionRequired = !(refreshTokenError instanceof InteractionRequiredAuthError &&
|
|
16656
16818
|
// For refresh token errors, bad_token does not always require interaction (silently resolvable)
|
|
16657
16819
|
refreshTokenError.subError !==
|
|
@@ -17045,7 +17207,7 @@ class UnknownOperatingContextController {
|
|
|
17045
17207
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
17046
17208
|
// Initialize the browser storage class.
|
|
17047
17209
|
this.browserStorage = this.isBrowserEnvironment
|
|
17048
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger)
|
|
17210
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, undefined, this.performanceClient)
|
|
17049
17211
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
17050
17212
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
17051
17213
|
}
|
|
@@ -18544,12 +18706,7 @@ class NestedAppAuthController {
|
|
|
18544
18706
|
}
|
|
18545
18707
|
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18546
18708
|
) {
|
|
18547
|
-
|
|
18548
|
-
return this.acquireTokenInteractive(request);
|
|
18549
|
-
}
|
|
18550
|
-
else {
|
|
18551
|
-
throw NestedAppAuthError.createUnsupportedError();
|
|
18552
|
-
}
|
|
18709
|
+
return this.acquireTokenInteractive(request || DEFAULT_REQUEST);
|
|
18553
18710
|
}
|
|
18554
18711
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18555
18712
|
loginRedirect(request) {
|