@azure/msal-browser 3.27.0 → 4.0.0-alpha.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/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +9 -85
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +55 -398
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.d.ts +16 -0
- package/dist/cache/CacheHelpers.d.ts.map +1 -0
- package/dist/cache/CacheHelpers.mjs +46 -0
- package/dist/cache/CacheHelpers.mjs.map +1 -0
- package/dist/cache/CookieStorage.d.ts +17 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -0
- package/dist/cache/CookieStorage.mjs +73 -0
- package/dist/cache/CookieStorage.mjs.map +1 -0
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/ITokenCache.d.ts +1 -1
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/IWindowStorage.d.ts +12 -0
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.d.ts +43 -0
- package/dist/cache/LocalStorage.d.ts.map +1 -0
- package/dist/cache/LocalStorage.mjs +201 -0
- package/dist/cache/LocalStorage.mjs.map +1 -0
- package/dist/cache/MemoryStorage.d.ts +3 -0
- package/dist/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.mjs +10 -1
- package/dist/cache/MemoryStorage.mjs.map +1 -1
- package/dist/cache/SessionStorage.d.ts +13 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -0
- package/dist/cache/SessionStorage.mjs +43 -0
- package/dist/cache/SessionStorage.mjs.map +1 -0
- package/dist/cache/TokenCache.d.ts +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +15 -15
- package/dist/cache/TokenCache.mjs.map +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 +4 -4
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +3 -2
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +27 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +83 -3
- package/dist/crypto/BrowserCrypto.mjs.map +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.d.ts +5 -0
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +2 -2
- package/dist/encode/Base64Decode.mjs.map +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.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -4
- package/dist/interaction_client/NativeInteractionClient.mjs.map +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.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +5 -8
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +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/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +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 +587 -622
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +587 -622
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +65 -66
- package/lib/types/cache/BrowserCacheManager.d.ts +9 -85
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/CacheHelpers.d.ts +16 -0
- package/lib/types/cache/CacheHelpers.d.ts.map +1 -0
- package/lib/types/cache/CookieStorage.d.ts +17 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -0
- package/lib/types/cache/ITokenCache.d.ts +1 -1
- package/lib/types/cache/ITokenCache.d.ts.map +1 -1
- package/lib/types/cache/IWindowStorage.d.ts +12 -0
- package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/types/cache/LocalStorage.d.ts +43 -0
- package/lib/types/cache/LocalStorage.d.ts.map +1 -0
- package/lib/types/cache/MemoryStorage.d.ts +3 -0
- package/lib/types/cache/MemoryStorage.d.ts.map +1 -1
- package/lib/types/cache/SessionStorage.d.ts +13 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -0
- package/lib/types/cache/TokenCache.d.ts +1 -1
- package/lib/types/cache/TokenCache.d.ts.map +1 -1
- package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts +27 -0
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/encode/Base64Decode.d.ts +5 -0
- package/lib/types/encode/Base64Decode.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cache/BrowserCacheManager.ts +85 -552
- package/src/cache/CacheHelpers.ts +52 -0
- package/src/cache/CookieStorage.ts +98 -0
- package/src/cache/ITokenCache.ts +1 -1
- package/src/cache/IWindowStorage.ts +14 -0
- package/src/cache/LocalStorage.ts +270 -0
- package/src/cache/MemoryStorage.ts +12 -0
- package/src/cache/SessionStorage.ts +52 -0
- package/src/cache/TokenCache.ts +19 -19
- package/src/controllers/NestedAppAuthController.ts +3 -3
- package/src/controllers/StandardController.ts +3 -1
- package/src/crypto/BrowserCrypto.ts +120 -1
- package/src/encode/Base64Decode.ts +1 -1
- package/src/index.ts +3 -1
- package/src/interaction_client/NativeInteractionClient.ts +3 -3
- package/src/interaction_client/StandardInteractionClient.ts +5 -8
- package/src/packageMetadata.ts +1 -1
- package/dist/cache/BrowserStorage.d.ts +0 -12
- package/dist/cache/BrowserStorage.d.ts.map +0 -1
- package/dist/cache/BrowserStorage.mjs +0 -41
- package/dist/cache/BrowserStorage.mjs.map +0 -1
- package/lib/types/cache/BrowserStorage.d.ts +0 -12
- package/lib/types/cache/BrowserStorage.d.ts.map +0 -1
- package/src/cache/BrowserStorage.ts +0 -52
package/lib/msal-browser.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser
|
|
1
|
+
/*! @azure/msal-browser v4.0.0-alpha.0 2024-12-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common
|
|
5
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -109,12 +109,6 @@ const HeaderNames = {
|
|
|
109
109
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
110
110
|
*/
|
|
111
111
|
const PersistentCacheKeys = {
|
|
112
|
-
ID_TOKEN: "idtoken",
|
|
113
|
-
CLIENT_INFO: "client.info",
|
|
114
|
-
ADAL_ID_TOKEN: "adal.idtoken",
|
|
115
|
-
ERROR: "error",
|
|
116
|
-
ERROR_DESC: "error.description",
|
|
117
|
-
ACTIVE_ACCOUNT: "active-account",
|
|
118
112
|
ACTIVE_ACCOUNT_FILTERS: "active-account-filters", // new cache entry for active_account for a more robust version for browser
|
|
119
113
|
};
|
|
120
114
|
/**
|
|
@@ -312,7 +306,7 @@ const JsonWebTokenTypes = {
|
|
|
312
306
|
// Token renewal offset default in seconds
|
|
313
307
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
314
308
|
|
|
315
|
-
/*! @azure/msal-common
|
|
309
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
316
310
|
/*
|
|
317
311
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
318
312
|
* Licensed under the MIT License.
|
|
@@ -329,7 +323,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
329
323
|
unexpectedError: unexpectedError
|
|
330
324
|
});
|
|
331
325
|
|
|
332
|
-
/*! @azure/msal-common
|
|
326
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
333
327
|
|
|
334
328
|
/*
|
|
335
329
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -378,7 +372,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
378
372
|
: AuthErrorMessages[code]);
|
|
379
373
|
}
|
|
380
374
|
|
|
381
|
-
/*! @azure/msal-common
|
|
375
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
382
376
|
/*
|
|
383
377
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
384
378
|
* Licensed under the MIT License.
|
|
@@ -476,7 +470,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
476
470
|
userTimeoutReached: userTimeoutReached
|
|
477
471
|
});
|
|
478
472
|
|
|
479
|
-
/*! @azure/msal-common
|
|
473
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
480
474
|
|
|
481
475
|
/*
|
|
482
476
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -728,7 +722,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
728
722
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
729
723
|
}
|
|
730
724
|
|
|
731
|
-
/*! @azure/msal-common
|
|
725
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
732
726
|
|
|
733
727
|
/*
|
|
734
728
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -767,7 +761,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
767
761
|
},
|
|
768
762
|
};
|
|
769
763
|
|
|
770
|
-
/*! @azure/msal-common
|
|
764
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
771
765
|
|
|
772
766
|
/*
|
|
773
767
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -958,12 +952,12 @@ class Logger {
|
|
|
958
952
|
}
|
|
959
953
|
}
|
|
960
954
|
|
|
961
|
-
/*! @azure/msal-common
|
|
955
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
962
956
|
/* eslint-disable header/header */
|
|
963
957
|
const name$1 = "@azure/msal-common";
|
|
964
|
-
const version$1 = "
|
|
958
|
+
const version$1 = "15.0.0-alpha.0";
|
|
965
959
|
|
|
966
|
-
/*! @azure/msal-common
|
|
960
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
967
961
|
/*
|
|
968
962
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
969
963
|
* Licensed under the MIT License.
|
|
@@ -983,7 +977,7 @@ const AzureCloudInstance = {
|
|
|
983
977
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
984
978
|
};
|
|
985
979
|
|
|
986
|
-
/*! @azure/msal-common
|
|
980
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
987
981
|
|
|
988
982
|
/*
|
|
989
983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1044,7 +1038,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1044
1038
|
}
|
|
1045
1039
|
}
|
|
1046
1040
|
|
|
1047
|
-
/*! @azure/msal-common
|
|
1041
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1048
1042
|
/*
|
|
1049
1043
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1050
1044
|
* Licensed under the MIT License.
|
|
@@ -1081,7 +1075,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1081
1075
|
return cachedAtSec > nowSeconds();
|
|
1082
1076
|
}
|
|
1083
1077
|
|
|
1084
|
-
/*! @azure/msal-common
|
|
1078
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1085
1079
|
|
|
1086
1080
|
/*
|
|
1087
1081
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1408,7 +1402,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1408
1402
|
return metadata.expiresAt <= nowSeconds();
|
|
1409
1403
|
}
|
|
1410
1404
|
|
|
1411
|
-
/*! @azure/msal-common
|
|
1405
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1412
1406
|
/*
|
|
1413
1407
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1414
1408
|
* Licensed under the MIT License.
|
|
@@ -1462,7 +1456,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1462
1456
|
urlParseError: urlParseError
|
|
1463
1457
|
});
|
|
1464
1458
|
|
|
1465
|
-
/*! @azure/msal-common
|
|
1459
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1466
1460
|
|
|
1467
1461
|
/*
|
|
1468
1462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1600,7 +1594,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1600
1594
|
return new ClientConfigurationError(errorCode);
|
|
1601
1595
|
}
|
|
1602
1596
|
|
|
1603
|
-
/*! @azure/msal-common
|
|
1597
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1604
1598
|
/*
|
|
1605
1599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1606
1600
|
* Licensed under the MIT License.
|
|
@@ -1697,7 +1691,7 @@ class StringUtils {
|
|
|
1697
1691
|
}
|
|
1698
1692
|
}
|
|
1699
1693
|
|
|
1700
|
-
/*! @azure/msal-common
|
|
1694
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1701
1695
|
|
|
1702
1696
|
/*
|
|
1703
1697
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1897,7 +1891,7 @@ class ScopeSet {
|
|
|
1897
1891
|
}
|
|
1898
1892
|
}
|
|
1899
1893
|
|
|
1900
|
-
/*! @azure/msal-common
|
|
1894
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1901
1895
|
|
|
1902
1896
|
/*
|
|
1903
1897
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1937,7 +1931,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1937
1931
|
};
|
|
1938
1932
|
}
|
|
1939
1933
|
|
|
1940
|
-
/*! @azure/msal-common
|
|
1934
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
1941
1935
|
/*
|
|
1942
1936
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1943
1937
|
* Licensed under the MIT License.
|
|
@@ -2016,7 +2010,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
2016
2010
|
return updatedAccountInfo;
|
|
2017
2011
|
}
|
|
2018
2012
|
|
|
2019
|
-
/*! @azure/msal-common
|
|
2013
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2020
2014
|
/*
|
|
2021
2015
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2022
2016
|
* Licensed under the MIT License.
|
|
@@ -2031,7 +2025,7 @@ const AuthorityType = {
|
|
|
2031
2025
|
Ciam: 3,
|
|
2032
2026
|
};
|
|
2033
2027
|
|
|
2034
|
-
/*! @azure/msal-common
|
|
2028
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2035
2029
|
/*
|
|
2036
2030
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2037
2031
|
* Licensed under the MIT License.
|
|
@@ -2053,7 +2047,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2053
2047
|
return null;
|
|
2054
2048
|
}
|
|
2055
2049
|
|
|
2056
|
-
/*! @azure/msal-common
|
|
2050
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2057
2051
|
/*
|
|
2058
2052
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2059
2053
|
* Licensed under the MIT License.
|
|
@@ -2066,7 +2060,7 @@ const ProtocolMode = {
|
|
|
2066
2060
|
OIDC: "OIDC",
|
|
2067
2061
|
};
|
|
2068
2062
|
|
|
2069
|
-
/*! @azure/msal-common
|
|
2063
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2070
2064
|
|
|
2071
2065
|
/*
|
|
2072
2066
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2309,7 +2303,7 @@ class AccountEntity {
|
|
|
2309
2303
|
}
|
|
2310
2304
|
}
|
|
2311
2305
|
|
|
2312
|
-
/*! @azure/msal-common
|
|
2306
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2313
2307
|
|
|
2314
2308
|
/*
|
|
2315
2309
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2356,7 +2350,7 @@ function getDeserializedResponse(responseString) {
|
|
|
2356
2350
|
return null;
|
|
2357
2351
|
}
|
|
2358
2352
|
|
|
2359
|
-
/*! @azure/msal-common
|
|
2353
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2360
2354
|
|
|
2361
2355
|
/*
|
|
2362
2356
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2520,7 +2514,7 @@ class UrlString {
|
|
|
2520
2514
|
}
|
|
2521
2515
|
}
|
|
2522
2516
|
|
|
2523
|
-
/*! @azure/msal-common
|
|
2517
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2524
2518
|
|
|
2525
2519
|
/*
|
|
2526
2520
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2660,7 +2654,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2660
2654
|
return null;
|
|
2661
2655
|
}
|
|
2662
2656
|
|
|
2663
|
-
/*! @azure/msal-common
|
|
2657
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2664
2658
|
/*
|
|
2665
2659
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2666
2660
|
* Licensed under the MIT License.
|
|
@@ -2668,7 +2662,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2668
2662
|
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2669
2663
|
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2670
2664
|
|
|
2671
|
-
/*! @azure/msal-common
|
|
2665
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2672
2666
|
|
|
2673
2667
|
/*
|
|
2674
2668
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2695,7 +2689,7 @@ class CacheError extends Error {
|
|
|
2695
2689
|
}
|
|
2696
2690
|
}
|
|
2697
2691
|
|
|
2698
|
-
/*! @azure/msal-common
|
|
2692
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
2699
2693
|
|
|
2700
2694
|
/*
|
|
2701
2695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2866,10 +2860,10 @@ class CacheManager {
|
|
|
2866
2860
|
}
|
|
2867
2861
|
try {
|
|
2868
2862
|
if (!!cacheRecord.account) {
|
|
2869
|
-
this.setAccount(cacheRecord.account);
|
|
2863
|
+
await this.setAccount(cacheRecord.account);
|
|
2870
2864
|
}
|
|
2871
2865
|
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2872
|
-
this.setIdTokenCredential(cacheRecord.idToken);
|
|
2866
|
+
await this.setIdTokenCredential(cacheRecord.idToken);
|
|
2873
2867
|
}
|
|
2874
2868
|
if (!!cacheRecord.accessToken &&
|
|
2875
2869
|
storeInCache?.accessToken !== false) {
|
|
@@ -2877,7 +2871,7 @@ class CacheManager {
|
|
|
2877
2871
|
}
|
|
2878
2872
|
if (!!cacheRecord.refreshToken &&
|
|
2879
2873
|
storeInCache?.refreshToken !== false) {
|
|
2880
|
-
this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2874
|
+
await this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2881
2875
|
}
|
|
2882
2876
|
if (!!cacheRecord.appMetadata) {
|
|
2883
2877
|
this.setAppMetadata(cacheRecord.appMetadata);
|
|
@@ -2934,7 +2928,7 @@ class CacheManager {
|
|
|
2934
2928
|
}
|
|
2935
2929
|
});
|
|
2936
2930
|
await Promise.all(removedAccessTokens);
|
|
2937
|
-
this.setAccessTokenCredential(credential);
|
|
2931
|
+
await this.setAccessTokenCredential(credential);
|
|
2938
2932
|
}
|
|
2939
2933
|
/**
|
|
2940
2934
|
* Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
|
|
@@ -3220,61 +3214,6 @@ class CacheManager {
|
|
|
3220
3214
|
});
|
|
3221
3215
|
await Promise.all(removedCredentials);
|
|
3222
3216
|
}
|
|
3223
|
-
/**
|
|
3224
|
-
* Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
|
|
3225
|
-
* cache into a condensed multi-tenant account object with tenant profiles.
|
|
3226
|
-
* @param accountKey
|
|
3227
|
-
* @param accountEntity
|
|
3228
|
-
* @param logger
|
|
3229
|
-
* @returns
|
|
3230
|
-
*/
|
|
3231
|
-
updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
|
|
3232
|
-
// Only update if account entity is defined and has no tenantProfiles object (is outdated)
|
|
3233
|
-
if (accountEntity && accountEntity.isSingleTenant()) {
|
|
3234
|
-
this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
|
|
3235
|
-
// Get keys of all accounts belonging to user
|
|
3236
|
-
const matchingAccountKeys = this.getAccountKeys().filter((key) => {
|
|
3237
|
-
return key.startsWith(accountEntity.homeAccountId);
|
|
3238
|
-
});
|
|
3239
|
-
// Get all account entities belonging to user
|
|
3240
|
-
const accountsToMerge = [];
|
|
3241
|
-
matchingAccountKeys.forEach((key) => {
|
|
3242
|
-
const account = this.getCachedAccountEntity(key);
|
|
3243
|
-
if (account) {
|
|
3244
|
-
accountsToMerge.push(account);
|
|
3245
|
-
}
|
|
3246
|
-
});
|
|
3247
|
-
// Set base account to home account if available, any account if not
|
|
3248
|
-
const baseAccount = accountsToMerge.find((account) => {
|
|
3249
|
-
return tenantIdMatchesHomeTenant(account.realm, account.homeAccountId);
|
|
3250
|
-
}) || accountsToMerge[0];
|
|
3251
|
-
// Populate tenant profiles built from each account entity belonging to the user
|
|
3252
|
-
baseAccount.tenantProfiles = accountsToMerge.map((account) => {
|
|
3253
|
-
return {
|
|
3254
|
-
tenantId: account.realm,
|
|
3255
|
-
localAccountId: account.localAccountId,
|
|
3256
|
-
name: account.name,
|
|
3257
|
-
isHomeTenant: tenantIdMatchesHomeTenant(account.realm, account.homeAccountId),
|
|
3258
|
-
};
|
|
3259
|
-
});
|
|
3260
|
-
const updatedAccount = CacheManager.toObject(new AccountEntity(), {
|
|
3261
|
-
...baseAccount,
|
|
3262
|
-
});
|
|
3263
|
-
const newAccountKey = updatedAccount.generateAccountKey();
|
|
3264
|
-
// Clear cache of legacy account objects that have been collpsed into tenant profiles
|
|
3265
|
-
matchingAccountKeys.forEach((key) => {
|
|
3266
|
-
if (key !== newAccountKey) {
|
|
3267
|
-
this.removeOutdatedAccount(accountKey);
|
|
3268
|
-
}
|
|
3269
|
-
});
|
|
3270
|
-
// Cache updated account object
|
|
3271
|
-
this.setAccount(updatedAccount);
|
|
3272
|
-
logger?.verbose("Updated an outdated account entity in the cache");
|
|
3273
|
-
return updatedAccount;
|
|
3274
|
-
}
|
|
3275
|
-
// No update is necessary
|
|
3276
|
-
return accountEntity;
|
|
3277
|
-
}
|
|
3278
3217
|
/**
|
|
3279
3218
|
* returns a boolean if the given credential is removed
|
|
3280
3219
|
* @param credential
|
|
@@ -3870,28 +3809,25 @@ class CacheManager {
|
|
|
3870
3809
|
}
|
|
3871
3810
|
/** @internal */
|
|
3872
3811
|
class DefaultStorageClass extends CacheManager {
|
|
3873
|
-
setAccount() {
|
|
3812
|
+
async setAccount() {
|
|
3874
3813
|
throw createClientAuthError(methodNotImplemented);
|
|
3875
3814
|
}
|
|
3876
3815
|
getAccount() {
|
|
3877
3816
|
throw createClientAuthError(methodNotImplemented);
|
|
3878
3817
|
}
|
|
3879
|
-
|
|
3880
|
-
throw createClientAuthError(methodNotImplemented);
|
|
3881
|
-
}
|
|
3882
|
-
setIdTokenCredential() {
|
|
3818
|
+
async setIdTokenCredential() {
|
|
3883
3819
|
throw createClientAuthError(methodNotImplemented);
|
|
3884
3820
|
}
|
|
3885
3821
|
getIdTokenCredential() {
|
|
3886
3822
|
throw createClientAuthError(methodNotImplemented);
|
|
3887
3823
|
}
|
|
3888
|
-
setAccessTokenCredential() {
|
|
3824
|
+
async setAccessTokenCredential() {
|
|
3889
3825
|
throw createClientAuthError(methodNotImplemented);
|
|
3890
3826
|
}
|
|
3891
3827
|
getAccessTokenCredential() {
|
|
3892
3828
|
throw createClientAuthError(methodNotImplemented);
|
|
3893
3829
|
}
|
|
3894
|
-
setRefreshTokenCredential() {
|
|
3830
|
+
async setRefreshTokenCredential() {
|
|
3895
3831
|
throw createClientAuthError(methodNotImplemented);
|
|
3896
3832
|
}
|
|
3897
3833
|
getRefreshTokenCredential() {
|
|
@@ -3936,15 +3872,9 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3936
3872
|
getTokenKeys() {
|
|
3937
3873
|
throw createClientAuthError(methodNotImplemented);
|
|
3938
3874
|
}
|
|
3939
|
-
updateCredentialCacheKey() {
|
|
3940
|
-
throw createClientAuthError(methodNotImplemented);
|
|
3941
|
-
}
|
|
3942
|
-
removeOutdatedAccount() {
|
|
3943
|
-
throw createClientAuthError(methodNotImplemented);
|
|
3944
|
-
}
|
|
3945
3875
|
}
|
|
3946
3876
|
|
|
3947
|
-
/*! @azure/msal-common
|
|
3877
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
3948
3878
|
|
|
3949
3879
|
/*
|
|
3950
3880
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4043,7 +3973,7 @@ function isOidcProtocolMode(config) {
|
|
|
4043
3973
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
4044
3974
|
}
|
|
4045
3975
|
|
|
4046
|
-
/*! @azure/msal-common
|
|
3976
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4047
3977
|
/*
|
|
4048
3978
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4049
3979
|
* Licensed under the MIT License.
|
|
@@ -4053,7 +3983,7 @@ const CcsCredentialType = {
|
|
|
4053
3983
|
UPN: "UPN",
|
|
4054
3984
|
};
|
|
4055
3985
|
|
|
4056
|
-
/*! @azure/msal-common
|
|
3986
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4057
3987
|
/*
|
|
4058
3988
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4059
3989
|
* Licensed under the MIT License.
|
|
@@ -4103,7 +4033,7 @@ const X_CLIENT_EXTRA_SKU = "x-client-xtra-sku";
|
|
|
4103
4033
|
const BROKER_CLIENT_ID = "brk_client_id";
|
|
4104
4034
|
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4105
4035
|
|
|
4106
|
-
/*! @azure/msal-common
|
|
4036
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4107
4037
|
|
|
4108
4038
|
/*
|
|
4109
4039
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4170,7 +4100,7 @@ class RequestValidator {
|
|
|
4170
4100
|
}
|
|
4171
4101
|
}
|
|
4172
4102
|
|
|
4173
|
-
/*! @azure/msal-common
|
|
4103
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4174
4104
|
|
|
4175
4105
|
/*
|
|
4176
4106
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4578,7 +4508,7 @@ class RequestParameterBuilder {
|
|
|
4578
4508
|
}
|
|
4579
4509
|
}
|
|
4580
4510
|
|
|
4581
|
-
/*! @azure/msal-common
|
|
4511
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4582
4512
|
/*
|
|
4583
4513
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4584
4514
|
* Licensed under the MIT License.
|
|
@@ -4590,7 +4520,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
4590
4520
|
response.hasOwnProperty("jwks_uri"));
|
|
4591
4521
|
}
|
|
4592
4522
|
|
|
4593
|
-
/*! @azure/msal-common
|
|
4523
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4594
4524
|
/*
|
|
4595
4525
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4596
4526
|
* Licensed under the MIT License.
|
|
@@ -4600,7 +4530,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
4600
4530
|
response.hasOwnProperty("metadata"));
|
|
4601
4531
|
}
|
|
4602
4532
|
|
|
4603
|
-
/*! @azure/msal-common
|
|
4533
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4604
4534
|
/*
|
|
4605
4535
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4606
4536
|
* Licensed under the MIT License.
|
|
@@ -4610,7 +4540,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
4610
4540
|
response.hasOwnProperty("error_description"));
|
|
4611
4541
|
}
|
|
4612
4542
|
|
|
4613
|
-
/*! @azure/msal-common
|
|
4543
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
4614
4544
|
/*
|
|
4615
4545
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4616
4546
|
* Licensed under the MIT License.
|
|
@@ -5097,7 +5027,7 @@ const IntFields = new Set([
|
|
|
5097
5027
|
"multiMatchedRT",
|
|
5098
5028
|
]);
|
|
5099
5029
|
|
|
5100
|
-
/*! @azure/msal-common
|
|
5030
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
5101
5031
|
/*
|
|
5102
5032
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5103
5033
|
* Licensed under the MIT License.
|
|
@@ -5193,7 +5123,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5193
5123
|
};
|
|
5194
5124
|
};
|
|
5195
5125
|
|
|
5196
|
-
/*! @azure/msal-common
|
|
5126
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
5197
5127
|
|
|
5198
5128
|
/*
|
|
5199
5129
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5302,7 +5232,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5302
5232
|
},
|
|
5303
5233
|
};
|
|
5304
5234
|
|
|
5305
|
-
/*! @azure/msal-common
|
|
5235
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
5306
5236
|
|
|
5307
5237
|
/*
|
|
5308
5238
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6141,7 +6071,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
6141
6071
|
};
|
|
6142
6072
|
}
|
|
6143
6073
|
|
|
6144
|
-
/*! @azure/msal-common
|
|
6074
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6145
6075
|
|
|
6146
6076
|
/*
|
|
6147
6077
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6172,7 +6102,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
6172
6102
|
}
|
|
6173
6103
|
}
|
|
6174
6104
|
|
|
6175
|
-
/*! @azure/msal-common
|
|
6105
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6176
6106
|
|
|
6177
6107
|
/*
|
|
6178
6108
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6191,7 +6121,7 @@ class ServerError extends AuthError {
|
|
|
6191
6121
|
}
|
|
6192
6122
|
}
|
|
6193
6123
|
|
|
6194
|
-
/*! @azure/msal-common
|
|
6124
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6195
6125
|
|
|
6196
6126
|
/*
|
|
6197
6127
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6289,7 +6219,7 @@ class ThrottlingUtils {
|
|
|
6289
6219
|
}
|
|
6290
6220
|
}
|
|
6291
6221
|
|
|
6292
|
-
/*! @azure/msal-common
|
|
6222
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6293
6223
|
|
|
6294
6224
|
/*
|
|
6295
6225
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6319,7 +6249,7 @@ function createNetworkError(error, httpStatus, responseHeaders) {
|
|
|
6319
6249
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6320
6250
|
}
|
|
6321
6251
|
|
|
6322
|
-
/*! @azure/msal-common
|
|
6252
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6323
6253
|
|
|
6324
6254
|
/*
|
|
6325
6255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6469,7 +6399,7 @@ class BaseClient {
|
|
|
6469
6399
|
}
|
|
6470
6400
|
}
|
|
6471
6401
|
|
|
6472
|
-
/*! @azure/msal-common
|
|
6402
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6473
6403
|
/*
|
|
6474
6404
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6475
6405
|
* Licensed under the MIT License.
|
|
@@ -6495,7 +6425,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6495
6425
|
refreshTokenExpired: refreshTokenExpired
|
|
6496
6426
|
});
|
|
6497
6427
|
|
|
6498
|
-
/*! @azure/msal-common
|
|
6428
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6499
6429
|
|
|
6500
6430
|
/*
|
|
6501
6431
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6583,7 +6513,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6583
6513
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6584
6514
|
}
|
|
6585
6515
|
|
|
6586
|
-
/*! @azure/msal-common
|
|
6516
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6587
6517
|
|
|
6588
6518
|
/*
|
|
6589
6519
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6655,7 +6585,7 @@ class ProtocolUtils {
|
|
|
6655
6585
|
}
|
|
6656
6586
|
}
|
|
6657
6587
|
|
|
6658
|
-
/*! @azure/msal-common
|
|
6588
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6659
6589
|
|
|
6660
6590
|
/*
|
|
6661
6591
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6739,7 +6669,7 @@ class PopTokenGenerator {
|
|
|
6739
6669
|
}
|
|
6740
6670
|
}
|
|
6741
6671
|
|
|
6742
|
-
/*! @azure/msal-common
|
|
6672
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6743
6673
|
/*
|
|
6744
6674
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6745
6675
|
* Licensed under the MIT License.
|
|
@@ -6766,7 +6696,7 @@ class PopTokenGenerator {
|
|
|
6766
6696
|
}
|
|
6767
6697
|
}
|
|
6768
6698
|
|
|
6769
|
-
/*! @azure/msal-common
|
|
6699
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
6770
6700
|
|
|
6771
6701
|
/*
|
|
6772
6702
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6926,7 +6856,7 @@ class ResponseHandler {
|
|
|
6926
6856
|
!forceCacheRefreshTokenResponse &&
|
|
6927
6857
|
cacheRecord.account) {
|
|
6928
6858
|
const key = cacheRecord.account.generateAccountKey();
|
|
6929
|
-
const account = this.cacheStorage.getAccount(key
|
|
6859
|
+
const account = this.cacheStorage.getAccount(key);
|
|
6930
6860
|
if (!account) {
|
|
6931
6861
|
this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
|
|
6932
6862
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
@@ -7118,7 +7048,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
7118
7048
|
});
|
|
7119
7049
|
let cachedAccount = null;
|
|
7120
7050
|
if (baseAccountKey) {
|
|
7121
|
-
cachedAccount = cacheStorage.getAccount(baseAccountKey
|
|
7051
|
+
cachedAccount = cacheStorage.getAccount(baseAccountKey);
|
|
7122
7052
|
}
|
|
7123
7053
|
const baseAccount = cachedAccount ||
|
|
7124
7054
|
AccountEntity.createAccount({
|
|
@@ -7143,7 +7073,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
7143
7073
|
return baseAccount;
|
|
7144
7074
|
}
|
|
7145
7075
|
|
|
7146
|
-
/*! @azure/msal-common
|
|
7076
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7147
7077
|
/*
|
|
7148
7078
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7149
7079
|
* Licensed under the MIT License.
|
|
@@ -7161,7 +7091,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
|
|
|
7161
7091
|
}
|
|
7162
7092
|
}
|
|
7163
7093
|
|
|
7164
|
-
/*! @azure/msal-common
|
|
7094
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7165
7095
|
|
|
7166
7096
|
/*
|
|
7167
7097
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7603,7 +7533,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7603
7533
|
}
|
|
7604
7534
|
}
|
|
7605
7535
|
|
|
7606
|
-
/*! @azure/msal-common
|
|
7536
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7607
7537
|
|
|
7608
7538
|
/*
|
|
7609
7539
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7823,7 +7753,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7823
7753
|
}
|
|
7824
7754
|
}
|
|
7825
7755
|
|
|
7826
|
-
/*! @azure/msal-common
|
|
7756
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7827
7757
|
|
|
7828
7758
|
/*
|
|
7829
7759
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7959,7 +7889,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7959
7889
|
}
|
|
7960
7890
|
}
|
|
7961
7891
|
|
|
7962
|
-
/*! @azure/msal-common
|
|
7892
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7963
7893
|
|
|
7964
7894
|
/*
|
|
7965
7895
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7974,7 +7904,7 @@ const StubbedNetworkModule = {
|
|
|
7974
7904
|
},
|
|
7975
7905
|
};
|
|
7976
7906
|
|
|
7977
|
-
/*! @azure/msal-common
|
|
7907
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
7978
7908
|
|
|
7979
7909
|
/*
|
|
7980
7910
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8032,7 +7962,7 @@ class AuthenticationHeaderParser {
|
|
|
8032
7962
|
}
|
|
8033
7963
|
}
|
|
8034
7964
|
|
|
8035
|
-
/*! @azure/msal-common
|
|
7965
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8036
7966
|
|
|
8037
7967
|
/*
|
|
8038
7968
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8295,7 +8225,7 @@ class ServerTelemetryManager {
|
|
|
8295
8225
|
}
|
|
8296
8226
|
}
|
|
8297
8227
|
|
|
8298
|
-
/*! @azure/msal-common
|
|
8228
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8299
8229
|
/*
|
|
8300
8230
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8301
8231
|
* Licensed under the MIT License.
|
|
@@ -8303,7 +8233,7 @@ class ServerTelemetryManager {
|
|
|
8303
8233
|
const missingKidError = "missing_kid_error";
|
|
8304
8234
|
const missingAlgError = "missing_alg_error";
|
|
8305
8235
|
|
|
8306
|
-
/*! @azure/msal-common
|
|
8236
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8307
8237
|
|
|
8308
8238
|
/*
|
|
8309
8239
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8328,7 +8258,7 @@ function createJoseHeaderError(code) {
|
|
|
8328
8258
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
8329
8259
|
}
|
|
8330
8260
|
|
|
8331
|
-
/*! @azure/msal-common
|
|
8261
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8332
8262
|
|
|
8333
8263
|
/*
|
|
8334
8264
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8368,7 +8298,7 @@ class JoseHeader {
|
|
|
8368
8298
|
}
|
|
8369
8299
|
}
|
|
8370
8300
|
|
|
8371
|
-
/*! @azure/msal-common
|
|
8301
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8372
8302
|
|
|
8373
8303
|
/*
|
|
8374
8304
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8447,7 +8377,7 @@ class StubPerformanceClient {
|
|
|
8447
8377
|
}
|
|
8448
8378
|
}
|
|
8449
8379
|
|
|
8450
|
-
/*! @azure/msal-common
|
|
8380
|
+
/*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
|
|
8451
8381
|
|
|
8452
8382
|
/*
|
|
8453
8383
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9684,6 +9614,43 @@ function base64EncArr(aBytes) {
|
|
|
9684
9614
|
return btoa(binString);
|
|
9685
9615
|
}
|
|
9686
9616
|
|
|
9617
|
+
/*
|
|
9618
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9619
|
+
* Licensed under the MIT License.
|
|
9620
|
+
*/
|
|
9621
|
+
/**
|
|
9622
|
+
* Class which exposes APIs to decode base64 strings to plaintext. See here for implementation details:
|
|
9623
|
+
* https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem
|
|
9624
|
+
*/
|
|
9625
|
+
/**
|
|
9626
|
+
* Returns a URL-safe plaintext decoded string from b64 encoded input.
|
|
9627
|
+
* @param input
|
|
9628
|
+
*/
|
|
9629
|
+
function base64Decode(input) {
|
|
9630
|
+
return new TextDecoder().decode(base64DecToArr(input));
|
|
9631
|
+
}
|
|
9632
|
+
/**
|
|
9633
|
+
* Decodes base64 into Uint8Array
|
|
9634
|
+
* @param base64String
|
|
9635
|
+
*/
|
|
9636
|
+
function base64DecToArr(base64String) {
|
|
9637
|
+
let encodedString = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
9638
|
+
switch (encodedString.length % 4) {
|
|
9639
|
+
case 0:
|
|
9640
|
+
break;
|
|
9641
|
+
case 2:
|
|
9642
|
+
encodedString += "==";
|
|
9643
|
+
break;
|
|
9644
|
+
case 3:
|
|
9645
|
+
encodedString += "=";
|
|
9646
|
+
break;
|
|
9647
|
+
default:
|
|
9648
|
+
throw createBrowserAuthError(invalidBase64String);
|
|
9649
|
+
}
|
|
9650
|
+
const binString = atob(encodedString);
|
|
9651
|
+
return Uint8Array.from(binString, (m) => m.codePointAt(0) || 0);
|
|
9652
|
+
}
|
|
9653
|
+
|
|
9687
9654
|
/*
|
|
9688
9655
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9689
9656
|
* Licensed under the MIT License.
|
|
@@ -9695,8 +9662,10 @@ function base64EncArr(aBytes) {
|
|
|
9695
9662
|
/**
|
|
9696
9663
|
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
9697
9664
|
*/
|
|
9698
|
-
//
|
|
9665
|
+
// Algorithms
|
|
9699
9666
|
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
9667
|
+
const AES_GCM = "AES-GCM";
|
|
9668
|
+
const HKDF = "HKDF";
|
|
9700
9669
|
// SHA-256 hashing algorithm
|
|
9701
9670
|
const S256_HASH_ALG = "SHA-256";
|
|
9702
9671
|
// MOD length for PoP tokens
|
|
@@ -9707,6 +9676,13 @@ const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
|
9707
9676
|
const UUID_CHARS = "0123456789abcdef";
|
|
9708
9677
|
// Array to store UINT32 random value
|
|
9709
9678
|
const UINT32_ARR = new Uint32Array(1);
|
|
9679
|
+
// Key Format
|
|
9680
|
+
const RAW = "raw";
|
|
9681
|
+
// Key Usages
|
|
9682
|
+
const ENCRYPT = "encrypt";
|
|
9683
|
+
const DECRYPT = "decrypt";
|
|
9684
|
+
const DERIVE_KEY = "deriveKey";
|
|
9685
|
+
// Suberror
|
|
9710
9686
|
const SUBTLE_SUBERROR = "crypto_subtle_undefined";
|
|
9711
9687
|
const keygenAlgorithmOptions = {
|
|
9712
9688
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
@@ -9829,6 +9805,76 @@ async function importJwk(key, extractable, usages) {
|
|
|
9829
9805
|
async function sign(key, data) {
|
|
9830
9806
|
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
9831
9807
|
}
|
|
9808
|
+
/**
|
|
9809
|
+
* Generates symmetric base encryption key. This may be stored as all encryption/decryption keys will be derived from this one.
|
|
9810
|
+
*/
|
|
9811
|
+
async function generateBaseKey() {
|
|
9812
|
+
const key = await window.crypto.subtle.generateKey({
|
|
9813
|
+
name: AES_GCM,
|
|
9814
|
+
length: 256,
|
|
9815
|
+
}, true, [ENCRYPT, DECRYPT]);
|
|
9816
|
+
return window.crypto.subtle.exportKey(RAW, key);
|
|
9817
|
+
}
|
|
9818
|
+
/**
|
|
9819
|
+
* Returns the raw key to be passed into the key derivation function
|
|
9820
|
+
* @param baseKey
|
|
9821
|
+
* @returns
|
|
9822
|
+
*/
|
|
9823
|
+
async function generateHKDF(baseKey) {
|
|
9824
|
+
return window.crypto.subtle.importKey(RAW, baseKey, HKDF, false, [
|
|
9825
|
+
DERIVE_KEY,
|
|
9826
|
+
]);
|
|
9827
|
+
}
|
|
9828
|
+
/**
|
|
9829
|
+
* Given a base key and a nonce generates a derived key to be used in encryption and decryption.
|
|
9830
|
+
* Note: every time we encrypt a new key is derived
|
|
9831
|
+
* @param baseKey
|
|
9832
|
+
* @param nonce
|
|
9833
|
+
* @returns
|
|
9834
|
+
*/
|
|
9835
|
+
async function deriveKey(baseKey, nonce, context) {
|
|
9836
|
+
return window.crypto.subtle.deriveKey({
|
|
9837
|
+
name: HKDF,
|
|
9838
|
+
salt: nonce,
|
|
9839
|
+
hash: S256_HASH_ALG,
|
|
9840
|
+
info: new TextEncoder().encode(context),
|
|
9841
|
+
}, baseKey, { name: AES_GCM, length: 256 }, false, [ENCRYPT, DECRYPT]);
|
|
9842
|
+
}
|
|
9843
|
+
/**
|
|
9844
|
+
* Encrypt the given data given a base key. Returns encrypted data and a nonce that must be provided during decryption
|
|
9845
|
+
* @param key
|
|
9846
|
+
* @param rawData
|
|
9847
|
+
*/
|
|
9848
|
+
async function encrypt(baseKey, rawData, context) {
|
|
9849
|
+
const encodedData = new TextEncoder().encode(rawData);
|
|
9850
|
+
// The nonce must never be reused with a given key.
|
|
9851
|
+
const nonce = window.crypto.getRandomValues(new Uint8Array(16));
|
|
9852
|
+
const derivedKey = await deriveKey(baseKey, nonce, context);
|
|
9853
|
+
const encryptedData = await window.crypto.subtle.encrypt({
|
|
9854
|
+
name: AES_GCM,
|
|
9855
|
+
iv: new Uint8Array(12), // New key is derived for every encrypt so we don't need a new nonce
|
|
9856
|
+
}, derivedKey, encodedData);
|
|
9857
|
+
return {
|
|
9858
|
+
data: urlEncodeArr(new Uint8Array(encryptedData)),
|
|
9859
|
+
nonce: urlEncodeArr(nonce),
|
|
9860
|
+
};
|
|
9861
|
+
}
|
|
9862
|
+
/**
|
|
9863
|
+
* Decrypt data with the given key and nonce
|
|
9864
|
+
* @param key
|
|
9865
|
+
* @param nonce
|
|
9866
|
+
* @param encryptedData
|
|
9867
|
+
* @returns
|
|
9868
|
+
*/
|
|
9869
|
+
async function decrypt(baseKey, nonce, context, encryptedData) {
|
|
9870
|
+
const encodedData = base64DecToArr(encryptedData);
|
|
9871
|
+
const derivedKey = await deriveKey(baseKey, base64DecToArr(nonce), context);
|
|
9872
|
+
const decryptedData = await window.crypto.subtle.decrypt({
|
|
9873
|
+
name: AES_GCM,
|
|
9874
|
+
iv: new Uint8Array(12), // New key is derived for every encrypt so we don't need a new nonce
|
|
9875
|
+
}, derivedKey, encodedData);
|
|
9876
|
+
return new TextDecoder().decode(decryptedData);
|
|
9877
|
+
}
|
|
9832
9878
|
/**
|
|
9833
9879
|
* Returns the SHA-256 hash of an input string
|
|
9834
9880
|
* @param plainText
|
|
@@ -10366,7 +10412,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
10366
10412
|
|
|
10367
10413
|
/* eslint-disable header/header */
|
|
10368
10414
|
const name = "@azure/msal-browser";
|
|
10369
|
-
const version = "
|
|
10415
|
+
const version = "4.0.0-alpha.0";
|
|
10370
10416
|
|
|
10371
10417
|
/*
|
|
10372
10418
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10742,43 +10788,6 @@ StandardOperatingContext.MODULE_NAME = "";
|
|
|
10742
10788
|
*/
|
|
10743
10789
|
StandardOperatingContext.ID = "StandardOperatingContext";
|
|
10744
10790
|
|
|
10745
|
-
/*
|
|
10746
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10747
|
-
* Licensed under the MIT License.
|
|
10748
|
-
*/
|
|
10749
|
-
/**
|
|
10750
|
-
* Class which exposes APIs to decode base64 strings to plaintext. See here for implementation details:
|
|
10751
|
-
* https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem
|
|
10752
|
-
*/
|
|
10753
|
-
/**
|
|
10754
|
-
* Returns a URL-safe plaintext decoded string from b64 encoded input.
|
|
10755
|
-
* @param input
|
|
10756
|
-
*/
|
|
10757
|
-
function base64Decode(input) {
|
|
10758
|
-
return new TextDecoder().decode(base64DecToArr(input));
|
|
10759
|
-
}
|
|
10760
|
-
/**
|
|
10761
|
-
* Decodes base64 into Uint8Array
|
|
10762
|
-
* @param base64String
|
|
10763
|
-
*/
|
|
10764
|
-
function base64DecToArr(base64String) {
|
|
10765
|
-
let encodedString = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
10766
|
-
switch (encodedString.length % 4) {
|
|
10767
|
-
case 0:
|
|
10768
|
-
break;
|
|
10769
|
-
case 2:
|
|
10770
|
-
encodedString += "==";
|
|
10771
|
-
break;
|
|
10772
|
-
case 3:
|
|
10773
|
-
encodedString += "=";
|
|
10774
|
-
break;
|
|
10775
|
-
default:
|
|
10776
|
-
throw createBrowserAuthError(invalidBase64String);
|
|
10777
|
-
}
|
|
10778
|
-
const binString = atob(encodedString);
|
|
10779
|
-
return Uint8Array.from(binString, (m) => m.codePointAt(0) || 0);
|
|
10780
|
-
}
|
|
10781
|
-
|
|
10782
10791
|
/*
|
|
10783
10792
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10784
10793
|
* Licensed under the MIT License.
|
|
@@ -10988,12 +10997,21 @@ class MemoryStorage {
|
|
|
10988
10997
|
constructor() {
|
|
10989
10998
|
this.cache = new Map();
|
|
10990
10999
|
}
|
|
11000
|
+
async initialize() {
|
|
11001
|
+
// Memory storage does not require initialization
|
|
11002
|
+
}
|
|
10991
11003
|
getItem(key) {
|
|
10992
11004
|
return this.cache.get(key) || null;
|
|
10993
11005
|
}
|
|
11006
|
+
getUserData(key) {
|
|
11007
|
+
return this.getItem(key);
|
|
11008
|
+
}
|
|
10994
11009
|
setItem(key, value) {
|
|
10995
11010
|
this.cache.set(key, value);
|
|
10996
11011
|
}
|
|
11012
|
+
async setUserData(key, value) {
|
|
11013
|
+
this.setItem(key, value);
|
|
11014
|
+
}
|
|
10997
11015
|
removeItem(key) {
|
|
10998
11016
|
this.cache.delete(key);
|
|
10999
11017
|
}
|
|
@@ -11325,32 +11343,327 @@ function getSortedObjectString(obj) {
|
|
|
11325
11343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11326
11344
|
* Licensed under the MIT License.
|
|
11327
11345
|
*/
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11346
|
+
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
11347
|
+
const COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
11348
|
+
class CookieStorage {
|
|
11349
|
+
initialize() {
|
|
11350
|
+
return Promise.resolve();
|
|
11351
|
+
}
|
|
11352
|
+
getItem(key) {
|
|
11353
|
+
const name = `${encodeURIComponent(key)}`;
|
|
11354
|
+
const cookieList = document.cookie.split(";");
|
|
11355
|
+
for (let i = 0; i < cookieList.length; i++) {
|
|
11356
|
+
const cookie = cookieList[i];
|
|
11357
|
+
const [key, ...rest] = decodeURIComponent(cookie).trim().split("=");
|
|
11358
|
+
const value = rest.join("=");
|
|
11359
|
+
if (key === name) {
|
|
11360
|
+
return value;
|
|
11361
|
+
}
|
|
11362
|
+
}
|
|
11363
|
+
return "";
|
|
11364
|
+
}
|
|
11365
|
+
getUserData() {
|
|
11366
|
+
throw createClientAuthError(methodNotImplemented);
|
|
11367
|
+
}
|
|
11368
|
+
setItem(key, value, cookieLifeDays, secure = true) {
|
|
11369
|
+
let cookieStr = `${encodeURIComponent(key)}=${encodeURIComponent(value)};path=/;SameSite=Lax;`;
|
|
11370
|
+
if (cookieLifeDays) {
|
|
11371
|
+
const expireTime = getCookieExpirationTime(cookieLifeDays);
|
|
11372
|
+
cookieStr += `expires=${expireTime};`;
|
|
11373
|
+
}
|
|
11374
|
+
if (secure) {
|
|
11375
|
+
cookieStr += "Secure;";
|
|
11376
|
+
}
|
|
11377
|
+
document.cookie = cookieStr;
|
|
11378
|
+
}
|
|
11379
|
+
async setUserData() {
|
|
11380
|
+
return Promise.reject(createClientAuthError(methodNotImplemented));
|
|
11381
|
+
}
|
|
11382
|
+
removeItem(key) {
|
|
11383
|
+
// Setting expiration to -1 removes it
|
|
11384
|
+
this.setItem(key, "", -1);
|
|
11385
|
+
}
|
|
11386
|
+
getKeys() {
|
|
11387
|
+
const cookieList = document.cookie.split(";");
|
|
11388
|
+
const keys = [];
|
|
11389
|
+
cookieList.forEach((cookie) => {
|
|
11390
|
+
const cookieParts = decodeURIComponent(cookie).trim().split("=");
|
|
11391
|
+
keys.push(cookieParts[0]);
|
|
11392
|
+
});
|
|
11393
|
+
return keys;
|
|
11394
|
+
}
|
|
11395
|
+
containsKey(key) {
|
|
11396
|
+
return this.getKeys().includes(key);
|
|
11397
|
+
}
|
|
11398
|
+
}
|
|
11399
|
+
/**
|
|
11400
|
+
* Get cookie expiration time
|
|
11401
|
+
* @param cookieLifeDays
|
|
11402
|
+
*/
|
|
11403
|
+
function getCookieExpirationTime(cookieLifeDays) {
|
|
11404
|
+
const today = new Date();
|
|
11405
|
+
const expr = new Date(today.getTime() + cookieLifeDays * COOKIE_LIFE_MULTIPLIER);
|
|
11406
|
+
return expr.toUTCString();
|
|
11407
|
+
}
|
|
11408
|
+
|
|
11409
|
+
/*
|
|
11410
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11411
|
+
* Licensed under the MIT License.
|
|
11412
|
+
*/
|
|
11413
|
+
/**
|
|
11414
|
+
* Returns a list of cache keys for all known accounts
|
|
11415
|
+
* @param storage
|
|
11416
|
+
* @returns
|
|
11417
|
+
*/
|
|
11418
|
+
function getAccountKeys(storage) {
|
|
11419
|
+
const accountKeys = storage.getItem(StaticCacheKeys.ACCOUNT_KEYS);
|
|
11420
|
+
if (accountKeys) {
|
|
11421
|
+
return JSON.parse(accountKeys);
|
|
11422
|
+
}
|
|
11423
|
+
return [];
|
|
11424
|
+
}
|
|
11425
|
+
/**
|
|
11426
|
+
* Returns a list of cache keys for all known tokens
|
|
11427
|
+
* @param clientId
|
|
11428
|
+
* @param storage
|
|
11429
|
+
* @returns
|
|
11430
|
+
*/
|
|
11431
|
+
function getTokenKeys(clientId, storage) {
|
|
11432
|
+
const item = storage.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${clientId}`);
|
|
11433
|
+
if (item) {
|
|
11434
|
+
const tokenKeys = JSON.parse(item);
|
|
11435
|
+
if (tokenKeys &&
|
|
11436
|
+
tokenKeys.hasOwnProperty("idToken") &&
|
|
11437
|
+
tokenKeys.hasOwnProperty("accessToken") &&
|
|
11438
|
+
tokenKeys.hasOwnProperty("refreshToken")) {
|
|
11439
|
+
return tokenKeys;
|
|
11440
|
+
}
|
|
11441
|
+
}
|
|
11442
|
+
return {
|
|
11443
|
+
idToken: [],
|
|
11444
|
+
accessToken: [],
|
|
11445
|
+
refreshToken: [],
|
|
11446
|
+
};
|
|
11447
|
+
}
|
|
11448
|
+
|
|
11449
|
+
/*
|
|
11450
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11451
|
+
* Licensed under the MIT License.
|
|
11452
|
+
*/
|
|
11453
|
+
const ENCRYPTION_KEY = "msal.cache.encryption";
|
|
11454
|
+
class LocalStorage {
|
|
11455
|
+
constructor(clientId) {
|
|
11456
|
+
if (!window.localStorage) {
|
|
11457
|
+
throw createBrowserConfigurationAuthError(storageNotSupported);
|
|
11458
|
+
}
|
|
11459
|
+
this.memoryStorage = new MemoryStorage();
|
|
11460
|
+
this.initialized = false;
|
|
11461
|
+
this.clientId = clientId;
|
|
11462
|
+
}
|
|
11463
|
+
async initialize() {
|
|
11464
|
+
this.initialized = true;
|
|
11465
|
+
const cookies = new CookieStorage();
|
|
11466
|
+
const cookieString = cookies.getItem(ENCRYPTION_KEY);
|
|
11467
|
+
let parsedCookie = { key: "", id: "" };
|
|
11468
|
+
if (cookieString) {
|
|
11469
|
+
try {
|
|
11470
|
+
parsedCookie = JSON.parse(cookieString);
|
|
11471
|
+
}
|
|
11472
|
+
catch (e) {
|
|
11473
|
+
// TODO: Log telemetry but don't throw
|
|
11474
|
+
}
|
|
11475
|
+
}
|
|
11476
|
+
if (parsedCookie.key && parsedCookie.id) {
|
|
11477
|
+
// Encryption key already exists, import
|
|
11478
|
+
this.encryptionCookie = {
|
|
11479
|
+
id: parsedCookie.id,
|
|
11480
|
+
key: await generateHKDF(base64DecToArr(parsedCookie.key)),
|
|
11481
|
+
};
|
|
11482
|
+
await this.importExistingCache();
|
|
11483
|
+
}
|
|
11484
|
+
else {
|
|
11485
|
+
// Encryption key doesn't exist or is invalid, generate a new one and clear existing cache
|
|
11486
|
+
this.clear();
|
|
11487
|
+
const id = createNewGuid();
|
|
11488
|
+
const baseKey = await generateBaseKey();
|
|
11489
|
+
const keyStr = urlEncodeArr(new Uint8Array(baseKey));
|
|
11490
|
+
this.encryptionCookie = {
|
|
11491
|
+
id: id,
|
|
11492
|
+
key: await generateHKDF(baseKey),
|
|
11493
|
+
};
|
|
11494
|
+
const cookieData = {
|
|
11495
|
+
id: id,
|
|
11496
|
+
key: keyStr,
|
|
11497
|
+
};
|
|
11498
|
+
cookies.setItem(ENCRYPTION_KEY, JSON.stringify(cookieData));
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
getItem(key) {
|
|
11502
|
+
return window.localStorage.getItem(key);
|
|
11503
|
+
}
|
|
11504
|
+
getUserData(key) {
|
|
11505
|
+
if (!this.initialized) {
|
|
11506
|
+
throw createBrowserAuthError(uninitializedPublicClientApplication);
|
|
11507
|
+
}
|
|
11508
|
+
return this.memoryStorage.getItem(key);
|
|
11509
|
+
}
|
|
11510
|
+
setItem(key, value) {
|
|
11511
|
+
window.localStorage.setItem(key, value);
|
|
11512
|
+
}
|
|
11513
|
+
async setUserData(key, value) {
|
|
11514
|
+
if (!this.initialized || !this.encryptionCookie) {
|
|
11515
|
+
throw createBrowserAuthError(uninitializedPublicClientApplication);
|
|
11516
|
+
}
|
|
11517
|
+
const { data, nonce } = await encrypt(this.encryptionCookie.key, value, this.getContext(key));
|
|
11518
|
+
const encryptedData = {
|
|
11519
|
+
id: this.encryptionCookie.id,
|
|
11520
|
+
nonce: nonce,
|
|
11521
|
+
data: data,
|
|
11522
|
+
};
|
|
11523
|
+
this.memoryStorage.setItem(key, value);
|
|
11524
|
+
this.setItem(key, JSON.stringify(encryptedData));
|
|
11525
|
+
}
|
|
11526
|
+
removeItem(key) {
|
|
11527
|
+
this.memoryStorage.removeItem(key);
|
|
11528
|
+
window.localStorage.removeItem(key);
|
|
11529
|
+
}
|
|
11530
|
+
getKeys() {
|
|
11531
|
+
return Object.keys(window.localStorage);
|
|
11532
|
+
}
|
|
11533
|
+
containsKey(key) {
|
|
11534
|
+
return window.localStorage.hasOwnProperty(key);
|
|
11535
|
+
}
|
|
11536
|
+
/**
|
|
11537
|
+
* Removes all known MSAL keys from the cache
|
|
11538
|
+
*/
|
|
11539
|
+
clear() {
|
|
11540
|
+
// Removes all remaining MSAL cache items
|
|
11541
|
+
this.memoryStorage.clear();
|
|
11542
|
+
const accountKeys = getAccountKeys(this);
|
|
11543
|
+
accountKeys.forEach((key) => this.removeItem(key));
|
|
11544
|
+
const tokenKeys = getTokenKeys(this.clientId, this);
|
|
11545
|
+
tokenKeys.idToken.forEach((key) => this.removeItem(key));
|
|
11546
|
+
tokenKeys.accessToken.forEach((key) => this.removeItem(key));
|
|
11547
|
+
tokenKeys.refreshToken.forEach((key) => this.removeItem(key));
|
|
11548
|
+
// Clean up anything left
|
|
11549
|
+
this.getKeys().forEach((cacheKey) => {
|
|
11550
|
+
if (cacheKey.startsWith(Constants.CACHE_PREFIX) ||
|
|
11551
|
+
cacheKey.indexOf(this.clientId) !== -1) {
|
|
11552
|
+
this.removeItem(cacheKey);
|
|
11553
|
+
}
|
|
11554
|
+
});
|
|
11555
|
+
}
|
|
11556
|
+
/**
|
|
11557
|
+
* Helper to decrypt all known MSAL keys in localStorage and save them to inMemory storage
|
|
11558
|
+
* @returns
|
|
11559
|
+
*/
|
|
11560
|
+
async importExistingCache() {
|
|
11561
|
+
if (!this.encryptionCookie) {
|
|
11562
|
+
return;
|
|
11563
|
+
}
|
|
11564
|
+
const accountKeys = getAccountKeys(this);
|
|
11565
|
+
await this.importArray(accountKeys);
|
|
11566
|
+
const tokenKeys = getTokenKeys(this.clientId, this);
|
|
11567
|
+
await Promise.all([
|
|
11568
|
+
this.importArray(tokenKeys.idToken),
|
|
11569
|
+
this.importArray(tokenKeys.accessToken),
|
|
11570
|
+
this.importArray(tokenKeys.refreshToken),
|
|
11571
|
+
]);
|
|
11572
|
+
}
|
|
11573
|
+
/**
|
|
11574
|
+
* Helper to decrypt and save cache entries
|
|
11575
|
+
* @param key
|
|
11576
|
+
* @returns
|
|
11577
|
+
*/
|
|
11578
|
+
async getItemFromEncryptedCache(key) {
|
|
11579
|
+
if (!this.encryptionCookie) {
|
|
11580
|
+
return null;
|
|
11581
|
+
}
|
|
11582
|
+
const rawCache = this.getItem(key);
|
|
11583
|
+
if (!rawCache) {
|
|
11584
|
+
return null;
|
|
11585
|
+
}
|
|
11586
|
+
let encObj;
|
|
11587
|
+
try {
|
|
11588
|
+
encObj = JSON.parse(rawCache);
|
|
11589
|
+
if (!encObj.id || !encObj.nonce || !encObj.data) {
|
|
11590
|
+
throw "Not encrypted!"; // TODO: Typed error
|
|
11591
|
+
}
|
|
11592
|
+
if (encObj.id !== this.encryptionCookie.id) {
|
|
11593
|
+
throw "Old item!"; // TODO: Typed error
|
|
11594
|
+
}
|
|
11595
|
+
}
|
|
11596
|
+
catch (e) {
|
|
11597
|
+
// Not a valid encrypted object, remove
|
|
11598
|
+
this.removeItem(key);
|
|
11599
|
+
// TODO: Log to telemetry
|
|
11600
|
+
return null;
|
|
11601
|
+
}
|
|
11602
|
+
return decrypt(this.encryptionCookie.key, encObj.nonce, this.getContext(key), encObj.data);
|
|
11603
|
+
}
|
|
11604
|
+
/**
|
|
11605
|
+
* Helper to decrypt and save an array of cache keys
|
|
11606
|
+
* @param arr
|
|
11607
|
+
*/
|
|
11608
|
+
async importArray(arr) {
|
|
11609
|
+
const promiseArr = [];
|
|
11610
|
+
arr.forEach((key) => {
|
|
11611
|
+
const promise = this.getItemFromEncryptedCache(key).then((value) => {
|
|
11612
|
+
if (value) {
|
|
11613
|
+
this.memoryStorage.setItem(key, value);
|
|
11614
|
+
}
|
|
11615
|
+
});
|
|
11616
|
+
promiseArr.push(promise);
|
|
11617
|
+
});
|
|
11618
|
+
await Promise.all(promiseArr);
|
|
11619
|
+
}
|
|
11620
|
+
/**
|
|
11621
|
+
* Gets encryption context for a given cache entry. This is clientId for app specific entries, empty string for shared entries
|
|
11622
|
+
* @param key
|
|
11623
|
+
* @returns
|
|
11624
|
+
*/
|
|
11625
|
+
getContext(key) {
|
|
11626
|
+
let context = "";
|
|
11627
|
+
if (key.includes(this.clientId)) {
|
|
11628
|
+
context = this.clientId; // Used to bind encryption key to this appId
|
|
11629
|
+
}
|
|
11630
|
+
return context;
|
|
11332
11631
|
}
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11632
|
+
}
|
|
11633
|
+
|
|
11634
|
+
/*
|
|
11635
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11636
|
+
* Licensed under the MIT License.
|
|
11637
|
+
*/
|
|
11638
|
+
class SessionStorage {
|
|
11639
|
+
constructor() {
|
|
11640
|
+
if (!window.sessionStorage) {
|
|
11337
11641
|
throw createBrowserConfigurationAuthError(storageNotSupported);
|
|
11338
11642
|
}
|
|
11339
11643
|
}
|
|
11644
|
+
async initialize() {
|
|
11645
|
+
// Session storage does not require initialization
|
|
11646
|
+
}
|
|
11340
11647
|
getItem(key) {
|
|
11341
|
-
return
|
|
11648
|
+
return window.sessionStorage.getItem(key);
|
|
11649
|
+
}
|
|
11650
|
+
getUserData(key) {
|
|
11651
|
+
return this.getItem(key);
|
|
11342
11652
|
}
|
|
11343
11653
|
setItem(key, value) {
|
|
11344
|
-
|
|
11654
|
+
window.sessionStorage.setItem(key, value);
|
|
11655
|
+
}
|
|
11656
|
+
async setUserData(key, value) {
|
|
11657
|
+
this.setItem(key, value);
|
|
11345
11658
|
}
|
|
11346
11659
|
removeItem(key) {
|
|
11347
|
-
|
|
11660
|
+
window.sessionStorage.removeItem(key);
|
|
11348
11661
|
}
|
|
11349
11662
|
getKeys() {
|
|
11350
|
-
return Object.keys(
|
|
11663
|
+
return Object.keys(window.sessionStorage);
|
|
11351
11664
|
}
|
|
11352
11665
|
containsKey(key) {
|
|
11353
|
-
return
|
|
11666
|
+
return window.sessionStorage.hasOwnProperty(key);
|
|
11354
11667
|
}
|
|
11355
11668
|
}
|
|
11356
11669
|
|
|
@@ -11388,180 +11701,39 @@ function extractBrowserRequestState(browserCrypto, state) {
|
|
|
11388
11701
|
class BrowserCacheManager extends CacheManager {
|
|
11389
11702
|
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions, performanceClient) {
|
|
11390
11703
|
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
11391
|
-
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
11392
|
-
this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
11393
11704
|
this.cacheConfig = cacheConfig;
|
|
11394
11705
|
this.logger = logger;
|
|
11395
11706
|
this.internalStorage = new MemoryStorage();
|
|
11396
11707
|
this.browserStorage = this.setupBrowserStorage(this.cacheConfig.cacheLocation);
|
|
11397
|
-
this.temporaryCacheStorage = this.
|
|
11398
|
-
|
|
11399
|
-
if (cacheConfig.cacheMigrationEnabled) {
|
|
11400
|
-
this.migrateCacheEntries();
|
|
11401
|
-
this.createKeyMaps();
|
|
11402
|
-
}
|
|
11708
|
+
this.temporaryCacheStorage = this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation);
|
|
11709
|
+
this.cookieStorage = new CookieStorage();
|
|
11403
11710
|
this.performanceClient = performanceClient;
|
|
11404
11711
|
}
|
|
11712
|
+
async initialize() {
|
|
11713
|
+
await this.browserStorage.initialize();
|
|
11714
|
+
}
|
|
11405
11715
|
/**
|
|
11406
11716
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
11407
11717
|
* @param cacheLocation
|
|
11408
11718
|
*/
|
|
11409
11719
|
setupBrowserStorage(cacheLocation) {
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11720
|
+
try {
|
|
11721
|
+
switch (cacheLocation) {
|
|
11722
|
+
case BrowserCacheLocation.LocalStorage:
|
|
11723
|
+
return new LocalStorage(this.clientId);
|
|
11724
|
+
case BrowserCacheLocation.SessionStorage:
|
|
11725
|
+
return new SessionStorage();
|
|
11726
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
11727
|
+
default:
|
|
11418
11728
|
break;
|
|
11419
|
-
|
|
11420
|
-
|
|
11729
|
+
}
|
|
11730
|
+
}
|
|
11731
|
+
catch (e) {
|
|
11732
|
+
this.logger.error(e);
|
|
11421
11733
|
}
|
|
11422
11734
|
this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;
|
|
11423
11735
|
return new MemoryStorage();
|
|
11424
11736
|
}
|
|
11425
|
-
/**
|
|
11426
|
-
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured temporaryCacheLocation.
|
|
11427
|
-
* @param temporaryCacheLocation
|
|
11428
|
-
* @param cacheLocation
|
|
11429
|
-
*/
|
|
11430
|
-
setupTemporaryCacheStorage(temporaryCacheLocation, cacheLocation) {
|
|
11431
|
-
switch (cacheLocation) {
|
|
11432
|
-
case BrowserCacheLocation.LocalStorage:
|
|
11433
|
-
case BrowserCacheLocation.SessionStorage:
|
|
11434
|
-
try {
|
|
11435
|
-
// Temporary cache items will always be stored in session storage to mitigate problems caused by multiple tabs
|
|
11436
|
-
return new BrowserStorage(temporaryCacheLocation ||
|
|
11437
|
-
BrowserCacheLocation.SessionStorage);
|
|
11438
|
-
}
|
|
11439
|
-
catch (e) {
|
|
11440
|
-
this.logger.verbose(e);
|
|
11441
|
-
return this.internalStorage;
|
|
11442
|
-
}
|
|
11443
|
-
case BrowserCacheLocation.MemoryStorage:
|
|
11444
|
-
default:
|
|
11445
|
-
return this.internalStorage;
|
|
11446
|
-
}
|
|
11447
|
-
}
|
|
11448
|
-
/**
|
|
11449
|
-
* Migrate all old cache entries to new schema. No rollback supported.
|
|
11450
|
-
* @param storeAuthStateInCookie
|
|
11451
|
-
*/
|
|
11452
|
-
migrateCacheEntries() {
|
|
11453
|
-
const idTokenKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ID_TOKEN}`;
|
|
11454
|
-
const clientInfoKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.CLIENT_INFO}`;
|
|
11455
|
-
const errorKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ERROR}`;
|
|
11456
|
-
const errorDescKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ERROR_DESC}`;
|
|
11457
|
-
const idTokenValue = this.browserStorage.getItem(idTokenKey);
|
|
11458
|
-
const clientInfoValue = this.browserStorage.getItem(clientInfoKey);
|
|
11459
|
-
const errorValue = this.browserStorage.getItem(errorKey);
|
|
11460
|
-
const errorDescValue = this.browserStorage.getItem(errorDescKey);
|
|
11461
|
-
const values = [
|
|
11462
|
-
idTokenValue,
|
|
11463
|
-
clientInfoValue,
|
|
11464
|
-
errorValue,
|
|
11465
|
-
errorDescValue,
|
|
11466
|
-
];
|
|
11467
|
-
const keysToMigrate = [
|
|
11468
|
-
PersistentCacheKeys.ID_TOKEN,
|
|
11469
|
-
PersistentCacheKeys.CLIENT_INFO,
|
|
11470
|
-
PersistentCacheKeys.ERROR,
|
|
11471
|
-
PersistentCacheKeys.ERROR_DESC,
|
|
11472
|
-
];
|
|
11473
|
-
keysToMigrate.forEach((cacheKey, index) => {
|
|
11474
|
-
const value = values[index];
|
|
11475
|
-
if (value) {
|
|
11476
|
-
this.setTemporaryCache(cacheKey, value, true);
|
|
11477
|
-
}
|
|
11478
|
-
});
|
|
11479
|
-
}
|
|
11480
|
-
/**
|
|
11481
|
-
* Searches all cache entries for MSAL accounts and creates the account key map
|
|
11482
|
-
* This is used to migrate users from older versions of MSAL which did not create the map.
|
|
11483
|
-
* @returns
|
|
11484
|
-
*/
|
|
11485
|
-
createKeyMaps() {
|
|
11486
|
-
this.logger.trace("BrowserCacheManager - createKeyMaps called.");
|
|
11487
|
-
const accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
|
|
11488
|
-
const tokenKeys = this.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
|
|
11489
|
-
if (accountKeys && tokenKeys) {
|
|
11490
|
-
this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");
|
|
11491
|
-
// Key maps already exist, no need to iterate through cache
|
|
11492
|
-
return;
|
|
11493
|
-
}
|
|
11494
|
-
const allKeys = this.browserStorage.getKeys();
|
|
11495
|
-
allKeys.forEach((key) => {
|
|
11496
|
-
if (this.isCredentialKey(key)) {
|
|
11497
|
-
// Get item, parse, validate and write key to map
|
|
11498
|
-
const value = this.getItem(key);
|
|
11499
|
-
if (value) {
|
|
11500
|
-
const credObj = this.validateAndParseJson(value);
|
|
11501
|
-
if (credObj && credObj.hasOwnProperty("credentialType")) {
|
|
11502
|
-
switch (credObj["credentialType"]) {
|
|
11503
|
-
case CredentialType.ID_TOKEN:
|
|
11504
|
-
if (isIdTokenEntity(credObj)) {
|
|
11505
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map");
|
|
11506
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${key} found, saving key to token key map`);
|
|
11507
|
-
const idTokenEntity = credObj;
|
|
11508
|
-
const newKey = this.updateCredentialCacheKey(key, idTokenEntity);
|
|
11509
|
-
this.addTokenKey(newKey, CredentialType.ID_TOKEN);
|
|
11510
|
-
return;
|
|
11511
|
-
}
|
|
11512
|
-
else {
|
|
11513
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping.");
|
|
11514
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${key}`);
|
|
11515
|
-
}
|
|
11516
|
-
break;
|
|
11517
|
-
case CredentialType.ACCESS_TOKEN:
|
|
11518
|
-
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
11519
|
-
if (isAccessTokenEntity(credObj)) {
|
|
11520
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map");
|
|
11521
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${key} found, saving key to token key map`);
|
|
11522
|
-
const accessTokenEntity = credObj;
|
|
11523
|
-
const newKey = this.updateCredentialCacheKey(key, accessTokenEntity);
|
|
11524
|
-
this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN);
|
|
11525
|
-
return;
|
|
11526
|
-
}
|
|
11527
|
-
else {
|
|
11528
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping.");
|
|
11529
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${key}`);
|
|
11530
|
-
}
|
|
11531
|
-
break;
|
|
11532
|
-
case CredentialType.REFRESH_TOKEN:
|
|
11533
|
-
if (isRefreshTokenEntity(credObj)) {
|
|
11534
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map");
|
|
11535
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${key} found, saving key to token key map`);
|
|
11536
|
-
const refreshTokenEntity = credObj;
|
|
11537
|
-
const newKey = this.updateCredentialCacheKey(key, refreshTokenEntity);
|
|
11538
|
-
this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN);
|
|
11539
|
-
return;
|
|
11540
|
-
}
|
|
11541
|
-
else {
|
|
11542
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping.");
|
|
11543
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${key}`);
|
|
11544
|
-
}
|
|
11545
|
-
break;
|
|
11546
|
-
// If credentialType isn't one of our predefined ones, it may not be an MSAL cache value. Ignore.
|
|
11547
|
-
}
|
|
11548
|
-
}
|
|
11549
|
-
}
|
|
11550
|
-
}
|
|
11551
|
-
if (this.isAccountKey(key)) {
|
|
11552
|
-
const value = this.getItem(key);
|
|
11553
|
-
if (value) {
|
|
11554
|
-
const accountObj = this.validateAndParseJson(value);
|
|
11555
|
-
if (accountObj &&
|
|
11556
|
-
AccountEntity.isAccountEntity(accountObj)) {
|
|
11557
|
-
this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map");
|
|
11558
|
-
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${key} found, saving key to account key map`);
|
|
11559
|
-
this.addAccountKeyToMap(key);
|
|
11560
|
-
}
|
|
11561
|
-
}
|
|
11562
|
-
}
|
|
11563
|
-
});
|
|
11564
|
-
}
|
|
11565
11737
|
/**
|
|
11566
11738
|
* Parses passed value as JSON object, JSON.parse() will throw an error.
|
|
11567
11739
|
* @param input
|
|
@@ -11583,38 +11755,15 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11583
11755
|
return null;
|
|
11584
11756
|
}
|
|
11585
11757
|
}
|
|
11586
|
-
/**
|
|
11587
|
-
* fetches the entry from the browser storage based off the key
|
|
11588
|
-
* @param key
|
|
11589
|
-
*/
|
|
11590
|
-
getItem(key) {
|
|
11591
|
-
return this.browserStorage.getItem(key);
|
|
11592
|
-
}
|
|
11593
|
-
/**
|
|
11594
|
-
* sets the entry in the browser storage
|
|
11595
|
-
* @param key
|
|
11596
|
-
* @param value
|
|
11597
|
-
*/
|
|
11598
|
-
setItem(key, value) {
|
|
11599
|
-
this.browserStorage.setItem(key, value);
|
|
11600
|
-
}
|
|
11601
|
-
/**
|
|
11602
|
-
* fetch the account entity from the platform cache
|
|
11603
|
-
* @param accountKey
|
|
11604
|
-
*/
|
|
11605
|
-
getAccount(accountKey, logger) {
|
|
11606
|
-
this.logger.trace("BrowserCacheManager.getAccount called");
|
|
11607
|
-
const accountEntity = this.getCachedAccountEntity(accountKey);
|
|
11608
|
-
return this.updateOutdatedCachedAccount(accountKey, accountEntity, logger);
|
|
11609
|
-
}
|
|
11610
11758
|
/**
|
|
11611
11759
|
* Reads account from cache, deserializes it into an account entity and returns it.
|
|
11612
11760
|
* If account is not found from the key, returns null and removes key from map.
|
|
11613
11761
|
* @param accountKey
|
|
11614
11762
|
* @returns
|
|
11615
11763
|
*/
|
|
11616
|
-
|
|
11617
|
-
|
|
11764
|
+
getAccount(accountKey) {
|
|
11765
|
+
this.logger.trace("BrowserCacheManager.getAccount called");
|
|
11766
|
+
const serializedAccount = this.browserStorage.getUserData(accountKey);
|
|
11618
11767
|
if (!serializedAccount) {
|
|
11619
11768
|
this.removeAccountKeyFromMap(accountKey);
|
|
11620
11769
|
return null;
|
|
@@ -11630,10 +11779,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11630
11779
|
* set account entity in the platform cache
|
|
11631
11780
|
* @param account
|
|
11632
11781
|
*/
|
|
11633
|
-
setAccount(account) {
|
|
11782
|
+
async setAccount(account) {
|
|
11634
11783
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
11635
11784
|
const key = account.generateAccountKey();
|
|
11636
|
-
this.
|
|
11785
|
+
await this.browserStorage.setUserData(key, JSON.stringify(account));
|
|
11637
11786
|
this.addAccountKeyToMap(key);
|
|
11638
11787
|
}
|
|
11639
11788
|
/**
|
|
@@ -11641,13 +11790,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11641
11790
|
* @returns
|
|
11642
11791
|
*/
|
|
11643
11792
|
getAccountKeys() {
|
|
11644
|
-
this.
|
|
11645
|
-
const accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
|
|
11646
|
-
if (accountKeys) {
|
|
11647
|
-
return JSON.parse(accountKeys);
|
|
11648
|
-
}
|
|
11649
|
-
this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found");
|
|
11650
|
-
return [];
|
|
11793
|
+
return getAccountKeys(this.browserStorage);
|
|
11651
11794
|
}
|
|
11652
11795
|
/**
|
|
11653
11796
|
* Add a new account to the key map
|
|
@@ -11660,7 +11803,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11660
11803
|
if (accountKeys.indexOf(key) === -1) {
|
|
11661
11804
|
// Only add key if it does not already exist in the map
|
|
11662
11805
|
accountKeys.push(key);
|
|
11663
|
-
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
11806
|
+
this.browserStorage.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
11664
11807
|
this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
|
|
11665
11808
|
}
|
|
11666
11809
|
else {
|
|
@@ -11678,7 +11821,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11678
11821
|
const removalIndex = accountKeys.indexOf(key);
|
|
11679
11822
|
if (removalIndex > -1) {
|
|
11680
11823
|
accountKeys.splice(removalIndex, 1);
|
|
11681
|
-
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
11824
|
+
this.browserStorage.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
11682
11825
|
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed");
|
|
11683
11826
|
}
|
|
11684
11827
|
else {
|
|
@@ -11693,14 +11836,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11693
11836
|
void super.removeAccount(key);
|
|
11694
11837
|
this.removeAccountKeyFromMap(key);
|
|
11695
11838
|
}
|
|
11696
|
-
/**
|
|
11697
|
-
* Remove account entity from the platform cache if it's outdated
|
|
11698
|
-
* @param accountKey
|
|
11699
|
-
*/
|
|
11700
|
-
removeOutdatedAccount(accountKey) {
|
|
11701
|
-
this.removeItem(accountKey);
|
|
11702
|
-
this.removeAccountKeyFromMap(accountKey);
|
|
11703
|
-
}
|
|
11704
11839
|
/**
|
|
11705
11840
|
* Removes given idToken from the cache and from the key map
|
|
11706
11841
|
* @param key
|
|
@@ -11730,28 +11865,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11730
11865
|
* @returns
|
|
11731
11866
|
*/
|
|
11732
11867
|
getTokenKeys() {
|
|
11733
|
-
this.
|
|
11734
|
-
const item = this.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
|
|
11735
|
-
if (item) {
|
|
11736
|
-
const tokenKeys = this.validateAndParseJson(item);
|
|
11737
|
-
if (tokenKeys &&
|
|
11738
|
-
tokenKeys.hasOwnProperty("idToken") &&
|
|
11739
|
-
tokenKeys.hasOwnProperty("accessToken") &&
|
|
11740
|
-
tokenKeys.hasOwnProperty("refreshToken")) {
|
|
11741
|
-
return tokenKeys;
|
|
11742
|
-
}
|
|
11743
|
-
else {
|
|
11744
|
-
this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.");
|
|
11745
|
-
}
|
|
11746
|
-
}
|
|
11747
|
-
else {
|
|
11748
|
-
this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");
|
|
11749
|
-
}
|
|
11750
|
-
return {
|
|
11751
|
-
idToken: [],
|
|
11752
|
-
accessToken: [],
|
|
11753
|
-
refreshToken: [],
|
|
11754
|
-
};
|
|
11868
|
+
return getTokenKeys(this.clientId, this.browserStorage);
|
|
11755
11869
|
}
|
|
11756
11870
|
/**
|
|
11757
11871
|
* Adds the given key to the token key map
|
|
@@ -11784,7 +11898,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11784
11898
|
this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
|
|
11785
11899
|
throw createClientAuthError(unexpectedCredentialType);
|
|
11786
11900
|
}
|
|
11787
|
-
this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
11901
|
+
this.browserStorage.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
11788
11902
|
}
|
|
11789
11903
|
/**
|
|
11790
11904
|
* Removes the given key from the token key map
|
|
@@ -11832,14 +11946,14 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11832
11946
|
this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
|
|
11833
11947
|
throw createClientAuthError(unexpectedCredentialType);
|
|
11834
11948
|
}
|
|
11835
|
-
this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
11949
|
+
this.browserStorage.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
11836
11950
|
}
|
|
11837
11951
|
/**
|
|
11838
11952
|
* generates idToken entity from a string
|
|
11839
11953
|
* @param idTokenKey
|
|
11840
11954
|
*/
|
|
11841
11955
|
getIdTokenCredential(idTokenKey) {
|
|
11842
|
-
const value = this.
|
|
11956
|
+
const value = this.browserStorage.getUserData(idTokenKey);
|
|
11843
11957
|
if (!value) {
|
|
11844
11958
|
this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
|
|
11845
11959
|
this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
@@ -11858,10 +11972,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11858
11972
|
* set IdToken credential to the platform cache
|
|
11859
11973
|
* @param idToken
|
|
11860
11974
|
*/
|
|
11861
|
-
setIdTokenCredential(idToken) {
|
|
11975
|
+
async setIdTokenCredential(idToken) {
|
|
11862
11976
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
11863
11977
|
const idTokenKey = generateCredentialKey(idToken);
|
|
11864
|
-
this.
|
|
11978
|
+
await this.browserStorage.setUserData(idTokenKey, JSON.stringify(idToken));
|
|
11865
11979
|
this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
11866
11980
|
}
|
|
11867
11981
|
/**
|
|
@@ -11869,7 +11983,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11869
11983
|
* @param key
|
|
11870
11984
|
*/
|
|
11871
11985
|
getAccessTokenCredential(accessTokenKey) {
|
|
11872
|
-
const value = this.
|
|
11986
|
+
const value = this.browserStorage.getUserData(accessTokenKey);
|
|
11873
11987
|
if (!value) {
|
|
11874
11988
|
this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
|
|
11875
11989
|
this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
@@ -11889,10 +12003,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11889
12003
|
* set accessToken credential to the platform cache
|
|
11890
12004
|
* @param accessToken
|
|
11891
12005
|
*/
|
|
11892
|
-
setAccessTokenCredential(accessToken) {
|
|
12006
|
+
async setAccessTokenCredential(accessToken) {
|
|
11893
12007
|
this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");
|
|
11894
12008
|
const accessTokenKey = generateCredentialKey(accessToken);
|
|
11895
|
-
this.
|
|
12009
|
+
await this.browserStorage.setUserData(accessTokenKey, JSON.stringify(accessToken));
|
|
11896
12010
|
this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
11897
12011
|
}
|
|
11898
12012
|
/**
|
|
@@ -11900,7 +12014,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11900
12014
|
* @param refreshTokenKey
|
|
11901
12015
|
*/
|
|
11902
12016
|
getRefreshTokenCredential(refreshTokenKey) {
|
|
11903
|
-
const value = this.
|
|
12017
|
+
const value = this.browserStorage.getUserData(refreshTokenKey);
|
|
11904
12018
|
if (!value) {
|
|
11905
12019
|
this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
|
|
11906
12020
|
this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
@@ -11920,10 +12034,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11920
12034
|
* set refreshToken credential to the platform cache
|
|
11921
12035
|
* @param refreshToken
|
|
11922
12036
|
*/
|
|
11923
|
-
setRefreshTokenCredential(refreshToken) {
|
|
12037
|
+
async setRefreshTokenCredential(refreshToken) {
|
|
11924
12038
|
this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");
|
|
11925
12039
|
const refreshTokenKey = generateCredentialKey(refreshToken);
|
|
11926
|
-
this.
|
|
12040
|
+
await this.browserStorage.setUserData(refreshTokenKey, JSON.stringify(refreshToken));
|
|
11927
12041
|
this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
11928
12042
|
}
|
|
11929
12043
|
/**
|
|
@@ -11931,7 +12045,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11931
12045
|
* @param appMetadataKey
|
|
11932
12046
|
*/
|
|
11933
12047
|
getAppMetadata(appMetadataKey) {
|
|
11934
|
-
const value = this.getItem(appMetadataKey);
|
|
12048
|
+
const value = this.browserStorage.getItem(appMetadataKey);
|
|
11935
12049
|
if (!value) {
|
|
11936
12050
|
this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit");
|
|
11937
12051
|
return null;
|
|
@@ -11952,14 +12066,14 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11952
12066
|
setAppMetadata(appMetadata) {
|
|
11953
12067
|
this.logger.trace("BrowserCacheManager.setAppMetadata called");
|
|
11954
12068
|
const appMetadataKey = generateAppMetadataKey(appMetadata);
|
|
11955
|
-
this.setItem(appMetadataKey, JSON.stringify(appMetadata));
|
|
12069
|
+
this.browserStorage.setItem(appMetadataKey, JSON.stringify(appMetadata));
|
|
11956
12070
|
}
|
|
11957
12071
|
/**
|
|
11958
12072
|
* fetch server telemetry entity from the platform cache
|
|
11959
12073
|
* @param serverTelemetryKey
|
|
11960
12074
|
*/
|
|
11961
12075
|
getServerTelemetry(serverTelemetryKey) {
|
|
11962
|
-
const value = this.getItem(serverTelemetryKey);
|
|
12076
|
+
const value = this.browserStorage.getItem(serverTelemetryKey);
|
|
11963
12077
|
if (!value) {
|
|
11964
12078
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
|
|
11965
12079
|
return null;
|
|
@@ -11980,7 +12094,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11980
12094
|
*/
|
|
11981
12095
|
setServerTelemetry(serverTelemetryKey, serverTelemetry) {
|
|
11982
12096
|
this.logger.trace("BrowserCacheManager.setServerTelemetry called");
|
|
11983
|
-
this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));
|
|
12097
|
+
this.browserStorage.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));
|
|
11984
12098
|
}
|
|
11985
12099
|
/**
|
|
11986
12100
|
*
|
|
@@ -12040,25 +12154,9 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12040
12154
|
*/
|
|
12041
12155
|
getActiveAccount() {
|
|
12042
12156
|
const activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
|
|
12043
|
-
const activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
|
|
12157
|
+
const activeAccountValueFilters = this.browserStorage.getItem(activeAccountKeyFilters);
|
|
12044
12158
|
if (!activeAccountValueFilters) {
|
|
12045
|
-
|
|
12046
|
-
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");
|
|
12047
|
-
const activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
|
|
12048
|
-
const activeAccountValueLocal = this.getItem(activeAccountKeyLocal);
|
|
12049
|
-
if (!activeAccountValueLocal) {
|
|
12050
|
-
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
|
|
12051
|
-
return null;
|
|
12052
|
-
}
|
|
12053
|
-
const activeAccount = this.getAccountInfoFilteredBy({
|
|
12054
|
-
localAccountId: activeAccountValueLocal,
|
|
12055
|
-
});
|
|
12056
|
-
if (activeAccount) {
|
|
12057
|
-
this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found");
|
|
12058
|
-
this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema");
|
|
12059
|
-
this.setActiveAccount(activeAccount);
|
|
12060
|
-
return activeAccount;
|
|
12061
|
-
}
|
|
12159
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found");
|
|
12062
12160
|
return null;
|
|
12063
12161
|
}
|
|
12064
12162
|
const activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);
|
|
@@ -12079,7 +12177,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12079
12177
|
*/
|
|
12080
12178
|
setActiveAccount(account) {
|
|
12081
12179
|
const activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
|
|
12082
|
-
const activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
|
|
12083
12180
|
if (account) {
|
|
12084
12181
|
this.logger.verbose("setActiveAccount: Active account set");
|
|
12085
12182
|
const activeAccountValue = {
|
|
@@ -12088,12 +12185,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12088
12185
|
tenantId: account.tenantId,
|
|
12089
12186
|
};
|
|
12090
12187
|
this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));
|
|
12091
|
-
this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);
|
|
12092
12188
|
}
|
|
12093
12189
|
else {
|
|
12094
12190
|
this.logger.verbose("setActiveAccount: No account passed, active account not set");
|
|
12095
12191
|
this.browserStorage.removeItem(activeAccountKey);
|
|
12096
|
-
this.browserStorage.removeItem(activeAccountKeyLocal);
|
|
12097
12192
|
}
|
|
12098
12193
|
}
|
|
12099
12194
|
/**
|
|
@@ -12101,7 +12196,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12101
12196
|
* @param throttlingCacheKey
|
|
12102
12197
|
*/
|
|
12103
12198
|
getThrottlingCache(throttlingCacheKey) {
|
|
12104
|
-
const value = this.getItem(throttlingCacheKey);
|
|
12199
|
+
const value = this.browserStorage.getItem(throttlingCacheKey);
|
|
12105
12200
|
if (!value) {
|
|
12106
12201
|
this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit");
|
|
12107
12202
|
return null;
|
|
@@ -12122,7 +12217,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12122
12217
|
*/
|
|
12123
12218
|
setThrottlingCache(throttlingCacheKey, throttlingCache) {
|
|
12124
12219
|
this.logger.trace("BrowserCacheManager.setThrottlingCache called");
|
|
12125
|
-
this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));
|
|
12220
|
+
this.browserStorage.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));
|
|
12126
12221
|
}
|
|
12127
12222
|
/**
|
|
12128
12223
|
* Gets cache item with given key.
|
|
@@ -12132,7 +12227,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12132
12227
|
getTemporaryCache(cacheKey, generateKey) {
|
|
12133
12228
|
const key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;
|
|
12134
12229
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
12135
|
-
const itemCookie = this.
|
|
12230
|
+
const itemCookie = this.cookieStorage.getItem(key);
|
|
12136
12231
|
if (itemCookie) {
|
|
12137
12232
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies");
|
|
12138
12233
|
return itemCookie;
|
|
@@ -12167,7 +12262,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12167
12262
|
this.temporaryCacheStorage.setItem(key, value);
|
|
12168
12263
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
12169
12264
|
this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie");
|
|
12170
|
-
this.
|
|
12265
|
+
this.cookieStorage.setItem(key, value, undefined, this.cacheConfig.secureCookies);
|
|
12171
12266
|
}
|
|
12172
12267
|
}
|
|
12173
12268
|
/**
|
|
@@ -12186,7 +12281,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12186
12281
|
this.temporaryCacheStorage.removeItem(key);
|
|
12187
12282
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
12188
12283
|
this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie");
|
|
12189
|
-
this.
|
|
12284
|
+
this.cookieStorage.removeItem(key);
|
|
12190
12285
|
}
|
|
12191
12286
|
}
|
|
12192
12287
|
/**
|
|
@@ -12242,79 +12337,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12242
12337
|
this.logger.warning(`${removedAccessTokens.length} access tokens with claims in the cache keys have been removed from the cache.`);
|
|
12243
12338
|
}
|
|
12244
12339
|
}
|
|
12245
|
-
/**
|
|
12246
|
-
* Add value to cookies
|
|
12247
|
-
* @param cookieName
|
|
12248
|
-
* @param cookieValue
|
|
12249
|
-
* @param expires
|
|
12250
|
-
* @deprecated
|
|
12251
|
-
*/
|
|
12252
|
-
setItemCookie(cookieName, cookieValue, expires) {
|
|
12253
|
-
let cookieStr = `${encodeURIComponent(cookieName)}=${encodeURIComponent(cookieValue)};path=/;SameSite=Lax;`;
|
|
12254
|
-
if (expires) {
|
|
12255
|
-
const expireTime = this.getCookieExpirationTime(expires);
|
|
12256
|
-
cookieStr += `expires=${expireTime};`;
|
|
12257
|
-
}
|
|
12258
|
-
if (this.cacheConfig.secureCookies) {
|
|
12259
|
-
cookieStr += "Secure;";
|
|
12260
|
-
}
|
|
12261
|
-
document.cookie = cookieStr;
|
|
12262
|
-
}
|
|
12263
|
-
/**
|
|
12264
|
-
* Get one item by key from cookies
|
|
12265
|
-
* @param cookieName
|
|
12266
|
-
* @deprecated
|
|
12267
|
-
*/
|
|
12268
|
-
getItemCookie(cookieName) {
|
|
12269
|
-
const name = `${encodeURIComponent(cookieName)}=`;
|
|
12270
|
-
const cookieList = document.cookie.split(";");
|
|
12271
|
-
for (let i = 0; i < cookieList.length; i++) {
|
|
12272
|
-
let cookie = cookieList[i];
|
|
12273
|
-
while (cookie.charAt(0) === " ") {
|
|
12274
|
-
cookie = cookie.substring(1);
|
|
12275
|
-
}
|
|
12276
|
-
if (cookie.indexOf(name) === 0) {
|
|
12277
|
-
return decodeURIComponent(cookie.substring(name.length, cookie.length));
|
|
12278
|
-
}
|
|
12279
|
-
}
|
|
12280
|
-
return Constants.EMPTY_STRING;
|
|
12281
|
-
}
|
|
12282
|
-
/**
|
|
12283
|
-
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
12284
|
-
* @deprecated
|
|
12285
|
-
*/
|
|
12286
|
-
clearMsalCookies() {
|
|
12287
|
-
const cookiePrefix = `${Constants.CACHE_PREFIX}.${this.clientId}`;
|
|
12288
|
-
const cookieList = document.cookie.split(";");
|
|
12289
|
-
cookieList.forEach((cookie) => {
|
|
12290
|
-
while (cookie.charAt(0) === " ") {
|
|
12291
|
-
// eslint-disable-next-line no-param-reassign
|
|
12292
|
-
cookie = cookie.substring(1);
|
|
12293
|
-
}
|
|
12294
|
-
if (cookie.indexOf(cookiePrefix) === 0) {
|
|
12295
|
-
const cookieKey = cookie.split("=")[0];
|
|
12296
|
-
this.clearItemCookie(cookieKey);
|
|
12297
|
-
}
|
|
12298
|
-
});
|
|
12299
|
-
}
|
|
12300
|
-
/**
|
|
12301
|
-
* Clear an item in the cookies by key
|
|
12302
|
-
* @param cookieName
|
|
12303
|
-
* @deprecated
|
|
12304
|
-
*/
|
|
12305
|
-
clearItemCookie(cookieName) {
|
|
12306
|
-
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
12307
|
-
}
|
|
12308
|
-
/**
|
|
12309
|
-
* Get cookie expiration time
|
|
12310
|
-
* @param cookieLifeDays
|
|
12311
|
-
* @deprecated
|
|
12312
|
-
*/
|
|
12313
|
-
getCookieExpirationTime(cookieLifeDays) {
|
|
12314
|
-
const today = new Date();
|
|
12315
|
-
const expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);
|
|
12316
|
-
return expr.toUTCString();
|
|
12317
|
-
}
|
|
12318
12340
|
/**
|
|
12319
12341
|
* Prepend msal.<client-id> to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)
|
|
12320
12342
|
* @param key
|
|
@@ -12323,8 +12345,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12323
12345
|
generateCacheKey(key) {
|
|
12324
12346
|
const generatedKey = this.validateAndParseJson(key);
|
|
12325
12347
|
if (!generatedKey) {
|
|
12326
|
-
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX)
|
|
12327
|
-
StringUtils.startsWith(key, PersistentCacheKeys.ADAL_ID_TOKEN)) {
|
|
12348
|
+
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX)) {
|
|
12328
12349
|
return key;
|
|
12329
12350
|
}
|
|
12330
12351
|
return `${Constants.CACHE_PREFIX}.${this.clientId}.${key}`;
|
|
@@ -12438,7 +12459,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12438
12459
|
this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${cachedState}`);
|
|
12439
12460
|
this.resetRequestCache(cachedState || Constants.EMPTY_STRING);
|
|
12440
12461
|
}
|
|
12441
|
-
this.clearMsalCookies();
|
|
12442
12462
|
}
|
|
12443
12463
|
/**
|
|
12444
12464
|
* Looks in temporary cache for any state values with the provided interactionType and removes all temporary cache items for that state
|
|
@@ -12466,7 +12486,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12466
12486
|
this.resetRequestCache(stateValue);
|
|
12467
12487
|
}
|
|
12468
12488
|
});
|
|
12469
|
-
this.clearMsalCookies();
|
|
12470
12489
|
this.setInteractionInProgress(false);
|
|
12471
12490
|
}
|
|
12472
12491
|
cacheCodeRequest(authCodeRequest) {
|
|
@@ -12552,59 +12571,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12552
12571
|
this.removeTemporaryItem(key);
|
|
12553
12572
|
}
|
|
12554
12573
|
}
|
|
12555
|
-
/**
|
|
12556
|
-
* Returns username retrieved from ADAL or MSAL v1 idToken
|
|
12557
|
-
* @deprecated
|
|
12558
|
-
*/
|
|
12559
|
-
getLegacyLoginHint() {
|
|
12560
|
-
// Only check for adal/msal token if no SSO params are being used
|
|
12561
|
-
const adalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ADAL_ID_TOKEN);
|
|
12562
|
-
if (adalIdTokenString) {
|
|
12563
|
-
this.browserStorage.removeItem(PersistentCacheKeys.ADAL_ID_TOKEN);
|
|
12564
|
-
this.logger.verbose("Cached ADAL id token retrieved.");
|
|
12565
|
-
}
|
|
12566
|
-
// Check for cached MSAL v1 id token
|
|
12567
|
-
const msalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ID_TOKEN, true);
|
|
12568
|
-
if (msalIdTokenString) {
|
|
12569
|
-
this.browserStorage.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
12570
|
-
this.logger.verbose("Cached MSAL.js v1 id token retrieved");
|
|
12571
|
-
}
|
|
12572
|
-
const cachedIdTokenString = msalIdTokenString || adalIdTokenString;
|
|
12573
|
-
if (cachedIdTokenString) {
|
|
12574
|
-
const idTokenClaims = extractTokenClaims(cachedIdTokenString, base64Decode);
|
|
12575
|
-
if (idTokenClaims.preferred_username) {
|
|
12576
|
-
this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint");
|
|
12577
|
-
return idTokenClaims.preferred_username;
|
|
12578
|
-
}
|
|
12579
|
-
else if (idTokenClaims.upn) {
|
|
12580
|
-
this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint");
|
|
12581
|
-
return idTokenClaims.upn;
|
|
12582
|
-
}
|
|
12583
|
-
else {
|
|
12584
|
-
this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.");
|
|
12585
|
-
}
|
|
12586
|
-
}
|
|
12587
|
-
return null;
|
|
12588
|
-
}
|
|
12589
|
-
/**
|
|
12590
|
-
* Updates a credential's cache key if the current cache key is outdated
|
|
12591
|
-
*/
|
|
12592
|
-
updateCredentialCacheKey(currentCacheKey, credential) {
|
|
12593
|
-
const updatedCacheKey = generateCredentialKey(credential);
|
|
12594
|
-
if (currentCacheKey !== updatedCacheKey) {
|
|
12595
|
-
const cacheItem = this.getItem(currentCacheKey);
|
|
12596
|
-
if (cacheItem) {
|
|
12597
|
-
this.browserStorage.removeItem(currentCacheKey);
|
|
12598
|
-
this.setItem(updatedCacheKey, cacheItem);
|
|
12599
|
-
this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
|
|
12600
|
-
return updatedCacheKey;
|
|
12601
|
-
}
|
|
12602
|
-
else {
|
|
12603
|
-
this.logger.error(`Attempted to update an outdated ${credential.credentialType} cache key but no item matching the outdated key was found in storage`);
|
|
12604
|
-
}
|
|
12605
|
-
}
|
|
12606
|
-
return currentCacheKey;
|
|
12607
|
-
}
|
|
12608
12574
|
/**
|
|
12609
12575
|
* Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
|
|
12610
12576
|
* @param result
|
|
@@ -13321,19 +13287,16 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
13321
13287
|
responseMode: this.config.auth.OIDCOptions
|
|
13322
13288
|
.serverResponseType,
|
|
13323
13289
|
};
|
|
13290
|
+
// Skip active account lookup if either login hint or session id is set
|
|
13291
|
+
if (request.loginHint || request.sid) {
|
|
13292
|
+
return validatedRequest;
|
|
13293
|
+
}
|
|
13324
13294
|
const account = request.account || this.browserStorage.getActiveAccount();
|
|
13325
13295
|
if (account) {
|
|
13326
13296
|
this.logger.verbose("Setting validated request account", this.correlationId);
|
|
13327
13297
|
this.logger.verbosePii(`Setting validated request account: ${account.homeAccountId}`, this.correlationId);
|
|
13328
13298
|
validatedRequest.account = account;
|
|
13329
13299
|
}
|
|
13330
|
-
// Check for ADAL/MSAL v1 SSO
|
|
13331
|
-
if (!validatedRequest.loginHint && !account) {
|
|
13332
|
-
const legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
13333
|
-
if (legacyLoginHint) {
|
|
13334
|
-
validatedRequest.loginHint = legacyLoginHint;
|
|
13335
|
-
}
|
|
13336
|
-
}
|
|
13337
13300
|
return validatedRequest;
|
|
13338
13301
|
}
|
|
13339
13302
|
}
|
|
@@ -13737,7 +13700,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
13737
13700
|
// generate authenticationResult
|
|
13738
13701
|
const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
|
13739
13702
|
// cache accounts and tokens in the appropriate storage
|
|
13740
|
-
this.cacheAccount(baseAccount);
|
|
13703
|
+
await this.cacheAccount(baseAccount);
|
|
13741
13704
|
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
|
|
13742
13705
|
return result;
|
|
13743
13706
|
}
|
|
@@ -13862,9 +13825,9 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
13862
13825
|
* cache the account entity in browser storage
|
|
13863
13826
|
* @param accountEntity
|
|
13864
13827
|
*/
|
|
13865
|
-
cacheAccount(accountEntity) {
|
|
13828
|
+
async cacheAccount(accountEntity) {
|
|
13866
13829
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
13867
|
-
this.browserStorage.setAccount(accountEntity);
|
|
13830
|
+
await this.browserStorage.setAccount(accountEntity);
|
|
13868
13831
|
// Remove any existing cached tokens for this account in browser storage
|
|
13869
13832
|
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
|
13870
13833
|
this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);
|
|
@@ -15742,7 +15705,7 @@ class TokenCache {
|
|
|
15742
15705
|
* @param options
|
|
15743
15706
|
* @returns `AuthenticationResult` for the response that was loaded.
|
|
15744
15707
|
*/
|
|
15745
|
-
loadExternalTokens(request, response, options) {
|
|
15708
|
+
async loadExternalTokens(request, response, options) {
|
|
15746
15709
|
if (!this.isBrowserEnvironment) {
|
|
15747
15710
|
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
15748
15711
|
}
|
|
@@ -15759,10 +15722,10 @@ class TokenCache {
|
|
|
15759
15722
|
const authority = request.authority
|
|
15760
15723
|
? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
|
|
15761
15724
|
: undefined;
|
|
15762
|
-
const cacheRecordAccount = this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
|
|
15763
|
-
const idToken = this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
|
|
15764
|
-
const accessToken = this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
|
|
15765
|
-
const refreshToken = this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
|
|
15725
|
+
const cacheRecordAccount = await this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
|
|
15726
|
+
const idToken = await this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
|
|
15727
|
+
const accessToken = await this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
|
|
15728
|
+
const refreshToken = await this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
|
|
15766
15729
|
return this.generateAuthenticationResult(request, {
|
|
15767
15730
|
account: cacheRecordAccount,
|
|
15768
15731
|
idToken,
|
|
@@ -15779,11 +15742,11 @@ class TokenCache {
|
|
|
15779
15742
|
* @param requestHomeAccountId
|
|
15780
15743
|
* @returns `AccountEntity`
|
|
15781
15744
|
*/
|
|
15782
|
-
loadAccount(request, clientInfo, idTokenClaims, authority) {
|
|
15745
|
+
async loadAccount(request, clientInfo, idTokenClaims, authority) {
|
|
15783
15746
|
this.logger.verbose("TokenCache - loading account");
|
|
15784
15747
|
if (request.account) {
|
|
15785
15748
|
const accountEntity = AccountEntity.createFromAccountInfo(request.account);
|
|
15786
|
-
this.storage.setAccount(accountEntity);
|
|
15749
|
+
await this.storage.setAccount(accountEntity);
|
|
15787
15750
|
return accountEntity;
|
|
15788
15751
|
}
|
|
15789
15752
|
else if (!authority || (!clientInfo && !idTokenClaims)) {
|
|
@@ -15795,7 +15758,7 @@ class TokenCache {
|
|
|
15795
15758
|
const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
|
|
15796
15759
|
undefined, // nativeAccountId
|
|
15797
15760
|
this.logger);
|
|
15798
|
-
this.storage.setAccount(cachedAccount);
|
|
15761
|
+
await this.storage.setAccount(cachedAccount);
|
|
15799
15762
|
return cachedAccount;
|
|
15800
15763
|
}
|
|
15801
15764
|
/**
|
|
@@ -15806,14 +15769,14 @@ class TokenCache {
|
|
|
15806
15769
|
* @param tenantId
|
|
15807
15770
|
* @returns `IdTokenEntity`
|
|
15808
15771
|
*/
|
|
15809
|
-
loadIdToken(response, homeAccountId, environment, tenantId) {
|
|
15772
|
+
async loadIdToken(response, homeAccountId, environment, tenantId) {
|
|
15810
15773
|
if (!response.id_token) {
|
|
15811
15774
|
this.logger.verbose("TokenCache - no id token found in response");
|
|
15812
15775
|
return null;
|
|
15813
15776
|
}
|
|
15814
15777
|
this.logger.verbose("TokenCache - loading id token");
|
|
15815
15778
|
const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
|
|
15816
|
-
this.storage.setIdTokenCredential(idTokenEntity);
|
|
15779
|
+
await this.storage.setIdTokenCredential(idTokenEntity);
|
|
15817
15780
|
return idTokenEntity;
|
|
15818
15781
|
}
|
|
15819
15782
|
/**
|
|
@@ -15825,7 +15788,7 @@ class TokenCache {
|
|
|
15825
15788
|
* @param tenantId
|
|
15826
15789
|
* @returns `AccessTokenEntity`
|
|
15827
15790
|
*/
|
|
15828
|
-
loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
|
|
15791
|
+
async loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
|
|
15829
15792
|
if (!response.access_token) {
|
|
15830
15793
|
this.logger.verbose("TokenCache - no access token found in response");
|
|
15831
15794
|
return null;
|
|
@@ -15849,7 +15812,7 @@ class TokenCache {
|
|
|
15849
15812
|
(response.ext_expires_in || response.expires_in) +
|
|
15850
15813
|
new Date().getTime() / 1000;
|
|
15851
15814
|
const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
|
|
15852
|
-
this.storage.setAccessTokenCredential(accessTokenEntity);
|
|
15815
|
+
await this.storage.setAccessTokenCredential(accessTokenEntity);
|
|
15853
15816
|
return accessTokenEntity;
|
|
15854
15817
|
}
|
|
15855
15818
|
/**
|
|
@@ -15860,7 +15823,7 @@ class TokenCache {
|
|
|
15860
15823
|
* @param environment
|
|
15861
15824
|
* @returns `RefreshTokenEntity`
|
|
15862
15825
|
*/
|
|
15863
|
-
loadRefreshToken(response, homeAccountId, environment) {
|
|
15826
|
+
async loadRefreshToken(response, homeAccountId, environment) {
|
|
15864
15827
|
if (!response.refresh_token) {
|
|
15865
15828
|
this.logger.verbose("TokenCache - no refresh token found in response");
|
|
15866
15829
|
return null;
|
|
@@ -15868,7 +15831,7 @@ class TokenCache {
|
|
|
15868
15831
|
this.logger.verbose("TokenCache - loading refresh token");
|
|
15869
15832
|
const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
|
|
15870
15833
|
response.refresh_token_expires_in);
|
|
15871
|
-
this.storage.setRefreshTokenCredential(refreshTokenEntity);
|
|
15834
|
+
await this.storage.setRefreshTokenCredential(refreshTokenEntity);
|
|
15872
15835
|
return refreshTokenEntity;
|
|
15873
15836
|
}
|
|
15874
15837
|
/**
|
|
@@ -16117,6 +16080,7 @@ class StandardController {
|
|
|
16117
16080
|
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16118
16081
|
return;
|
|
16119
16082
|
}
|
|
16083
|
+
await this.browserStorage.initialize();
|
|
16120
16084
|
const initCorrelationId = request?.correlationId || this.getRequestCorrelationId();
|
|
16121
16085
|
const allowNativeBroker = this.config.system.allowNativeBroker;
|
|
16122
16086
|
const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication, initCorrelationId);
|
|
@@ -16842,7 +16806,7 @@ class StandardController {
|
|
|
16842
16806
|
this.logger.verbose("hydrateCache called");
|
|
16843
16807
|
// Account gets saved to browser storage regardless of native or not
|
|
16844
16808
|
const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
16845
|
-
this.browserStorage.setAccount(accountEntity);
|
|
16809
|
+
await this.browserStorage.setAccount(accountEntity);
|
|
16846
16810
|
if (result.fromNativeBroker) {
|
|
16847
16811
|
this.logger.verbose("Response was from native broker, storing in-memory");
|
|
16848
16812
|
// Tokens from native broker are stored in-memory
|
|
@@ -17643,8 +17607,8 @@ class NestedAppAuthController {
|
|
|
17643
17607
|
* Specific implementation of initialize function for NestedAppAuthController
|
|
17644
17608
|
* @returns
|
|
17645
17609
|
*/
|
|
17646
|
-
initialize() {
|
|
17647
|
-
|
|
17610
|
+
async initialize() {
|
|
17611
|
+
await this.browserStorage.initialize();
|
|
17648
17612
|
return Promise.resolve();
|
|
17649
17613
|
}
|
|
17650
17614
|
/**
|
|
@@ -18070,7 +18034,7 @@ class NestedAppAuthController {
|
|
|
18070
18034
|
async hydrateCache(result, request) {
|
|
18071
18035
|
this.logger.verbose("hydrateCache called");
|
|
18072
18036
|
const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
18073
|
-
this.browserStorage.setAccount(accountEntity);
|
|
18037
|
+
await this.browserStorage.setAccount(accountEntity);
|
|
18074
18038
|
return this.browserStorage.hydrateCache(result, request);
|
|
18075
18039
|
}
|
|
18076
18040
|
}
|
|
@@ -19615,7 +19579,6 @@ exports.BrowserConfigurationAuthErrorCodes = BrowserConfigurationAuthErrorCodes;
|
|
|
19615
19579
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
19616
19580
|
exports.BrowserPerformanceClient = BrowserPerformanceClient;
|
|
19617
19581
|
exports.BrowserPerformanceMeasurement = BrowserPerformanceMeasurement;
|
|
19618
|
-
exports.BrowserStorage = BrowserStorage;
|
|
19619
19582
|
exports.BrowserUtils = BrowserUtils;
|
|
19620
19583
|
exports.CacheLookupPolicy = CacheLookupPolicy;
|
|
19621
19584
|
exports.ClientAuthError = ClientAuthError;
|
|
@@ -19633,6 +19596,7 @@ exports.InteractionRequiredAuthErrorCodes = InteractionRequiredAuthErrorCodes;
|
|
|
19633
19596
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
19634
19597
|
exports.InteractionStatus = InteractionStatus;
|
|
19635
19598
|
exports.JsonWebTokenTypes = JsonWebTokenTypes;
|
|
19599
|
+
exports.LocalStorage = LocalStorage;
|
|
19636
19600
|
exports.Logger = Logger;
|
|
19637
19601
|
exports.MemoryStorage = MemoryStorage;
|
|
19638
19602
|
exports.NavigationClient = NavigationClient;
|
|
@@ -19644,6 +19608,7 @@ exports.PublicClientApplication = PublicClientApplication;
|
|
|
19644
19608
|
exports.PublicClientNext = PublicClientNext;
|
|
19645
19609
|
exports.ServerError = ServerError;
|
|
19646
19610
|
exports.ServerResponseType = ServerResponseType;
|
|
19611
|
+
exports.SessionStorage = SessionStorage;
|
|
19647
19612
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
19648
19613
|
exports.StringUtils = StringUtils;
|
|
19649
19614
|
exports.StubPerformanceClient = StubPerformanceClient;
|