@azure/msal-browser 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +2 -3
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +4 -5
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +8 -27
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +48 -75
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.d.ts +1 -1
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +14 -4
- package/dist/cache/DatabaseStorage.mjs.map +1 -1
- package/dist/cache/{IAsyncMemoryStorage.d.ts → IAsyncStorage.d.ts} +1 -1
- package/dist/cache/IAsyncStorage.d.ts.map +1 -0
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/IController.d.ts +1 -3
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +2 -3
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +21 -19
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +5 -23
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +47 -127
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +1 -2
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +28 -36
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +5 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +12 -2
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +28 -12
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +1 -6
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -43
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +1 -9
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +3 -22
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +3 -2
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +3 -2
- 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.d.ts +3 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +4 -3
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/RequestHelpers.d.ts +14 -0
- package/dist/request/RequestHelpers.d.ts.map +1 -0
- package/dist/request/RequestHelpers.mjs +61 -0
- package/dist/request/RequestHelpers.mjs.map +1 -0
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +5 -5
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.d.ts +14 -3
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +37 -10
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +866 -584
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +866 -584
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -66
- package/package.json +2 -2
- package/src/cache/AsyncMemoryStorage.ts +4 -6
- package/src/cache/BrowserCacheManager.ts +54 -90
- package/src/cache/DatabaseStorage.ts +14 -4
- package/src/controllers/IController.ts +1 -7
- package/src/controllers/NestedAppAuthController.ts +38 -23
- package/src/controllers/StandardController.ts +107 -179
- package/src/controllers/UnknownOperatingContextController.ts +28 -37
- package/src/crypto/BrowserCrypto.ts +11 -0
- package/src/crypto/CryptoOps.ts +31 -13
- package/src/index.ts +2 -0
- package/src/interaction_client/BaseInteractionClient.ts +0 -66
- package/src/interaction_client/SilentCacheClient.ts +11 -51
- package/src/interaction_client/SilentRefreshClient.ts +3 -2
- package/src/interaction_client/StandardInteractionClient.ts +8 -2
- package/src/naa/mapping/NestedAppAuthAdapter.ts +10 -2
- package/src/packageMetadata.ts +1 -1
- package/src/request/RequestHelpers.ts +112 -0
- package/src/telemetry/BrowserPerformanceClient.ts +18 -9
- package/src/utils/BrowserUtils.ts +50 -15
- package/dist/cache/CryptoKeyStore.d.ts +0 -19
- package/dist/cache/CryptoKeyStore.d.ts.map +0 -1
- package/dist/cache/CryptoKeyStore.mjs +0 -47
- package/dist/cache/CryptoKeyStore.mjs.map +0 -1
- package/dist/cache/IAsyncMemoryStorage.d.ts.map +0 -1
- package/src/cache/CryptoKeyStore.ts +0 -63
- /package/src/cache/{IAsyncMemoryStorage.ts → IAsyncStorage.ts} +0 -0
package/lib/msal-browser.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.11.0 2024-03-22 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v14.
|
|
5
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -297,7 +297,7 @@ const JsonWebTokenTypes = {
|
|
|
297
297
|
Pop: "pop",
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
-
/*! @azure/msal-common v14.
|
|
300
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
301
301
|
/*
|
|
302
302
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
303
303
|
* Licensed under the MIT License.
|
|
@@ -314,7 +314,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
314
314
|
unexpectedError: unexpectedError
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
/*! @azure/msal-common v14.
|
|
317
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
318
318
|
|
|
319
319
|
/*
|
|
320
320
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -363,7 +363,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
363
363
|
: AuthErrorMessages[code]);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
/*! @azure/msal-common v14.
|
|
366
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
367
367
|
/*
|
|
368
368
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
369
369
|
* Licensed under the MIT License.
|
|
@@ -461,7 +461,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
461
461
|
userTimeoutReached: userTimeoutReached
|
|
462
462
|
});
|
|
463
463
|
|
|
464
|
-
/*! @azure/msal-common v14.
|
|
464
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
465
465
|
|
|
466
466
|
/*
|
|
467
467
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -713,7 +713,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
713
713
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
714
714
|
}
|
|
715
715
|
|
|
716
|
-
/*! @azure/msal-common v14.
|
|
716
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
717
717
|
|
|
718
718
|
/*
|
|
719
719
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -746,7 +746,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
746
746
|
},
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
-
/*! @azure/msal-common v14.
|
|
749
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
750
750
|
|
|
751
751
|
/*
|
|
752
752
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -937,12 +937,12 @@ class Logger {
|
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
/*! @azure/msal-common v14.
|
|
940
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
941
941
|
/* eslint-disable header/header */
|
|
942
942
|
const name$1 = "@azure/msal-common";
|
|
943
|
-
const version$1 = "14.
|
|
943
|
+
const version$1 = "14.8.0";
|
|
944
944
|
|
|
945
|
-
/*! @azure/msal-common v14.
|
|
945
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
946
946
|
/*
|
|
947
947
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
948
948
|
* Licensed under the MIT License.
|
|
@@ -962,7 +962,7 @@ const AzureCloudInstance = {
|
|
|
962
962
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
963
963
|
};
|
|
964
964
|
|
|
965
|
-
/*! @azure/msal-common v14.
|
|
965
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
966
966
|
|
|
967
967
|
/*
|
|
968
968
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1023,7 +1023,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
|
-
/*! @azure/msal-common v14.
|
|
1026
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1027
1027
|
/*
|
|
1028
1028
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1029
1029
|
* Licensed under the MIT License.
|
|
@@ -1060,7 +1060,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1060
1060
|
return cachedAtSec > nowSeconds();
|
|
1061
1061
|
}
|
|
1062
1062
|
|
|
1063
|
-
/*! @azure/msal-common v14.
|
|
1063
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1064
1064
|
|
|
1065
1065
|
/*
|
|
1066
1066
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1387,7 +1387,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1387
1387
|
return metadata.expiresAt <= nowSeconds();
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
|
-
/*! @azure/msal-common v14.
|
|
1390
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1391
1391
|
/*
|
|
1392
1392
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1393
1393
|
* Licensed under the MIT License.
|
|
@@ -1441,7 +1441,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1441
1441
|
urlParseError: urlParseError
|
|
1442
1442
|
});
|
|
1443
1443
|
|
|
1444
|
-
/*! @azure/msal-common v14.
|
|
1444
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1445
1445
|
|
|
1446
1446
|
/*
|
|
1447
1447
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1579,7 +1579,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1579
1579
|
return new ClientConfigurationError(errorCode);
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
-
/*! @azure/msal-common v14.
|
|
1582
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1583
1583
|
/*
|
|
1584
1584
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1585
1585
|
* Licensed under the MIT License.
|
|
@@ -1676,7 +1676,7 @@ class StringUtils {
|
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
|
|
1679
|
-
/*! @azure/msal-common v14.
|
|
1679
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1680
1680
|
|
|
1681
1681
|
/*
|
|
1682
1682
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1876,7 +1876,7 @@ class ScopeSet {
|
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
1878
|
|
|
1879
|
-
/*! @azure/msal-common v14.
|
|
1879
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1880
1880
|
|
|
1881
1881
|
/*
|
|
1882
1882
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1916,7 +1916,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1916
1916
|
};
|
|
1917
1917
|
}
|
|
1918
1918
|
|
|
1919
|
-
/*! @azure/msal-common v14.
|
|
1919
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1920
1920
|
/*
|
|
1921
1921
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1922
1922
|
* Licensed under the MIT License.
|
|
@@ -1978,7 +1978,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
1978
1978
|
return updatedAccountInfo;
|
|
1979
1979
|
}
|
|
1980
1980
|
|
|
1981
|
-
/*! @azure/msal-common v14.
|
|
1981
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1982
1982
|
/*
|
|
1983
1983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1984
1984
|
* Licensed under the MIT License.
|
|
@@ -1993,7 +1993,7 @@ const AuthorityType = {
|
|
|
1993
1993
|
Ciam: 3,
|
|
1994
1994
|
};
|
|
1995
1995
|
|
|
1996
|
-
/*! @azure/msal-common v14.
|
|
1996
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1997
1997
|
/*
|
|
1998
1998
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1999
1999
|
* Licensed under the MIT License.
|
|
@@ -2015,7 +2015,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2015
2015
|
return null;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
-
/*! @azure/msal-common v14.
|
|
2018
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2019
2019
|
/*
|
|
2020
2020
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2021
2021
|
* Licensed under the MIT License.
|
|
@@ -2028,7 +2028,7 @@ const ProtocolMode = {
|
|
|
2028
2028
|
OIDC: "OIDC",
|
|
2029
2029
|
};
|
|
2030
2030
|
|
|
2031
|
-
/*! @azure/msal-common v14.
|
|
2031
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2032
2032
|
|
|
2033
2033
|
/*
|
|
2034
2034
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2275,7 +2275,7 @@ class AccountEntity {
|
|
|
2275
2275
|
}
|
|
2276
2276
|
}
|
|
2277
2277
|
|
|
2278
|
-
/*! @azure/msal-common v14.
|
|
2278
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2279
2279
|
|
|
2280
2280
|
/*
|
|
2281
2281
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2322,7 +2322,7 @@ function getDeserializedResponse(responseString) {
|
|
|
2322
2322
|
return null;
|
|
2323
2323
|
}
|
|
2324
2324
|
|
|
2325
|
-
/*! @azure/msal-common v14.
|
|
2325
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2326
2326
|
|
|
2327
2327
|
/*
|
|
2328
2328
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2486,7 +2486,7 @@ class UrlString {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
}
|
|
2488
2488
|
|
|
2489
|
-
/*! @azure/msal-common v14.
|
|
2489
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2490
2490
|
|
|
2491
2491
|
/*
|
|
2492
2492
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2626,7 +2626,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2626
2626
|
return null;
|
|
2627
2627
|
}
|
|
2628
2628
|
|
|
2629
|
-
/*! @azure/msal-common v14.
|
|
2629
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2630
2630
|
|
|
2631
2631
|
/*
|
|
2632
2632
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3033,14 +3033,6 @@ class CacheManager {
|
|
|
3033
3033
|
* @param filter
|
|
3034
3034
|
*/
|
|
3035
3035
|
getAppMetadataFilteredBy(filter) {
|
|
3036
|
-
return this.getAppMetadataFilteredByInternal(filter.environment, filter.clientId);
|
|
3037
|
-
}
|
|
3038
|
-
/**
|
|
3039
|
-
* Support function to help match appMetadata
|
|
3040
|
-
* @param environment
|
|
3041
|
-
* @param clientId
|
|
3042
|
-
*/
|
|
3043
|
-
getAppMetadataFilteredByInternal(environment, clientId) {
|
|
3044
3036
|
const allCacheKeys = this.getKeys();
|
|
3045
3037
|
const matchingAppMetadata = {};
|
|
3046
3038
|
allCacheKeys.forEach((cacheKey) => {
|
|
@@ -3053,10 +3045,12 @@ class CacheManager {
|
|
|
3053
3045
|
if (!entity) {
|
|
3054
3046
|
return;
|
|
3055
3047
|
}
|
|
3056
|
-
if (!!environment &&
|
|
3048
|
+
if (!!filter.environment &&
|
|
3049
|
+
!this.matchEnvironment(entity, filter.environment)) {
|
|
3057
3050
|
return;
|
|
3058
3051
|
}
|
|
3059
|
-
if (!!clientId &&
|
|
3052
|
+
if (!!filter.clientId &&
|
|
3053
|
+
!this.matchClientId(entity, filter.clientId)) {
|
|
3060
3054
|
return;
|
|
3061
3055
|
}
|
|
3062
3056
|
matchingAppMetadata[cacheKey] = entity;
|
|
@@ -3843,9 +3837,6 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3843
3837
|
removeItem() {
|
|
3844
3838
|
throw createClientAuthError(methodNotImplemented);
|
|
3845
3839
|
}
|
|
3846
|
-
containsKey() {
|
|
3847
|
-
throw createClientAuthError(methodNotImplemented);
|
|
3848
|
-
}
|
|
3849
3840
|
getKeys() {
|
|
3850
3841
|
throw createClientAuthError(methodNotImplemented);
|
|
3851
3842
|
}
|
|
@@ -3866,7 +3857,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3866
3857
|
}
|
|
3867
3858
|
}
|
|
3868
3859
|
|
|
3869
|
-
/*! @azure/msal-common v14.
|
|
3860
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3870
3861
|
|
|
3871
3862
|
/*
|
|
3872
3863
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3966,7 +3957,7 @@ function isOidcProtocolMode(config) {
|
|
|
3966
3957
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3967
3958
|
}
|
|
3968
3959
|
|
|
3969
|
-
/*! @azure/msal-common v14.
|
|
3960
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3970
3961
|
|
|
3971
3962
|
/*
|
|
3972
3963
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3983,7 +3974,7 @@ class ServerError extends AuthError {
|
|
|
3983
3974
|
}
|
|
3984
3975
|
}
|
|
3985
3976
|
|
|
3986
|
-
/*! @azure/msal-common v14.
|
|
3977
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3987
3978
|
|
|
3988
3979
|
/*
|
|
3989
3980
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4081,7 +4072,7 @@ class ThrottlingUtils {
|
|
|
4081
4072
|
}
|
|
4082
4073
|
}
|
|
4083
4074
|
|
|
4084
|
-
/*! @azure/msal-common v14.
|
|
4075
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4085
4076
|
|
|
4086
4077
|
/*
|
|
4087
4078
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4118,7 +4109,7 @@ class NetworkManager {
|
|
|
4118
4109
|
}
|
|
4119
4110
|
}
|
|
4120
4111
|
|
|
4121
|
-
/*! @azure/msal-common v14.
|
|
4112
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4122
4113
|
/*
|
|
4123
4114
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4124
4115
|
* Licensed under the MIT License.
|
|
@@ -4128,7 +4119,7 @@ const CcsCredentialType = {
|
|
|
4128
4119
|
UPN: "UPN",
|
|
4129
4120
|
};
|
|
4130
4121
|
|
|
4131
|
-
/*! @azure/msal-common v14.
|
|
4122
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4132
4123
|
/*
|
|
4133
4124
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4134
4125
|
* Licensed under the MIT License.
|
|
@@ -4175,7 +4166,7 @@ const SID = "sid";
|
|
|
4175
4166
|
const LOGIN_HINT = "login_hint";
|
|
4176
4167
|
const DOMAIN_HINT = "domain_hint";
|
|
4177
4168
|
|
|
4178
|
-
/*! @azure/msal-common v14.
|
|
4169
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4179
4170
|
|
|
4180
4171
|
/*
|
|
4181
4172
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4259,7 +4250,7 @@ class RequestValidator {
|
|
|
4259
4250
|
}
|
|
4260
4251
|
}
|
|
4261
4252
|
|
|
4262
|
-
/*! @azure/msal-common v14.
|
|
4253
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4263
4254
|
|
|
4264
4255
|
/*
|
|
4265
4256
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4643,7 +4634,7 @@ class RequestParameterBuilder {
|
|
|
4643
4634
|
}
|
|
4644
4635
|
}
|
|
4645
4636
|
|
|
4646
|
-
/*! @azure/msal-common v14.
|
|
4637
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4647
4638
|
/*
|
|
4648
4639
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4649
4640
|
* Licensed under the MIT License.
|
|
@@ -4655,7 +4646,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
4655
4646
|
response.hasOwnProperty("jwks_uri"));
|
|
4656
4647
|
}
|
|
4657
4648
|
|
|
4658
|
-
/*! @azure/msal-common v14.
|
|
4649
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4659
4650
|
/*
|
|
4660
4651
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4661
4652
|
* Licensed under the MIT License.
|
|
@@ -4665,7 +4656,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
4665
4656
|
response.hasOwnProperty("metadata"));
|
|
4666
4657
|
}
|
|
4667
4658
|
|
|
4668
|
-
/*! @azure/msal-common v14.
|
|
4659
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4669
4660
|
/*
|
|
4670
4661
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4671
4662
|
* Licensed under the MIT License.
|
|
@@ -4675,7 +4666,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
4675
4666
|
response.hasOwnProperty("error_description"));
|
|
4676
4667
|
}
|
|
4677
4668
|
|
|
4678
|
-
/*! @azure/msal-common v14.
|
|
4669
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4679
4670
|
/*
|
|
4680
4671
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4681
4672
|
* Licensed under the MIT License.
|
|
@@ -4910,6 +4901,219 @@ const PerformanceEvents = {
|
|
|
4910
4901
|
Sha256Digest: "sha256Digest",
|
|
4911
4902
|
GetRandomValues: "getRandomValues",
|
|
4912
4903
|
};
|
|
4904
|
+
const PerformanceEventAbbreviations = new Map([
|
|
4905
|
+
[PerformanceEvents.AcquireTokenByCode, "ATByCode"],
|
|
4906
|
+
[PerformanceEvents.AcquireTokenByRefreshToken, "ATByRT"],
|
|
4907
|
+
[PerformanceEvents.AcquireTokenSilent, "ATS"],
|
|
4908
|
+
[PerformanceEvents.AcquireTokenSilentAsync, "ATSAsync"],
|
|
4909
|
+
[PerformanceEvents.AcquireTokenPopup, "ATPopup"],
|
|
4910
|
+
[PerformanceEvents.AcquireTokenRedirect, "ATRedirect"],
|
|
4911
|
+
[
|
|
4912
|
+
PerformanceEvents.CryptoOptsGetPublicKeyThumbprint,
|
|
4913
|
+
"CryptoGetPKThumb",
|
|
4914
|
+
],
|
|
4915
|
+
[PerformanceEvents.CryptoOptsSignJwt, "CryptoSignJwt"],
|
|
4916
|
+
[PerformanceEvents.SilentCacheClientAcquireToken, "SltCacheClientAT"],
|
|
4917
|
+
[PerformanceEvents.SilentIframeClientAcquireToken, "SltIframeClientAT"],
|
|
4918
|
+
[PerformanceEvents.SilentRefreshClientAcquireToken, "SltRClientAT"],
|
|
4919
|
+
[PerformanceEvents.SsoSilent, "SsoSlt"],
|
|
4920
|
+
[
|
|
4921
|
+
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
4922
|
+
"StdIntClientGetDiscAuth",
|
|
4923
|
+
],
|
|
4924
|
+
[
|
|
4925
|
+
PerformanceEvents.FetchAccountIdWithNativeBroker,
|
|
4926
|
+
"FetchAccIdWithNtvBroker",
|
|
4927
|
+
],
|
|
4928
|
+
[
|
|
4929
|
+
PerformanceEvents.NativeInteractionClientAcquireToken,
|
|
4930
|
+
"NtvIntClientAT",
|
|
4931
|
+
],
|
|
4932
|
+
[
|
|
4933
|
+
PerformanceEvents.BaseClientCreateTokenRequestHeaders,
|
|
4934
|
+
"BaseClientCreateTReqHead",
|
|
4935
|
+
],
|
|
4936
|
+
[
|
|
4937
|
+
PerformanceEvents.RefreshTokenClientExecutePostToTokenEndpoint,
|
|
4938
|
+
"RTClientExecPost",
|
|
4939
|
+
],
|
|
4940
|
+
[
|
|
4941
|
+
PerformanceEvents.AuthorizationCodeClientExecutePostToTokenEndpoint,
|
|
4942
|
+
"AuthCodeClientExecPost",
|
|
4943
|
+
],
|
|
4944
|
+
[PerformanceEvents.BrokerHandhshake, "BrokerHandshake"],
|
|
4945
|
+
[
|
|
4946
|
+
PerformanceEvents.AcquireTokenByRefreshTokenInBroker,
|
|
4947
|
+
"ATByRTInBroker",
|
|
4948
|
+
],
|
|
4949
|
+
[PerformanceEvents.AcquireTokenByBroker, "ATByBroker"],
|
|
4950
|
+
[
|
|
4951
|
+
PerformanceEvents.RefreshTokenClientExecuteTokenRequest,
|
|
4952
|
+
"RTClientExecTReq",
|
|
4953
|
+
],
|
|
4954
|
+
[PerformanceEvents.RefreshTokenClientAcquireToken, "RTClientAT"],
|
|
4955
|
+
[
|
|
4956
|
+
PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,
|
|
4957
|
+
"RTClientATWithCachedRT",
|
|
4958
|
+
],
|
|
4959
|
+
[
|
|
4960
|
+
PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken,
|
|
4961
|
+
"RTClientATByRT",
|
|
4962
|
+
],
|
|
4963
|
+
[
|
|
4964
|
+
PerformanceEvents.RefreshTokenClientCreateTokenRequestBody,
|
|
4965
|
+
"RTClientCreateTReqBody",
|
|
4966
|
+
],
|
|
4967
|
+
[PerformanceEvents.AcquireTokenFromCache, "ATFromCache"],
|
|
4968
|
+
[
|
|
4969
|
+
PerformanceEvents.SilentFlowClientAcquireCachedToken,
|
|
4970
|
+
"SltFlowClientATCached",
|
|
4971
|
+
],
|
|
4972
|
+
[
|
|
4973
|
+
PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord,
|
|
4974
|
+
"SltFlowClientGenResFromCache",
|
|
4975
|
+
],
|
|
4976
|
+
[PerformanceEvents.AcquireTokenBySilentIframe, "ATBySltIframe"],
|
|
4977
|
+
[PerformanceEvents.InitializeBaseRequest, "InitBaseReq"],
|
|
4978
|
+
[PerformanceEvents.InitializeSilentRequest, "InitSltReq"],
|
|
4979
|
+
[
|
|
4980
|
+
PerformanceEvents.InitializeClientApplication,
|
|
4981
|
+
"InitClientApplication",
|
|
4982
|
+
],
|
|
4983
|
+
[PerformanceEvents.SilentIframeClientTokenHelper, "SIClientTHelper"],
|
|
4984
|
+
[
|
|
4985
|
+
PerformanceEvents.SilentHandlerInitiateAuthRequest,
|
|
4986
|
+
"SHandlerInitAuthReq",
|
|
4987
|
+
],
|
|
4988
|
+
[
|
|
4989
|
+
PerformanceEvents.SilentHandlerMonitorIframeForHash,
|
|
4990
|
+
"SltHandlerMonitorIframeForHash",
|
|
4991
|
+
],
|
|
4992
|
+
[PerformanceEvents.SilentHandlerLoadFrame, "SHandlerLoadFrame"],
|
|
4993
|
+
[PerformanceEvents.SilentHandlerLoadFrameSync, "SHandlerLoadFrameSync"],
|
|
4994
|
+
[
|
|
4995
|
+
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
4996
|
+
"StdIntClientCreateAuthCodeClient",
|
|
4997
|
+
],
|
|
4998
|
+
[
|
|
4999
|
+
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
5000
|
+
"StdIntClientGetClientConf",
|
|
5001
|
+
],
|
|
5002
|
+
[
|
|
5003
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
5004
|
+
"StdIntClientInitAuthReq",
|
|
5005
|
+
],
|
|
5006
|
+
[
|
|
5007
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
5008
|
+
"StdIntClientInitAuthCodeReq",
|
|
5009
|
+
],
|
|
5010
|
+
[PerformanceEvents.GetAuthCodeUrl, "GetAuthCodeUrl"],
|
|
5011
|
+
[
|
|
5012
|
+
PerformanceEvents.HandleCodeResponseFromServer,
|
|
5013
|
+
"HandleCodeResFromServer",
|
|
5014
|
+
],
|
|
5015
|
+
[PerformanceEvents.HandleCodeResponse, "HandleCodeResp"],
|
|
5016
|
+
[PerformanceEvents.UpdateTokenEndpointAuthority, "UpdTEndpointAuth"],
|
|
5017
|
+
[PerformanceEvents.AuthClientAcquireToken, "AuthClientAT"],
|
|
5018
|
+
[PerformanceEvents.AuthClientExecuteTokenRequest, "AuthClientExecTReq"],
|
|
5019
|
+
[
|
|
5020
|
+
PerformanceEvents.AuthClientCreateTokenRequestBody,
|
|
5021
|
+
"AuthClientCreateTReqBody",
|
|
5022
|
+
],
|
|
5023
|
+
[
|
|
5024
|
+
PerformanceEvents.AuthClientCreateQueryString,
|
|
5025
|
+
"AuthClientCreateQueryStr",
|
|
5026
|
+
],
|
|
5027
|
+
[PerformanceEvents.PopTokenGenerateCnf, "PopTGenCnf"],
|
|
5028
|
+
[PerformanceEvents.PopTokenGenerateKid, "PopTGenKid"],
|
|
5029
|
+
[PerformanceEvents.HandleServerTokenResponse, "HandleServerTRes"],
|
|
5030
|
+
[PerformanceEvents.DeserializeResponse, "DeserializeRes"],
|
|
5031
|
+
[
|
|
5032
|
+
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
|
|
5033
|
+
"AuthFactCreateDiscInst",
|
|
5034
|
+
],
|
|
5035
|
+
[
|
|
5036
|
+
PerformanceEvents.AuthorityResolveEndpointsAsync,
|
|
5037
|
+
"AuthResolveEndpointsAsync",
|
|
5038
|
+
],
|
|
5039
|
+
[
|
|
5040
|
+
PerformanceEvents.AuthorityResolveEndpointsFromLocalSources,
|
|
5041
|
+
"AuthResolveEndpointsFromLocal",
|
|
5042
|
+
],
|
|
5043
|
+
[
|
|
5044
|
+
PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork,
|
|
5045
|
+
"AuthGetCDMetaFromNet",
|
|
5046
|
+
],
|
|
5047
|
+
[
|
|
5048
|
+
PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata,
|
|
5049
|
+
"AuthUpdCDMeta",
|
|
5050
|
+
],
|
|
5051
|
+
[
|
|
5052
|
+
PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork,
|
|
5053
|
+
"AuthUpdCDMetaFromNet",
|
|
5054
|
+
],
|
|
5055
|
+
[
|
|
5056
|
+
PerformanceEvents.AuthorityUpdateEndpointMetadata,
|
|
5057
|
+
"AuthUpdEndpointMeta",
|
|
5058
|
+
],
|
|
5059
|
+
[
|
|
5060
|
+
PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation,
|
|
5061
|
+
"AuthUpdMetaWithRegInfo",
|
|
5062
|
+
],
|
|
5063
|
+
[PerformanceEvents.RegionDiscoveryDetectRegion, "RegDiscDetectReg"],
|
|
5064
|
+
[
|
|
5065
|
+
PerformanceEvents.RegionDiscoveryGetRegionFromIMDS,
|
|
5066
|
+
"RegDiscGetRegFromIMDS",
|
|
5067
|
+
],
|
|
5068
|
+
[
|
|
5069
|
+
PerformanceEvents.RegionDiscoveryGetCurrentVersion,
|
|
5070
|
+
"RegDiscGetCurrentVer",
|
|
5071
|
+
],
|
|
5072
|
+
[PerformanceEvents.AcquireTokenByCodeAsync, "ATByCodeAsync"],
|
|
5073
|
+
[
|
|
5074
|
+
PerformanceEvents.GetEndpointMetadataFromNetwork,
|
|
5075
|
+
"GetEndpointMetaFromNet",
|
|
5076
|
+
],
|
|
5077
|
+
[
|
|
5078
|
+
PerformanceEvents.GetCloudDiscoveryMetadataFromNetworkMeasurement,
|
|
5079
|
+
"GetCDMetaFromNet",
|
|
5080
|
+
],
|
|
5081
|
+
[
|
|
5082
|
+
PerformanceEvents.HandleRedirectPromiseMeasurement,
|
|
5083
|
+
"HandleRedirectPromise",
|
|
5084
|
+
],
|
|
5085
|
+
[
|
|
5086
|
+
PerformanceEvents.HandleNativeRedirectPromiseMeasurement,
|
|
5087
|
+
"HandleNtvRedirectPromise",
|
|
5088
|
+
],
|
|
5089
|
+
[
|
|
5090
|
+
PerformanceEvents.UpdateCloudDiscoveryMetadataMeasurement,
|
|
5091
|
+
"UpdateCDMeta",
|
|
5092
|
+
],
|
|
5093
|
+
[
|
|
5094
|
+
PerformanceEvents.UsernamePasswordClientAcquireToken,
|
|
5095
|
+
"UserPassClientAT",
|
|
5096
|
+
],
|
|
5097
|
+
[
|
|
5098
|
+
PerformanceEvents.NativeMessageHandlerHandshake,
|
|
5099
|
+
"NtvMsgHandlerHandshake",
|
|
5100
|
+
],
|
|
5101
|
+
[PerformanceEvents.NativeGenerateAuthResult, "NtvGenAuthRes"],
|
|
5102
|
+
[PerformanceEvents.RemoveHiddenIframe, "RemoveHiddenIframe"],
|
|
5103
|
+
[
|
|
5104
|
+
PerformanceEvents.ClearTokensAndKeysWithClaims,
|
|
5105
|
+
"ClearTAndKeysWithClaims",
|
|
5106
|
+
],
|
|
5107
|
+
[PerformanceEvents.CacheManagerGetRefreshToken, "CacheManagerGetRT"],
|
|
5108
|
+
[PerformanceEvents.GeneratePkceCodes, "GenPkceCodes"],
|
|
5109
|
+
[PerformanceEvents.GenerateCodeVerifier, "GenCodeVerifier"],
|
|
5110
|
+
[
|
|
5111
|
+
PerformanceEvents.GenerateCodeChallengeFromVerifier,
|
|
5112
|
+
"GenCodeChallengeFromVerifier",
|
|
5113
|
+
],
|
|
5114
|
+
[PerformanceEvents.Sha256Digest, "Sha256Digest"],
|
|
5115
|
+
[PerformanceEvents.GetRandomValues, "GetRandomValues"],
|
|
5116
|
+
]);
|
|
4913
5117
|
/**
|
|
4914
5118
|
* State of the performance event.
|
|
4915
5119
|
*
|
|
@@ -4936,7 +5140,7 @@ const IntFields = new Set([
|
|
|
4936
5140
|
"multiMatchedRT",
|
|
4937
5141
|
]);
|
|
4938
5142
|
|
|
4939
|
-
/*! @azure/msal-common v14.
|
|
5143
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4940
5144
|
/*
|
|
4941
5145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4942
5146
|
* Licensed under the MIT License.
|
|
@@ -4980,7 +5184,7 @@ const invoke = (callback, eventName, logger, telemetryClient, correlationId) =>
|
|
|
4980
5184
|
}
|
|
4981
5185
|
inProgressEvent?.end({
|
|
4982
5186
|
success: false,
|
|
4983
|
-
});
|
|
5187
|
+
}, e);
|
|
4984
5188
|
throw e;
|
|
4985
5189
|
}
|
|
4986
5190
|
};
|
|
@@ -5026,13 +5230,13 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5026
5230
|
}
|
|
5027
5231
|
inProgressEvent?.end({
|
|
5028
5232
|
success: false,
|
|
5029
|
-
});
|
|
5233
|
+
}, e);
|
|
5030
5234
|
throw e;
|
|
5031
5235
|
});
|
|
5032
5236
|
};
|
|
5033
5237
|
};
|
|
5034
5238
|
|
|
5035
|
-
/*! @azure/msal-common v14.
|
|
5239
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5036
5240
|
|
|
5037
5241
|
/*
|
|
5038
5242
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5141,7 +5345,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5141
5345
|
},
|
|
5142
5346
|
};
|
|
5143
5347
|
|
|
5144
|
-
/*! @azure/msal-common v14.
|
|
5348
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5145
5349
|
|
|
5146
5350
|
/*
|
|
5147
5351
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5976,7 +6180,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
5976
6180
|
};
|
|
5977
6181
|
}
|
|
5978
6182
|
|
|
5979
|
-
/*! @azure/msal-common v14.
|
|
6183
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5980
6184
|
|
|
5981
6185
|
/*
|
|
5982
6186
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6007,7 +6211,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
6007
6211
|
}
|
|
6008
6212
|
}
|
|
6009
6213
|
|
|
6010
|
-
/*! @azure/msal-common v14.
|
|
6214
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6011
6215
|
|
|
6012
6216
|
/*
|
|
6013
6217
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6110,7 +6314,7 @@ class BaseClient {
|
|
|
6110
6314
|
}
|
|
6111
6315
|
}
|
|
6112
6316
|
|
|
6113
|
-
/*! @azure/msal-common v14.
|
|
6317
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6114
6318
|
/*
|
|
6115
6319
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6116
6320
|
* Licensed under the MIT License.
|
|
@@ -6136,7 +6340,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6136
6340
|
refreshTokenExpired: refreshTokenExpired
|
|
6137
6341
|
});
|
|
6138
6342
|
|
|
6139
|
-
/*! @azure/msal-common v14.
|
|
6343
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6140
6344
|
|
|
6141
6345
|
/*
|
|
6142
6346
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6223,7 +6427,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6223
6427
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6224
6428
|
}
|
|
6225
6429
|
|
|
6226
|
-
/*! @azure/msal-common v14.
|
|
6430
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6227
6431
|
/*
|
|
6228
6432
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6229
6433
|
* Licensed under the MIT License.
|
|
@@ -6239,7 +6443,7 @@ class CacheRecord {
|
|
|
6239
6443
|
}
|
|
6240
6444
|
}
|
|
6241
6445
|
|
|
6242
|
-
/*! @azure/msal-common v14.
|
|
6446
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6243
6447
|
|
|
6244
6448
|
/*
|
|
6245
6449
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6311,7 +6515,7 @@ class ProtocolUtils {
|
|
|
6311
6515
|
}
|
|
6312
6516
|
}
|
|
6313
6517
|
|
|
6314
|
-
/*! @azure/msal-common v14.
|
|
6518
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6315
6519
|
|
|
6316
6520
|
/*
|
|
6317
6521
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6396,7 +6600,7 @@ class PopTokenGenerator {
|
|
|
6396
6600
|
}
|
|
6397
6601
|
}
|
|
6398
6602
|
|
|
6399
|
-
/*! @azure/msal-common v14.
|
|
6603
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6400
6604
|
/*
|
|
6401
6605
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6402
6606
|
* Licensed under the MIT License.
|
|
@@ -6423,7 +6627,7 @@ class PopTokenGenerator {
|
|
|
6423
6627
|
}
|
|
6424
6628
|
}
|
|
6425
6629
|
|
|
6426
|
-
/*! @azure/msal-common v14.
|
|
6630
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6427
6631
|
|
|
6428
6632
|
/*
|
|
6429
6633
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6776,7 +6980,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
|
|
|
6776
6980
|
return baseAccount;
|
|
6777
6981
|
}
|
|
6778
6982
|
|
|
6779
|
-
/*! @azure/msal-common v14.
|
|
6983
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6780
6984
|
|
|
6781
6985
|
/*
|
|
6782
6986
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7181,7 +7385,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7181
7385
|
}
|
|
7182
7386
|
}
|
|
7183
7387
|
|
|
7184
|
-
/*! @azure/msal-common v14.
|
|
7388
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7185
7389
|
|
|
7186
7390
|
/*
|
|
7187
7391
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7388,7 +7592,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7388
7592
|
}
|
|
7389
7593
|
}
|
|
7390
7594
|
|
|
7391
|
-
/*! @azure/msal-common v14.
|
|
7595
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7392
7596
|
|
|
7393
7597
|
/*
|
|
7394
7598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7406,7 +7610,12 @@ class SilentFlowClient extends BaseClient {
|
|
|
7406
7610
|
*/
|
|
7407
7611
|
async acquireToken(request) {
|
|
7408
7612
|
try {
|
|
7409
|
-
const [authResponse, cacheOutcome] = await this.acquireCachedToken(
|
|
7613
|
+
const [authResponse, cacheOutcome] = await this.acquireCachedToken({
|
|
7614
|
+
...request,
|
|
7615
|
+
scopes: request.scopes?.length
|
|
7616
|
+
? request.scopes
|
|
7617
|
+
: [...OIDC_DEFAULT_SCOPES],
|
|
7618
|
+
});
|
|
7410
7619
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
7411
7620
|
if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
7412
7621
|
this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
|
|
@@ -7519,7 +7728,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7519
7728
|
}
|
|
7520
7729
|
}
|
|
7521
7730
|
|
|
7522
|
-
/*! @azure/msal-common v14.
|
|
7731
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7523
7732
|
|
|
7524
7733
|
/*
|
|
7525
7734
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7534,7 +7743,7 @@ const StubbedNetworkModule = {
|
|
|
7534
7743
|
},
|
|
7535
7744
|
};
|
|
7536
7745
|
|
|
7537
|
-
/*! @azure/msal-common v14.
|
|
7746
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7538
7747
|
/*
|
|
7539
7748
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7540
7749
|
* Licensed under the MIT License.
|
|
@@ -7542,7 +7751,7 @@ const StubbedNetworkModule = {
|
|
|
7542
7751
|
const missingKidError = "missing_kid_error";
|
|
7543
7752
|
const missingAlgError = "missing_alg_error";
|
|
7544
7753
|
|
|
7545
|
-
/*! @azure/msal-common v14.
|
|
7754
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7546
7755
|
|
|
7547
7756
|
/*
|
|
7548
7757
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7567,7 +7776,7 @@ function createJoseHeaderError(code) {
|
|
|
7567
7776
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7568
7777
|
}
|
|
7569
7778
|
|
|
7570
|
-
/*! @azure/msal-common v14.
|
|
7779
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7571
7780
|
|
|
7572
7781
|
/*
|
|
7573
7782
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7607,7 +7816,7 @@ class JoseHeader {
|
|
|
7607
7816
|
}
|
|
7608
7817
|
}
|
|
7609
7818
|
|
|
7610
|
-
/*! @azure/msal-common v14.
|
|
7819
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7611
7820
|
|
|
7612
7821
|
/*
|
|
7613
7822
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7665,7 +7874,7 @@ class AuthenticationHeaderParser {
|
|
|
7665
7874
|
}
|
|
7666
7875
|
}
|
|
7667
7876
|
|
|
7668
|
-
/*! @azure/msal-common v14.
|
|
7877
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7669
7878
|
|
|
7670
7879
|
/*
|
|
7671
7880
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7869,7 +8078,7 @@ class ServerTelemetryManager {
|
|
|
7869
8078
|
}
|
|
7870
8079
|
}
|
|
7871
8080
|
|
|
7872
|
-
/*! @azure/msal-common v14.
|
|
8081
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7873
8082
|
|
|
7874
8083
|
/*
|
|
7875
8084
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7948,12 +8157,168 @@ class StubPerformanceClient {
|
|
|
7948
8157
|
}
|
|
7949
8158
|
}
|
|
7950
8159
|
|
|
7951
|
-
/*! @azure/msal-common v14.
|
|
8160
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7952
8161
|
|
|
7953
8162
|
/*
|
|
7954
8163
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7955
8164
|
* Licensed under the MIT License.
|
|
7956
8165
|
*/
|
|
8166
|
+
/**
|
|
8167
|
+
* Starts context by adding payload to the stack
|
|
8168
|
+
* @param event {PerformanceEvent}
|
|
8169
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
8170
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
8171
|
+
*/
|
|
8172
|
+
function startContext(event, abbreviations, stack) {
|
|
8173
|
+
if (!stack) {
|
|
8174
|
+
return;
|
|
8175
|
+
}
|
|
8176
|
+
stack.push({
|
|
8177
|
+
name: abbreviations.get(event.name) || event.name,
|
|
8178
|
+
});
|
|
8179
|
+
}
|
|
8180
|
+
/**
|
|
8181
|
+
* Ends context by removing payload from the stack and returning parent or self, if stack is empty, payload
|
|
8182
|
+
*
|
|
8183
|
+
* @param event {PerformanceEvent}
|
|
8184
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
8185
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
8186
|
+
* @param error {?unknown} error
|
|
8187
|
+
*/
|
|
8188
|
+
function endContext(event, abbreviations, stack, error) {
|
|
8189
|
+
if (!stack?.length) {
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
8192
|
+
const peek = (stack) => {
|
|
8193
|
+
return stack.length ? stack[stack.length - 1] : undefined;
|
|
8194
|
+
};
|
|
8195
|
+
const abbrEventName = abbreviations.get(event.name) || event.name;
|
|
8196
|
+
const top = peek(stack);
|
|
8197
|
+
if (top?.name !== abbrEventName) {
|
|
8198
|
+
return;
|
|
8199
|
+
}
|
|
8200
|
+
const current = stack?.pop();
|
|
8201
|
+
if (!current) {
|
|
8202
|
+
return;
|
|
8203
|
+
}
|
|
8204
|
+
const errorCode = error instanceof AuthError
|
|
8205
|
+
? error.errorCode
|
|
8206
|
+
: error instanceof Error
|
|
8207
|
+
? error.name
|
|
8208
|
+
: undefined;
|
|
8209
|
+
const subErr = error instanceof AuthError ? error.subError : undefined;
|
|
8210
|
+
if (errorCode && current.childErr !== errorCode) {
|
|
8211
|
+
current.err = errorCode;
|
|
8212
|
+
if (subErr) {
|
|
8213
|
+
current.subErr = subErr;
|
|
8214
|
+
}
|
|
8215
|
+
}
|
|
8216
|
+
delete current.name;
|
|
8217
|
+
delete current.childErr;
|
|
8218
|
+
const context = {
|
|
8219
|
+
...current,
|
|
8220
|
+
dur: event.durationMs,
|
|
8221
|
+
};
|
|
8222
|
+
if (!event.success) {
|
|
8223
|
+
context.fail = 1;
|
|
8224
|
+
}
|
|
8225
|
+
const parent = peek(stack);
|
|
8226
|
+
if (!parent) {
|
|
8227
|
+
return { [abbrEventName]: context };
|
|
8228
|
+
}
|
|
8229
|
+
if (errorCode) {
|
|
8230
|
+
parent.childErr = errorCode;
|
|
8231
|
+
}
|
|
8232
|
+
let childName;
|
|
8233
|
+
if (!parent[abbrEventName]) {
|
|
8234
|
+
childName = abbrEventName;
|
|
8235
|
+
}
|
|
8236
|
+
else {
|
|
8237
|
+
const siblings = Object.keys(parent).filter((key) => key.startsWith(abbrEventName)).length;
|
|
8238
|
+
childName = `${abbrEventName}_${siblings + 1}`;
|
|
8239
|
+
}
|
|
8240
|
+
parent[childName] = context;
|
|
8241
|
+
return parent;
|
|
8242
|
+
}
|
|
8243
|
+
/**
|
|
8244
|
+
* Adds error name and stack trace to the telemetry event
|
|
8245
|
+
* @param error {Error}
|
|
8246
|
+
* @param logger {Logger}
|
|
8247
|
+
* @param event {PerformanceEvent}
|
|
8248
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
8249
|
+
*/
|
|
8250
|
+
function addError(error, logger, event, stackMaxSize = 5) {
|
|
8251
|
+
if (!(error instanceof Error)) {
|
|
8252
|
+
logger.trace("PerformanceClient.addErrorStack: Input error is not instance of Error", event.correlationId);
|
|
8253
|
+
return;
|
|
8254
|
+
}
|
|
8255
|
+
else if (error instanceof AuthError) {
|
|
8256
|
+
event.errorCode = error.errorCode;
|
|
8257
|
+
event.subErrorCode = error.subError;
|
|
8258
|
+
return;
|
|
8259
|
+
}
|
|
8260
|
+
else if (event.errorStack?.length) {
|
|
8261
|
+
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
|
|
8262
|
+
return;
|
|
8263
|
+
}
|
|
8264
|
+
else if (!error.stack?.length) {
|
|
8265
|
+
logger.trace("PerformanceClient.addErrorStack: Input stack is empty", event.correlationId);
|
|
8266
|
+
return;
|
|
8267
|
+
}
|
|
8268
|
+
if (error.stack) {
|
|
8269
|
+
event.errorStack = compactStack(error.stack, stackMaxSize);
|
|
8270
|
+
}
|
|
8271
|
+
event.errorName = error.name;
|
|
8272
|
+
}
|
|
8273
|
+
/**
|
|
8274
|
+
* Compacts error stack into array by fetching N first entries
|
|
8275
|
+
* @param stack {string} error stack
|
|
8276
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
8277
|
+
* @returns {string[]}
|
|
8278
|
+
*/
|
|
8279
|
+
function compactStack(stack, stackMaxSize) {
|
|
8280
|
+
if (stackMaxSize < 0) {
|
|
8281
|
+
return [];
|
|
8282
|
+
}
|
|
8283
|
+
const stackArr = stack.split("\n") || [];
|
|
8284
|
+
if (stackArr.length < 2) {
|
|
8285
|
+
return [];
|
|
8286
|
+
}
|
|
8287
|
+
const res = [];
|
|
8288
|
+
// Get top N stack lines
|
|
8289
|
+
for (
|
|
8290
|
+
// Skip first line as it may contain PII data
|
|
8291
|
+
let ix = Math.max(stackArr.length - stackMaxSize - 1, 1); ix < stackArr.length; ix++) {
|
|
8292
|
+
const line = stackArr[ix];
|
|
8293
|
+
if (res.length >= stackMaxSize) {
|
|
8294
|
+
break;
|
|
8295
|
+
}
|
|
8296
|
+
res.push(compactStackLine(line));
|
|
8297
|
+
}
|
|
8298
|
+
return res;
|
|
8299
|
+
}
|
|
8300
|
+
/**
|
|
8301
|
+
* Compacts error stack line by shortening file path
|
|
8302
|
+
* Example: https://localhost/msal-common/src/authority/Authority.js:100:1 -> Authority.js:100:1
|
|
8303
|
+
* @param line {string} stack line
|
|
8304
|
+
* @returns {string}
|
|
8305
|
+
*/
|
|
8306
|
+
function compactStackLine(line) {
|
|
8307
|
+
const filePathIx = line.lastIndexOf(" ") + 1;
|
|
8308
|
+
if (filePathIx < 1) {
|
|
8309
|
+
return line;
|
|
8310
|
+
}
|
|
8311
|
+
const filePath = line.substring(filePathIx);
|
|
8312
|
+
let fileNameIx = filePath.lastIndexOf("/");
|
|
8313
|
+
fileNameIx = fileNameIx < 0 ? filePath.lastIndexOf("\\") : fileNameIx;
|
|
8314
|
+
if (fileNameIx >= 0) {
|
|
8315
|
+
return (line.substring(0, filePathIx) +
|
|
8316
|
+
"(" +
|
|
8317
|
+
filePath.substring(fileNameIx + 1) +
|
|
8318
|
+
(filePath.charAt(filePath.length - 1) === ")" ? "" : ")")).trimStart();
|
|
8319
|
+
}
|
|
8320
|
+
return line.trimStart();
|
|
8321
|
+
}
|
|
7957
8322
|
class PerformanceClient {
|
|
7958
8323
|
/**
|
|
7959
8324
|
* Creates an instance of PerformanceClient,
|
|
@@ -7967,8 +8332,9 @@ class PerformanceClient {
|
|
|
7967
8332
|
* @param {string} libraryVersion Version of the library
|
|
7968
8333
|
* @param {ApplicationTelemetry} applicationTelemetry application name and version
|
|
7969
8334
|
* @param {Set<String>} intFields integer fields to be truncated
|
|
8335
|
+
* @param {Map<string, string>} abbreviations event name abbreviations
|
|
7970
8336
|
*/
|
|
7971
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields) {
|
|
8337
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields, abbreviations) {
|
|
7972
8338
|
this.authority = authority;
|
|
7973
8339
|
this.libraryName = libraryName;
|
|
7974
8340
|
this.libraryVersion = libraryVersion;
|
|
@@ -7977,12 +8343,17 @@ class PerformanceClient {
|
|
|
7977
8343
|
this.logger = logger;
|
|
7978
8344
|
this.callbacks = new Map();
|
|
7979
8345
|
this.eventsByCorrelationId = new Map();
|
|
8346
|
+
this.eventStack = new Map();
|
|
7980
8347
|
this.queueMeasurements = new Map();
|
|
7981
8348
|
this.preQueueTimeByCorrelationId = new Map();
|
|
7982
8349
|
this.intFields = intFields || new Set();
|
|
7983
8350
|
for (const item of IntFields) {
|
|
7984
8351
|
this.intFields.add(item);
|
|
7985
8352
|
}
|
|
8353
|
+
this.abbreviations = abbreviations || new Map();
|
|
8354
|
+
for (const [key, value] of PerformanceEventAbbreviations) {
|
|
8355
|
+
this.abbreviations.set(key, value);
|
|
8356
|
+
}
|
|
7986
8357
|
}
|
|
7987
8358
|
/**
|
|
7988
8359
|
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
@@ -8112,15 +8483,16 @@ class PerformanceClient {
|
|
|
8112
8483
|
};
|
|
8113
8484
|
// Store in progress events so they can be discarded if not ended properly
|
|
8114
8485
|
this.cacheEventByCorrelationId(inProgressEvent);
|
|
8486
|
+
startContext(inProgressEvent, this.abbreviations, this.eventStack.get(eventCorrelationId));
|
|
8115
8487
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
8116
8488
|
return {
|
|
8117
|
-
end: (event) => {
|
|
8489
|
+
end: (event, error) => {
|
|
8118
8490
|
return this.endMeasurement({
|
|
8119
8491
|
// Initial set of event properties
|
|
8120
8492
|
...inProgressEvent,
|
|
8121
8493
|
// Properties set when event ends
|
|
8122
8494
|
...event,
|
|
8123
|
-
});
|
|
8495
|
+
}, error);
|
|
8124
8496
|
},
|
|
8125
8497
|
discard: () => {
|
|
8126
8498
|
return this.discardMeasurements(inProgressEvent.correlationId);
|
|
@@ -8142,10 +8514,10 @@ class PerformanceClient {
|
|
|
8142
8514
|
* otherwise.
|
|
8143
8515
|
*
|
|
8144
8516
|
* @param {PerformanceEvent} event
|
|
8145
|
-
* @param {
|
|
8517
|
+
* @param {unknown} error
|
|
8146
8518
|
* @returns {(PerformanceEvent | null)}
|
|
8147
8519
|
*/
|
|
8148
|
-
endMeasurement(event) {
|
|
8520
|
+
endMeasurement(event, error) {
|
|
8149
8521
|
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
8150
8522
|
if (!rootEvent) {
|
|
8151
8523
|
this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);
|
|
@@ -8157,6 +8529,8 @@ class PerformanceClient {
|
|
|
8157
8529
|
totalQueueCount: 0,
|
|
8158
8530
|
manuallyCompletedCount: 0,
|
|
8159
8531
|
};
|
|
8532
|
+
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
|
|
8533
|
+
const context = endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error);
|
|
8160
8534
|
if (isRoot) {
|
|
8161
8535
|
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8162
8536
|
this.discardCache(rootEvent.correlationId);
|
|
@@ -8164,13 +8538,15 @@ class PerformanceClient {
|
|
|
8164
8538
|
else {
|
|
8165
8539
|
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
8166
8540
|
}
|
|
8167
|
-
|
|
8168
|
-
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);
|
|
8541
|
+
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${event.durationMs} ms`, event.correlationId);
|
|
8169
8542
|
// Add sub-measurement attribute to root event.
|
|
8170
8543
|
if (!isRoot) {
|
|
8171
|
-
rootEvent[event.name + "DurationMs"] = Math.floor(durationMs);
|
|
8544
|
+
rootEvent[event.name + "DurationMs"] = Math.floor(event.durationMs);
|
|
8172
8545
|
return { ...rootEvent };
|
|
8173
8546
|
}
|
|
8547
|
+
if (error) {
|
|
8548
|
+
addError(error, this.logger, rootEvent);
|
|
8549
|
+
}
|
|
8174
8550
|
let finalEvent = { ...rootEvent, ...event };
|
|
8175
8551
|
let incompleteSubsCount = 0;
|
|
8176
8552
|
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
|
|
@@ -8181,12 +8557,12 @@ class PerformanceClient {
|
|
|
8181
8557
|
finalEvent.incompleteSubMeasurements = undefined;
|
|
8182
8558
|
finalEvent = {
|
|
8183
8559
|
...finalEvent,
|
|
8184
|
-
durationMs: Math.round(durationMs),
|
|
8185
8560
|
queuedTimeMs: queueInfo.totalQueueTime,
|
|
8186
8561
|
queuedCount: queueInfo.totalQueueCount,
|
|
8187
8562
|
queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount,
|
|
8188
8563
|
status: PerformanceEventStatus.Completed,
|
|
8189
8564
|
incompleteSubsCount,
|
|
8565
|
+
context,
|
|
8190
8566
|
};
|
|
8191
8567
|
this.truncateIntegralFields(finalEvent);
|
|
8192
8568
|
this.emitEvents([finalEvent], event.correlationId);
|
|
@@ -8256,6 +8632,7 @@ class PerformanceClient {
|
|
|
8256
8632
|
else {
|
|
8257
8633
|
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);
|
|
8258
8634
|
this.eventsByCorrelationId.set(event.correlationId, { ...event });
|
|
8635
|
+
this.eventStack.set(event.correlationId, []);
|
|
8259
8636
|
}
|
|
8260
8637
|
}
|
|
8261
8638
|
getQueueInfo(correlationId) {
|
|
@@ -8297,6 +8674,8 @@ class PerformanceClient {
|
|
|
8297
8674
|
this.queueMeasurements.delete(correlationId);
|
|
8298
8675
|
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
8299
8676
|
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
8677
|
+
this.logger.trace("PerformanceClient: Event stack discarded", correlationId);
|
|
8678
|
+
this.eventStack.delete(correlationId);
|
|
8300
8679
|
}
|
|
8301
8680
|
/**
|
|
8302
8681
|
* Registers a callback function to receive performance events.
|
|
@@ -8342,7 +8721,6 @@ class PerformanceClient {
|
|
|
8342
8721
|
/**
|
|
8343
8722
|
* Enforce truncation of integral fields in performance event.
|
|
8344
8723
|
* @param {PerformanceEvent} event performance event to update.
|
|
8345
|
-
* @param {Set<string>} intFields integral fields.
|
|
8346
8724
|
*/
|
|
8347
8725
|
truncateIntegralFields(event) {
|
|
8348
8726
|
this.intFields.forEach((key) => {
|
|
@@ -8934,6 +9312,50 @@ const LOG_LEVEL_CACHE_KEY = "msal.browser.log.level";
|
|
|
8934
9312
|
const LOG_PII_CACHE_KEY = "msal.browser.log.pii";
|
|
8935
9313
|
const BROWSER_PERF_ENABLED_KEY = "msal.browser.performance.enabled";
|
|
8936
9314
|
|
|
9315
|
+
/*
|
|
9316
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9317
|
+
* Licensed under the MIT License.
|
|
9318
|
+
*/
|
|
9319
|
+
/**
|
|
9320
|
+
* Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:
|
|
9321
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64
|
|
9322
|
+
*/
|
|
9323
|
+
/**
|
|
9324
|
+
* Returns URL Safe b64 encoded string from a plaintext string.
|
|
9325
|
+
* @param input
|
|
9326
|
+
*/
|
|
9327
|
+
function urlEncode(input) {
|
|
9328
|
+
return encodeURIComponent(base64Encode(input)
|
|
9329
|
+
.replace(/=/g, "")
|
|
9330
|
+
.replace(/\+/g, "-")
|
|
9331
|
+
.replace(/\//g, "_"));
|
|
9332
|
+
}
|
|
9333
|
+
/**
|
|
9334
|
+
* Returns URL Safe b64 encoded string from an int8Array.
|
|
9335
|
+
* @param inputArr
|
|
9336
|
+
*/
|
|
9337
|
+
function urlEncodeArr(inputArr) {
|
|
9338
|
+
return base64EncArr(inputArr)
|
|
9339
|
+
.replace(/=/g, "")
|
|
9340
|
+
.replace(/\+/g, "-")
|
|
9341
|
+
.replace(/\//g, "_");
|
|
9342
|
+
}
|
|
9343
|
+
/**
|
|
9344
|
+
* Returns b64 encoded string from plaintext string.
|
|
9345
|
+
* @param input
|
|
9346
|
+
*/
|
|
9347
|
+
function base64Encode(input) {
|
|
9348
|
+
return base64EncArr(new TextEncoder().encode(input));
|
|
9349
|
+
}
|
|
9350
|
+
/**
|
|
9351
|
+
* Base64 encode byte array
|
|
9352
|
+
* @param aBytes
|
|
9353
|
+
*/
|
|
9354
|
+
function base64EncArr(aBytes) {
|
|
9355
|
+
const binString = Array.from(aBytes, (x) => String.fromCodePoint(x)).join("");
|
|
9356
|
+
return btoa(binString);
|
|
9357
|
+
}
|
|
9358
|
+
|
|
8937
9359
|
/*
|
|
8938
9360
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8939
9361
|
* Licensed under the MIT License.
|
|
@@ -9076,6 +9498,71 @@ async function importJwk(key, extractable, usages) {
|
|
|
9076
9498
|
async function sign(key, data) {
|
|
9077
9499
|
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
9078
9500
|
}
|
|
9501
|
+
/**
|
|
9502
|
+
* Returns the SHA-256 hash of an input string
|
|
9503
|
+
* @param plainText
|
|
9504
|
+
*/
|
|
9505
|
+
async function hashString(plainText) {
|
|
9506
|
+
const hashBuffer = await sha256Digest(plainText);
|
|
9507
|
+
const hashBytes = new Uint8Array(hashBuffer);
|
|
9508
|
+
return urlEncodeArr(hashBytes);
|
|
9509
|
+
}
|
|
9510
|
+
|
|
9511
|
+
/*
|
|
9512
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9513
|
+
* Licensed under the MIT License.
|
|
9514
|
+
*/
|
|
9515
|
+
const storageNotSupported = "storage_not_supported";
|
|
9516
|
+
const stubbedPublicClientApplicationCalled = "stubbed_public_client_application_called";
|
|
9517
|
+
const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
|
|
9518
|
+
|
|
9519
|
+
var BrowserConfigurationAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
9520
|
+
__proto__: null,
|
|
9521
|
+
inMemRedirectUnavailable: inMemRedirectUnavailable,
|
|
9522
|
+
storageNotSupported: storageNotSupported,
|
|
9523
|
+
stubbedPublicClientApplicationCalled: stubbedPublicClientApplicationCalled
|
|
9524
|
+
});
|
|
9525
|
+
|
|
9526
|
+
/*
|
|
9527
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9528
|
+
* Licensed under the MIT License.
|
|
9529
|
+
*/
|
|
9530
|
+
const BrowserConfigurationAuthErrorMessages = {
|
|
9531
|
+
[storageNotSupported]: "Given storage configuration option was not supported.",
|
|
9532
|
+
[stubbedPublicClientApplicationCalled]: "Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",
|
|
9533
|
+
[inMemRedirectUnavailable]: "Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true.",
|
|
9534
|
+
};
|
|
9535
|
+
/**
|
|
9536
|
+
* BrowserAuthErrorMessage class containing string constants used by error codes and messages.
|
|
9537
|
+
* @deprecated Use BrowserAuthErrorCodes instead
|
|
9538
|
+
*/
|
|
9539
|
+
const BrowserConfigurationAuthErrorMessage = {
|
|
9540
|
+
storageNotSupportedError: {
|
|
9541
|
+
code: storageNotSupported,
|
|
9542
|
+
desc: BrowserConfigurationAuthErrorMessages[storageNotSupported],
|
|
9543
|
+
},
|
|
9544
|
+
stubPcaInstanceCalled: {
|
|
9545
|
+
code: stubbedPublicClientApplicationCalled,
|
|
9546
|
+
desc: BrowserConfigurationAuthErrorMessages[stubbedPublicClientApplicationCalled],
|
|
9547
|
+
},
|
|
9548
|
+
inMemRedirectUnavailable: {
|
|
9549
|
+
code: inMemRedirectUnavailable,
|
|
9550
|
+
desc: BrowserConfigurationAuthErrorMessages[inMemRedirectUnavailable],
|
|
9551
|
+
},
|
|
9552
|
+
};
|
|
9553
|
+
/**
|
|
9554
|
+
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
9555
|
+
*/
|
|
9556
|
+
class BrowserConfigurationAuthError extends AuthError {
|
|
9557
|
+
constructor(errorCode, errorMessage) {
|
|
9558
|
+
super(errorCode, errorMessage);
|
|
9559
|
+
this.name = "BrowserConfigurationAuthError";
|
|
9560
|
+
Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);
|
|
9561
|
+
}
|
|
9562
|
+
}
|
|
9563
|
+
function createBrowserConfigurationAuthError(errorCode) {
|
|
9564
|
+
return new BrowserConfigurationAuthError(errorCode, BrowserConfigurationAuthErrorMessages[errorCode]);
|
|
9565
|
+
}
|
|
9079
9566
|
|
|
9080
9567
|
/*
|
|
9081
9568
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9147,11 +9634,8 @@ function blockReloadInHiddenIframes() {
|
|
|
9147
9634
|
* @param interactionType Interaction type for the request
|
|
9148
9635
|
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
9149
9636
|
*/
|
|
9150
|
-
function blockRedirectInIframe(
|
|
9151
|
-
|
|
9152
|
-
if (interactionType === exports.InteractionType.Redirect &&
|
|
9153
|
-
isIframedApp &&
|
|
9154
|
-
!allowRedirectInIframe) {
|
|
9637
|
+
function blockRedirectInIframe(allowRedirectInIframe) {
|
|
9638
|
+
if (isInIframe() && !allowRedirectInIframe) {
|
|
9155
9639
|
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
|
|
9156
9640
|
throw createBrowserAuthError(redirectInIframe);
|
|
9157
9641
|
}
|
|
@@ -9169,8 +9653,8 @@ function blockAcquireTokenInPopups() {
|
|
|
9169
9653
|
* Throws error if token requests are made in non-browser environment
|
|
9170
9654
|
* @param isBrowserEnvironment Flag indicating if environment is a browser.
|
|
9171
9655
|
*/
|
|
9172
|
-
function blockNonBrowserEnvironment(
|
|
9173
|
-
if (
|
|
9656
|
+
function blockNonBrowserEnvironment() {
|
|
9657
|
+
if (typeof window === "undefined") {
|
|
9174
9658
|
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
9175
9659
|
}
|
|
9176
9660
|
}
|
|
@@ -9183,6 +9667,34 @@ function blockAPICallsBeforeInitialize(initialized) {
|
|
|
9183
9667
|
throw createBrowserAuthError(uninitializedPublicClientApplication);
|
|
9184
9668
|
}
|
|
9185
9669
|
}
|
|
9670
|
+
/**
|
|
9671
|
+
* Helper to validate app environment before making an auth request
|
|
9672
|
+
* @param initialized
|
|
9673
|
+
*/
|
|
9674
|
+
function preflightCheck(initialized) {
|
|
9675
|
+
// Block request if not in browser environment
|
|
9676
|
+
blockNonBrowserEnvironment();
|
|
9677
|
+
// Block auth requests inside a hidden iframe
|
|
9678
|
+
blockReloadInHiddenIframes();
|
|
9679
|
+
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
9680
|
+
blockAcquireTokenInPopups();
|
|
9681
|
+
// Block token acquisition before initialize has been called
|
|
9682
|
+
blockAPICallsBeforeInitialize(initialized);
|
|
9683
|
+
}
|
|
9684
|
+
/**
|
|
9685
|
+
* Helper to validate app enviornment before making redirect request
|
|
9686
|
+
* @param initialized
|
|
9687
|
+
* @param config
|
|
9688
|
+
*/
|
|
9689
|
+
function redirectPreflightCheck(initialized, config) {
|
|
9690
|
+
preflightCheck(initialized);
|
|
9691
|
+
blockRedirectInIframe(config.system.allowRedirectInIframe);
|
|
9692
|
+
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
9693
|
+
if (config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&
|
|
9694
|
+
!config.cache.storeAuthStateInCookie) {
|
|
9695
|
+
throw createBrowserConfigurationAuthError(inMemRedirectUnavailable);
|
|
9696
|
+
}
|
|
9697
|
+
}
|
|
9186
9698
|
/**
|
|
9187
9699
|
* Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
|
|
9188
9700
|
* @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
|
|
@@ -9224,6 +9736,8 @@ var BrowserUtils = /*#__PURE__*/Object.freeze({
|
|
|
9224
9736
|
isInIframe: isInIframe,
|
|
9225
9737
|
isInPopup: isInPopup,
|
|
9226
9738
|
preconnect: preconnect,
|
|
9739
|
+
preflightCheck: preflightCheck,
|
|
9740
|
+
redirectPreflightCheck: redirectPreflightCheck,
|
|
9227
9741
|
replaceHash: replaceHash
|
|
9228
9742
|
});
|
|
9229
9743
|
|
|
@@ -9499,7 +10013,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
9499
10013
|
|
|
9500
10014
|
/* eslint-disable header/header */
|
|
9501
10015
|
const name = "@azure/msal-browser";
|
|
9502
|
-
const version = "3.
|
|
10016
|
+
const version = "3.11.0";
|
|
9503
10017
|
|
|
9504
10018
|
/*
|
|
9505
10019
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9925,50 +10439,6 @@ async function createController(config) {
|
|
|
9925
10439
|
}
|
|
9926
10440
|
}
|
|
9927
10441
|
|
|
9928
|
-
/*
|
|
9929
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9930
|
-
* Licensed under the MIT License.
|
|
9931
|
-
*/
|
|
9932
|
-
/**
|
|
9933
|
-
* Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:
|
|
9934
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64
|
|
9935
|
-
*/
|
|
9936
|
-
/**
|
|
9937
|
-
* Returns URL Safe b64 encoded string from a plaintext string.
|
|
9938
|
-
* @param input
|
|
9939
|
-
*/
|
|
9940
|
-
function urlEncode(input) {
|
|
9941
|
-
return encodeURIComponent(base64Encode(input)
|
|
9942
|
-
.replace(/=/g, "")
|
|
9943
|
-
.replace(/\+/g, "-")
|
|
9944
|
-
.replace(/\//g, "_"));
|
|
9945
|
-
}
|
|
9946
|
-
/**
|
|
9947
|
-
* Returns URL Safe b64 encoded string from an int8Array.
|
|
9948
|
-
* @param inputArr
|
|
9949
|
-
*/
|
|
9950
|
-
function urlEncodeArr(inputArr) {
|
|
9951
|
-
return base64EncArr(inputArr)
|
|
9952
|
-
.replace(/=/g, "")
|
|
9953
|
-
.replace(/\+/g, "-")
|
|
9954
|
-
.replace(/\//g, "_");
|
|
9955
|
-
}
|
|
9956
|
-
/**
|
|
9957
|
-
* Returns b64 encoded string from plaintext string.
|
|
9958
|
-
* @param input
|
|
9959
|
-
*/
|
|
9960
|
-
function base64Encode(input) {
|
|
9961
|
-
return base64EncArr(new TextEncoder().encode(input));
|
|
9962
|
-
}
|
|
9963
|
-
/**
|
|
9964
|
-
* Base64 encode byte array
|
|
9965
|
-
* @param aBytes
|
|
9966
|
-
*/
|
|
9967
|
-
function base64EncArr(aBytes) {
|
|
9968
|
-
const binString = Array.from(aBytes, (x) => String.fromCodePoint(x)).join("");
|
|
9969
|
-
return btoa(binString);
|
|
9970
|
-
}
|
|
9971
|
-
|
|
9972
10442
|
/*
|
|
9973
10443
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9974
10444
|
* Licensed under the MIT License.
|
|
@@ -10190,9 +10660,19 @@ class DatabaseStorage {
|
|
|
10190
10660
|
}
|
|
10191
10661
|
return new Promise((resolve, reject) => {
|
|
10192
10662
|
const deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
|
|
10193
|
-
|
|
10194
|
-
deleteDbRequest.addEventListener("
|
|
10195
|
-
|
|
10663
|
+
const id = setTimeout(() => reject(false), 200); // Reject if events aren't raised within 200ms
|
|
10664
|
+
deleteDbRequest.addEventListener("success", () => {
|
|
10665
|
+
clearTimeout(id);
|
|
10666
|
+
return resolve(true);
|
|
10667
|
+
});
|
|
10668
|
+
deleteDbRequest.addEventListener("blocked", () => {
|
|
10669
|
+
clearTimeout(id);
|
|
10670
|
+
return resolve(true);
|
|
10671
|
+
});
|
|
10672
|
+
deleteDbRequest.addEventListener("error", () => {
|
|
10673
|
+
clearTimeout(id);
|
|
10674
|
+
return reject(false);
|
|
10675
|
+
});
|
|
10196
10676
|
});
|
|
10197
10677
|
}
|
|
10198
10678
|
}
|
|
@@ -10238,11 +10718,10 @@ class MemoryStorage {
|
|
|
10238
10718
|
* backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
|
|
10239
10719
|
*/
|
|
10240
10720
|
class AsyncMemoryStorage {
|
|
10241
|
-
constructor(logger
|
|
10721
|
+
constructor(logger) {
|
|
10242
10722
|
this.inMemoryCache = new MemoryStorage();
|
|
10243
10723
|
this.indexedDBCache = new DatabaseStorage();
|
|
10244
10724
|
this.logger = logger;
|
|
10245
|
-
this.storeName = storeName;
|
|
10246
10725
|
}
|
|
10247
10726
|
handleDatabaseAccessError(error) {
|
|
10248
10727
|
if (error instanceof BrowserAuthError &&
|
|
@@ -10338,66 +10817,25 @@ class AsyncMemoryStorage {
|
|
|
10338
10817
|
*/
|
|
10339
10818
|
clearInMemory() {
|
|
10340
10819
|
// InMemory cache is a Map instance, clear is straightforward
|
|
10341
|
-
this.logger.verbose(`Deleting in-memory keystore
|
|
10820
|
+
this.logger.verbose(`Deleting in-memory keystore`);
|
|
10342
10821
|
this.inMemoryCache.clear();
|
|
10343
|
-
this.logger.verbose(`In-memory keystore
|
|
10344
|
-
}
|
|
10345
|
-
/**
|
|
10346
|
-
* Tries to delete the IndexedDB database
|
|
10347
|
-
* @returns
|
|
10348
|
-
*/
|
|
10349
|
-
async clearPersistent() {
|
|
10350
|
-
try {
|
|
10351
|
-
this.logger.verbose("Deleting persistent keystore");
|
|
10352
|
-
const dbDeleted = await this.indexedDBCache.deleteDatabase();
|
|
10353
|
-
if (dbDeleted) {
|
|
10354
|
-
this.logger.verbose("Persistent keystore deleted");
|
|
10355
|
-
}
|
|
10356
|
-
return dbDeleted;
|
|
10357
|
-
}
|
|
10358
|
-
catch (e) {
|
|
10359
|
-
this.handleDatabaseAccessError(e);
|
|
10360
|
-
return false;
|
|
10361
|
-
}
|
|
10362
|
-
}
|
|
10363
|
-
}
|
|
10364
|
-
|
|
10365
|
-
/*
|
|
10366
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10367
|
-
* Licensed under the MIT License.
|
|
10368
|
-
*/
|
|
10369
|
-
const CryptoKeyStoreNames = {
|
|
10370
|
-
asymmetricKeys: "asymmetricKeys",
|
|
10371
|
-
symmetricKeys: "symmetricKeys",
|
|
10372
|
-
};
|
|
10373
|
-
/**
|
|
10374
|
-
* MSAL CryptoKeyStore DB Version 2
|
|
10375
|
-
*/
|
|
10376
|
-
class CryptoKeyStore {
|
|
10377
|
-
constructor(logger) {
|
|
10378
|
-
this.logger = logger;
|
|
10379
|
-
this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);
|
|
10380
|
-
this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);
|
|
10381
|
-
}
|
|
10382
|
-
async clear() {
|
|
10383
|
-
// Delete in-memory keystores
|
|
10384
|
-
this.asymmetricKeys.clearInMemory();
|
|
10385
|
-
this.symmetricKeys.clearInMemory();
|
|
10386
|
-
/**
|
|
10387
|
-
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
10388
|
-
* every persistent keystore
|
|
10389
|
-
*/
|
|
10822
|
+
this.logger.verbose(`In-memory keystore deleted`);
|
|
10823
|
+
}
|
|
10824
|
+
/**
|
|
10825
|
+
* Tries to delete the IndexedDB database
|
|
10826
|
+
* @returns
|
|
10827
|
+
*/
|
|
10828
|
+
async clearPersistent() {
|
|
10390
10829
|
try {
|
|
10391
|
-
|
|
10392
|
-
|
|
10830
|
+
this.logger.verbose("Deleting persistent keystore");
|
|
10831
|
+
const dbDeleted = await this.indexedDBCache.deleteDatabase();
|
|
10832
|
+
if (dbDeleted) {
|
|
10833
|
+
this.logger.verbose("Persistent keystore deleted");
|
|
10834
|
+
}
|
|
10835
|
+
return dbDeleted;
|
|
10393
10836
|
}
|
|
10394
10837
|
catch (e) {
|
|
10395
|
-
|
|
10396
|
-
this.logger.error(`Clearing keystore failed with error: ${e.message}`);
|
|
10397
|
-
}
|
|
10398
|
-
else {
|
|
10399
|
-
this.logger.error("Clearing keystore failed with unknown error");
|
|
10400
|
-
}
|
|
10838
|
+
this.handleDatabaseAccessError(e);
|
|
10401
10839
|
return false;
|
|
10402
10840
|
}
|
|
10403
10841
|
}
|
|
@@ -10416,7 +10854,7 @@ class CryptoOps {
|
|
|
10416
10854
|
this.logger = logger;
|
|
10417
10855
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
10418
10856
|
validateCryptoAvailable(logger);
|
|
10419
|
-
this.cache = new
|
|
10857
|
+
this.cache = new AsyncMemoryStorage(this.logger);
|
|
10420
10858
|
this.performanceClient = performanceClient;
|
|
10421
10859
|
}
|
|
10422
10860
|
/**
|
|
@@ -10462,7 +10900,7 @@ class CryptoOps {
|
|
|
10462
10900
|
// Re-import private key to make it unextractable
|
|
10463
10901
|
const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"]);
|
|
10464
10902
|
// Store Keypair data in keystore
|
|
10465
|
-
await this.cache.
|
|
10903
|
+
await this.cache.setItem(publicJwkHash, {
|
|
10466
10904
|
privateKey: unextractablePrivateKey,
|
|
10467
10905
|
publicKey: keyPair.publicKey,
|
|
10468
10906
|
requestMethod: request.resourceRequestMethod,
|
|
@@ -10480,15 +10918,33 @@ class CryptoOps {
|
|
|
10480
10918
|
* @param kid
|
|
10481
10919
|
*/
|
|
10482
10920
|
async removeTokenBindingKey(kid) {
|
|
10483
|
-
await this.cache.
|
|
10484
|
-
const keyFound = await this.cache.
|
|
10921
|
+
await this.cache.removeItem(kid);
|
|
10922
|
+
const keyFound = await this.cache.containsKey(kid);
|
|
10485
10923
|
return !keyFound;
|
|
10486
10924
|
}
|
|
10487
10925
|
/**
|
|
10488
10926
|
* Removes all cryptographic keys from IndexedDB storage
|
|
10489
10927
|
*/
|
|
10490
10928
|
async clearKeystore() {
|
|
10491
|
-
|
|
10929
|
+
// Delete in-memory keystores
|
|
10930
|
+
this.cache.clearInMemory();
|
|
10931
|
+
/**
|
|
10932
|
+
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
10933
|
+
* every persistent keystore
|
|
10934
|
+
*/
|
|
10935
|
+
try {
|
|
10936
|
+
await this.cache.clearPersistent();
|
|
10937
|
+
return true;
|
|
10938
|
+
}
|
|
10939
|
+
catch (e) {
|
|
10940
|
+
if (e instanceof Error) {
|
|
10941
|
+
this.logger.error(`Clearing keystore failed with error: ${e.message}`);
|
|
10942
|
+
}
|
|
10943
|
+
else {
|
|
10944
|
+
this.logger.error("Clearing keystore failed with unknown error");
|
|
10945
|
+
}
|
|
10946
|
+
return false;
|
|
10947
|
+
}
|
|
10492
10948
|
}
|
|
10493
10949
|
/**
|
|
10494
10950
|
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
@@ -10497,7 +10953,7 @@ class CryptoOps {
|
|
|
10497
10953
|
*/
|
|
10498
10954
|
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
10499
10955
|
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
10500
|
-
const cachedKeyPair = await this.cache.
|
|
10956
|
+
const cachedKeyPair = await this.cache.getItem(kid);
|
|
10501
10957
|
if (!cachedKeyPair) {
|
|
10502
10958
|
throw createBrowserAuthError(cryptoKeyNotFound);
|
|
10503
10959
|
}
|
|
@@ -10538,9 +10994,7 @@ class CryptoOps {
|
|
|
10538
10994
|
* @param plainText
|
|
10539
10995
|
*/
|
|
10540
10996
|
async hashString(plainText) {
|
|
10541
|
-
|
|
10542
|
-
const hashBytes = new Uint8Array(hashBuffer);
|
|
10543
|
-
return urlEncodeArr(hashBytes);
|
|
10997
|
+
return hashString(plainText);
|
|
10544
10998
|
}
|
|
10545
10999
|
}
|
|
10546
11000
|
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
@@ -10549,62 +11003,6 @@ function getSortedObjectString(obj) {
|
|
|
10549
11003
|
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
10550
11004
|
}
|
|
10551
11005
|
|
|
10552
|
-
/*
|
|
10553
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10554
|
-
* Licensed under the MIT License.
|
|
10555
|
-
*/
|
|
10556
|
-
const storageNotSupported = "storage_not_supported";
|
|
10557
|
-
const stubbedPublicClientApplicationCalled = "stubbed_public_client_application_called";
|
|
10558
|
-
const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
|
|
10559
|
-
|
|
10560
|
-
var BrowserConfigurationAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
10561
|
-
__proto__: null,
|
|
10562
|
-
inMemRedirectUnavailable: inMemRedirectUnavailable,
|
|
10563
|
-
storageNotSupported: storageNotSupported,
|
|
10564
|
-
stubbedPublicClientApplicationCalled: stubbedPublicClientApplicationCalled
|
|
10565
|
-
});
|
|
10566
|
-
|
|
10567
|
-
/*
|
|
10568
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10569
|
-
* Licensed under the MIT License.
|
|
10570
|
-
*/
|
|
10571
|
-
const BrowserConfigurationAuthErrorMessages = {
|
|
10572
|
-
[storageNotSupported]: "Given storage configuration option was not supported.",
|
|
10573
|
-
[stubbedPublicClientApplicationCalled]: "Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",
|
|
10574
|
-
[inMemRedirectUnavailable]: "Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true.",
|
|
10575
|
-
};
|
|
10576
|
-
/**
|
|
10577
|
-
* BrowserAuthErrorMessage class containing string constants used by error codes and messages.
|
|
10578
|
-
* @deprecated Use BrowserAuthErrorCodes instead
|
|
10579
|
-
*/
|
|
10580
|
-
const BrowserConfigurationAuthErrorMessage = {
|
|
10581
|
-
storageNotSupportedError: {
|
|
10582
|
-
code: storageNotSupported,
|
|
10583
|
-
desc: BrowserConfigurationAuthErrorMessages[storageNotSupported],
|
|
10584
|
-
},
|
|
10585
|
-
stubPcaInstanceCalled: {
|
|
10586
|
-
code: stubbedPublicClientApplicationCalled,
|
|
10587
|
-
desc: BrowserConfigurationAuthErrorMessages[stubbedPublicClientApplicationCalled],
|
|
10588
|
-
},
|
|
10589
|
-
inMemRedirectUnavailable: {
|
|
10590
|
-
code: inMemRedirectUnavailable,
|
|
10591
|
-
desc: BrowserConfigurationAuthErrorMessages[inMemRedirectUnavailable],
|
|
10592
|
-
},
|
|
10593
|
-
};
|
|
10594
|
-
/**
|
|
10595
|
-
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
10596
|
-
*/
|
|
10597
|
-
class BrowserConfigurationAuthError extends AuthError {
|
|
10598
|
-
constructor(errorCode, errorMessage) {
|
|
10599
|
-
super(errorCode, errorMessage);
|
|
10600
|
-
this.name = "BrowserConfigurationAuthError";
|
|
10601
|
-
Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);
|
|
10602
|
-
}
|
|
10603
|
-
}
|
|
10604
|
-
function createBrowserConfigurationAuthError(errorCode) {
|
|
10605
|
-
return new BrowserConfigurationAuthError(errorCode, BrowserConfigurationAuthErrorMessages[errorCode]);
|
|
10606
|
-
}
|
|
10607
|
-
|
|
10608
11006
|
/*
|
|
10609
11007
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10610
11008
|
* Licensed under the MIT License.
|
|
@@ -10753,18 +11151,12 @@ class BrowserCacheManager extends CacheManager {
|
|
|
10753
11151
|
PersistentCacheKeys.ERROR,
|
|
10754
11152
|
PersistentCacheKeys.ERROR_DESC,
|
|
10755
11153
|
];
|
|
10756
|
-
keysToMigrate.forEach((cacheKey, index) =>
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
* @param storeAuthStateInCookie
|
|
10763
|
-
*/
|
|
10764
|
-
migrateCacheEntry(newKey, value) {
|
|
10765
|
-
if (value) {
|
|
10766
|
-
this.setTemporaryCache(newKey, value, true);
|
|
10767
|
-
}
|
|
11154
|
+
keysToMigrate.forEach((cacheKey, index) => {
|
|
11155
|
+
const value = values[index];
|
|
11156
|
+
if (value) {
|
|
11157
|
+
this.setTemporaryCache(cacheKey, value, true);
|
|
11158
|
+
}
|
|
11159
|
+
});
|
|
10768
11160
|
}
|
|
10769
11161
|
/**
|
|
10770
11162
|
* Searches all cache entries for MSAL accounts and creates the account key map
|
|
@@ -11461,33 +11853,28 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11461
11853
|
}
|
|
11462
11854
|
/**
|
|
11463
11855
|
* Removes the cache item with the given key.
|
|
11464
|
-
* Will also clear the cookie item if storeAuthStateInCookie is set to true.
|
|
11465
11856
|
* @param key
|
|
11466
11857
|
*/
|
|
11467
11858
|
removeItem(key) {
|
|
11468
11859
|
this.browserStorage.removeItem(key);
|
|
11860
|
+
}
|
|
11861
|
+
/**
|
|
11862
|
+
* Removes the temporary cache item with the given key.
|
|
11863
|
+
* Will also clear the cookie item if storeAuthStateInCookie is set to true.
|
|
11864
|
+
* @param key
|
|
11865
|
+
*/
|
|
11866
|
+
removeTemporaryItem(key) {
|
|
11469
11867
|
this.temporaryCacheStorage.removeItem(key);
|
|
11470
11868
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
11471
11869
|
this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie");
|
|
11472
11870
|
this.clearItemCookie(key);
|
|
11473
11871
|
}
|
|
11474
11872
|
}
|
|
11475
|
-
/**
|
|
11476
|
-
* Checks whether key is in cache.
|
|
11477
|
-
* @param key
|
|
11478
|
-
*/
|
|
11479
|
-
containsKey(key) {
|
|
11480
|
-
return (this.browserStorage.containsKey(key) ||
|
|
11481
|
-
this.temporaryCacheStorage.containsKey(key));
|
|
11482
|
-
}
|
|
11483
11873
|
/**
|
|
11484
11874
|
* Gets all keys in window.
|
|
11485
11875
|
*/
|
|
11486
11876
|
getKeys() {
|
|
11487
|
-
return
|
|
11488
|
-
...this.browserStorage.getKeys(),
|
|
11489
|
-
...this.temporaryCacheStorage.getKeys(),
|
|
11490
|
-
];
|
|
11877
|
+
return this.browserStorage.getKeys();
|
|
11491
11878
|
}
|
|
11492
11879
|
/**
|
|
11493
11880
|
* Clears all cache entries created by MSAL.
|
|
@@ -11496,14 +11883,18 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11496
11883
|
// Removes all accounts and their credentials
|
|
11497
11884
|
await this.removeAllAccounts();
|
|
11498
11885
|
this.removeAppMetadata();
|
|
11886
|
+
// Remove temp storage first to make sure any cookies are cleared
|
|
11887
|
+
this.temporaryCacheStorage.getKeys().forEach((cacheKey) => {
|
|
11888
|
+
if (cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11889
|
+
cacheKey.indexOf(this.clientId) !== -1) {
|
|
11890
|
+
this.removeTemporaryItem(cacheKey);
|
|
11891
|
+
}
|
|
11892
|
+
});
|
|
11499
11893
|
// Removes all remaining MSAL cache items
|
|
11500
|
-
this.getKeys().forEach((cacheKey) => {
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
this.
|
|
11504
|
-
(cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11505
|
-
cacheKey.indexOf(this.clientId) !== -1)) {
|
|
11506
|
-
this.removeItem(cacheKey);
|
|
11894
|
+
this.browserStorage.getKeys().forEach((cacheKey) => {
|
|
11895
|
+
if (cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11896
|
+
cacheKey.indexOf(this.clientId) !== -1) {
|
|
11897
|
+
this.browserStorage.removeItem(cacheKey);
|
|
11507
11898
|
}
|
|
11508
11899
|
});
|
|
11509
11900
|
this.internalStorage.clear();
|
|
@@ -11536,6 +11927,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11536
11927
|
* @param cookieName
|
|
11537
11928
|
* @param cookieValue
|
|
11538
11929
|
* @param expires
|
|
11930
|
+
* @deprecated
|
|
11539
11931
|
*/
|
|
11540
11932
|
setItemCookie(cookieName, cookieValue, expires) {
|
|
11541
11933
|
let cookieStr = `${encodeURIComponent(cookieName)}=${encodeURIComponent(cookieValue)};path=/;SameSite=Lax;`;
|
|
@@ -11551,6 +11943,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11551
11943
|
/**
|
|
11552
11944
|
* Get one item by key from cookies
|
|
11553
11945
|
* @param cookieName
|
|
11946
|
+
* @deprecated
|
|
11554
11947
|
*/
|
|
11555
11948
|
getItemCookie(cookieName) {
|
|
11556
11949
|
const name = `${encodeURIComponent(cookieName)}=`;
|
|
@@ -11568,6 +11961,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11568
11961
|
}
|
|
11569
11962
|
/**
|
|
11570
11963
|
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
11964
|
+
* @deprecated
|
|
11571
11965
|
*/
|
|
11572
11966
|
clearMsalCookies() {
|
|
11573
11967
|
const cookiePrefix = `${Constants.CACHE_PREFIX}.${this.clientId}`;
|
|
@@ -11586,6 +11980,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11586
11980
|
/**
|
|
11587
11981
|
* Clear an item in the cookies by key
|
|
11588
11982
|
* @param cookieName
|
|
11983
|
+
* @deprecated
|
|
11589
11984
|
*/
|
|
11590
11985
|
clearItemCookie(cookieName) {
|
|
11591
11986
|
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
@@ -11593,24 +11988,13 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11593
11988
|
/**
|
|
11594
11989
|
* Get cookie expiration time
|
|
11595
11990
|
* @param cookieLifeDays
|
|
11991
|
+
* @deprecated
|
|
11596
11992
|
*/
|
|
11597
11993
|
getCookieExpirationTime(cookieLifeDays) {
|
|
11598
11994
|
const today = new Date();
|
|
11599
11995
|
const expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);
|
|
11600
11996
|
return expr.toUTCString();
|
|
11601
11997
|
}
|
|
11602
|
-
/**
|
|
11603
|
-
* Gets the cache object referenced by the browser
|
|
11604
|
-
*/
|
|
11605
|
-
getCache() {
|
|
11606
|
-
return this.browserStorage;
|
|
11607
|
-
}
|
|
11608
|
-
/**
|
|
11609
|
-
* interface compat, we cannot overwrite browser cache; Functionality is supported by individual entities in browser
|
|
11610
|
-
*/
|
|
11611
|
-
setCache() {
|
|
11612
|
-
// sets nothing
|
|
11613
|
-
}
|
|
11614
11998
|
/**
|
|
11615
11999
|
* 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)
|
|
11616
12000
|
* @param key
|
|
@@ -11703,22 +12087,22 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11703
12087
|
this.logger.trace("BrowserCacheManager.resetRequestCache called");
|
|
11704
12088
|
// check state and remove associated cache items
|
|
11705
12089
|
if (state) {
|
|
11706
|
-
this.getKeys().forEach((key) => {
|
|
12090
|
+
this.temporaryCacheStorage.getKeys().forEach((key) => {
|
|
11707
12091
|
if (key.indexOf(state) !== -1) {
|
|
11708
|
-
this.
|
|
12092
|
+
this.removeTemporaryItem(key);
|
|
11709
12093
|
}
|
|
11710
12094
|
});
|
|
11711
12095
|
// delete generic interactive request parameters
|
|
11712
|
-
this.
|
|
11713
|
-
this.
|
|
11714
|
-
this.
|
|
11715
|
-
}
|
|
11716
|
-
this.
|
|
11717
|
-
this.
|
|
11718
|
-
this.
|
|
11719
|
-
this.
|
|
11720
|
-
this.
|
|
11721
|
-
this.
|
|
12096
|
+
this.removeTemporaryItem(this.generateStateKey(state));
|
|
12097
|
+
this.removeTemporaryItem(this.generateNonceKey(state));
|
|
12098
|
+
this.removeTemporaryItem(this.generateAuthorityKey(state));
|
|
12099
|
+
}
|
|
12100
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
12101
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
|
|
12102
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
12103
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
|
|
12104
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
12105
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
11722
12106
|
this.setInteractionInProgress(false);
|
|
11723
12107
|
}
|
|
11724
12108
|
/**
|
|
@@ -11744,7 +12128,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11744
12128
|
cleanRequestByInteractionType(interactionType) {
|
|
11745
12129
|
this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called");
|
|
11746
12130
|
// Loop through all keys to find state key
|
|
11747
|
-
this.getKeys().forEach((key) => {
|
|
12131
|
+
this.temporaryCacheStorage.getKeys().forEach((key) => {
|
|
11748
12132
|
// If this key is not the state key, move on
|
|
11749
12133
|
if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
11750
12134
|
return;
|
|
@@ -11789,7 +12173,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11789
12173
|
this.logger.error(`Parsing cached token request threw with error: ${e}`);
|
|
11790
12174
|
throw createBrowserAuthError(unableToParseTokenRequestCacheError);
|
|
11791
12175
|
}
|
|
11792
|
-
this.
|
|
12176
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
11793
12177
|
// Get cached authority and use if no authority is cached with request.
|
|
11794
12178
|
if (!parsedRequest.authority) {
|
|
11795
12179
|
const authorityCacheKey = this.generateAuthorityKey(state);
|
|
@@ -11845,7 +12229,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11845
12229
|
}
|
|
11846
12230
|
else if (!inProgress &&
|
|
11847
12231
|
this.getInteractionInProgress() === this.clientId) {
|
|
11848
|
-
this.
|
|
12232
|
+
this.removeTemporaryItem(key);
|
|
11849
12233
|
}
|
|
11850
12234
|
}
|
|
11851
12235
|
/**
|
|
@@ -11862,7 +12246,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11862
12246
|
// Check for cached MSAL v1 id token
|
|
11863
12247
|
const msalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ID_TOKEN, true);
|
|
11864
12248
|
if (msalIdTokenString) {
|
|
11865
|
-
this.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
12249
|
+
this.browserStorage.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
11866
12250
|
this.logger.verbose("Cached MSAL.js v1 id token retrieved");
|
|
11867
12251
|
}
|
|
11868
12252
|
const cachedIdTokenString = msalIdTokenString || adalIdTokenString;
|
|
@@ -11890,7 +12274,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11890
12274
|
if (currentCacheKey !== updatedCacheKey) {
|
|
11891
12275
|
const cacheItem = this.getItem(currentCacheKey);
|
|
11892
12276
|
if (cacheItem) {
|
|
11893
|
-
this.removeItem(currentCacheKey);
|
|
12277
|
+
this.browserStorage.removeItem(currentCacheKey);
|
|
11894
12278
|
this.setItem(updatedCacheKey, cacheItem);
|
|
11895
12279
|
this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
|
|
11896
12280
|
return updatedCacheKey;
|
|
@@ -11901,19 +12285,6 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11901
12285
|
}
|
|
11902
12286
|
return currentCacheKey;
|
|
11903
12287
|
}
|
|
11904
|
-
/**
|
|
11905
|
-
* Returns application id as redirect context during AcquireTokenRedirect flow.
|
|
11906
|
-
*/
|
|
11907
|
-
getRedirectRequestContext() {
|
|
11908
|
-
return this.getTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, true);
|
|
11909
|
-
}
|
|
11910
|
-
/**
|
|
11911
|
-
* Sets application id as the redirect context during AcquireTokenRedirect flow.
|
|
11912
|
-
* @param value
|
|
11913
|
-
*/
|
|
11914
|
-
setRedirectRequestContext(value) {
|
|
11915
|
-
this.setTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, value, true);
|
|
11916
|
-
}
|
|
11917
12288
|
/**
|
|
11918
12289
|
* Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
|
|
11919
12290
|
* @param result
|
|
@@ -12148,47 +12519,6 @@ class BaseInteractionClient {
|
|
|
12148
12519
|
}
|
|
12149
12520
|
}
|
|
12150
12521
|
}
|
|
12151
|
-
/**
|
|
12152
|
-
* Initializer function for all request APIs
|
|
12153
|
-
* @param request
|
|
12154
|
-
*/
|
|
12155
|
-
async initializeBaseRequest(request) {
|
|
12156
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12157
|
-
const authority = request.authority || this.config.auth.authority;
|
|
12158
|
-
const scopes = [...((request && request.scopes) || [])];
|
|
12159
|
-
const validatedRequest = {
|
|
12160
|
-
...request,
|
|
12161
|
-
correlationId: this.correlationId,
|
|
12162
|
-
authority,
|
|
12163
|
-
scopes,
|
|
12164
|
-
};
|
|
12165
|
-
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
12166
|
-
if (!validatedRequest.authenticationScheme) {
|
|
12167
|
-
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
12168
|
-
this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
12169
|
-
}
|
|
12170
|
-
else {
|
|
12171
|
-
if (validatedRequest.authenticationScheme ===
|
|
12172
|
-
AuthenticationScheme.SSH) {
|
|
12173
|
-
if (!request.sshJwk) {
|
|
12174
|
-
throw createClientConfigurationError(missingSshJwk);
|
|
12175
|
-
}
|
|
12176
|
-
if (!request.sshKid) {
|
|
12177
|
-
throw createClientConfigurationError(missingSshKid);
|
|
12178
|
-
}
|
|
12179
|
-
}
|
|
12180
|
-
this.logger.verbose(`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`);
|
|
12181
|
-
}
|
|
12182
|
-
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
12183
|
-
if (this.config.cache.claimsBasedCachingEnabled &&
|
|
12184
|
-
request.claims &&
|
|
12185
|
-
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
12186
|
-
!StringUtils.isEmptyObj(request.claims)) {
|
|
12187
|
-
validatedRequest.requestedClaimsHash =
|
|
12188
|
-
await this.browserCrypto.hashString(request.claims);
|
|
12189
|
-
}
|
|
12190
|
-
return validatedRequest;
|
|
12191
|
-
}
|
|
12192
12522
|
/**
|
|
12193
12523
|
*
|
|
12194
12524
|
* Use to get the redirect uri configured in MSAL or null.
|
|
@@ -12306,6 +12636,60 @@ async function generateCodeChallengeFromVerifier(pkceCodeVerifier, performanceCl
|
|
|
12306
12636
|
}
|
|
12307
12637
|
}
|
|
12308
12638
|
|
|
12639
|
+
/*
|
|
12640
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12641
|
+
* Licensed under the MIT License.
|
|
12642
|
+
*/
|
|
12643
|
+
/**
|
|
12644
|
+
* Initializer function for all request APIs
|
|
12645
|
+
* @param request
|
|
12646
|
+
*/
|
|
12647
|
+
async function initializeBaseRequest(request, config, performanceClient, logger) {
|
|
12648
|
+
performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
12649
|
+
const authority = request.authority || config.auth.authority;
|
|
12650
|
+
const scopes = [...((request && request.scopes) || [])];
|
|
12651
|
+
const validatedRequest = {
|
|
12652
|
+
...request,
|
|
12653
|
+
correlationId: request.correlationId,
|
|
12654
|
+
authority,
|
|
12655
|
+
scopes,
|
|
12656
|
+
};
|
|
12657
|
+
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
12658
|
+
if (!validatedRequest.authenticationScheme) {
|
|
12659
|
+
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
12660
|
+
logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
12661
|
+
}
|
|
12662
|
+
else {
|
|
12663
|
+
if (validatedRequest.authenticationScheme === AuthenticationScheme.SSH) {
|
|
12664
|
+
if (!request.sshJwk) {
|
|
12665
|
+
throw createClientConfigurationError(missingSshJwk);
|
|
12666
|
+
}
|
|
12667
|
+
if (!request.sshKid) {
|
|
12668
|
+
throw createClientConfigurationError(missingSshKid);
|
|
12669
|
+
}
|
|
12670
|
+
}
|
|
12671
|
+
logger.verbose(`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`);
|
|
12672
|
+
}
|
|
12673
|
+
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
12674
|
+
if (config.cache.claimsBasedCachingEnabled &&
|
|
12675
|
+
request.claims &&
|
|
12676
|
+
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
12677
|
+
!StringUtils.isEmptyObj(request.claims)) {
|
|
12678
|
+
validatedRequest.requestedClaimsHash = await hashString(request.claims);
|
|
12679
|
+
}
|
|
12680
|
+
return validatedRequest;
|
|
12681
|
+
}
|
|
12682
|
+
async function initializeSilentRequest(request, account, config, performanceClient, logger) {
|
|
12683
|
+
performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
12684
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, logger, performanceClient, request.correlationId)(request, config, performanceClient, logger);
|
|
12685
|
+
return {
|
|
12686
|
+
...request,
|
|
12687
|
+
...baseRequest,
|
|
12688
|
+
account: account,
|
|
12689
|
+
forceRefresh: request.forceRefresh || false,
|
|
12690
|
+
};
|
|
12691
|
+
}
|
|
12692
|
+
|
|
12309
12693
|
/*
|
|
12310
12694
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12311
12695
|
* Licensed under the MIT License.
|
|
@@ -12480,7 +12864,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
12480
12864
|
interactionType: interactionType,
|
|
12481
12865
|
};
|
|
12482
12866
|
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
12483
|
-
const baseRequest = await invokeAsync(
|
|
12867
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)({ ...request, correlationId: this.correlationId }, this.config, this.performanceClient, this.logger);
|
|
12484
12868
|
const validatedRequest = {
|
|
12485
12869
|
...baseRequest,
|
|
12486
12870
|
redirectUri: redirectUri,
|
|
@@ -12599,7 +12983,8 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
12599
12983
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
12600
12984
|
// Telemetry manager only used to increment cacheHits here
|
|
12601
12985
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
12602
|
-
const
|
|
12986
|
+
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
|
|
12987
|
+
const silentAuthClient = new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12603
12988
|
this.logger.verbose("Silent auth client created");
|
|
12604
12989
|
try {
|
|
12605
12990
|
const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
@@ -12626,26 +13011,6 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
12626
13011
|
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
|
12627
13012
|
return this.clearCacheOnLogout(validLogoutRequest?.account);
|
|
12628
13013
|
}
|
|
12629
|
-
/**
|
|
12630
|
-
* Creates an Silent Flow Client with the given authority, or the default authority.
|
|
12631
|
-
* @param serverTelemetryManager
|
|
12632
|
-
* @param authorityUrl
|
|
12633
|
-
*/
|
|
12634
|
-
async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
|
|
12635
|
-
// Create auth module.
|
|
12636
|
-
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
|
|
12637
|
-
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12638
|
-
}
|
|
12639
|
-
async initializeSilentRequest(request, account) {
|
|
12640
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
12641
|
-
const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
12642
|
-
return {
|
|
12643
|
-
...request,
|
|
12644
|
-
...baseRequest,
|
|
12645
|
-
account: account,
|
|
12646
|
-
forceRefresh: request.forceRefresh || false,
|
|
12647
|
-
};
|
|
12648
|
-
}
|
|
12649
13014
|
}
|
|
12650
13015
|
|
|
12651
13016
|
/*
|
|
@@ -14725,7 +15090,7 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
14725
15090
|
*/
|
|
14726
15091
|
async acquireToken(request) {
|
|
14727
15092
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
14728
|
-
const baseRequest = await invokeAsync(
|
|
15093
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger);
|
|
14729
15094
|
const silentRequest = {
|
|
14730
15095
|
...request,
|
|
14731
15096
|
...baseRequest,
|
|
@@ -15081,7 +15446,6 @@ class StandardController {
|
|
|
15081
15446
|
* @param configuration Object for the MSAL PublicClientApplication instance
|
|
15082
15447
|
*/
|
|
15083
15448
|
constructor(operatingContext) {
|
|
15084
|
-
this.atsAsyncMeasurement = undefined;
|
|
15085
15449
|
this.operatingContext = operatingContext;
|
|
15086
15450
|
this.isBrowserEnvironment =
|
|
15087
15451
|
this.operatingContext.isBrowserEnvironment();
|
|
@@ -15133,14 +15497,12 @@ class StandardController {
|
|
|
15133
15497
|
await controller.initialize();
|
|
15134
15498
|
return controller;
|
|
15135
15499
|
}
|
|
15136
|
-
trackPageVisibility() {
|
|
15137
|
-
if (!
|
|
15500
|
+
trackPageVisibility(correlationId) {
|
|
15501
|
+
if (!correlationId) {
|
|
15138
15502
|
return;
|
|
15139
15503
|
}
|
|
15140
15504
|
this.logger.info("Perf: Visibility change detected");
|
|
15141
|
-
this.
|
|
15142
|
-
visibilityChangeCount: 1,
|
|
15143
|
-
});
|
|
15505
|
+
this.performanceClient.incrementFields({ visibilityChangeCount: 1 }, correlationId);
|
|
15144
15506
|
}
|
|
15145
15507
|
/**
|
|
15146
15508
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
@@ -15245,18 +15607,9 @@ class StandardController {
|
|
|
15245
15607
|
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15246
15608
|
}
|
|
15247
15609
|
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
errorCode: eventError.errorCode,
|
|
15252
|
-
subErrorCode: eventError.subError,
|
|
15253
|
-
});
|
|
15254
|
-
}
|
|
15255
|
-
else {
|
|
15256
|
-
rootMeasurement.end({
|
|
15257
|
-
success: false,
|
|
15258
|
-
});
|
|
15259
|
-
}
|
|
15610
|
+
rootMeasurement.end({
|
|
15611
|
+
success: false,
|
|
15612
|
+
}, eventError);
|
|
15260
15613
|
throw e;
|
|
15261
15614
|
});
|
|
15262
15615
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
@@ -15282,7 +15635,8 @@ class StandardController {
|
|
|
15282
15635
|
// Preflight request
|
|
15283
15636
|
const correlationId = this.getRequestCorrelationId(request);
|
|
15284
15637
|
this.logger.verbose("acquireTokenRedirect called", correlationId);
|
|
15285
|
-
this.
|
|
15638
|
+
redirectPreflightCheck(this.initialized, this.config);
|
|
15639
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15286
15640
|
// If logged in, emit acquire token events
|
|
15287
15641
|
const isLoggedIn = this.getAllAccounts().length > 0;
|
|
15288
15642
|
if (isLoggedIn) {
|
|
@@ -15308,7 +15662,7 @@ class StandardController {
|
|
|
15308
15662
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
15309
15663
|
return redirectClient.acquireToken(request);
|
|
15310
15664
|
}
|
|
15311
|
-
this.
|
|
15665
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15312
15666
|
throw e;
|
|
15313
15667
|
});
|
|
15314
15668
|
}
|
|
@@ -15341,7 +15695,8 @@ class StandardController {
|
|
|
15341
15695
|
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
15342
15696
|
try {
|
|
15343
15697
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
15344
|
-
this.
|
|
15698
|
+
preflightCheck(this.initialized);
|
|
15699
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15345
15700
|
}
|
|
15346
15701
|
catch (e) {
|
|
15347
15702
|
// Since this function is syncronous we need to reject
|
|
@@ -15362,7 +15717,7 @@ class StandardController {
|
|
|
15362
15717
|
correlationId,
|
|
15363
15718
|
}, ApiId.acquireTokenPopup)
|
|
15364
15719
|
.then((response) => {
|
|
15365
|
-
this.
|
|
15720
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15366
15721
|
atPopupMeasurement.end({
|
|
15367
15722
|
success: true,
|
|
15368
15723
|
isNativeBroker: true,
|
|
@@ -15382,7 +15737,7 @@ class StandardController {
|
|
|
15382
15737
|
const popupClient = this.createPopupClient(correlationId);
|
|
15383
15738
|
return popupClient.acquireToken(request);
|
|
15384
15739
|
}
|
|
15385
|
-
this.
|
|
15740
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15386
15741
|
throw e;
|
|
15387
15742
|
});
|
|
15388
15743
|
}
|
|
@@ -15420,10 +15775,8 @@ class StandardController {
|
|
|
15420
15775
|
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
15421
15776
|
}
|
|
15422
15777
|
atPopupMeasurement.end({
|
|
15423
|
-
errorCode: e.errorCode,
|
|
15424
|
-
subErrorCode: e.subError,
|
|
15425
15778
|
success: false,
|
|
15426
|
-
});
|
|
15779
|
+
}, e);
|
|
15427
15780
|
// Since this function is syncronous we need to reject
|
|
15428
15781
|
return Promise.reject(e);
|
|
15429
15782
|
});
|
|
@@ -15464,7 +15817,7 @@ class StandardController {
|
|
|
15464
15817
|
prompt: request.prompt,
|
|
15465
15818
|
correlationId: correlationId,
|
|
15466
15819
|
};
|
|
15467
|
-
this.
|
|
15820
|
+
preflightCheck(this.initialized);
|
|
15468
15821
|
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
|
|
15469
15822
|
this.ssoSilentMeasurement?.increment({
|
|
15470
15823
|
visibilityChangeCount: 0,
|
|
@@ -15505,10 +15858,8 @@ class StandardController {
|
|
|
15505
15858
|
.catch((e) => {
|
|
15506
15859
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15507
15860
|
this.ssoSilentMeasurement?.end({
|
|
15508
|
-
errorCode: e.errorCode,
|
|
15509
|
-
subErrorCode: e.subError,
|
|
15510
15861
|
success: false,
|
|
15511
|
-
});
|
|
15862
|
+
}, e);
|
|
15512
15863
|
throw e;
|
|
15513
15864
|
})
|
|
15514
15865
|
.finally(() => {
|
|
@@ -15527,8 +15878,8 @@ class StandardController {
|
|
|
15527
15878
|
*/
|
|
15528
15879
|
async acquireTokenByCode(request) {
|
|
15529
15880
|
const correlationId = this.getRequestCorrelationId(request);
|
|
15530
|
-
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15531
15881
|
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
15882
|
+
preflightCheck(this.initialized);
|
|
15532
15883
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
15533
15884
|
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
|
|
15534
15885
|
try {
|
|
@@ -15563,10 +15914,8 @@ class StandardController {
|
|
|
15563
15914
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
15564
15915
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
15565
15916
|
atbcMeasurement.end({
|
|
15566
|
-
errorCode: error.errorCode,
|
|
15567
|
-
subErrorCode: error.subError,
|
|
15568
15917
|
success: false,
|
|
15569
|
-
});
|
|
15918
|
+
}, error);
|
|
15570
15919
|
throw error;
|
|
15571
15920
|
});
|
|
15572
15921
|
this.hybridAuthCodeResponses.set(hybridAuthCode, response);
|
|
@@ -15602,10 +15951,8 @@ class StandardController {
|
|
|
15602
15951
|
catch (e) {
|
|
15603
15952
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15604
15953
|
atbcMeasurement.end({
|
|
15605
|
-
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
15606
|
-
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
15607
15954
|
success: false,
|
|
15608
|
-
});
|
|
15955
|
+
}, e);
|
|
15609
15956
|
throw e;
|
|
15610
15957
|
}
|
|
15611
15958
|
}
|
|
@@ -15636,10 +15983,8 @@ class StandardController {
|
|
|
15636
15983
|
})
|
|
15637
15984
|
.catch((tokenRenewalError) => {
|
|
15638
15985
|
this.acquireTokenByCodeAsyncMeasurement?.end({
|
|
15639
|
-
errorCode: tokenRenewalError.errorCode,
|
|
15640
|
-
subErrorCode: tokenRenewalError.subError,
|
|
15641
15986
|
success: false,
|
|
15642
|
-
});
|
|
15987
|
+
}, tokenRenewalError);
|
|
15643
15988
|
throw tokenRenewalError;
|
|
15644
15989
|
})
|
|
15645
15990
|
.finally(() => {
|
|
@@ -15654,12 +15999,13 @@ class StandardController {
|
|
|
15654
15999
|
* @param silentRequest SilentRequest
|
|
15655
16000
|
* @returns A promise that, when resolved, returns the access token
|
|
15656
16001
|
*/
|
|
15657
|
-
async acquireTokenFromCache(
|
|
16002
|
+
async acquireTokenFromCache(commonRequest, cacheLookupPolicy) {
|
|
15658
16003
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
15659
16004
|
switch (cacheLookupPolicy) {
|
|
15660
16005
|
case CacheLookupPolicy.Default:
|
|
15661
16006
|
case CacheLookupPolicy.AccessToken:
|
|
15662
16007
|
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
16008
|
+
const silentCacheClient = this.createSilentCacheClient(commonRequest.correlationId);
|
|
15663
16009
|
return invokeAsync(silentCacheClient.acquireToken.bind(silentCacheClient), PerformanceEvents.SilentCacheClientAcquireToken, this.logger, this.performanceClient, commonRequest.correlationId)(commonRequest);
|
|
15664
16010
|
default:
|
|
15665
16011
|
throw createClientAuthError(tokenRefreshRequired);
|
|
@@ -15716,7 +16062,8 @@ class StandardController {
|
|
|
15716
16062
|
*/
|
|
15717
16063
|
async logoutRedirect(logoutRequest) {
|
|
15718
16064
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
15719
|
-
this.
|
|
16065
|
+
redirectPreflightCheck(this.initialized, this.config);
|
|
16066
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15720
16067
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
15721
16068
|
return redirectClient.logout(logoutRequest);
|
|
15722
16069
|
}
|
|
@@ -15727,7 +16074,8 @@ class StandardController {
|
|
|
15727
16074
|
logoutPopup(logoutRequest) {
|
|
15728
16075
|
try {
|
|
15729
16076
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
15730
|
-
this.
|
|
16077
|
+
preflightCheck(this.initialized);
|
|
16078
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15731
16079
|
const popupClient = this.createPopupClient(correlationId);
|
|
15732
16080
|
return popupClient.logout(logoutRequest);
|
|
15733
16081
|
}
|
|
@@ -15893,52 +16241,6 @@ class StandardController {
|
|
|
15893
16241
|
}
|
|
15894
16242
|
}
|
|
15895
16243
|
// #region Helpers
|
|
15896
|
-
/**
|
|
15897
|
-
* Helper to validate app environment before making an auth request
|
|
15898
|
-
*
|
|
15899
|
-
* @protected
|
|
15900
|
-
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
15901
|
-
* @param {boolean} [isAppEmbedded=false] Whether to set interaction in progress temp cache flag
|
|
15902
|
-
*/
|
|
15903
|
-
preflightBrowserEnvironmentCheck(interactionType, isAppEmbedded = false) {
|
|
15904
|
-
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
15905
|
-
// Block request if not in browser environment
|
|
15906
|
-
blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
15907
|
-
// Block redirects if in an iframe
|
|
15908
|
-
blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);
|
|
15909
|
-
// Block auth requests inside a hidden iframe
|
|
15910
|
-
blockReloadInHiddenIframes();
|
|
15911
|
-
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
15912
|
-
blockAcquireTokenInPopups();
|
|
15913
|
-
// Block token acquisition before initialize has been called
|
|
15914
|
-
blockAPICallsBeforeInitialize(this.initialized);
|
|
15915
|
-
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
15916
|
-
if (interactionType === exports.InteractionType.Redirect &&
|
|
15917
|
-
this.config.cache.cacheLocation ===
|
|
15918
|
-
BrowserCacheLocation.MemoryStorage &&
|
|
15919
|
-
!this.config.cache.storeAuthStateInCookie) {
|
|
15920
|
-
throw createBrowserConfigurationAuthError(inMemRedirectUnavailable);
|
|
15921
|
-
}
|
|
15922
|
-
if (interactionType === exports.InteractionType.Redirect ||
|
|
15923
|
-
interactionType === exports.InteractionType.Popup) {
|
|
15924
|
-
this.preflightInteractiveRequest(!isAppEmbedded);
|
|
15925
|
-
}
|
|
15926
|
-
}
|
|
15927
|
-
/**
|
|
15928
|
-
* Preflight check for interactive requests
|
|
15929
|
-
*
|
|
15930
|
-
* @protected
|
|
15931
|
-
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
|
|
15932
|
-
*/
|
|
15933
|
-
preflightInteractiveRequest(setInteractionInProgress) {
|
|
15934
|
-
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
15935
|
-
// block the reload if it occurred inside a hidden iframe
|
|
15936
|
-
blockReloadInHiddenIframes();
|
|
15937
|
-
// Set interaction in progress temporary cache or throw if alread set.
|
|
15938
|
-
if (setInteractionInProgress) {
|
|
15939
|
-
this.getBrowserStorage().setInteractionInProgress(true);
|
|
15940
|
-
}
|
|
15941
|
-
}
|
|
15942
16244
|
/**
|
|
15943
16245
|
* Acquire a token from native device (e.g. WAM)
|
|
15944
16246
|
* @param request
|
|
@@ -16123,12 +16425,6 @@ class StandardController {
|
|
|
16123
16425
|
getPerformanceClient() {
|
|
16124
16426
|
return this.performanceClient;
|
|
16125
16427
|
}
|
|
16126
|
-
/**
|
|
16127
|
-
* Returns the browser storage
|
|
16128
|
-
*/
|
|
16129
|
-
getBrowserStorage() {
|
|
16130
|
-
return this.browserStorage;
|
|
16131
|
-
}
|
|
16132
16428
|
/**
|
|
16133
16429
|
* Returns the browser env indicator
|
|
16134
16430
|
*/
|
|
@@ -16206,7 +16502,7 @@ class StandardController {
|
|
|
16206
16502
|
atsMeasurement.add({
|
|
16207
16503
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
16208
16504
|
});
|
|
16209
|
-
this.
|
|
16505
|
+
preflightCheck(this.initialized);
|
|
16210
16506
|
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
16211
16507
|
const account = request.account || this.getActiveAccount();
|
|
16212
16508
|
if (!account) {
|
|
@@ -16251,10 +16547,8 @@ class StandardController {
|
|
|
16251
16547
|
.catch((error) => {
|
|
16252
16548
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
16253
16549
|
atsMeasurement.end({
|
|
16254
|
-
errorCode: error.errorCode,
|
|
16255
|
-
subErrorCode: error.subError,
|
|
16256
16550
|
success: false,
|
|
16257
|
-
});
|
|
16551
|
+
}, error);
|
|
16258
16552
|
throw error;
|
|
16259
16553
|
});
|
|
16260
16554
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
@@ -16282,11 +16576,10 @@ class StandardController {
|
|
|
16282
16576
|
async acquireTokenSilentAsync(request, account) {
|
|
16283
16577
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
16284
16578
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
document.addEventListener("visibilitychange", this.trackPageVisibility);
|
|
16579
|
+
if (request.correlationId) {
|
|
16580
|
+
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
16581
|
+
}
|
|
16582
|
+
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16290
16583
|
let result;
|
|
16291
16584
|
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) &&
|
|
16292
16585
|
account.nativeAccountId) {
|
|
@@ -16309,16 +16602,13 @@ class StandardController {
|
|
|
16309
16602
|
}
|
|
16310
16603
|
else {
|
|
16311
16604
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16312
|
-
const
|
|
16313
|
-
const silentRequest = await invokeAsync(silentCacheClient.initializeSilentRequest.bind(silentCacheClient), PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account);
|
|
16605
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
16314
16606
|
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
16315
|
-
result = invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(
|
|
16607
|
+
result = invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
16316
16608
|
if (request.cacheLookupPolicy ===
|
|
16317
16609
|
CacheLookupPolicy.AccessToken) {
|
|
16318
16610
|
throw cacheError;
|
|
16319
16611
|
}
|
|
16320
|
-
// block the reload if it occurred inside a hidden iframe
|
|
16321
|
-
blockReloadInHiddenIframes();
|
|
16322
16612
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
16323
16613
|
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((refreshTokenError) => {
|
|
16324
16614
|
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, silentRequest, cacheLookupPolicy);
|
|
@@ -16336,25 +16626,21 @@ class StandardController {
|
|
|
16336
16626
|
return result
|
|
16337
16627
|
.then((response) => {
|
|
16338
16628
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
16339
|
-
|
|
16340
|
-
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16344
|
-
|
|
16629
|
+
if (request.correlationId) {
|
|
16630
|
+
this.performanceClient.addFields({
|
|
16631
|
+
fromCache: response.fromCache,
|
|
16632
|
+
isNativeBroker: response.fromNativeBroker,
|
|
16633
|
+
requestId: response.requestId,
|
|
16634
|
+
}, request.correlationId);
|
|
16635
|
+
}
|
|
16345
16636
|
return response;
|
|
16346
16637
|
})
|
|
16347
16638
|
.catch((tokenRenewalError) => {
|
|
16348
16639
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
16349
|
-
this.atsAsyncMeasurement?.end({
|
|
16350
|
-
errorCode: tokenRenewalError.errorCode,
|
|
16351
|
-
subErrorCode: tokenRenewalError.subError,
|
|
16352
|
-
success: false,
|
|
16353
|
-
});
|
|
16354
16640
|
throw tokenRenewalError;
|
|
16355
16641
|
})
|
|
16356
16642
|
.finally(() => {
|
|
16357
|
-
document.removeEventListener("visibilitychange", this.trackPageVisibility);
|
|
16643
|
+
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16358
16644
|
});
|
|
16359
16645
|
}
|
|
16360
16646
|
}
|
|
@@ -16795,27 +17081,27 @@ class UnknownOperatingContextController {
|
|
|
16795
17081
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16796
17082
|
acquireTokenPopup(request) {
|
|
16797
17083
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16798
|
-
blockNonBrowserEnvironment(
|
|
17084
|
+
blockNonBrowserEnvironment();
|
|
16799
17085
|
return {};
|
|
16800
17086
|
}
|
|
16801
17087
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16802
17088
|
acquireTokenRedirect(request) {
|
|
16803
17089
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16804
|
-
blockNonBrowserEnvironment(
|
|
17090
|
+
blockNonBrowserEnvironment();
|
|
16805
17091
|
return Promise.resolve();
|
|
16806
17092
|
}
|
|
16807
17093
|
acquireTokenSilent(
|
|
16808
17094
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16809
17095
|
silentRequest) {
|
|
16810
17096
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16811
|
-
blockNonBrowserEnvironment(
|
|
17097
|
+
blockNonBrowserEnvironment();
|
|
16812
17098
|
return {};
|
|
16813
17099
|
}
|
|
16814
17100
|
acquireTokenByCode(
|
|
16815
17101
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16816
17102
|
request) {
|
|
16817
17103
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16818
|
-
blockNonBrowserEnvironment(
|
|
17104
|
+
blockNonBrowserEnvironment();
|
|
16819
17105
|
return {};
|
|
16820
17106
|
}
|
|
16821
17107
|
acquireTokenNative(
|
|
@@ -16826,7 +17112,7 @@ class UnknownOperatingContextController {
|
|
|
16826
17112
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16827
17113
|
accountId) {
|
|
16828
17114
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16829
|
-
blockNonBrowserEnvironment(
|
|
17115
|
+
blockNonBrowserEnvironment();
|
|
16830
17116
|
return {};
|
|
16831
17117
|
}
|
|
16832
17118
|
acquireTokenByRefreshToken(
|
|
@@ -16835,7 +17121,7 @@ class UnknownOperatingContextController {
|
|
|
16835
17121
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16836
17122
|
silentRequest) {
|
|
16837
17123
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16838
|
-
blockNonBrowserEnvironment(
|
|
17124
|
+
blockNonBrowserEnvironment();
|
|
16839
17125
|
return {};
|
|
16840
17126
|
}
|
|
16841
17127
|
addEventCallback(callback) {
|
|
@@ -16847,22 +17133,22 @@ class UnknownOperatingContextController {
|
|
|
16847
17133
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16848
17134
|
addPerformanceCallback(callback) {
|
|
16849
17135
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16850
|
-
blockNonBrowserEnvironment(
|
|
17136
|
+
blockNonBrowserEnvironment();
|
|
16851
17137
|
return "";
|
|
16852
17138
|
}
|
|
16853
17139
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16854
17140
|
removePerformanceCallback(callbackId) {
|
|
16855
17141
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16856
|
-
blockNonBrowserEnvironment(
|
|
17142
|
+
blockNonBrowserEnvironment();
|
|
16857
17143
|
return true;
|
|
16858
17144
|
}
|
|
16859
17145
|
enableAccountStorageEvents() {
|
|
16860
17146
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16861
|
-
blockNonBrowserEnvironment(
|
|
17147
|
+
blockNonBrowserEnvironment();
|
|
16862
17148
|
}
|
|
16863
17149
|
disableAccountStorageEvents() {
|
|
16864
17150
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16865
|
-
blockNonBrowserEnvironment(
|
|
17151
|
+
blockNonBrowserEnvironment();
|
|
16866
17152
|
}
|
|
16867
17153
|
handleRedirectPromise(
|
|
16868
17154
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -16874,45 +17160,45 @@ class UnknownOperatingContextController {
|
|
|
16874
17160
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16875
17161
|
request) {
|
|
16876
17162
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16877
|
-
blockNonBrowserEnvironment(
|
|
17163
|
+
blockNonBrowserEnvironment();
|
|
16878
17164
|
return {};
|
|
16879
17165
|
}
|
|
16880
17166
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16881
17167
|
loginRedirect(request) {
|
|
16882
17168
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16883
|
-
blockNonBrowserEnvironment(
|
|
17169
|
+
blockNonBrowserEnvironment();
|
|
16884
17170
|
return {};
|
|
16885
17171
|
}
|
|
16886
17172
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16887
17173
|
logout(logoutRequest) {
|
|
16888
17174
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16889
|
-
blockNonBrowserEnvironment(
|
|
17175
|
+
blockNonBrowserEnvironment();
|
|
16890
17176
|
return {};
|
|
16891
17177
|
}
|
|
16892
17178
|
logoutRedirect(
|
|
16893
17179
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16894
17180
|
logoutRequest) {
|
|
16895
17181
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16896
|
-
blockNonBrowserEnvironment(
|
|
17182
|
+
blockNonBrowserEnvironment();
|
|
16897
17183
|
return {};
|
|
16898
17184
|
}
|
|
16899
17185
|
logoutPopup(
|
|
16900
17186
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16901
17187
|
logoutRequest) {
|
|
16902
17188
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16903
|
-
blockNonBrowserEnvironment(
|
|
17189
|
+
blockNonBrowserEnvironment();
|
|
16904
17190
|
return {};
|
|
16905
17191
|
}
|
|
16906
17192
|
ssoSilent(
|
|
16907
17193
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16908
17194
|
request) {
|
|
16909
17195
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16910
|
-
blockNonBrowserEnvironment(
|
|
17196
|
+
blockNonBrowserEnvironment();
|
|
16911
17197
|
return {};
|
|
16912
17198
|
}
|
|
16913
17199
|
getTokenCache() {
|
|
16914
17200
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16915
|
-
blockNonBrowserEnvironment(
|
|
17201
|
+
blockNonBrowserEnvironment();
|
|
16916
17202
|
return {};
|
|
16917
17203
|
}
|
|
16918
17204
|
getLogger() {
|
|
@@ -16921,16 +17207,16 @@ class UnknownOperatingContextController {
|
|
|
16921
17207
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16922
17208
|
setLogger(logger) {
|
|
16923
17209
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16924
|
-
blockNonBrowserEnvironment(
|
|
17210
|
+
blockNonBrowserEnvironment();
|
|
16925
17211
|
}
|
|
16926
17212
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16927
17213
|
setActiveAccount(account) {
|
|
16928
17214
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16929
|
-
blockNonBrowserEnvironment(
|
|
17215
|
+
blockNonBrowserEnvironment();
|
|
16930
17216
|
}
|
|
16931
17217
|
getActiveAccount() {
|
|
16932
17218
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16933
|
-
blockNonBrowserEnvironment(
|
|
17219
|
+
blockNonBrowserEnvironment();
|
|
16934
17220
|
return null;
|
|
16935
17221
|
}
|
|
16936
17222
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -16940,43 +17226,35 @@ class UnknownOperatingContextController {
|
|
|
16940
17226
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16941
17227
|
setNavigationClient(navigationClient) {
|
|
16942
17228
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16943
|
-
blockNonBrowserEnvironment(
|
|
17229
|
+
blockNonBrowserEnvironment();
|
|
16944
17230
|
}
|
|
16945
17231
|
getConfiguration() {
|
|
16946
17232
|
return this.config;
|
|
16947
17233
|
}
|
|
16948
17234
|
isBrowserEnv() {
|
|
16949
17235
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16950
|
-
blockNonBrowserEnvironment(
|
|
17236
|
+
blockNonBrowserEnvironment();
|
|
16951
17237
|
return true;
|
|
16952
17238
|
}
|
|
16953
17239
|
getBrowserCrypto() {
|
|
16954
17240
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16955
|
-
blockNonBrowserEnvironment(
|
|
17241
|
+
blockNonBrowserEnvironment();
|
|
16956
17242
|
return {};
|
|
16957
17243
|
}
|
|
16958
17244
|
getPerformanceClient() {
|
|
16959
17245
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16960
|
-
blockNonBrowserEnvironment(
|
|
17246
|
+
blockNonBrowserEnvironment();
|
|
16961
17247
|
return {};
|
|
16962
17248
|
}
|
|
16963
17249
|
getRedirectResponse() {
|
|
16964
17250
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16965
|
-
blockNonBrowserEnvironment(
|
|
17251
|
+
blockNonBrowserEnvironment();
|
|
16966
17252
|
return {};
|
|
16967
17253
|
}
|
|
16968
|
-
preflightBrowserEnvironmentCheck(
|
|
16969
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16970
|
-
interactionType,
|
|
16971
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16972
|
-
isAppEmbedded) {
|
|
16973
|
-
blockAPICallsBeforeInitialize(this.initialized);
|
|
16974
|
-
blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
16975
|
-
}
|
|
16976
17254
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16977
17255
|
async clearCache(logoutRequest) {
|
|
16978
17256
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16979
|
-
blockNonBrowserEnvironment(
|
|
17257
|
+
blockNonBrowserEnvironment();
|
|
16980
17258
|
}
|
|
16981
17259
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16982
17260
|
async hydrateCache(
|
|
@@ -16985,7 +17263,7 @@ class UnknownOperatingContextController {
|
|
|
16985
17263
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16986
17264
|
request) {
|
|
16987
17265
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16988
|
-
blockNonBrowserEnvironment(
|
|
17266
|
+
blockNonBrowserEnvironment();
|
|
16989
17267
|
}
|
|
16990
17268
|
}
|
|
16991
17269
|
|
|
@@ -17636,11 +17914,11 @@ function getPerfDurationMs(startTime) {
|
|
|
17636
17914
|
return Math.round(window.performance.now() - startTime);
|
|
17637
17915
|
}
|
|
17638
17916
|
class BrowserPerformanceClient extends PerformanceClient {
|
|
17639
|
-
constructor(configuration, intFields) {
|
|
17917
|
+
constructor(configuration, intFields, abbreviations) {
|
|
17640
17918
|
super(configuration.auth.clientId, configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`, new Logger(configuration.system?.loggerOptions || {}, name, version), name, version, configuration.telemetry?.application || {
|
|
17641
17919
|
appName: "",
|
|
17642
17920
|
appVersion: "",
|
|
17643
|
-
}, intFields);
|
|
17921
|
+
}, intFields, abbreviations);
|
|
17644
17922
|
}
|
|
17645
17923
|
generateId() {
|
|
17646
17924
|
return createNewGuid();
|
|
@@ -17684,13 +17962,13 @@ class BrowserPerformanceClient extends PerformanceClient {
|
|
|
17684
17962
|
void browserMeasurement?.then((measurement) => measurement.startMeasurement());
|
|
17685
17963
|
return {
|
|
17686
17964
|
...inProgressEvent,
|
|
17687
|
-
end: (event) => {
|
|
17965
|
+
end: (event, error) => {
|
|
17688
17966
|
const res = inProgressEvent.end({
|
|
17689
17967
|
...event,
|
|
17690
17968
|
startPageVisibility,
|
|
17691
17969
|
endPageVisibility: this.getPageVisibility(),
|
|
17692
17970
|
durationMs: getPerfDurationMs(startTime),
|
|
17693
|
-
});
|
|
17971
|
+
}, error);
|
|
17694
17972
|
void browserMeasurement?.then((measurement) => measurement.endMeasurement());
|
|
17695
17973
|
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
17696
17974
|
return res;
|
|
@@ -17886,11 +18164,12 @@ class NestedAppAuthAdapter {
|
|
|
17886
18164
|
}
|
|
17887
18165
|
const requestBuilder = new RequestParameterBuilder();
|
|
17888
18166
|
const claims = requestBuilder.addClientCapabilitiesToClaims(request.claims, this.clientCapabilities);
|
|
18167
|
+
const scopes = request.scopes || OIDC_DEFAULT_SCOPES;
|
|
17889
18168
|
const tokenRequest = {
|
|
17890
18169
|
platformBrokerId: request.account?.homeAccountId,
|
|
17891
18170
|
clientId: this.clientId,
|
|
17892
18171
|
authority: request.authority,
|
|
17893
|
-
scope:
|
|
18172
|
+
scope: scopes.join(" "),
|
|
17894
18173
|
correlationId: request.correlationId !== undefined
|
|
17895
18174
|
? request.correlationId
|
|
17896
18175
|
: this.crypto.createNewGuid(),
|
|
@@ -18072,12 +18351,22 @@ class NestedAppAuthController {
|
|
|
18072
18351
|
// do nothing not required by this controller
|
|
18073
18352
|
return Promise.resolve();
|
|
18074
18353
|
}
|
|
18354
|
+
ensureValidRequest(request) {
|
|
18355
|
+
if (request?.correlationId) {
|
|
18356
|
+
return request;
|
|
18357
|
+
}
|
|
18358
|
+
return {
|
|
18359
|
+
...request,
|
|
18360
|
+
correlationId: this.browserCrypto.createNewGuid(),
|
|
18361
|
+
};
|
|
18362
|
+
}
|
|
18075
18363
|
async acquireTokenInteractive(request) {
|
|
18076
|
-
this.
|
|
18077
|
-
|
|
18364
|
+
const validRequest = this.ensureValidRequest(request);
|
|
18365
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Popup, validRequest);
|
|
18366
|
+
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, validRequest.correlationId);
|
|
18078
18367
|
atPopupMeasurement?.add({ nestedAppAuthRequest: true });
|
|
18079
18368
|
try {
|
|
18080
|
-
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(
|
|
18369
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
18081
18370
|
const reqTimestamp = nowSeconds();
|
|
18082
18371
|
const response = await this.bridgeProxy.getTokenInteractive(naaRequest);
|
|
18083
18372
|
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
@@ -18097,16 +18386,15 @@ class NestedAppAuthController {
|
|
|
18097
18386
|
const error = this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
18098
18387
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
18099
18388
|
atPopupMeasurement.end({
|
|
18100
|
-
errorCode: error.errorCode,
|
|
18101
|
-
subErrorCode: error.subError,
|
|
18102
18389
|
success: false,
|
|
18103
|
-
});
|
|
18390
|
+
}, e);
|
|
18104
18391
|
throw error;
|
|
18105
18392
|
}
|
|
18106
18393
|
}
|
|
18107
18394
|
async acquireTokenSilentInternal(request) {
|
|
18108
|
-
this.
|
|
18109
|
-
|
|
18395
|
+
const validRequest = this.ensureValidRequest(request);
|
|
18396
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, validRequest);
|
|
18397
|
+
const ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, validRequest.correlationId);
|
|
18110
18398
|
ssoSilentMeasurement?.increment({
|
|
18111
18399
|
visibilityChangeCount: 0,
|
|
18112
18400
|
});
|
|
@@ -18114,7 +18402,7 @@ class NestedAppAuthController {
|
|
|
18114
18402
|
nestedAppAuthRequest: true,
|
|
18115
18403
|
});
|
|
18116
18404
|
try {
|
|
18117
|
-
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(
|
|
18405
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
18118
18406
|
const reqTimestamp = nowSeconds();
|
|
18119
18407
|
const response = await this.bridgeProxy.getTokenSilent(naaRequest);
|
|
18120
18408
|
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
@@ -18134,10 +18422,8 @@ class NestedAppAuthController {
|
|
|
18134
18422
|
const error = this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
18135
18423
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, e);
|
|
18136
18424
|
ssoSilentMeasurement?.end({
|
|
18137
|
-
errorCode: error.errorCode,
|
|
18138
|
-
subErrorCode: error.subError,
|
|
18139
18425
|
success: false,
|
|
18140
|
-
});
|
|
18426
|
+
}, e);
|
|
18141
18427
|
throw error;
|
|
18142
18428
|
}
|
|
18143
18429
|
}
|
|
@@ -18254,7 +18540,7 @@ class NestedAppAuthController {
|
|
|
18254
18540
|
}
|
|
18255
18541
|
handleRedirectPromise(hash // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18256
18542
|
) {
|
|
18257
|
-
|
|
18543
|
+
return Promise.resolve(null);
|
|
18258
18544
|
}
|
|
18259
18545
|
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18260
18546
|
) {
|
|
@@ -18347,11 +18633,6 @@ class NestedAppAuthController {
|
|
|
18347
18633
|
getRedirectResponse() {
|
|
18348
18634
|
throw NestedAppAuthError.createUnsupportedError();
|
|
18349
18635
|
}
|
|
18350
|
-
preflightBrowserEnvironmentCheck(interactionType, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18351
|
-
setInteractionInProgress // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18352
|
-
) {
|
|
18353
|
-
throw NestedAppAuthError.createUnsupportedError();
|
|
18354
|
-
}
|
|
18355
18636
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18356
18637
|
async clearCache(logoutRequest) {
|
|
18357
18638
|
throw NestedAppAuthError.createUnsupportedError();
|
|
@@ -18418,6 +18699,7 @@ exports.ServerError = ServerError;
|
|
|
18418
18699
|
exports.ServerResponseType = ServerResponseType;
|
|
18419
18700
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
18420
18701
|
exports.StringUtils = StringUtils;
|
|
18702
|
+
exports.StubPerformanceClient = StubPerformanceClient;
|
|
18421
18703
|
exports.UrlString = UrlString;
|
|
18422
18704
|
exports.WrapperSKU = WrapperSKU;
|
|
18423
18705
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|