@azure/msal-browser 3.11.1 → 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 +363 -206
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +363 -206
- 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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.13.0 2024-04-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v14.
|
|
9
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -71,11 +71,20 @@
|
|
|
71
71
|
};
|
|
72
72
|
const HttpStatus = {
|
|
73
73
|
SUCCESS_RANGE_START: 200,
|
|
74
|
+
SUCCESS: 200,
|
|
74
75
|
SUCCESS_RANGE_END: 299,
|
|
75
76
|
REDIRECT: 302,
|
|
76
77
|
CLIENT_ERROR_RANGE_START: 400,
|
|
78
|
+
BAD_REQUEST: 400,
|
|
79
|
+
UNAUTHORIZED: 401,
|
|
80
|
+
NOT_FOUND: 404,
|
|
81
|
+
REQUEST_TIMEOUT: 408,
|
|
82
|
+
TOO_MANY_REQUESTS: 429,
|
|
77
83
|
CLIENT_ERROR_RANGE_END: 499,
|
|
78
84
|
SERVER_ERROR_RANGE_START: 500,
|
|
85
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
86
|
+
SERVICE_UNAVAILABLE: 503,
|
|
87
|
+
GATEWAY_TIMEOUT: 504,
|
|
79
88
|
SERVER_ERROR_RANGE_END: 599,
|
|
80
89
|
};
|
|
81
90
|
const OIDC_DEFAULT_SCOPES = [
|
|
@@ -300,8 +309,10 @@
|
|
|
300
309
|
Jwk: "JWK",
|
|
301
310
|
Pop: "pop",
|
|
302
311
|
};
|
|
312
|
+
// Token renewal offset default in seconds
|
|
313
|
+
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
303
314
|
|
|
304
|
-
/*! @azure/msal-common v14.
|
|
315
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
305
316
|
/*
|
|
306
317
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
307
318
|
* Licensed under the MIT License.
|
|
@@ -318,7 +329,7 @@
|
|
|
318
329
|
unexpectedError: unexpectedError
|
|
319
330
|
});
|
|
320
331
|
|
|
321
|
-
/*! @azure/msal-common v14.
|
|
332
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
322
333
|
|
|
323
334
|
/*
|
|
324
335
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -367,7 +378,7 @@
|
|
|
367
378
|
: AuthErrorMessages[code]);
|
|
368
379
|
}
|
|
369
380
|
|
|
370
|
-
/*! @azure/msal-common v14.
|
|
381
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
371
382
|
/*
|
|
372
383
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
373
384
|
* Licensed under the MIT License.
|
|
@@ -465,7 +476,7 @@
|
|
|
465
476
|
userTimeoutReached: userTimeoutReached
|
|
466
477
|
});
|
|
467
478
|
|
|
468
|
-
/*! @azure/msal-common v14.
|
|
479
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
469
480
|
|
|
470
481
|
/*
|
|
471
482
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -717,7 +728,7 @@
|
|
|
717
728
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
718
729
|
}
|
|
719
730
|
|
|
720
|
-
/*! @azure/msal-common v14.
|
|
731
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
721
732
|
|
|
722
733
|
/*
|
|
723
734
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -750,7 +761,7 @@
|
|
|
750
761
|
},
|
|
751
762
|
};
|
|
752
763
|
|
|
753
|
-
/*! @azure/msal-common v14.
|
|
764
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
754
765
|
|
|
755
766
|
/*
|
|
756
767
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -941,12 +952,12 @@
|
|
|
941
952
|
}
|
|
942
953
|
}
|
|
943
954
|
|
|
944
|
-
/*! @azure/msal-common v14.
|
|
955
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
945
956
|
/* eslint-disable header/header */
|
|
946
957
|
const name$1 = "@azure/msal-common";
|
|
947
|
-
const version$1 = "14.
|
|
958
|
+
const version$1 = "14.9.0";
|
|
948
959
|
|
|
949
|
-
/*! @azure/msal-common v14.
|
|
960
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
950
961
|
/*
|
|
951
962
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
952
963
|
* Licensed under the MIT License.
|
|
@@ -966,7 +977,7 @@
|
|
|
966
977
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
967
978
|
};
|
|
968
979
|
|
|
969
|
-
/*! @azure/msal-common v14.
|
|
980
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
970
981
|
|
|
971
982
|
/*
|
|
972
983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1027,7 +1038,7 @@
|
|
|
1027
1038
|
}
|
|
1028
1039
|
}
|
|
1029
1040
|
|
|
1030
|
-
/*! @azure/msal-common v14.
|
|
1041
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1031
1042
|
/*
|
|
1032
1043
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1033
1044
|
* Licensed under the MIT License.
|
|
@@ -1064,7 +1075,7 @@
|
|
|
1064
1075
|
return cachedAtSec > nowSeconds();
|
|
1065
1076
|
}
|
|
1066
1077
|
|
|
1067
|
-
/*! @azure/msal-common v14.
|
|
1078
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1068
1079
|
|
|
1069
1080
|
/*
|
|
1070
1081
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1391,7 +1402,7 @@
|
|
|
1391
1402
|
return metadata.expiresAt <= nowSeconds();
|
|
1392
1403
|
}
|
|
1393
1404
|
|
|
1394
|
-
/*! @azure/msal-common v14.
|
|
1405
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1395
1406
|
/*
|
|
1396
1407
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1397
1408
|
* Licensed under the MIT License.
|
|
@@ -1445,7 +1456,7 @@
|
|
|
1445
1456
|
urlParseError: urlParseError
|
|
1446
1457
|
});
|
|
1447
1458
|
|
|
1448
|
-
/*! @azure/msal-common v14.
|
|
1459
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1449
1460
|
|
|
1450
1461
|
/*
|
|
1451
1462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1583,7 +1594,7 @@
|
|
|
1583
1594
|
return new ClientConfigurationError(errorCode);
|
|
1584
1595
|
}
|
|
1585
1596
|
|
|
1586
|
-
/*! @azure/msal-common v14.
|
|
1597
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1587
1598
|
/*
|
|
1588
1599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1589
1600
|
* Licensed under the MIT License.
|
|
@@ -1680,7 +1691,7 @@
|
|
|
1680
1691
|
}
|
|
1681
1692
|
}
|
|
1682
1693
|
|
|
1683
|
-
/*! @azure/msal-common v14.
|
|
1694
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1684
1695
|
|
|
1685
1696
|
/*
|
|
1686
1697
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1880,7 +1891,7 @@
|
|
|
1880
1891
|
}
|
|
1881
1892
|
}
|
|
1882
1893
|
|
|
1883
|
-
/*! @azure/msal-common v14.
|
|
1894
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1884
1895
|
|
|
1885
1896
|
/*
|
|
1886
1897
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1920,7 +1931,7 @@
|
|
|
1920
1931
|
};
|
|
1921
1932
|
}
|
|
1922
1933
|
|
|
1923
|
-
/*! @azure/msal-common v14.
|
|
1934
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1924
1935
|
/*
|
|
1925
1936
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1926
1937
|
* Licensed under the MIT License.
|
|
@@ -1982,7 +1993,7 @@
|
|
|
1982
1993
|
return updatedAccountInfo;
|
|
1983
1994
|
}
|
|
1984
1995
|
|
|
1985
|
-
/*! @azure/msal-common v14.
|
|
1996
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
1986
1997
|
/*
|
|
1987
1998
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1988
1999
|
* Licensed under the MIT License.
|
|
@@ -1997,7 +2008,7 @@
|
|
|
1997
2008
|
Ciam: 3,
|
|
1998
2009
|
};
|
|
1999
2010
|
|
|
2000
|
-
/*! @azure/msal-common v14.
|
|
2011
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2001
2012
|
/*
|
|
2002
2013
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2003
2014
|
* Licensed under the MIT License.
|
|
@@ -2019,7 +2030,7 @@
|
|
|
2019
2030
|
return null;
|
|
2020
2031
|
}
|
|
2021
2032
|
|
|
2022
|
-
/*! @azure/msal-common v14.
|
|
2033
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2023
2034
|
/*
|
|
2024
2035
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2025
2036
|
* Licensed under the MIT License.
|
|
@@ -2032,7 +2043,7 @@
|
|
|
2032
2043
|
OIDC: "OIDC",
|
|
2033
2044
|
};
|
|
2034
2045
|
|
|
2035
|
-
/*! @azure/msal-common v14.
|
|
2046
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2036
2047
|
|
|
2037
2048
|
/*
|
|
2038
2049
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2279,7 +2290,7 @@
|
|
|
2279
2290
|
}
|
|
2280
2291
|
}
|
|
2281
2292
|
|
|
2282
|
-
/*! @azure/msal-common v14.
|
|
2293
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2283
2294
|
|
|
2284
2295
|
/*
|
|
2285
2296
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2326,7 +2337,7 @@
|
|
|
2326
2337
|
return null;
|
|
2327
2338
|
}
|
|
2328
2339
|
|
|
2329
|
-
/*! @azure/msal-common v14.
|
|
2340
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2330
2341
|
|
|
2331
2342
|
/*
|
|
2332
2343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2490,7 +2501,7 @@
|
|
|
2490
2501
|
}
|
|
2491
2502
|
}
|
|
2492
2503
|
|
|
2493
|
-
/*! @azure/msal-common v14.
|
|
2504
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2494
2505
|
|
|
2495
2506
|
/*
|
|
2496
2507
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2630,7 +2641,42 @@
|
|
|
2630
2641
|
return null;
|
|
2631
2642
|
}
|
|
2632
2643
|
|
|
2633
|
-
/*! @azure/msal-common v14.
|
|
2644
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2645
|
+
/*
|
|
2646
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2647
|
+
* Licensed under the MIT License.
|
|
2648
|
+
*/
|
|
2649
|
+
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2650
|
+
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2651
|
+
|
|
2652
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2653
|
+
|
|
2654
|
+
/*
|
|
2655
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2656
|
+
* Licensed under the MIT License.
|
|
2657
|
+
*/
|
|
2658
|
+
const CacheErrorMessages = {
|
|
2659
|
+
[cacheQuotaExceededErrorCode]: "Exceeded cache storage capacity.",
|
|
2660
|
+
[cacheUnknownErrorCode]: "Unexpected error occurred when using cache storage.",
|
|
2661
|
+
};
|
|
2662
|
+
/**
|
|
2663
|
+
* Error thrown when there is an error with the cache
|
|
2664
|
+
*/
|
|
2665
|
+
class CacheError extends Error {
|
|
2666
|
+
constructor(errorCode, errorMessage) {
|
|
2667
|
+
const message = errorMessage ||
|
|
2668
|
+
(CacheErrorMessages[errorCode]
|
|
2669
|
+
? CacheErrorMessages[errorCode]
|
|
2670
|
+
: CacheErrorMessages[cacheUnknownErrorCode]);
|
|
2671
|
+
super(`${errorCode}: ${message}`);
|
|
2672
|
+
Object.setPrototypeOf(this, CacheError.prototype);
|
|
2673
|
+
this.name = "CacheError";
|
|
2674
|
+
this.errorCode = errorCode;
|
|
2675
|
+
this.errorMessage = message;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
2634
2680
|
|
|
2635
2681
|
/*
|
|
2636
2682
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2794,27 +2840,51 @@
|
|
|
2794
2840
|
}
|
|
2795
2841
|
/**
|
|
2796
2842
|
* saves a cache record
|
|
2797
|
-
* @param cacheRecord
|
|
2843
|
+
* @param cacheRecord {CacheRecord}
|
|
2844
|
+
* @param storeInCache {?StoreInCache}
|
|
2845
|
+
* @param correlationId {?string} correlation id
|
|
2798
2846
|
*/
|
|
2799
|
-
async saveCacheRecord(cacheRecord, storeInCache) {
|
|
2847
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
2800
2848
|
if (!cacheRecord) {
|
|
2801
2849
|
throw createClientAuthError(invalidCacheRecord);
|
|
2802
2850
|
}
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2851
|
+
try {
|
|
2852
|
+
if (!!cacheRecord.account) {
|
|
2853
|
+
this.setAccount(cacheRecord.account);
|
|
2854
|
+
}
|
|
2855
|
+
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2856
|
+
this.setIdTokenCredential(cacheRecord.idToken);
|
|
2857
|
+
}
|
|
2858
|
+
if (!!cacheRecord.accessToken &&
|
|
2859
|
+
storeInCache?.accessToken !== false) {
|
|
2860
|
+
await this.saveAccessToken(cacheRecord.accessToken);
|
|
2861
|
+
}
|
|
2862
|
+
if (!!cacheRecord.refreshToken &&
|
|
2863
|
+
storeInCache?.refreshToken !== false) {
|
|
2864
|
+
this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2865
|
+
}
|
|
2866
|
+
if (!!cacheRecord.appMetadata) {
|
|
2867
|
+
this.setAppMetadata(cacheRecord.appMetadata);
|
|
2868
|
+
}
|
|
2815
2869
|
}
|
|
2816
|
-
|
|
2817
|
-
this.
|
|
2870
|
+
catch (e) {
|
|
2871
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
|
|
2872
|
+
if (e instanceof Error) {
|
|
2873
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);
|
|
2874
|
+
if (e.name === "QuotaExceededError" ||
|
|
2875
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
2876
|
+
e.message.includes("exceeded the quota")) {
|
|
2877
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
|
|
2878
|
+
throw new CacheError(cacheQuotaExceededErrorCode);
|
|
2879
|
+
}
|
|
2880
|
+
else {
|
|
2881
|
+
throw new CacheError(e.name, e.message);
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
else {
|
|
2885
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);
|
|
2886
|
+
throw new CacheError(cacheUnknownErrorCode);
|
|
2887
|
+
}
|
|
2818
2888
|
}
|
|
2819
2889
|
}
|
|
2820
2890
|
/**
|
|
@@ -3861,14 +3931,12 @@
|
|
|
3861
3931
|
}
|
|
3862
3932
|
}
|
|
3863
3933
|
|
|
3864
|
-
/*! @azure/msal-common v14.
|
|
3934
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3865
3935
|
|
|
3866
3936
|
/*
|
|
3867
3937
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3868
3938
|
* Licensed under the MIT License.
|
|
3869
3939
|
*/
|
|
3870
|
-
// Token renewal offset default in seconds
|
|
3871
|
-
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3872
3940
|
const DEFAULT_SYSTEM_OPTIONS = {
|
|
3873
3941
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3874
3942
|
preventCorsPreflight: false,
|
|
@@ -3961,7 +4029,7 @@
|
|
|
3961
4029
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3962
4030
|
}
|
|
3963
4031
|
|
|
3964
|
-
/*! @azure/msal-common v14.
|
|
4032
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3965
4033
|
|
|
3966
4034
|
/*
|
|
3967
4035
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3978,7 +4046,7 @@
|
|
|
3978
4046
|
}
|
|
3979
4047
|
}
|
|
3980
4048
|
|
|
3981
|
-
/*! @azure/msal-common v14.
|
|
4049
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
3982
4050
|
|
|
3983
4051
|
/*
|
|
3984
4052
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4076,7 +4144,7 @@
|
|
|
4076
4144
|
}
|
|
4077
4145
|
}
|
|
4078
4146
|
|
|
4079
|
-
/*! @azure/msal-common v14.
|
|
4147
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4080
4148
|
|
|
4081
4149
|
/*
|
|
4082
4150
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4113,7 +4181,7 @@
|
|
|
4113
4181
|
}
|
|
4114
4182
|
}
|
|
4115
4183
|
|
|
4116
|
-
/*! @azure/msal-common v14.
|
|
4184
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4117
4185
|
/*
|
|
4118
4186
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4119
4187
|
* Licensed under the MIT License.
|
|
@@ -4123,7 +4191,7 @@
|
|
|
4123
4191
|
UPN: "UPN",
|
|
4124
4192
|
};
|
|
4125
4193
|
|
|
4126
|
-
/*! @azure/msal-common v14.
|
|
4194
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4127
4195
|
/*
|
|
4128
4196
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4129
4197
|
* Licensed under the MIT License.
|
|
@@ -4170,7 +4238,7 @@
|
|
|
4170
4238
|
const LOGIN_HINT = "login_hint";
|
|
4171
4239
|
const DOMAIN_HINT = "domain_hint";
|
|
4172
4240
|
|
|
4173
|
-
/*! @azure/msal-common v14.
|
|
4241
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4174
4242
|
|
|
4175
4243
|
/*
|
|
4176
4244
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4254,7 +4322,7 @@
|
|
|
4254
4322
|
}
|
|
4255
4323
|
}
|
|
4256
4324
|
|
|
4257
|
-
/*! @azure/msal-common v14.
|
|
4325
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4258
4326
|
|
|
4259
4327
|
/*
|
|
4260
4328
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4638,7 +4706,7 @@
|
|
|
4638
4706
|
}
|
|
4639
4707
|
}
|
|
4640
4708
|
|
|
4641
|
-
/*! @azure/msal-common v14.
|
|
4709
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4642
4710
|
/*
|
|
4643
4711
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4644
4712
|
* Licensed under the MIT License.
|
|
@@ -4650,7 +4718,7 @@
|
|
|
4650
4718
|
response.hasOwnProperty("jwks_uri"));
|
|
4651
4719
|
}
|
|
4652
4720
|
|
|
4653
|
-
/*! @azure/msal-common v14.
|
|
4721
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4654
4722
|
/*
|
|
4655
4723
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4656
4724
|
* Licensed under the MIT License.
|
|
@@ -4660,7 +4728,7 @@
|
|
|
4660
4728
|
response.hasOwnProperty("metadata"));
|
|
4661
4729
|
}
|
|
4662
4730
|
|
|
4663
|
-
/*! @azure/msal-common v14.
|
|
4731
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4664
4732
|
/*
|
|
4665
4733
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4666
4734
|
* Licensed under the MIT License.
|
|
@@ -4670,7 +4738,7 @@
|
|
|
4670
4738
|
response.hasOwnProperty("error_description"));
|
|
4671
4739
|
}
|
|
4672
4740
|
|
|
4673
|
-
/*! @azure/msal-common v14.
|
|
4741
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
4674
4742
|
/*
|
|
4675
4743
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4676
4744
|
* Licensed under the MIT License.
|
|
@@ -4732,6 +4800,7 @@
|
|
|
4732
4800
|
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4733
4801
|
*/
|
|
4734
4802
|
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4803
|
+
AwaitConcurrentIframe: "awaitConcurrentIframe",
|
|
4735
4804
|
/**
|
|
4736
4805
|
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4737
4806
|
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
@@ -5144,7 +5213,7 @@
|
|
|
5144
5213
|
"multiMatchedRT",
|
|
5145
5214
|
]);
|
|
5146
5215
|
|
|
5147
|
-
/*! @azure/msal-common v14.
|
|
5216
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5148
5217
|
/*
|
|
5149
5218
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5150
5219
|
* Licensed under the MIT License.
|
|
@@ -5240,7 +5309,7 @@
|
|
|
5240
5309
|
};
|
|
5241
5310
|
};
|
|
5242
5311
|
|
|
5243
|
-
/*! @azure/msal-common v14.
|
|
5312
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5244
5313
|
|
|
5245
5314
|
/*
|
|
5246
5315
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5349,7 +5418,7 @@
|
|
|
5349
5418
|
},
|
|
5350
5419
|
};
|
|
5351
5420
|
|
|
5352
|
-
/*! @azure/msal-common v14.
|
|
5421
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
5353
5422
|
|
|
5354
5423
|
/*
|
|
5355
5424
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5361,7 +5430,7 @@
|
|
|
5361
5430
|
* @internal
|
|
5362
5431
|
*/
|
|
5363
5432
|
class Authority {
|
|
5364
|
-
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
|
|
5433
|
+
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient, managedIdentity) {
|
|
5365
5434
|
this.canonicalAuthority = authority;
|
|
5366
5435
|
this._canonicalAuthority.validateAsUri();
|
|
5367
5436
|
this.networkInterface = networkInterface;
|
|
@@ -5375,6 +5444,7 @@
|
|
|
5375
5444
|
this.logger = logger;
|
|
5376
5445
|
this.performanceClient = performanceClient;
|
|
5377
5446
|
this.correlationId = correlationId;
|
|
5447
|
+
this.managedIdentity = managedIdentity || false;
|
|
5378
5448
|
this.regionDiscovery = new RegionDiscovery(networkInterface, this.logger, this.performanceClient, this.correlationId);
|
|
5379
5449
|
}
|
|
5380
5450
|
/**
|
|
@@ -5580,7 +5650,7 @@
|
|
|
5580
5650
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
5581
5651
|
}
|
|
5582
5652
|
/**
|
|
5583
|
-
* Boolean that returns
|
|
5653
|
+
* Boolean that returns whether or not tenant discovery has been completed.
|
|
5584
5654
|
*/
|
|
5585
5655
|
discoveryComplete() {
|
|
5586
5656
|
return !!this.metadata;
|
|
@@ -6032,7 +6102,10 @@
|
|
|
6032
6102
|
* helper function to generate environment from authority object
|
|
6033
6103
|
*/
|
|
6034
6104
|
getPreferredCache() {
|
|
6035
|
-
if (this.
|
|
6105
|
+
if (this.managedIdentity) {
|
|
6106
|
+
return Constants.DEFAULT_AUTHORITY_HOST;
|
|
6107
|
+
}
|
|
6108
|
+
else if (this.discoveryComplete()) {
|
|
6036
6109
|
return this.metadata.preferred_cache;
|
|
6037
6110
|
}
|
|
6038
6111
|
else {
|
|
@@ -6184,7 +6257,7 @@
|
|
|
6184
6257
|
};
|
|
6185
6258
|
}
|
|
6186
6259
|
|
|
6187
|
-
/*! @azure/msal-common v14.
|
|
6260
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6188
6261
|
|
|
6189
6262
|
/*
|
|
6190
6263
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6215,7 +6288,7 @@
|
|
|
6215
6288
|
}
|
|
6216
6289
|
}
|
|
6217
6290
|
|
|
6218
|
-
/*! @azure/msal-common v14.
|
|
6291
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6219
6292
|
|
|
6220
6293
|
/*
|
|
6221
6294
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6318,7 +6391,7 @@
|
|
|
6318
6391
|
}
|
|
6319
6392
|
}
|
|
6320
6393
|
|
|
6321
|
-
/*! @azure/msal-common v14.
|
|
6394
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6322
6395
|
/*
|
|
6323
6396
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6324
6397
|
* Licensed under the MIT License.
|
|
@@ -6344,7 +6417,7 @@
|
|
|
6344
6417
|
refreshTokenExpired: refreshTokenExpired
|
|
6345
6418
|
});
|
|
6346
6419
|
|
|
6347
|
-
/*! @azure/msal-common v14.
|
|
6420
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6348
6421
|
|
|
6349
6422
|
/*
|
|
6350
6423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6431,7 +6504,7 @@
|
|
|
6431
6504
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6432
6505
|
}
|
|
6433
6506
|
|
|
6434
|
-
/*! @azure/msal-common v14.
|
|
6507
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6435
6508
|
/*
|
|
6436
6509
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6437
6510
|
* Licensed under the MIT License.
|
|
@@ -6447,7 +6520,7 @@
|
|
|
6447
6520
|
}
|
|
6448
6521
|
}
|
|
6449
6522
|
|
|
6450
|
-
/*! @azure/msal-common v14.
|
|
6523
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6451
6524
|
|
|
6452
6525
|
/*
|
|
6453
6526
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6519,7 +6592,7 @@
|
|
|
6519
6592
|
}
|
|
6520
6593
|
}
|
|
6521
6594
|
|
|
6522
|
-
/*! @azure/msal-common v14.
|
|
6595
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6523
6596
|
|
|
6524
6597
|
/*
|
|
6525
6598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6604,7 +6677,7 @@
|
|
|
6604
6677
|
}
|
|
6605
6678
|
}
|
|
6606
6679
|
|
|
6607
|
-
/*! @azure/msal-common v14.
|
|
6680
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6608
6681
|
/*
|
|
6609
6682
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6610
6683
|
* Licensed under the MIT License.
|
|
@@ -6631,7 +6704,7 @@
|
|
|
6631
6704
|
}
|
|
6632
6705
|
}
|
|
6633
6706
|
|
|
6634
|
-
/*! @azure/msal-common v14.
|
|
6707
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6635
6708
|
|
|
6636
6709
|
/*
|
|
6637
6710
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6786,7 +6859,7 @@
|
|
|
6786
6859
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
6787
6860
|
}
|
|
6788
6861
|
}
|
|
6789
|
-
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache);
|
|
6862
|
+
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
|
|
6790
6863
|
}
|
|
6791
6864
|
finally {
|
|
6792
6865
|
if (this.persistencePlugin &&
|
|
@@ -6984,7 +7057,7 @@
|
|
|
6984
7057
|
return baseAccount;
|
|
6985
7058
|
}
|
|
6986
7059
|
|
|
6987
|
-
/*! @azure/msal-common v14.
|
|
7060
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
6988
7061
|
|
|
6989
7062
|
/*
|
|
6990
7063
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7269,7 +7342,11 @@
|
|
|
7269
7342
|
}
|
|
7270
7343
|
else if (request.account) {
|
|
7271
7344
|
const accountSid = this.extractAccountSid(request.account);
|
|
7272
|
-
|
|
7345
|
+
let accountLoginHintClaim = this.extractLoginHint(request.account);
|
|
7346
|
+
if (accountLoginHintClaim && request.domainHint) {
|
|
7347
|
+
this.logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`);
|
|
7348
|
+
accountLoginHintClaim = null;
|
|
7349
|
+
}
|
|
7273
7350
|
// If login_hint claim is present, use it over sid/username
|
|
7274
7351
|
if (accountLoginHintClaim) {
|
|
7275
7352
|
this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
|
|
@@ -7389,7 +7466,7 @@
|
|
|
7389
7466
|
}
|
|
7390
7467
|
}
|
|
7391
7468
|
|
|
7392
|
-
/*! @azure/msal-common v14.
|
|
7469
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7393
7470
|
|
|
7394
7471
|
/*
|
|
7395
7472
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7596,7 +7673,7 @@
|
|
|
7596
7673
|
}
|
|
7597
7674
|
}
|
|
7598
7675
|
|
|
7599
|
-
/*! @azure/msal-common v14.
|
|
7676
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7600
7677
|
|
|
7601
7678
|
/*
|
|
7602
7679
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7732,7 +7809,7 @@
|
|
|
7732
7809
|
}
|
|
7733
7810
|
}
|
|
7734
7811
|
|
|
7735
|
-
/*! @azure/msal-common v14.
|
|
7812
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7736
7813
|
|
|
7737
7814
|
/*
|
|
7738
7815
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7747,7 +7824,7 @@
|
|
|
7747
7824
|
},
|
|
7748
7825
|
};
|
|
7749
7826
|
|
|
7750
|
-
/*! @azure/msal-common v14.
|
|
7827
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7751
7828
|
/*
|
|
7752
7829
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7753
7830
|
* Licensed under the MIT License.
|
|
@@ -7755,7 +7832,7 @@
|
|
|
7755
7832
|
const missingKidError = "missing_kid_error";
|
|
7756
7833
|
const missingAlgError = "missing_alg_error";
|
|
7757
7834
|
|
|
7758
|
-
/*! @azure/msal-common v14.
|
|
7835
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7759
7836
|
|
|
7760
7837
|
/*
|
|
7761
7838
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7780,7 +7857,7 @@
|
|
|
7780
7857
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7781
7858
|
}
|
|
7782
7859
|
|
|
7783
|
-
/*! @azure/msal-common v14.
|
|
7860
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7784
7861
|
|
|
7785
7862
|
/*
|
|
7786
7863
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7820,7 +7897,7 @@
|
|
|
7820
7897
|
}
|
|
7821
7898
|
}
|
|
7822
7899
|
|
|
7823
|
-
/*! @azure/msal-common v14.
|
|
7900
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7824
7901
|
|
|
7825
7902
|
/*
|
|
7826
7903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7878,7 +7955,7 @@
|
|
|
7878
7955
|
}
|
|
7879
7956
|
}
|
|
7880
7957
|
|
|
7881
|
-
/*! @azure/msal-common v14.
|
|
7958
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
7882
7959
|
|
|
7883
7960
|
/*
|
|
7884
7961
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8082,7 +8159,7 @@
|
|
|
8082
8159
|
}
|
|
8083
8160
|
}
|
|
8084
8161
|
|
|
8085
|
-
/*! @azure/msal-common v14.
|
|
8162
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
8086
8163
|
|
|
8087
8164
|
/*
|
|
8088
8165
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8161,7 +8238,7 @@
|
|
|
8161
8238
|
}
|
|
8162
8239
|
}
|
|
8163
8240
|
|
|
8164
|
-
/*! @azure/msal-common v14.
|
|
8241
|
+
/*! @azure/msal-common v14.9.0 2024-04-11 */
|
|
8165
8242
|
|
|
8166
8243
|
/*
|
|
8167
8244
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8261,6 +8338,10 @@
|
|
|
8261
8338
|
event.subErrorCode = error.subError;
|
|
8262
8339
|
return;
|
|
8263
8340
|
}
|
|
8341
|
+
else if (error instanceof CacheError) {
|
|
8342
|
+
event.errorCode = error.errorCode;
|
|
8343
|
+
return;
|
|
8344
|
+
}
|
|
8264
8345
|
else if (event.errorStack?.length) {
|
|
8265
8346
|
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
|
|
8266
8347
|
return;
|
|
@@ -10017,7 +10098,7 @@
|
|
|
10017
10098
|
|
|
10018
10099
|
/* eslint-disable header/header */
|
|
10019
10100
|
const name = "@azure/msal-browser";
|
|
10020
|
-
const version = "3.
|
|
10101
|
+
const version = "3.13.0";
|
|
10021
10102
|
|
|
10022
10103
|
/*
|
|
10023
10104
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10152,11 +10233,7 @@
|
|
|
10152
10233
|
if (window.nestedAppAuthBridge === undefined) {
|
|
10153
10234
|
throw new Error("window.nestedAppAuthBridge is undefined");
|
|
10154
10235
|
}
|
|
10155
|
-
if (window.crypto === undefined) {
|
|
10156
|
-
throw new Error("window.crypto is undefined");
|
|
10157
|
-
}
|
|
10158
10236
|
try {
|
|
10159
|
-
BridgeProxy.crypto = window.crypto;
|
|
10160
10237
|
window.nestedAppAuthBridge.addEventListener("message", (response) => {
|
|
10161
10238
|
const responsePayload = typeof response === "string" ? response : response.data;
|
|
10162
10239
|
const responseEnvelope = JSON.parse(responsePayload);
|
|
@@ -10175,7 +10252,7 @@
|
|
|
10175
10252
|
const message = {
|
|
10176
10253
|
messageType: "NestedAppAuthRequest",
|
|
10177
10254
|
method: "GetInitContext",
|
|
10178
|
-
requestId:
|
|
10255
|
+
requestId: createNewGuid(),
|
|
10179
10256
|
};
|
|
10180
10257
|
const request = {
|
|
10181
10258
|
requestId: message.requestId,
|
|
@@ -10193,9 +10270,6 @@
|
|
|
10193
10270
|
throw error;
|
|
10194
10271
|
}
|
|
10195
10272
|
}
|
|
10196
|
-
static getRandomId() {
|
|
10197
|
-
return BridgeProxy.crypto.randomUUID();
|
|
10198
|
-
}
|
|
10199
10273
|
/**
|
|
10200
10274
|
* getTokenInteractive - Attempts to get a token interactively from the bridge
|
|
10201
10275
|
* @param request A token request
|
|
@@ -10237,7 +10311,7 @@
|
|
|
10237
10311
|
const message = {
|
|
10238
10312
|
messageType: "NestedAppAuthRequest",
|
|
10239
10313
|
method: method,
|
|
10240
|
-
requestId:
|
|
10314
|
+
requestId: createNewGuid(),
|
|
10241
10315
|
...requestParams,
|
|
10242
10316
|
};
|
|
10243
10317
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -11072,7 +11146,7 @@
|
|
|
11072
11146
|
* parameters such as state and nonce, generally.
|
|
11073
11147
|
*/
|
|
11074
11148
|
class BrowserCacheManager extends CacheManager {
|
|
11075
|
-
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions) {
|
|
11149
|
+
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions, performanceClient) {
|
|
11076
11150
|
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
11077
11151
|
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
11078
11152
|
this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
@@ -11086,6 +11160,7 @@
|
|
|
11086
11160
|
this.migrateCacheEntries();
|
|
11087
11161
|
this.createKeyMaps();
|
|
11088
11162
|
}
|
|
11163
|
+
this.performanceClient = performanceClient;
|
|
11089
11164
|
}
|
|
11090
11165
|
/**
|
|
11091
11166
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
@@ -12306,6 +12381,33 @@
|
|
|
12306
12381
|
const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
|
|
12307
12382
|
return this.saveCacheRecord(cacheRecord);
|
|
12308
12383
|
}
|
|
12384
|
+
/**
|
|
12385
|
+
* saves a cache record
|
|
12386
|
+
* @param cacheRecord {CacheRecord}
|
|
12387
|
+
* @param storeInCache {?StoreInCache}
|
|
12388
|
+
* @param correlationId {?string} correlation id
|
|
12389
|
+
*/
|
|
12390
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
12391
|
+
try {
|
|
12392
|
+
await super.saveCacheRecord(cacheRecord, storeInCache, correlationId);
|
|
12393
|
+
}
|
|
12394
|
+
catch (e) {
|
|
12395
|
+
if (e instanceof CacheError &&
|
|
12396
|
+
this.performanceClient &&
|
|
12397
|
+
correlationId) {
|
|
12398
|
+
try {
|
|
12399
|
+
const tokenKeys = this.getTokenKeys();
|
|
12400
|
+
this.performanceClient.addFields({
|
|
12401
|
+
cacheRtCount: tokenKeys.refreshToken.length,
|
|
12402
|
+
cacheIdCount: tokenKeys.idToken.length,
|
|
12403
|
+
cacheAtCount: tokenKeys.accessToken.length,
|
|
12404
|
+
}, correlationId);
|
|
12405
|
+
}
|
|
12406
|
+
catch (e) { }
|
|
12407
|
+
}
|
|
12408
|
+
throw e;
|
|
12409
|
+
}
|
|
12410
|
+
}
|
|
12309
12411
|
}
|
|
12310
12412
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
12311
12413
|
const cacheOptions = {
|
|
@@ -14964,6 +15066,7 @@
|
|
|
14964
15066
|
*/
|
|
14965
15067
|
function createHiddenIframe() {
|
|
14966
15068
|
const authFrame = document.createElement("iframe");
|
|
15069
|
+
authFrame.className = "msalSilentIframe";
|
|
14967
15070
|
authFrame.style.visibility = "hidden";
|
|
14968
15071
|
authFrame.style.position = "absolute";
|
|
14969
15072
|
authFrame.style.width = authFrame.style.height = "0";
|
|
@@ -15475,7 +15578,7 @@
|
|
|
15475
15578
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
15476
15579
|
// Initialize the browser storage class.
|
|
15477
15580
|
this.browserStorage = this.isBrowserEnvironment
|
|
15478
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth))
|
|
15581
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth), this.performanceClient)
|
|
15479
15582
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
15480
15583
|
// initialize in memory storage for native flows
|
|
15481
15584
|
const nativeCacheOptions = {
|
|
@@ -15486,7 +15589,7 @@
|
|
|
15486
15589
|
cacheMigrationEnabled: false,
|
|
15487
15590
|
claimsBasedCachingEnabled: false,
|
|
15488
15591
|
};
|
|
15489
|
-
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
15592
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, undefined, this.performanceClient);
|
|
15490
15593
|
// Initialize the token cache
|
|
15491
15594
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
15492
15595
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -15549,7 +15652,6 @@
|
|
|
15549
15652
|
this.logger.verbose("handleRedirectPromise called");
|
|
15550
15653
|
// Block token acquisition before initialize has been called
|
|
15551
15654
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
15552
|
-
const loggedInAccounts = this.getAllAccounts();
|
|
15553
15655
|
if (this.isBrowserEnvironment) {
|
|
15554
15656
|
/**
|
|
15555
15657
|
* Store the promise on the PublicClientApplication instance if this is the first invocation of handleRedirectPromise,
|
|
@@ -15559,64 +15661,9 @@
|
|
|
15559
15661
|
const redirectResponseKey = hash || "";
|
|
15560
15662
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
15561
15663
|
if (typeof response === "undefined") {
|
|
15562
|
-
|
|
15563
|
-
const useNative = request &&
|
|
15564
|
-
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15565
|
-
this.nativeExtensionProvider &&
|
|
15566
|
-
!hash;
|
|
15567
|
-
const correlationId = useNative
|
|
15568
|
-
? request?.correlationId
|
|
15569
|
-
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15570
|
-
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15571
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15572
|
-
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15573
|
-
let redirectResponse;
|
|
15574
|
-
if (useNative && this.nativeExtensionProvider) {
|
|
15575
|
-
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15576
|
-
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);
|
|
15577
|
-
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15578
|
-
}
|
|
15579
|
-
else {
|
|
15580
|
-
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15581
|
-
const redirectClient = this.createRedirectClient(correlationId);
|
|
15582
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
15583
|
-
}
|
|
15584
|
-
response = redirectResponse
|
|
15585
|
-
.then((result) => {
|
|
15586
|
-
if (result) {
|
|
15587
|
-
// Emit login event if number of accounts change
|
|
15588
|
-
const isLoggingIn = loggedInAccounts.length <
|
|
15589
|
-
this.getAllAccounts().length;
|
|
15590
|
-
if (isLoggingIn) {
|
|
15591
|
-
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15592
|
-
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15593
|
-
}
|
|
15594
|
-
else {
|
|
15595
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15596
|
-
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15597
|
-
}
|
|
15598
|
-
rootMeasurement.end({ success: true });
|
|
15599
|
-
}
|
|
15600
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15601
|
-
rootMeasurement.end({ success: false });
|
|
15602
|
-
return result;
|
|
15603
|
-
})
|
|
15604
|
-
.catch((e) => {
|
|
15605
|
-
const eventError = e;
|
|
15606
|
-
// Emit login event if there is an account
|
|
15607
|
-
if (loggedInAccounts.length > 0) {
|
|
15608
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15609
|
-
}
|
|
15610
|
-
else {
|
|
15611
|
-
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15612
|
-
}
|
|
15613
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15614
|
-
rootMeasurement.end({
|
|
15615
|
-
success: false,
|
|
15616
|
-
}, eventError);
|
|
15617
|
-
throw e;
|
|
15618
|
-
});
|
|
15664
|
+
response = this.handleRedirectPromiseInternal(hash);
|
|
15619
15665
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
15666
|
+
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15620
15667
|
}
|
|
15621
15668
|
else {
|
|
15622
15669
|
this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");
|
|
@@ -15626,6 +15673,69 @@
|
|
|
15626
15673
|
this.logger.verbose("handleRedirectPromise returns null, not browser environment");
|
|
15627
15674
|
return null;
|
|
15628
15675
|
}
|
|
15676
|
+
/**
|
|
15677
|
+
* The internal details of handleRedirectPromise. This is separated out to a helper to allow handleRedirectPromise to memoize requests
|
|
15678
|
+
* @param hash
|
|
15679
|
+
* @returns
|
|
15680
|
+
*/
|
|
15681
|
+
async handleRedirectPromiseInternal(hash) {
|
|
15682
|
+
const loggedInAccounts = this.getAllAccounts();
|
|
15683
|
+
const request = this.browserStorage.getCachedNativeRequest();
|
|
15684
|
+
const useNative = request &&
|
|
15685
|
+
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15686
|
+
this.nativeExtensionProvider &&
|
|
15687
|
+
!hash;
|
|
15688
|
+
const correlationId = useNative
|
|
15689
|
+
? request?.correlationId
|
|
15690
|
+
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15691
|
+
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15692
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15693
|
+
let redirectResponse;
|
|
15694
|
+
if (useNative && this.nativeExtensionProvider) {
|
|
15695
|
+
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15696
|
+
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);
|
|
15697
|
+
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15698
|
+
}
|
|
15699
|
+
else {
|
|
15700
|
+
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15701
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15702
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
15703
|
+
}
|
|
15704
|
+
return redirectResponse
|
|
15705
|
+
.then((result) => {
|
|
15706
|
+
if (result) {
|
|
15707
|
+
// Emit login event if number of accounts change
|
|
15708
|
+
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
15709
|
+
if (isLoggingIn) {
|
|
15710
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15711
|
+
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15712
|
+
}
|
|
15713
|
+
else {
|
|
15714
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15715
|
+
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15716
|
+
}
|
|
15717
|
+
rootMeasurement.end({ success: true });
|
|
15718
|
+
}
|
|
15719
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15720
|
+
rootMeasurement.end({ success: false });
|
|
15721
|
+
return result;
|
|
15722
|
+
})
|
|
15723
|
+
.catch((e) => {
|
|
15724
|
+
const eventError = e;
|
|
15725
|
+
// Emit login event if there is an account
|
|
15726
|
+
if (loggedInAccounts.length > 0) {
|
|
15727
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15728
|
+
}
|
|
15729
|
+
else {
|
|
15730
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15731
|
+
}
|
|
15732
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15733
|
+
rootMeasurement.end({
|
|
15734
|
+
success: false,
|
|
15735
|
+
}, eventError);
|
|
15736
|
+
throw e;
|
|
15737
|
+
});
|
|
15738
|
+
}
|
|
15629
15739
|
/**
|
|
15630
15740
|
* 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
|
|
15631
15741
|
* the page, so any code that follows this function will not execute.
|
|
@@ -16584,49 +16694,69 @@
|
|
|
16584
16694
|
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
16585
16695
|
}
|
|
16586
16696
|
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
|
|
16611
|
-
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16697
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
16698
|
+
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
16699
|
+
const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
|
|
16700
|
+
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy);
|
|
16701
|
+
if (shouldTryToResolveSilently) {
|
|
16702
|
+
if (!this.activeIframeRequest) {
|
|
16703
|
+
let _resolve, _reject;
|
|
16704
|
+
// Always set the active request tracker immediately after checking it to prevent races
|
|
16705
|
+
this.activeIframeRequest = [
|
|
16706
|
+
new Promise((resolve, reject) => {
|
|
16707
|
+
_resolve = resolve;
|
|
16708
|
+
_reject = reject;
|
|
16709
|
+
}),
|
|
16710
|
+
silentRequest.correlationId,
|
|
16711
|
+
];
|
|
16712
|
+
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", silentRequest.correlationId);
|
|
16713
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest)
|
|
16714
|
+
.then((iframeResult) => {
|
|
16715
|
+
_resolve();
|
|
16716
|
+
return iframeResult;
|
|
16717
|
+
})
|
|
16718
|
+
.catch((e) => {
|
|
16719
|
+
_reject(e);
|
|
16720
|
+
throw e;
|
|
16721
|
+
})
|
|
16722
|
+
.finally(() => {
|
|
16723
|
+
this.activeIframeRequest = undefined;
|
|
16724
|
+
});
|
|
16615
16725
|
}
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
|
|
16622
|
-
}
|
|
16623
|
-
|
|
16624
|
-
|
|
16726
|
+
else if (cacheLookupPolicy !== CacheLookupPolicy.Skip) {
|
|
16727
|
+
const [activePromise, activeCorrelationId] = this.activeIframeRequest;
|
|
16728
|
+
this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${activeCorrelationId}`, silentRequest.correlationId);
|
|
16729
|
+
const awaitConcurrentIframeMeasure = this.performanceClient.startMeasurement(PerformanceEvents.AwaitConcurrentIframe, silentRequest.correlationId);
|
|
16730
|
+
awaitConcurrentIframeMeasure.add({
|
|
16731
|
+
awaitIframeCorrelationId: activeCorrelationId,
|
|
16732
|
+
});
|
|
16733
|
+
// Await for errors first so we can distinguish errors thrown by activePromise versus errors thrown by .then below
|
|
16734
|
+
await activePromise.catch(() => {
|
|
16735
|
+
awaitConcurrentIframeMeasure.end({
|
|
16736
|
+
success: false,
|
|
16737
|
+
});
|
|
16738
|
+
this.logger.info(`Iframe request with correlationId: ${activeCorrelationId} failed. Interaction is required.`);
|
|
16739
|
+
// If previous iframe request failed, it's unlikely to succeed this time. Throw original error.
|
|
16625
16740
|
throw refreshTokenError;
|
|
16626
|
-
}
|
|
16627
|
-
|
|
16628
|
-
|
|
16629
|
-
|
|
16741
|
+
});
|
|
16742
|
+
return activePromise.then(() => {
|
|
16743
|
+
awaitConcurrentIframeMeasure.end({ success: true });
|
|
16744
|
+
this.logger.verbose(`Parallel iframe request with correlationId: ${activeCorrelationId} succeeded. Retrying cache and/or RT redemption`, silentRequest.correlationId);
|
|
16745
|
+
// Retry cache lookup and/or RT exchange after iframe completes
|
|
16746
|
+
return this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy);
|
|
16747
|
+
});
|
|
16748
|
+
}
|
|
16749
|
+
else {
|
|
16750
|
+
// Cache policy set to skip and another iframe request is already in progress
|
|
16751
|
+
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);
|
|
16752
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
16753
|
+
}
|
|
16754
|
+
}
|
|
16755
|
+
else {
|
|
16756
|
+
// Error cannot be silently resolved or iframe renewal is not allowed, interaction required
|
|
16757
|
+
throw refreshTokenError;
|
|
16758
|
+
}
|
|
16759
|
+
});
|
|
16630
16760
|
return result
|
|
16631
16761
|
.then((response) => {
|
|
16632
16762
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
@@ -16647,6 +16777,38 @@
|
|
|
16647
16777
|
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16648
16778
|
});
|
|
16649
16779
|
}
|
|
16780
|
+
/**
|
|
16781
|
+
* 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.
|
|
16782
|
+
* @param silentRequest
|
|
16783
|
+
* @param cacheLookupPolicy
|
|
16784
|
+
* @returns
|
|
16785
|
+
*/
|
|
16786
|
+
async acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy) {
|
|
16787
|
+
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, silentRequest.authenticationScheme) &&
|
|
16788
|
+
silentRequest.account.nativeAccountId) {
|
|
16789
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
16790
|
+
return this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
16791
|
+
// If native token acquisition fails for availability reasons fallback to web flow
|
|
16792
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
16793
|
+
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
16794
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
16795
|
+
// Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal
|
|
16796
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
16797
|
+
}
|
|
16798
|
+
throw e;
|
|
16799
|
+
});
|
|
16800
|
+
}
|
|
16801
|
+
else {
|
|
16802
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16803
|
+
return invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
16804
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
16805
|
+
throw cacheError;
|
|
16806
|
+
}
|
|
16807
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
16808
|
+
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy);
|
|
16809
|
+
});
|
|
16810
|
+
}
|
|
16811
|
+
}
|
|
16650
16812
|
}
|
|
16651
16813
|
/**
|
|
16652
16814
|
* Determines whether an error thrown by the refresh token endpoint can be resolved without interaction
|
|
@@ -16655,7 +16817,7 @@
|
|
|
16655
16817
|
* @param cacheLookupPolicy
|
|
16656
16818
|
* @returns
|
|
16657
16819
|
*/
|
|
16658
|
-
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError,
|
|
16820
|
+
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy) {
|
|
16659
16821
|
const noInteractionRequired = !(refreshTokenError instanceof InteractionRequiredAuthError &&
|
|
16660
16822
|
// For refresh token errors, bad_token does not always require interaction (silently resolvable)
|
|
16661
16823
|
refreshTokenError.subError !==
|
|
@@ -17049,7 +17211,7 @@
|
|
|
17049
17211
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
17050
17212
|
// Initialize the browser storage class.
|
|
17051
17213
|
this.browserStorage = this.isBrowserEnvironment
|
|
17052
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger)
|
|
17214
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, undefined, this.performanceClient)
|
|
17053
17215
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
17054
17216
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
17055
17217
|
}
|
|
@@ -18548,12 +18710,7 @@
|
|
|
18548
18710
|
}
|
|
18549
18711
|
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18550
18712
|
) {
|
|
18551
|
-
|
|
18552
|
-
return this.acquireTokenInteractive(request);
|
|
18553
|
-
}
|
|
18554
|
-
else {
|
|
18555
|
-
throw NestedAppAuthError.createUnsupportedError();
|
|
18556
|
-
}
|
|
18713
|
+
return this.acquireTokenInteractive(request || DEFAULT_REQUEST);
|
|
18557
18714
|
}
|
|
18558
18715
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18559
18716
|
loginRedirect(request) {
|