@azure/msal-browser 3.9.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.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +18 -6
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.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.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +14 -11
- package/dist/interaction_client/SilentIframeClient.mjs.map +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.d.ts.map +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 +7 -6
- 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 +19 -3
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +45 -10
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +1116 -808
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1116 -808
- 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/NativeInteractionClient.ts +28 -9
- package/src/interaction_client/SilentCacheClient.ts +11 -51
- package/src/interaction_client/SilentIframeClient.ts +15 -16
- 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 +20 -10
- package/src/utils/BrowserUtils.ts +59 -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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.11.0 2024-03-22 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v14.
|
|
9
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
Pop: "pop",
|
|
302
302
|
};
|
|
303
303
|
|
|
304
|
-
/*! @azure/msal-common v14.
|
|
304
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
305
305
|
/*
|
|
306
306
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
307
307
|
* Licensed under the MIT License.
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
unexpectedError: unexpectedError
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
/*! @azure/msal-common v14.
|
|
321
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
322
322
|
|
|
323
323
|
/*
|
|
324
324
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
: AuthErrorMessages[code]);
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
/*! @azure/msal-common v14.
|
|
370
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
371
371
|
/*
|
|
372
372
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
373
373
|
* Licensed under the MIT License.
|
|
@@ -465,7 +465,7 @@
|
|
|
465
465
|
userTimeoutReached: userTimeoutReached
|
|
466
466
|
});
|
|
467
467
|
|
|
468
|
-
/*! @azure/msal-common v14.
|
|
468
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
469
469
|
|
|
470
470
|
/*
|
|
471
471
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -717,7 +717,7 @@
|
|
|
717
717
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
-
/*! @azure/msal-common v14.
|
|
720
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
721
721
|
|
|
722
722
|
/*
|
|
723
723
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -750,7 +750,7 @@
|
|
|
750
750
|
},
|
|
751
751
|
};
|
|
752
752
|
|
|
753
|
-
/*! @azure/msal-common v14.
|
|
753
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
754
754
|
|
|
755
755
|
/*
|
|
756
756
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -941,12 +941,12 @@
|
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
/*! @azure/msal-common v14.
|
|
944
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
945
945
|
/* eslint-disable header/header */
|
|
946
946
|
const name$1 = "@azure/msal-common";
|
|
947
|
-
const version$1 = "14.
|
|
947
|
+
const version$1 = "14.8.0";
|
|
948
948
|
|
|
949
|
-
/*! @azure/msal-common v14.
|
|
949
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
950
950
|
/*
|
|
951
951
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
952
952
|
* Licensed under the MIT License.
|
|
@@ -966,7 +966,7 @@
|
|
|
966
966
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
967
967
|
};
|
|
968
968
|
|
|
969
|
-
/*! @azure/msal-common v14.
|
|
969
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
970
970
|
|
|
971
971
|
/*
|
|
972
972
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1027,7 +1027,7 @@
|
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
|
-
/*! @azure/msal-common v14.
|
|
1030
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1031
1031
|
/*
|
|
1032
1032
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1033
1033
|
* Licensed under the MIT License.
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
return cachedAtSec > nowSeconds();
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
-
/*! @azure/msal-common v14.
|
|
1067
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1068
1068
|
|
|
1069
1069
|
/*
|
|
1070
1070
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1391,7 +1391,7 @@
|
|
|
1391
1391
|
return metadata.expiresAt <= nowSeconds();
|
|
1392
1392
|
}
|
|
1393
1393
|
|
|
1394
|
-
/*! @azure/msal-common v14.
|
|
1394
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1395
1395
|
/*
|
|
1396
1396
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1397
1397
|
* Licensed under the MIT License.
|
|
@@ -1445,7 +1445,7 @@
|
|
|
1445
1445
|
urlParseError: urlParseError
|
|
1446
1446
|
});
|
|
1447
1447
|
|
|
1448
|
-
/*! @azure/msal-common v14.
|
|
1448
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1449
1449
|
|
|
1450
1450
|
/*
|
|
1451
1451
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1583,7 +1583,7 @@
|
|
|
1583
1583
|
return new ClientConfigurationError(errorCode);
|
|
1584
1584
|
}
|
|
1585
1585
|
|
|
1586
|
-
/*! @azure/msal-common v14.
|
|
1586
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1587
1587
|
/*
|
|
1588
1588
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1589
1589
|
* Licensed under the MIT License.
|
|
@@ -1680,7 +1680,7 @@
|
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
1682
|
|
|
1683
|
-
/*! @azure/msal-common v14.
|
|
1683
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1684
1684
|
|
|
1685
1685
|
/*
|
|
1686
1686
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1880,7 +1880,7 @@
|
|
|
1880
1880
|
}
|
|
1881
1881
|
}
|
|
1882
1882
|
|
|
1883
|
-
/*! @azure/msal-common v14.
|
|
1883
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1884
1884
|
|
|
1885
1885
|
/*
|
|
1886
1886
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1920,7 +1920,7 @@
|
|
|
1920
1920
|
};
|
|
1921
1921
|
}
|
|
1922
1922
|
|
|
1923
|
-
/*! @azure/msal-common v14.
|
|
1923
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1924
1924
|
/*
|
|
1925
1925
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1926
1926
|
* Licensed under the MIT License.
|
|
@@ -1958,7 +1958,7 @@
|
|
|
1958
1958
|
* @param idTokenClaims
|
|
1959
1959
|
* @returns
|
|
1960
1960
|
*/
|
|
1961
|
-
function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenClaims) {
|
|
1961
|
+
function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenClaims, idTokenSecret) {
|
|
1962
1962
|
let updatedAccountInfo = baseAccountInfo;
|
|
1963
1963
|
// Tenant Profile overrides passed in account info
|
|
1964
1964
|
if (tenantProfile) {
|
|
@@ -1975,13 +1975,14 @@
|
|
|
1975
1975
|
...updatedAccountInfo,
|
|
1976
1976
|
...claimsSourcedTenantProfile,
|
|
1977
1977
|
idTokenClaims: idTokenClaims,
|
|
1978
|
+
idToken: idTokenSecret,
|
|
1978
1979
|
};
|
|
1979
1980
|
return updatedAccountInfo;
|
|
1980
1981
|
}
|
|
1981
1982
|
return updatedAccountInfo;
|
|
1982
1983
|
}
|
|
1983
1984
|
|
|
1984
|
-
/*! @azure/msal-common v14.
|
|
1985
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
1985
1986
|
/*
|
|
1986
1987
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1987
1988
|
* Licensed under the MIT License.
|
|
@@ -1996,7 +1997,7 @@
|
|
|
1996
1997
|
Ciam: 3,
|
|
1997
1998
|
};
|
|
1998
1999
|
|
|
1999
|
-
/*! @azure/msal-common v14.
|
|
2000
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2000
2001
|
/*
|
|
2001
2002
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2002
2003
|
* Licensed under the MIT License.
|
|
@@ -2018,7 +2019,7 @@
|
|
|
2018
2019
|
return null;
|
|
2019
2020
|
}
|
|
2020
2021
|
|
|
2021
|
-
/*! @azure/msal-common v14.
|
|
2022
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2022
2023
|
/*
|
|
2023
2024
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2024
2025
|
* Licensed under the MIT License.
|
|
@@ -2031,7 +2032,7 @@
|
|
|
2031
2032
|
OIDC: "OIDC",
|
|
2032
2033
|
};
|
|
2033
2034
|
|
|
2034
|
-
/*! @azure/msal-common v14.
|
|
2035
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2035
2036
|
|
|
2036
2037
|
/*
|
|
2037
2038
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2278,7 +2279,7 @@
|
|
|
2278
2279
|
}
|
|
2279
2280
|
}
|
|
2280
2281
|
|
|
2281
|
-
/*! @azure/msal-common v14.
|
|
2282
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2282
2283
|
|
|
2283
2284
|
/*
|
|
2284
2285
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2325,7 +2326,7 @@
|
|
|
2325
2326
|
return null;
|
|
2326
2327
|
}
|
|
2327
2328
|
|
|
2328
|
-
/*! @azure/msal-common v14.
|
|
2329
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2329
2330
|
|
|
2330
2331
|
/*
|
|
2331
2332
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2489,7 +2490,7 @@
|
|
|
2489
2490
|
}
|
|
2490
2491
|
}
|
|
2491
2492
|
|
|
2492
|
-
/*! @azure/msal-common v14.
|
|
2493
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2493
2494
|
|
|
2494
2495
|
/*
|
|
2495
2496
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2629,7 +2630,7 @@
|
|
|
2629
2630
|
return null;
|
|
2630
2631
|
}
|
|
2631
2632
|
|
|
2632
|
-
/*! @azure/msal-common v14.
|
|
2633
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
2633
2634
|
|
|
2634
2635
|
/*
|
|
2635
2636
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2720,7 +2721,7 @@
|
|
|
2720
2721
|
}
|
|
2721
2722
|
}
|
|
2722
2723
|
// Expand tenant profile into account info based on matching tenant profile and if available matching ID token claims
|
|
2723
|
-
tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims);
|
|
2724
|
+
tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims, idToken?.secret);
|
|
2724
2725
|
return tenantedAccountInfo;
|
|
2725
2726
|
}
|
|
2726
2727
|
getTenantProfilesFromAccountEntity(accountEntity, targetTenantId, tenantProfileFilter) {
|
|
@@ -3036,14 +3037,6 @@
|
|
|
3036
3037
|
* @param filter
|
|
3037
3038
|
*/
|
|
3038
3039
|
getAppMetadataFilteredBy(filter) {
|
|
3039
|
-
return this.getAppMetadataFilteredByInternal(filter.environment, filter.clientId);
|
|
3040
|
-
}
|
|
3041
|
-
/**
|
|
3042
|
-
* Support function to help match appMetadata
|
|
3043
|
-
* @param environment
|
|
3044
|
-
* @param clientId
|
|
3045
|
-
*/
|
|
3046
|
-
getAppMetadataFilteredByInternal(environment, clientId) {
|
|
3047
3040
|
const allCacheKeys = this.getKeys();
|
|
3048
3041
|
const matchingAppMetadata = {};
|
|
3049
3042
|
allCacheKeys.forEach((cacheKey) => {
|
|
@@ -3056,10 +3049,12 @@
|
|
|
3056
3049
|
if (!entity) {
|
|
3057
3050
|
return;
|
|
3058
3051
|
}
|
|
3059
|
-
if (!!environment &&
|
|
3052
|
+
if (!!filter.environment &&
|
|
3053
|
+
!this.matchEnvironment(entity, filter.environment)) {
|
|
3060
3054
|
return;
|
|
3061
3055
|
}
|
|
3062
|
-
if (!!clientId &&
|
|
3056
|
+
if (!!filter.clientId &&
|
|
3057
|
+
!this.matchClientId(entity, filter.clientId)) {
|
|
3063
3058
|
return;
|
|
3064
3059
|
}
|
|
3065
3060
|
matchingAppMetadata[cacheKey] = entity;
|
|
@@ -3846,9 +3841,6 @@
|
|
|
3846
3841
|
removeItem() {
|
|
3847
3842
|
throw createClientAuthError(methodNotImplemented);
|
|
3848
3843
|
}
|
|
3849
|
-
containsKey() {
|
|
3850
|
-
throw createClientAuthError(methodNotImplemented);
|
|
3851
|
-
}
|
|
3852
3844
|
getKeys() {
|
|
3853
3845
|
throw createClientAuthError(methodNotImplemented);
|
|
3854
3846
|
}
|
|
@@ -3869,7 +3861,7 @@
|
|
|
3869
3861
|
}
|
|
3870
3862
|
}
|
|
3871
3863
|
|
|
3872
|
-
/*! @azure/msal-common v14.
|
|
3864
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3873
3865
|
|
|
3874
3866
|
/*
|
|
3875
3867
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3969,7 +3961,7 @@
|
|
|
3969
3961
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3970
3962
|
}
|
|
3971
3963
|
|
|
3972
|
-
/*! @azure/msal-common v14.
|
|
3964
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3973
3965
|
|
|
3974
3966
|
/*
|
|
3975
3967
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3986,7 +3978,7 @@
|
|
|
3986
3978
|
}
|
|
3987
3979
|
}
|
|
3988
3980
|
|
|
3989
|
-
/*! @azure/msal-common v14.
|
|
3981
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
3990
3982
|
|
|
3991
3983
|
/*
|
|
3992
3984
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4084,7 +4076,7 @@
|
|
|
4084
4076
|
}
|
|
4085
4077
|
}
|
|
4086
4078
|
|
|
4087
|
-
/*! @azure/msal-common v14.
|
|
4079
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4088
4080
|
|
|
4089
4081
|
/*
|
|
4090
4082
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4121,7 +4113,7 @@
|
|
|
4121
4113
|
}
|
|
4122
4114
|
}
|
|
4123
4115
|
|
|
4124
|
-
/*! @azure/msal-common v14.
|
|
4116
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4125
4117
|
/*
|
|
4126
4118
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4127
4119
|
* Licensed under the MIT License.
|
|
@@ -4131,7 +4123,7 @@
|
|
|
4131
4123
|
UPN: "UPN",
|
|
4132
4124
|
};
|
|
4133
4125
|
|
|
4134
|
-
/*! @azure/msal-common v14.
|
|
4126
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4135
4127
|
/*
|
|
4136
4128
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4137
4129
|
* Licensed under the MIT License.
|
|
@@ -4178,7 +4170,7 @@
|
|
|
4178
4170
|
const LOGIN_HINT = "login_hint";
|
|
4179
4171
|
const DOMAIN_HINT = "domain_hint";
|
|
4180
4172
|
|
|
4181
|
-
/*! @azure/msal-common v14.
|
|
4173
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4182
4174
|
|
|
4183
4175
|
/*
|
|
4184
4176
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4262,7 +4254,7 @@
|
|
|
4262
4254
|
}
|
|
4263
4255
|
}
|
|
4264
4256
|
|
|
4265
|
-
/*! @azure/msal-common v14.
|
|
4257
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4266
4258
|
|
|
4267
4259
|
/*
|
|
4268
4260
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4646,7 +4638,7 @@
|
|
|
4646
4638
|
}
|
|
4647
4639
|
}
|
|
4648
4640
|
|
|
4649
|
-
/*! @azure/msal-common v14.
|
|
4641
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4650
4642
|
/*
|
|
4651
4643
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4652
4644
|
* Licensed under the MIT License.
|
|
@@ -4658,7 +4650,7 @@
|
|
|
4658
4650
|
response.hasOwnProperty("jwks_uri"));
|
|
4659
4651
|
}
|
|
4660
4652
|
|
|
4661
|
-
/*! @azure/msal-common v14.
|
|
4653
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4662
4654
|
/*
|
|
4663
4655
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4664
4656
|
* Licensed under the MIT License.
|
|
@@ -4668,7 +4660,7 @@
|
|
|
4668
4660
|
response.hasOwnProperty("metadata"));
|
|
4669
4661
|
}
|
|
4670
4662
|
|
|
4671
|
-
/*! @azure/msal-common v14.
|
|
4663
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4672
4664
|
/*
|
|
4673
4665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4674
4666
|
* Licensed under the MIT License.
|
|
@@ -4678,7 +4670,7 @@
|
|
|
4678
4670
|
response.hasOwnProperty("error_description"));
|
|
4679
4671
|
}
|
|
4680
4672
|
|
|
4681
|
-
/*! @azure/msal-common v14.
|
|
4673
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4682
4674
|
/*
|
|
4683
4675
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4684
4676
|
* Licensed under the MIT License.
|
|
@@ -4913,6 +4905,219 @@
|
|
|
4913
4905
|
Sha256Digest: "sha256Digest",
|
|
4914
4906
|
GetRandomValues: "getRandomValues",
|
|
4915
4907
|
};
|
|
4908
|
+
const PerformanceEventAbbreviations = new Map([
|
|
4909
|
+
[PerformanceEvents.AcquireTokenByCode, "ATByCode"],
|
|
4910
|
+
[PerformanceEvents.AcquireTokenByRefreshToken, "ATByRT"],
|
|
4911
|
+
[PerformanceEvents.AcquireTokenSilent, "ATS"],
|
|
4912
|
+
[PerformanceEvents.AcquireTokenSilentAsync, "ATSAsync"],
|
|
4913
|
+
[PerformanceEvents.AcquireTokenPopup, "ATPopup"],
|
|
4914
|
+
[PerformanceEvents.AcquireTokenRedirect, "ATRedirect"],
|
|
4915
|
+
[
|
|
4916
|
+
PerformanceEvents.CryptoOptsGetPublicKeyThumbprint,
|
|
4917
|
+
"CryptoGetPKThumb",
|
|
4918
|
+
],
|
|
4919
|
+
[PerformanceEvents.CryptoOptsSignJwt, "CryptoSignJwt"],
|
|
4920
|
+
[PerformanceEvents.SilentCacheClientAcquireToken, "SltCacheClientAT"],
|
|
4921
|
+
[PerformanceEvents.SilentIframeClientAcquireToken, "SltIframeClientAT"],
|
|
4922
|
+
[PerformanceEvents.SilentRefreshClientAcquireToken, "SltRClientAT"],
|
|
4923
|
+
[PerformanceEvents.SsoSilent, "SsoSlt"],
|
|
4924
|
+
[
|
|
4925
|
+
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
4926
|
+
"StdIntClientGetDiscAuth",
|
|
4927
|
+
],
|
|
4928
|
+
[
|
|
4929
|
+
PerformanceEvents.FetchAccountIdWithNativeBroker,
|
|
4930
|
+
"FetchAccIdWithNtvBroker",
|
|
4931
|
+
],
|
|
4932
|
+
[
|
|
4933
|
+
PerformanceEvents.NativeInteractionClientAcquireToken,
|
|
4934
|
+
"NtvIntClientAT",
|
|
4935
|
+
],
|
|
4936
|
+
[
|
|
4937
|
+
PerformanceEvents.BaseClientCreateTokenRequestHeaders,
|
|
4938
|
+
"BaseClientCreateTReqHead",
|
|
4939
|
+
],
|
|
4940
|
+
[
|
|
4941
|
+
PerformanceEvents.RefreshTokenClientExecutePostToTokenEndpoint,
|
|
4942
|
+
"RTClientExecPost",
|
|
4943
|
+
],
|
|
4944
|
+
[
|
|
4945
|
+
PerformanceEvents.AuthorizationCodeClientExecutePostToTokenEndpoint,
|
|
4946
|
+
"AuthCodeClientExecPost",
|
|
4947
|
+
],
|
|
4948
|
+
[PerformanceEvents.BrokerHandhshake, "BrokerHandshake"],
|
|
4949
|
+
[
|
|
4950
|
+
PerformanceEvents.AcquireTokenByRefreshTokenInBroker,
|
|
4951
|
+
"ATByRTInBroker",
|
|
4952
|
+
],
|
|
4953
|
+
[PerformanceEvents.AcquireTokenByBroker, "ATByBroker"],
|
|
4954
|
+
[
|
|
4955
|
+
PerformanceEvents.RefreshTokenClientExecuteTokenRequest,
|
|
4956
|
+
"RTClientExecTReq",
|
|
4957
|
+
],
|
|
4958
|
+
[PerformanceEvents.RefreshTokenClientAcquireToken, "RTClientAT"],
|
|
4959
|
+
[
|
|
4960
|
+
PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken,
|
|
4961
|
+
"RTClientATWithCachedRT",
|
|
4962
|
+
],
|
|
4963
|
+
[
|
|
4964
|
+
PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken,
|
|
4965
|
+
"RTClientATByRT",
|
|
4966
|
+
],
|
|
4967
|
+
[
|
|
4968
|
+
PerformanceEvents.RefreshTokenClientCreateTokenRequestBody,
|
|
4969
|
+
"RTClientCreateTReqBody",
|
|
4970
|
+
],
|
|
4971
|
+
[PerformanceEvents.AcquireTokenFromCache, "ATFromCache"],
|
|
4972
|
+
[
|
|
4973
|
+
PerformanceEvents.SilentFlowClientAcquireCachedToken,
|
|
4974
|
+
"SltFlowClientATCached",
|
|
4975
|
+
],
|
|
4976
|
+
[
|
|
4977
|
+
PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord,
|
|
4978
|
+
"SltFlowClientGenResFromCache",
|
|
4979
|
+
],
|
|
4980
|
+
[PerformanceEvents.AcquireTokenBySilentIframe, "ATBySltIframe"],
|
|
4981
|
+
[PerformanceEvents.InitializeBaseRequest, "InitBaseReq"],
|
|
4982
|
+
[PerformanceEvents.InitializeSilentRequest, "InitSltReq"],
|
|
4983
|
+
[
|
|
4984
|
+
PerformanceEvents.InitializeClientApplication,
|
|
4985
|
+
"InitClientApplication",
|
|
4986
|
+
],
|
|
4987
|
+
[PerformanceEvents.SilentIframeClientTokenHelper, "SIClientTHelper"],
|
|
4988
|
+
[
|
|
4989
|
+
PerformanceEvents.SilentHandlerInitiateAuthRequest,
|
|
4990
|
+
"SHandlerInitAuthReq",
|
|
4991
|
+
],
|
|
4992
|
+
[
|
|
4993
|
+
PerformanceEvents.SilentHandlerMonitorIframeForHash,
|
|
4994
|
+
"SltHandlerMonitorIframeForHash",
|
|
4995
|
+
],
|
|
4996
|
+
[PerformanceEvents.SilentHandlerLoadFrame, "SHandlerLoadFrame"],
|
|
4997
|
+
[PerformanceEvents.SilentHandlerLoadFrameSync, "SHandlerLoadFrameSync"],
|
|
4998
|
+
[
|
|
4999
|
+
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
5000
|
+
"StdIntClientCreateAuthCodeClient",
|
|
5001
|
+
],
|
|
5002
|
+
[
|
|
5003
|
+
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
5004
|
+
"StdIntClientGetClientConf",
|
|
5005
|
+
],
|
|
5006
|
+
[
|
|
5007
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
5008
|
+
"StdIntClientInitAuthReq",
|
|
5009
|
+
],
|
|
5010
|
+
[
|
|
5011
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
5012
|
+
"StdIntClientInitAuthCodeReq",
|
|
5013
|
+
],
|
|
5014
|
+
[PerformanceEvents.GetAuthCodeUrl, "GetAuthCodeUrl"],
|
|
5015
|
+
[
|
|
5016
|
+
PerformanceEvents.HandleCodeResponseFromServer,
|
|
5017
|
+
"HandleCodeResFromServer",
|
|
5018
|
+
],
|
|
5019
|
+
[PerformanceEvents.HandleCodeResponse, "HandleCodeResp"],
|
|
5020
|
+
[PerformanceEvents.UpdateTokenEndpointAuthority, "UpdTEndpointAuth"],
|
|
5021
|
+
[PerformanceEvents.AuthClientAcquireToken, "AuthClientAT"],
|
|
5022
|
+
[PerformanceEvents.AuthClientExecuteTokenRequest, "AuthClientExecTReq"],
|
|
5023
|
+
[
|
|
5024
|
+
PerformanceEvents.AuthClientCreateTokenRequestBody,
|
|
5025
|
+
"AuthClientCreateTReqBody",
|
|
5026
|
+
],
|
|
5027
|
+
[
|
|
5028
|
+
PerformanceEvents.AuthClientCreateQueryString,
|
|
5029
|
+
"AuthClientCreateQueryStr",
|
|
5030
|
+
],
|
|
5031
|
+
[PerformanceEvents.PopTokenGenerateCnf, "PopTGenCnf"],
|
|
5032
|
+
[PerformanceEvents.PopTokenGenerateKid, "PopTGenKid"],
|
|
5033
|
+
[PerformanceEvents.HandleServerTokenResponse, "HandleServerTRes"],
|
|
5034
|
+
[PerformanceEvents.DeserializeResponse, "DeserializeRes"],
|
|
5035
|
+
[
|
|
5036
|
+
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
|
|
5037
|
+
"AuthFactCreateDiscInst",
|
|
5038
|
+
],
|
|
5039
|
+
[
|
|
5040
|
+
PerformanceEvents.AuthorityResolveEndpointsAsync,
|
|
5041
|
+
"AuthResolveEndpointsAsync",
|
|
5042
|
+
],
|
|
5043
|
+
[
|
|
5044
|
+
PerformanceEvents.AuthorityResolveEndpointsFromLocalSources,
|
|
5045
|
+
"AuthResolveEndpointsFromLocal",
|
|
5046
|
+
],
|
|
5047
|
+
[
|
|
5048
|
+
PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork,
|
|
5049
|
+
"AuthGetCDMetaFromNet",
|
|
5050
|
+
],
|
|
5051
|
+
[
|
|
5052
|
+
PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata,
|
|
5053
|
+
"AuthUpdCDMeta",
|
|
5054
|
+
],
|
|
5055
|
+
[
|
|
5056
|
+
PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork,
|
|
5057
|
+
"AuthUpdCDMetaFromNet",
|
|
5058
|
+
],
|
|
5059
|
+
[
|
|
5060
|
+
PerformanceEvents.AuthorityUpdateEndpointMetadata,
|
|
5061
|
+
"AuthUpdEndpointMeta",
|
|
5062
|
+
],
|
|
5063
|
+
[
|
|
5064
|
+
PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation,
|
|
5065
|
+
"AuthUpdMetaWithRegInfo",
|
|
5066
|
+
],
|
|
5067
|
+
[PerformanceEvents.RegionDiscoveryDetectRegion, "RegDiscDetectReg"],
|
|
5068
|
+
[
|
|
5069
|
+
PerformanceEvents.RegionDiscoveryGetRegionFromIMDS,
|
|
5070
|
+
"RegDiscGetRegFromIMDS",
|
|
5071
|
+
],
|
|
5072
|
+
[
|
|
5073
|
+
PerformanceEvents.RegionDiscoveryGetCurrentVersion,
|
|
5074
|
+
"RegDiscGetCurrentVer",
|
|
5075
|
+
],
|
|
5076
|
+
[PerformanceEvents.AcquireTokenByCodeAsync, "ATByCodeAsync"],
|
|
5077
|
+
[
|
|
5078
|
+
PerformanceEvents.GetEndpointMetadataFromNetwork,
|
|
5079
|
+
"GetEndpointMetaFromNet",
|
|
5080
|
+
],
|
|
5081
|
+
[
|
|
5082
|
+
PerformanceEvents.GetCloudDiscoveryMetadataFromNetworkMeasurement,
|
|
5083
|
+
"GetCDMetaFromNet",
|
|
5084
|
+
],
|
|
5085
|
+
[
|
|
5086
|
+
PerformanceEvents.HandleRedirectPromiseMeasurement,
|
|
5087
|
+
"HandleRedirectPromise",
|
|
5088
|
+
],
|
|
5089
|
+
[
|
|
5090
|
+
PerformanceEvents.HandleNativeRedirectPromiseMeasurement,
|
|
5091
|
+
"HandleNtvRedirectPromise",
|
|
5092
|
+
],
|
|
5093
|
+
[
|
|
5094
|
+
PerformanceEvents.UpdateCloudDiscoveryMetadataMeasurement,
|
|
5095
|
+
"UpdateCDMeta",
|
|
5096
|
+
],
|
|
5097
|
+
[
|
|
5098
|
+
PerformanceEvents.UsernamePasswordClientAcquireToken,
|
|
5099
|
+
"UserPassClientAT",
|
|
5100
|
+
],
|
|
5101
|
+
[
|
|
5102
|
+
PerformanceEvents.NativeMessageHandlerHandshake,
|
|
5103
|
+
"NtvMsgHandlerHandshake",
|
|
5104
|
+
],
|
|
5105
|
+
[PerformanceEvents.NativeGenerateAuthResult, "NtvGenAuthRes"],
|
|
5106
|
+
[PerformanceEvents.RemoveHiddenIframe, "RemoveHiddenIframe"],
|
|
5107
|
+
[
|
|
5108
|
+
PerformanceEvents.ClearTokensAndKeysWithClaims,
|
|
5109
|
+
"ClearTAndKeysWithClaims",
|
|
5110
|
+
],
|
|
5111
|
+
[PerformanceEvents.CacheManagerGetRefreshToken, "CacheManagerGetRT"],
|
|
5112
|
+
[PerformanceEvents.GeneratePkceCodes, "GenPkceCodes"],
|
|
5113
|
+
[PerformanceEvents.GenerateCodeVerifier, "GenCodeVerifier"],
|
|
5114
|
+
[
|
|
5115
|
+
PerformanceEvents.GenerateCodeChallengeFromVerifier,
|
|
5116
|
+
"GenCodeChallengeFromVerifier",
|
|
5117
|
+
],
|
|
5118
|
+
[PerformanceEvents.Sha256Digest, "Sha256Digest"],
|
|
5119
|
+
[PerformanceEvents.GetRandomValues, "GetRandomValues"],
|
|
5120
|
+
]);
|
|
4916
5121
|
/**
|
|
4917
5122
|
* State of the performance event.
|
|
4918
5123
|
*
|
|
@@ -4939,7 +5144,7 @@
|
|
|
4939
5144
|
"multiMatchedRT",
|
|
4940
5145
|
]);
|
|
4941
5146
|
|
|
4942
|
-
/*! @azure/msal-common v14.
|
|
5147
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
4943
5148
|
/*
|
|
4944
5149
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4945
5150
|
* Licensed under the MIT License.
|
|
@@ -4983,7 +5188,7 @@
|
|
|
4983
5188
|
}
|
|
4984
5189
|
inProgressEvent?.end({
|
|
4985
5190
|
success: false,
|
|
4986
|
-
});
|
|
5191
|
+
}, e);
|
|
4987
5192
|
throw e;
|
|
4988
5193
|
}
|
|
4989
5194
|
};
|
|
@@ -5029,13 +5234,13 @@
|
|
|
5029
5234
|
}
|
|
5030
5235
|
inProgressEvent?.end({
|
|
5031
5236
|
success: false,
|
|
5032
|
-
});
|
|
5237
|
+
}, e);
|
|
5033
5238
|
throw e;
|
|
5034
5239
|
});
|
|
5035
5240
|
};
|
|
5036
5241
|
};
|
|
5037
5242
|
|
|
5038
|
-
/*! @azure/msal-common v14.
|
|
5243
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5039
5244
|
|
|
5040
5245
|
/*
|
|
5041
5246
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5144,7 +5349,7 @@
|
|
|
5144
5349
|
},
|
|
5145
5350
|
};
|
|
5146
5351
|
|
|
5147
|
-
/*! @azure/msal-common v14.
|
|
5352
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5148
5353
|
|
|
5149
5354
|
/*
|
|
5150
5355
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5941,8 +6146,10 @@
|
|
|
5941
6146
|
* AAD Authority - domain/tenantId -> Credentials are cached with realm = tenantId
|
|
5942
6147
|
* B2C Authority - domain/{tenantId}?/.../policy -> Credentials are cached with realm = policy
|
|
5943
6148
|
* tenantId is downcased because B2C policies can have mixed case but tfp claim is downcased
|
|
6149
|
+
*
|
|
6150
|
+
* Note that we may not have any path segments in certain OIDC scenarios.
|
|
5944
6151
|
*/
|
|
5945
|
-
const tenantId = authorityUrlComponents.PathSegments.slice(-1)[0]
|
|
6152
|
+
const tenantId = authorityUrlComponents.PathSegments.slice(-1)[0]?.toLowerCase();
|
|
5946
6153
|
switch (tenantId) {
|
|
5947
6154
|
case AADAuthorityConstants.COMMON:
|
|
5948
6155
|
case AADAuthorityConstants.ORGANIZATIONS:
|
|
@@ -5977,7 +6184,7 @@
|
|
|
5977
6184
|
};
|
|
5978
6185
|
}
|
|
5979
6186
|
|
|
5980
|
-
/*! @azure/msal-common v14.
|
|
6187
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
5981
6188
|
|
|
5982
6189
|
/*
|
|
5983
6190
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6008,7 +6215,7 @@
|
|
|
6008
6215
|
}
|
|
6009
6216
|
}
|
|
6010
6217
|
|
|
6011
|
-
/*! @azure/msal-common v14.
|
|
6218
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6012
6219
|
|
|
6013
6220
|
/*
|
|
6014
6221
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6111,7 +6318,7 @@
|
|
|
6111
6318
|
}
|
|
6112
6319
|
}
|
|
6113
6320
|
|
|
6114
|
-
/*! @azure/msal-common v14.
|
|
6321
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6115
6322
|
/*
|
|
6116
6323
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6117
6324
|
* Licensed under the MIT License.
|
|
@@ -6137,7 +6344,7 @@
|
|
|
6137
6344
|
refreshTokenExpired: refreshTokenExpired
|
|
6138
6345
|
});
|
|
6139
6346
|
|
|
6140
|
-
/*! @azure/msal-common v14.
|
|
6347
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6141
6348
|
|
|
6142
6349
|
/*
|
|
6143
6350
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6224,7 +6431,7 @@
|
|
|
6224
6431
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6225
6432
|
}
|
|
6226
6433
|
|
|
6227
|
-
/*! @azure/msal-common v14.
|
|
6434
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6228
6435
|
/*
|
|
6229
6436
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6230
6437
|
* Licensed under the MIT License.
|
|
@@ -6240,7 +6447,7 @@
|
|
|
6240
6447
|
}
|
|
6241
6448
|
}
|
|
6242
6449
|
|
|
6243
|
-
/*! @azure/msal-common v14.
|
|
6450
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6244
6451
|
|
|
6245
6452
|
/*
|
|
6246
6453
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6312,7 +6519,7 @@
|
|
|
6312
6519
|
}
|
|
6313
6520
|
}
|
|
6314
6521
|
|
|
6315
|
-
/*! @azure/msal-common v14.
|
|
6522
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6316
6523
|
|
|
6317
6524
|
/*
|
|
6318
6525
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6397,7 +6604,7 @@
|
|
|
6397
6604
|
}
|
|
6398
6605
|
}
|
|
6399
6606
|
|
|
6400
|
-
/*! @azure/msal-common v14.
|
|
6607
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6401
6608
|
/*
|
|
6402
6609
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6403
6610
|
* Licensed under the MIT License.
|
|
@@ -6424,7 +6631,7 @@
|
|
|
6424
6631
|
}
|
|
6425
6632
|
}
|
|
6426
6633
|
|
|
6427
|
-
/*! @azure/msal-common v14.
|
|
6634
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6428
6635
|
|
|
6429
6636
|
/*
|
|
6430
6637
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6714,7 +6921,7 @@
|
|
|
6714
6921
|
}
|
|
6715
6922
|
const accountInfo = cacheRecord.account
|
|
6716
6923
|
? updateAccountTenantProfileData(cacheRecord.account.getAccountInfo(), undefined, // tenantProfile optional
|
|
6717
|
-
idTokenClaims)
|
|
6924
|
+
idTokenClaims, cacheRecord.idToken?.secret)
|
|
6718
6925
|
: null;
|
|
6719
6926
|
return {
|
|
6720
6927
|
authority: authority.canonicalAuthority,
|
|
@@ -6777,7 +6984,7 @@
|
|
|
6777
6984
|
return baseAccount;
|
|
6778
6985
|
}
|
|
6779
6986
|
|
|
6780
|
-
/*! @azure/msal-common v14.
|
|
6987
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
6781
6988
|
|
|
6782
6989
|
/*
|
|
6783
6990
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7182,7 +7389,7 @@
|
|
|
7182
7389
|
}
|
|
7183
7390
|
}
|
|
7184
7391
|
|
|
7185
|
-
/*! @azure/msal-common v14.
|
|
7392
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7186
7393
|
|
|
7187
7394
|
/*
|
|
7188
7395
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7389,7 +7596,7 @@
|
|
|
7389
7596
|
}
|
|
7390
7597
|
}
|
|
7391
7598
|
|
|
7392
|
-
/*! @azure/msal-common v14.
|
|
7599
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7393
7600
|
|
|
7394
7601
|
/*
|
|
7395
7602
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7407,7 +7614,12 @@
|
|
|
7407
7614
|
*/
|
|
7408
7615
|
async acquireToken(request) {
|
|
7409
7616
|
try {
|
|
7410
|
-
const [authResponse, cacheOutcome] = await this.acquireCachedToken(
|
|
7617
|
+
const [authResponse, cacheOutcome] = await this.acquireCachedToken({
|
|
7618
|
+
...request,
|
|
7619
|
+
scopes: request.scopes?.length
|
|
7620
|
+
? request.scopes
|
|
7621
|
+
: [...OIDC_DEFAULT_SCOPES],
|
|
7622
|
+
});
|
|
7411
7623
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
7412
7624
|
if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
7413
7625
|
this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
|
|
@@ -7520,7 +7732,7 @@
|
|
|
7520
7732
|
}
|
|
7521
7733
|
}
|
|
7522
7734
|
|
|
7523
|
-
/*! @azure/msal-common v14.
|
|
7735
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7524
7736
|
|
|
7525
7737
|
/*
|
|
7526
7738
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7535,7 +7747,7 @@
|
|
|
7535
7747
|
},
|
|
7536
7748
|
};
|
|
7537
7749
|
|
|
7538
|
-
/*! @azure/msal-common v14.
|
|
7750
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7539
7751
|
/*
|
|
7540
7752
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7541
7753
|
* Licensed under the MIT License.
|
|
@@ -7543,7 +7755,7 @@
|
|
|
7543
7755
|
const missingKidError = "missing_kid_error";
|
|
7544
7756
|
const missingAlgError = "missing_alg_error";
|
|
7545
7757
|
|
|
7546
|
-
/*! @azure/msal-common v14.
|
|
7758
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7547
7759
|
|
|
7548
7760
|
/*
|
|
7549
7761
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7568,7 +7780,7 @@
|
|
|
7568
7780
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7569
7781
|
}
|
|
7570
7782
|
|
|
7571
|
-
/*! @azure/msal-common v14.
|
|
7783
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7572
7784
|
|
|
7573
7785
|
/*
|
|
7574
7786
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7608,7 +7820,7 @@
|
|
|
7608
7820
|
}
|
|
7609
7821
|
}
|
|
7610
7822
|
|
|
7611
|
-
/*! @azure/msal-common v14.
|
|
7823
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7612
7824
|
|
|
7613
7825
|
/*
|
|
7614
7826
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7666,7 +7878,7 @@
|
|
|
7666
7878
|
}
|
|
7667
7879
|
}
|
|
7668
7880
|
|
|
7669
|
-
/*! @azure/msal-common v14.
|
|
7881
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7670
7882
|
|
|
7671
7883
|
/*
|
|
7672
7884
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7870,7 +8082,7 @@
|
|
|
7870
8082
|
}
|
|
7871
8083
|
}
|
|
7872
8084
|
|
|
7873
|
-
/*! @azure/msal-common v14.
|
|
8085
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7874
8086
|
|
|
7875
8087
|
/*
|
|
7876
8088
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7949,12 +8161,168 @@
|
|
|
7949
8161
|
}
|
|
7950
8162
|
}
|
|
7951
8163
|
|
|
7952
|
-
/*! @azure/msal-common v14.
|
|
8164
|
+
/*! @azure/msal-common v14.8.0 2024-03-22 */
|
|
7953
8165
|
|
|
7954
8166
|
/*
|
|
7955
8167
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7956
8168
|
* Licensed under the MIT License.
|
|
7957
8169
|
*/
|
|
8170
|
+
/**
|
|
8171
|
+
* Starts context by adding payload to the stack
|
|
8172
|
+
* @param event {PerformanceEvent}
|
|
8173
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
8174
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
8175
|
+
*/
|
|
8176
|
+
function startContext(event, abbreviations, stack) {
|
|
8177
|
+
if (!stack) {
|
|
8178
|
+
return;
|
|
8179
|
+
}
|
|
8180
|
+
stack.push({
|
|
8181
|
+
name: abbreviations.get(event.name) || event.name,
|
|
8182
|
+
});
|
|
8183
|
+
}
|
|
8184
|
+
/**
|
|
8185
|
+
* Ends context by removing payload from the stack and returning parent or self, if stack is empty, payload
|
|
8186
|
+
*
|
|
8187
|
+
* @param event {PerformanceEvent}
|
|
8188
|
+
* @param abbreviations {Map<string, string>} event name abbreviations
|
|
8189
|
+
* @param stack {?PerformanceEventStackedContext[]} stack
|
|
8190
|
+
* @param error {?unknown} error
|
|
8191
|
+
*/
|
|
8192
|
+
function endContext(event, abbreviations, stack, error) {
|
|
8193
|
+
if (!stack?.length) {
|
|
8194
|
+
return;
|
|
8195
|
+
}
|
|
8196
|
+
const peek = (stack) => {
|
|
8197
|
+
return stack.length ? stack[stack.length - 1] : undefined;
|
|
8198
|
+
};
|
|
8199
|
+
const abbrEventName = abbreviations.get(event.name) || event.name;
|
|
8200
|
+
const top = peek(stack);
|
|
8201
|
+
if (top?.name !== abbrEventName) {
|
|
8202
|
+
return;
|
|
8203
|
+
}
|
|
8204
|
+
const current = stack?.pop();
|
|
8205
|
+
if (!current) {
|
|
8206
|
+
return;
|
|
8207
|
+
}
|
|
8208
|
+
const errorCode = error instanceof AuthError
|
|
8209
|
+
? error.errorCode
|
|
8210
|
+
: error instanceof Error
|
|
8211
|
+
? error.name
|
|
8212
|
+
: undefined;
|
|
8213
|
+
const subErr = error instanceof AuthError ? error.subError : undefined;
|
|
8214
|
+
if (errorCode && current.childErr !== errorCode) {
|
|
8215
|
+
current.err = errorCode;
|
|
8216
|
+
if (subErr) {
|
|
8217
|
+
current.subErr = subErr;
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8220
|
+
delete current.name;
|
|
8221
|
+
delete current.childErr;
|
|
8222
|
+
const context = {
|
|
8223
|
+
...current,
|
|
8224
|
+
dur: event.durationMs,
|
|
8225
|
+
};
|
|
8226
|
+
if (!event.success) {
|
|
8227
|
+
context.fail = 1;
|
|
8228
|
+
}
|
|
8229
|
+
const parent = peek(stack);
|
|
8230
|
+
if (!parent) {
|
|
8231
|
+
return { [abbrEventName]: context };
|
|
8232
|
+
}
|
|
8233
|
+
if (errorCode) {
|
|
8234
|
+
parent.childErr = errorCode;
|
|
8235
|
+
}
|
|
8236
|
+
let childName;
|
|
8237
|
+
if (!parent[abbrEventName]) {
|
|
8238
|
+
childName = abbrEventName;
|
|
8239
|
+
}
|
|
8240
|
+
else {
|
|
8241
|
+
const siblings = Object.keys(parent).filter((key) => key.startsWith(abbrEventName)).length;
|
|
8242
|
+
childName = `${abbrEventName}_${siblings + 1}`;
|
|
8243
|
+
}
|
|
8244
|
+
parent[childName] = context;
|
|
8245
|
+
return parent;
|
|
8246
|
+
}
|
|
8247
|
+
/**
|
|
8248
|
+
* Adds error name and stack trace to the telemetry event
|
|
8249
|
+
* @param error {Error}
|
|
8250
|
+
* @param logger {Logger}
|
|
8251
|
+
* @param event {PerformanceEvent}
|
|
8252
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
8253
|
+
*/
|
|
8254
|
+
function addError(error, logger, event, stackMaxSize = 5) {
|
|
8255
|
+
if (!(error instanceof Error)) {
|
|
8256
|
+
logger.trace("PerformanceClient.addErrorStack: Input error is not instance of Error", event.correlationId);
|
|
8257
|
+
return;
|
|
8258
|
+
}
|
|
8259
|
+
else if (error instanceof AuthError) {
|
|
8260
|
+
event.errorCode = error.errorCode;
|
|
8261
|
+
event.subErrorCode = error.subError;
|
|
8262
|
+
return;
|
|
8263
|
+
}
|
|
8264
|
+
else if (event.errorStack?.length) {
|
|
8265
|
+
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
|
|
8266
|
+
return;
|
|
8267
|
+
}
|
|
8268
|
+
else if (!error.stack?.length) {
|
|
8269
|
+
logger.trace("PerformanceClient.addErrorStack: Input stack is empty", event.correlationId);
|
|
8270
|
+
return;
|
|
8271
|
+
}
|
|
8272
|
+
if (error.stack) {
|
|
8273
|
+
event.errorStack = compactStack(error.stack, stackMaxSize);
|
|
8274
|
+
}
|
|
8275
|
+
event.errorName = error.name;
|
|
8276
|
+
}
|
|
8277
|
+
/**
|
|
8278
|
+
* Compacts error stack into array by fetching N first entries
|
|
8279
|
+
* @param stack {string} error stack
|
|
8280
|
+
* @param stackMaxSize {number} max error stack size to capture
|
|
8281
|
+
* @returns {string[]}
|
|
8282
|
+
*/
|
|
8283
|
+
function compactStack(stack, stackMaxSize) {
|
|
8284
|
+
if (stackMaxSize < 0) {
|
|
8285
|
+
return [];
|
|
8286
|
+
}
|
|
8287
|
+
const stackArr = stack.split("\n") || [];
|
|
8288
|
+
if (stackArr.length < 2) {
|
|
8289
|
+
return [];
|
|
8290
|
+
}
|
|
8291
|
+
const res = [];
|
|
8292
|
+
// Get top N stack lines
|
|
8293
|
+
for (
|
|
8294
|
+
// Skip first line as it may contain PII data
|
|
8295
|
+
let ix = Math.max(stackArr.length - stackMaxSize - 1, 1); ix < stackArr.length; ix++) {
|
|
8296
|
+
const line = stackArr[ix];
|
|
8297
|
+
if (res.length >= stackMaxSize) {
|
|
8298
|
+
break;
|
|
8299
|
+
}
|
|
8300
|
+
res.push(compactStackLine(line));
|
|
8301
|
+
}
|
|
8302
|
+
return res;
|
|
8303
|
+
}
|
|
8304
|
+
/**
|
|
8305
|
+
* Compacts error stack line by shortening file path
|
|
8306
|
+
* Example: https://localhost/msal-common/src/authority/Authority.js:100:1 -> Authority.js:100:1
|
|
8307
|
+
* @param line {string} stack line
|
|
8308
|
+
* @returns {string}
|
|
8309
|
+
*/
|
|
8310
|
+
function compactStackLine(line) {
|
|
8311
|
+
const filePathIx = line.lastIndexOf(" ") + 1;
|
|
8312
|
+
if (filePathIx < 1) {
|
|
8313
|
+
return line;
|
|
8314
|
+
}
|
|
8315
|
+
const filePath = line.substring(filePathIx);
|
|
8316
|
+
let fileNameIx = filePath.lastIndexOf("/");
|
|
8317
|
+
fileNameIx = fileNameIx < 0 ? filePath.lastIndexOf("\\") : fileNameIx;
|
|
8318
|
+
if (fileNameIx >= 0) {
|
|
8319
|
+
return (line.substring(0, filePathIx) +
|
|
8320
|
+
"(" +
|
|
8321
|
+
filePath.substring(fileNameIx + 1) +
|
|
8322
|
+
(filePath.charAt(filePath.length - 1) === ")" ? "" : ")")).trimStart();
|
|
8323
|
+
}
|
|
8324
|
+
return line.trimStart();
|
|
8325
|
+
}
|
|
7958
8326
|
class PerformanceClient {
|
|
7959
8327
|
/**
|
|
7960
8328
|
* Creates an instance of PerformanceClient,
|
|
@@ -7968,8 +8336,9 @@
|
|
|
7968
8336
|
* @param {string} libraryVersion Version of the library
|
|
7969
8337
|
* @param {ApplicationTelemetry} applicationTelemetry application name and version
|
|
7970
8338
|
* @param {Set<String>} intFields integer fields to be truncated
|
|
8339
|
+
* @param {Map<string, string>} abbreviations event name abbreviations
|
|
7971
8340
|
*/
|
|
7972
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields) {
|
|
8341
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields, abbreviations) {
|
|
7973
8342
|
this.authority = authority;
|
|
7974
8343
|
this.libraryName = libraryName;
|
|
7975
8344
|
this.libraryVersion = libraryVersion;
|
|
@@ -7978,12 +8347,17 @@
|
|
|
7978
8347
|
this.logger = logger;
|
|
7979
8348
|
this.callbacks = new Map();
|
|
7980
8349
|
this.eventsByCorrelationId = new Map();
|
|
8350
|
+
this.eventStack = new Map();
|
|
7981
8351
|
this.queueMeasurements = new Map();
|
|
7982
8352
|
this.preQueueTimeByCorrelationId = new Map();
|
|
7983
8353
|
this.intFields = intFields || new Set();
|
|
7984
8354
|
for (const item of IntFields) {
|
|
7985
8355
|
this.intFields.add(item);
|
|
7986
8356
|
}
|
|
8357
|
+
this.abbreviations = abbreviations || new Map();
|
|
8358
|
+
for (const [key, value] of PerformanceEventAbbreviations) {
|
|
8359
|
+
this.abbreviations.set(key, value);
|
|
8360
|
+
}
|
|
7987
8361
|
}
|
|
7988
8362
|
/**
|
|
7989
8363
|
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
@@ -8113,15 +8487,16 @@
|
|
|
8113
8487
|
};
|
|
8114
8488
|
// Store in progress events so they can be discarded if not ended properly
|
|
8115
8489
|
this.cacheEventByCorrelationId(inProgressEvent);
|
|
8490
|
+
startContext(inProgressEvent, this.abbreviations, this.eventStack.get(eventCorrelationId));
|
|
8116
8491
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
8117
8492
|
return {
|
|
8118
|
-
end: (event) => {
|
|
8493
|
+
end: (event, error) => {
|
|
8119
8494
|
return this.endMeasurement({
|
|
8120
8495
|
// Initial set of event properties
|
|
8121
8496
|
...inProgressEvent,
|
|
8122
8497
|
// Properties set when event ends
|
|
8123
8498
|
...event,
|
|
8124
|
-
});
|
|
8499
|
+
}, error);
|
|
8125
8500
|
},
|
|
8126
8501
|
discard: () => {
|
|
8127
8502
|
return this.discardMeasurements(inProgressEvent.correlationId);
|
|
@@ -8143,10 +8518,10 @@
|
|
|
8143
8518
|
* otherwise.
|
|
8144
8519
|
*
|
|
8145
8520
|
* @param {PerformanceEvent} event
|
|
8146
|
-
* @param {
|
|
8521
|
+
* @param {unknown} error
|
|
8147
8522
|
* @returns {(PerformanceEvent | null)}
|
|
8148
8523
|
*/
|
|
8149
|
-
endMeasurement(event) {
|
|
8524
|
+
endMeasurement(event, error) {
|
|
8150
8525
|
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
8151
8526
|
if (!rootEvent) {
|
|
8152
8527
|
this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);
|
|
@@ -8158,6 +8533,8 @@
|
|
|
8158
8533
|
totalQueueCount: 0,
|
|
8159
8534
|
manuallyCompletedCount: 0,
|
|
8160
8535
|
};
|
|
8536
|
+
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
|
|
8537
|
+
const context = endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error);
|
|
8161
8538
|
if (isRoot) {
|
|
8162
8539
|
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8163
8540
|
this.discardCache(rootEvent.correlationId);
|
|
@@ -8165,13 +8542,15 @@
|
|
|
8165
8542
|
else {
|
|
8166
8543
|
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
8167
8544
|
}
|
|
8168
|
-
|
|
8169
|
-
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);
|
|
8545
|
+
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${event.durationMs} ms`, event.correlationId);
|
|
8170
8546
|
// Add sub-measurement attribute to root event.
|
|
8171
8547
|
if (!isRoot) {
|
|
8172
|
-
rootEvent[event.name + "DurationMs"] = Math.floor(durationMs);
|
|
8548
|
+
rootEvent[event.name + "DurationMs"] = Math.floor(event.durationMs);
|
|
8173
8549
|
return { ...rootEvent };
|
|
8174
8550
|
}
|
|
8551
|
+
if (error) {
|
|
8552
|
+
addError(error, this.logger, rootEvent);
|
|
8553
|
+
}
|
|
8175
8554
|
let finalEvent = { ...rootEvent, ...event };
|
|
8176
8555
|
let incompleteSubsCount = 0;
|
|
8177
8556
|
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
|
|
@@ -8182,12 +8561,12 @@
|
|
|
8182
8561
|
finalEvent.incompleteSubMeasurements = undefined;
|
|
8183
8562
|
finalEvent = {
|
|
8184
8563
|
...finalEvent,
|
|
8185
|
-
durationMs: Math.round(durationMs),
|
|
8186
8564
|
queuedTimeMs: queueInfo.totalQueueTime,
|
|
8187
8565
|
queuedCount: queueInfo.totalQueueCount,
|
|
8188
8566
|
queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount,
|
|
8189
8567
|
status: PerformanceEventStatus.Completed,
|
|
8190
8568
|
incompleteSubsCount,
|
|
8569
|
+
context,
|
|
8191
8570
|
};
|
|
8192
8571
|
this.truncateIntegralFields(finalEvent);
|
|
8193
8572
|
this.emitEvents([finalEvent], event.correlationId);
|
|
@@ -8257,6 +8636,7 @@
|
|
|
8257
8636
|
else {
|
|
8258
8637
|
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);
|
|
8259
8638
|
this.eventsByCorrelationId.set(event.correlationId, { ...event });
|
|
8639
|
+
this.eventStack.set(event.correlationId, []);
|
|
8260
8640
|
}
|
|
8261
8641
|
}
|
|
8262
8642
|
getQueueInfo(correlationId) {
|
|
@@ -8298,6 +8678,8 @@
|
|
|
8298
8678
|
this.queueMeasurements.delete(correlationId);
|
|
8299
8679
|
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
8300
8680
|
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
8681
|
+
this.logger.trace("PerformanceClient: Event stack discarded", correlationId);
|
|
8682
|
+
this.eventStack.delete(correlationId);
|
|
8301
8683
|
}
|
|
8302
8684
|
/**
|
|
8303
8685
|
* Registers a callback function to receive performance events.
|
|
@@ -8343,7 +8725,6 @@
|
|
|
8343
8725
|
/**
|
|
8344
8726
|
* Enforce truncation of integral fields in performance event.
|
|
8345
8727
|
* @param {PerformanceEvent} event performance event to update.
|
|
8346
|
-
* @param {Set<string>} intFields integral fields.
|
|
8347
8728
|
*/
|
|
8348
8729
|
truncateIntegralFields(event) {
|
|
8349
8730
|
this.intFields.forEach((key) => {
|
|
@@ -8940,114 +9321,391 @@
|
|
|
8940
9321
|
* Licensed under the MIT License.
|
|
8941
9322
|
*/
|
|
8942
9323
|
/**
|
|
8943
|
-
*
|
|
9324
|
+
* Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:
|
|
9325
|
+
* 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
|
|
8944
9326
|
*/
|
|
8945
|
-
function clearHash(contentWindow) {
|
|
8946
|
-
// Office.js sets history.replaceState to null
|
|
8947
|
-
contentWindow.location.hash = "";
|
|
8948
|
-
if (typeof contentWindow.history.replaceState === "function") {
|
|
8949
|
-
// Full removes "#" from url
|
|
8950
|
-
contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
|
|
8951
|
-
}
|
|
8952
|
-
}
|
|
8953
9327
|
/**
|
|
8954
|
-
*
|
|
9328
|
+
* Returns URL Safe b64 encoded string from a plaintext string.
|
|
9329
|
+
* @param input
|
|
8955
9330
|
*/
|
|
8956
|
-
function
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
9331
|
+
function urlEncode(input) {
|
|
9332
|
+
return encodeURIComponent(base64Encode(input)
|
|
9333
|
+
.replace(/=/g, "")
|
|
9334
|
+
.replace(/\+/g, "-")
|
|
9335
|
+
.replace(/\//g, "_"));
|
|
8960
9336
|
}
|
|
8961
9337
|
/**
|
|
8962
|
-
* Returns
|
|
9338
|
+
* Returns URL Safe b64 encoded string from an int8Array.
|
|
9339
|
+
* @param inputArr
|
|
8963
9340
|
*/
|
|
8964
|
-
function
|
|
8965
|
-
return
|
|
9341
|
+
function urlEncodeArr(inputArr) {
|
|
9342
|
+
return base64EncArr(inputArr)
|
|
9343
|
+
.replace(/=/g, "")
|
|
9344
|
+
.replace(/\+/g, "-")
|
|
9345
|
+
.replace(/\//g, "_");
|
|
8966
9346
|
}
|
|
8967
9347
|
/**
|
|
8968
|
-
* Returns
|
|
9348
|
+
* Returns b64 encoded string from plaintext string.
|
|
9349
|
+
* @param input
|
|
8969
9350
|
*/
|
|
8970
|
-
function
|
|
8971
|
-
return (
|
|
8972
|
-
!!window.opener &&
|
|
8973
|
-
window.opener !== window &&
|
|
8974
|
-
typeof window.name === "string" &&
|
|
8975
|
-
window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0);
|
|
9351
|
+
function base64Encode(input) {
|
|
9352
|
+
return base64EncArr(new TextEncoder().encode(input));
|
|
8976
9353
|
}
|
|
8977
|
-
// #endregion
|
|
8978
9354
|
/**
|
|
8979
|
-
*
|
|
9355
|
+
* Base64 encode byte array
|
|
9356
|
+
* @param aBytes
|
|
8980
9357
|
*/
|
|
8981
|
-
function
|
|
8982
|
-
|
|
9358
|
+
function base64EncArr(aBytes) {
|
|
9359
|
+
const binString = Array.from(aBytes, (x) => String.fromCodePoint(x)).join("");
|
|
9360
|
+
return btoa(binString);
|
|
8983
9361
|
}
|
|
9362
|
+
|
|
9363
|
+
/*
|
|
9364
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9365
|
+
* Licensed under the MIT License.
|
|
9366
|
+
*/
|
|
8984
9367
|
/**
|
|
8985
|
-
*
|
|
9368
|
+
* This file defines functions used by the browser library to perform cryptography operations such as
|
|
9369
|
+
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
8986
9370
|
*/
|
|
8987
|
-
function getHomepage() {
|
|
8988
|
-
const currentUrl = new UrlString(window.location.href);
|
|
8989
|
-
const urlComponents = currentUrl.getUrlComponents();
|
|
8990
|
-
return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
|
|
8991
|
-
}
|
|
8992
9371
|
/**
|
|
8993
|
-
*
|
|
8994
|
-
* attempting another auth request inside an iframe.
|
|
9372
|
+
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
8995
9373
|
*/
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9374
|
+
// RSA KeyGen Algorithm
|
|
9375
|
+
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
9376
|
+
// SHA-256 hashing algorithm
|
|
9377
|
+
const S256_HASH_ALG = "SHA-256";
|
|
9378
|
+
// MOD length for PoP tokens
|
|
9379
|
+
const MODULUS_LENGTH = 2048;
|
|
9380
|
+
// Public Exponent
|
|
9381
|
+
const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
9382
|
+
// UUID hex digits
|
|
9383
|
+
const UUID_CHARS = "0123456789abcdef";
|
|
9384
|
+
// Array to store UINT32 random value
|
|
9385
|
+
const UINT32_ARR = new Uint32Array(1);
|
|
9386
|
+
const keygenAlgorithmOptions = {
|
|
9387
|
+
name: PKCS1_V15_KEYGEN_ALG,
|
|
9388
|
+
hash: S256_HASH_ALG,
|
|
9389
|
+
modulusLength: MODULUS_LENGTH,
|
|
9390
|
+
publicExponent: PUBLIC_EXPONENT,
|
|
9391
|
+
};
|
|
9003
9392
|
/**
|
|
9004
|
-
*
|
|
9005
|
-
* @param interactionType Interaction type for the request
|
|
9006
|
-
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
9393
|
+
* Check whether browser crypto is available.
|
|
9007
9394
|
*/
|
|
9008
|
-
function
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
throw createBrowserAuthError(
|
|
9395
|
+
function validateCryptoAvailable(logger) {
|
|
9396
|
+
if ("crypto" in window) {
|
|
9397
|
+
logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
9398
|
+
}
|
|
9399
|
+
else {
|
|
9400
|
+
logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
9401
|
+
throw createBrowserAuthError(cryptoNonExistent);
|
|
9015
9402
|
}
|
|
9016
9403
|
}
|
|
9017
9404
|
/**
|
|
9018
|
-
*
|
|
9405
|
+
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
9406
|
+
* @param dataString {string} data string
|
|
9407
|
+
* @param performanceClient {?IPerformanceClient}
|
|
9408
|
+
* @param correlationId {?string} correlation id
|
|
9019
9409
|
*/
|
|
9020
|
-
function
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9410
|
+
async function sha256Digest(dataString, performanceClient, correlationId) {
|
|
9411
|
+
performanceClient?.addQueueMeasurement(PerformanceEvents.Sha256Digest, correlationId);
|
|
9412
|
+
const encoder = new TextEncoder();
|
|
9413
|
+
const data = encoder.encode(dataString);
|
|
9414
|
+
return window.crypto.subtle.digest(S256_HASH_ALG, data);
|
|
9025
9415
|
}
|
|
9026
9416
|
/**
|
|
9027
|
-
*
|
|
9028
|
-
* @param
|
|
9417
|
+
* Populates buffer with cryptographically random values.
|
|
9418
|
+
* @param dataBuffer
|
|
9029
9419
|
*/
|
|
9030
|
-
function
|
|
9031
|
-
|
|
9032
|
-
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
9033
|
-
}
|
|
9420
|
+
function getRandomValues(dataBuffer) {
|
|
9421
|
+
return window.crypto.getRandomValues(dataBuffer);
|
|
9034
9422
|
}
|
|
9035
9423
|
/**
|
|
9036
|
-
*
|
|
9037
|
-
* @
|
|
9424
|
+
* Returns random Uint32 value.
|
|
9425
|
+
* @returns {number}
|
|
9038
9426
|
*/
|
|
9039
|
-
function
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
}
|
|
9427
|
+
function getRandomUint32() {
|
|
9428
|
+
window.crypto.getRandomValues(UINT32_ARR);
|
|
9429
|
+
return UINT32_ARR[0];
|
|
9043
9430
|
}
|
|
9044
9431
|
/**
|
|
9045
|
-
*
|
|
9046
|
-
*
|
|
9047
|
-
* @returns
|
|
9432
|
+
* Creates a UUID v7 from the current timestamp.
|
|
9433
|
+
* Implementation relies on the system clock to guarantee increasing order of generated identifiers.
|
|
9434
|
+
* @returns {number}
|
|
9048
9435
|
*/
|
|
9049
|
-
function
|
|
9050
|
-
const
|
|
9436
|
+
function createNewGuid() {
|
|
9437
|
+
const currentTimestamp = Date.now();
|
|
9438
|
+
const baseRand = getRandomUint32() * 0x400 + (getRandomUint32() & 0x3ff);
|
|
9439
|
+
// Result byte array
|
|
9440
|
+
const bytes = new Uint8Array(16);
|
|
9441
|
+
// A 12-bit `rand_a` field value
|
|
9442
|
+
const randA = Math.trunc(baseRand / 2 ** 30);
|
|
9443
|
+
// The higher 30 bits of 62-bit `rand_b` field value
|
|
9444
|
+
const randBHi = baseRand & (2 ** 30 - 1);
|
|
9445
|
+
// The lower 32 bits of 62-bit `rand_b` field value
|
|
9446
|
+
const randBLo = getRandomUint32();
|
|
9447
|
+
bytes[0] = currentTimestamp / 2 ** 40;
|
|
9448
|
+
bytes[1] = currentTimestamp / 2 ** 32;
|
|
9449
|
+
bytes[2] = currentTimestamp / 2 ** 24;
|
|
9450
|
+
bytes[3] = currentTimestamp / 2 ** 16;
|
|
9451
|
+
bytes[4] = currentTimestamp / 2 ** 8;
|
|
9452
|
+
bytes[5] = currentTimestamp;
|
|
9453
|
+
bytes[6] = 0x70 | (randA >>> 8);
|
|
9454
|
+
bytes[7] = randA;
|
|
9455
|
+
bytes[8] = 0x80 | (randBHi >>> 24);
|
|
9456
|
+
bytes[9] = randBHi >>> 16;
|
|
9457
|
+
bytes[10] = randBHi >>> 8;
|
|
9458
|
+
bytes[11] = randBHi;
|
|
9459
|
+
bytes[12] = randBLo >>> 24;
|
|
9460
|
+
bytes[13] = randBLo >>> 16;
|
|
9461
|
+
bytes[14] = randBLo >>> 8;
|
|
9462
|
+
bytes[15] = randBLo;
|
|
9463
|
+
let text = "";
|
|
9464
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
9465
|
+
text += UUID_CHARS.charAt(bytes[i] >>> 4);
|
|
9466
|
+
text += UUID_CHARS.charAt(bytes[i] & 0xf);
|
|
9467
|
+
if (i === 3 || i === 5 || i === 7 || i === 9) {
|
|
9468
|
+
text += "-";
|
|
9469
|
+
}
|
|
9470
|
+
}
|
|
9471
|
+
return text;
|
|
9472
|
+
}
|
|
9473
|
+
/**
|
|
9474
|
+
* Generates a keypair based on current keygen algorithm config.
|
|
9475
|
+
* @param extractable
|
|
9476
|
+
* @param usages
|
|
9477
|
+
*/
|
|
9478
|
+
async function generateKeyPair(extractable, usages) {
|
|
9479
|
+
return window.crypto.subtle.generateKey(keygenAlgorithmOptions, extractable, usages);
|
|
9480
|
+
}
|
|
9481
|
+
/**
|
|
9482
|
+
* Export key as Json Web Key (JWK)
|
|
9483
|
+
* @param key
|
|
9484
|
+
*/
|
|
9485
|
+
async function exportJwk(key) {
|
|
9486
|
+
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
9487
|
+
}
|
|
9488
|
+
/**
|
|
9489
|
+
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
9490
|
+
* @param key
|
|
9491
|
+
* @param extractable
|
|
9492
|
+
* @param usages
|
|
9493
|
+
*/
|
|
9494
|
+
async function importJwk(key, extractable, usages) {
|
|
9495
|
+
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, keygenAlgorithmOptions, extractable, usages);
|
|
9496
|
+
}
|
|
9497
|
+
/**
|
|
9498
|
+
* Signs given data with given key
|
|
9499
|
+
* @param key
|
|
9500
|
+
* @param data
|
|
9501
|
+
*/
|
|
9502
|
+
async function sign(key, data) {
|
|
9503
|
+
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
9504
|
+
}
|
|
9505
|
+
/**
|
|
9506
|
+
* Returns the SHA-256 hash of an input string
|
|
9507
|
+
* @param plainText
|
|
9508
|
+
*/
|
|
9509
|
+
async function hashString(plainText) {
|
|
9510
|
+
const hashBuffer = await sha256Digest(plainText);
|
|
9511
|
+
const hashBytes = new Uint8Array(hashBuffer);
|
|
9512
|
+
return urlEncodeArr(hashBytes);
|
|
9513
|
+
}
|
|
9514
|
+
|
|
9515
|
+
/*
|
|
9516
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9517
|
+
* Licensed under the MIT License.
|
|
9518
|
+
*/
|
|
9519
|
+
const storageNotSupported = "storage_not_supported";
|
|
9520
|
+
const stubbedPublicClientApplicationCalled = "stubbed_public_client_application_called";
|
|
9521
|
+
const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
|
|
9522
|
+
|
|
9523
|
+
var BrowserConfigurationAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
9524
|
+
__proto__: null,
|
|
9525
|
+
inMemRedirectUnavailable: inMemRedirectUnavailable,
|
|
9526
|
+
storageNotSupported: storageNotSupported,
|
|
9527
|
+
stubbedPublicClientApplicationCalled: stubbedPublicClientApplicationCalled
|
|
9528
|
+
});
|
|
9529
|
+
|
|
9530
|
+
/*
|
|
9531
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9532
|
+
* Licensed under the MIT License.
|
|
9533
|
+
*/
|
|
9534
|
+
const BrowserConfigurationAuthErrorMessages = {
|
|
9535
|
+
[storageNotSupported]: "Given storage configuration option was not supported.",
|
|
9536
|
+
[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",
|
|
9537
|
+
[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.",
|
|
9538
|
+
};
|
|
9539
|
+
/**
|
|
9540
|
+
* BrowserAuthErrorMessage class containing string constants used by error codes and messages.
|
|
9541
|
+
* @deprecated Use BrowserAuthErrorCodes instead
|
|
9542
|
+
*/
|
|
9543
|
+
const BrowserConfigurationAuthErrorMessage = {
|
|
9544
|
+
storageNotSupportedError: {
|
|
9545
|
+
code: storageNotSupported,
|
|
9546
|
+
desc: BrowserConfigurationAuthErrorMessages[storageNotSupported],
|
|
9547
|
+
},
|
|
9548
|
+
stubPcaInstanceCalled: {
|
|
9549
|
+
code: stubbedPublicClientApplicationCalled,
|
|
9550
|
+
desc: BrowserConfigurationAuthErrorMessages[stubbedPublicClientApplicationCalled],
|
|
9551
|
+
},
|
|
9552
|
+
inMemRedirectUnavailable: {
|
|
9553
|
+
code: inMemRedirectUnavailable,
|
|
9554
|
+
desc: BrowserConfigurationAuthErrorMessages[inMemRedirectUnavailable],
|
|
9555
|
+
},
|
|
9556
|
+
};
|
|
9557
|
+
/**
|
|
9558
|
+
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
9559
|
+
*/
|
|
9560
|
+
class BrowserConfigurationAuthError extends AuthError {
|
|
9561
|
+
constructor(errorCode, errorMessage) {
|
|
9562
|
+
super(errorCode, errorMessage);
|
|
9563
|
+
this.name = "BrowserConfigurationAuthError";
|
|
9564
|
+
Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);
|
|
9565
|
+
}
|
|
9566
|
+
}
|
|
9567
|
+
function createBrowserConfigurationAuthError(errorCode) {
|
|
9568
|
+
return new BrowserConfigurationAuthError(errorCode, BrowserConfigurationAuthErrorMessages[errorCode]);
|
|
9569
|
+
}
|
|
9570
|
+
|
|
9571
|
+
/*
|
|
9572
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9573
|
+
* Licensed under the MIT License.
|
|
9574
|
+
*/
|
|
9575
|
+
/**
|
|
9576
|
+
* Clears hash from window url.
|
|
9577
|
+
*/
|
|
9578
|
+
function clearHash(contentWindow) {
|
|
9579
|
+
// Office.js sets history.replaceState to null
|
|
9580
|
+
contentWindow.location.hash = "";
|
|
9581
|
+
if (typeof contentWindow.history.replaceState === "function") {
|
|
9582
|
+
// Full removes "#" from url
|
|
9583
|
+
contentWindow.history.replaceState(null, "", `${contentWindow.location.origin}${contentWindow.location.pathname}${contentWindow.location.search}`);
|
|
9584
|
+
}
|
|
9585
|
+
}
|
|
9586
|
+
/**
|
|
9587
|
+
* Replaces current hash with hash from provided url
|
|
9588
|
+
*/
|
|
9589
|
+
function replaceHash(url) {
|
|
9590
|
+
const urlParts = url.split("#");
|
|
9591
|
+
urlParts.shift(); // Remove part before the hash
|
|
9592
|
+
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : "";
|
|
9593
|
+
}
|
|
9594
|
+
/**
|
|
9595
|
+
* Returns boolean of whether the current window is in an iframe or not.
|
|
9596
|
+
*/
|
|
9597
|
+
function isInIframe() {
|
|
9598
|
+
return window.parent !== window;
|
|
9599
|
+
}
|
|
9600
|
+
/**
|
|
9601
|
+
* Returns boolean of whether or not the current window is a popup opened by msal
|
|
9602
|
+
*/
|
|
9603
|
+
function isInPopup() {
|
|
9604
|
+
return (typeof window !== "undefined" &&
|
|
9605
|
+
!!window.opener &&
|
|
9606
|
+
window.opener !== window &&
|
|
9607
|
+
typeof window.name === "string" &&
|
|
9608
|
+
window.name.indexOf(`${BrowserConstants.POPUP_NAME_PREFIX}.`) === 0);
|
|
9609
|
+
}
|
|
9610
|
+
// #endregion
|
|
9611
|
+
/**
|
|
9612
|
+
* Returns current window URL as redirect uri
|
|
9613
|
+
*/
|
|
9614
|
+
function getCurrentUri() {
|
|
9615
|
+
return window.location.href.split("?")[0].split("#")[0];
|
|
9616
|
+
}
|
|
9617
|
+
/**
|
|
9618
|
+
* Gets the homepage url for the current window location.
|
|
9619
|
+
*/
|
|
9620
|
+
function getHomepage() {
|
|
9621
|
+
const currentUrl = new UrlString(window.location.href);
|
|
9622
|
+
const urlComponents = currentUrl.getUrlComponents();
|
|
9623
|
+
return `${urlComponents.Protocol}//${urlComponents.HostNameAndPort}/`;
|
|
9624
|
+
}
|
|
9625
|
+
/**
|
|
9626
|
+
* Throws error if we have completed an auth and are
|
|
9627
|
+
* attempting another auth request inside an iframe.
|
|
9628
|
+
*/
|
|
9629
|
+
function blockReloadInHiddenIframes() {
|
|
9630
|
+
const isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);
|
|
9631
|
+
// return an error if called from the hidden iframe created by the msal js silent calls
|
|
9632
|
+
if (isResponseHash && isInIframe()) {
|
|
9633
|
+
throw createBrowserAuthError(blockIframeReload);
|
|
9634
|
+
}
|
|
9635
|
+
}
|
|
9636
|
+
/**
|
|
9637
|
+
* Block redirect operations in iframes unless explicitly allowed
|
|
9638
|
+
* @param interactionType Interaction type for the request
|
|
9639
|
+
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
9640
|
+
*/
|
|
9641
|
+
function blockRedirectInIframe(allowRedirectInIframe) {
|
|
9642
|
+
if (isInIframe() && !allowRedirectInIframe) {
|
|
9643
|
+
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
|
|
9644
|
+
throw createBrowserAuthError(redirectInIframe);
|
|
9645
|
+
}
|
|
9646
|
+
}
|
|
9647
|
+
/**
|
|
9648
|
+
* Block redirectUri loaded in popup from calling AcquireToken APIs
|
|
9649
|
+
*/
|
|
9650
|
+
function blockAcquireTokenInPopups() {
|
|
9651
|
+
// Popups opened by msal popup APIs are given a name that starts with "msal."
|
|
9652
|
+
if (isInPopup()) {
|
|
9653
|
+
throw createBrowserAuthError(blockNestedPopups);
|
|
9654
|
+
}
|
|
9655
|
+
}
|
|
9656
|
+
/**
|
|
9657
|
+
* Throws error if token requests are made in non-browser environment
|
|
9658
|
+
* @param isBrowserEnvironment Flag indicating if environment is a browser.
|
|
9659
|
+
*/
|
|
9660
|
+
function blockNonBrowserEnvironment() {
|
|
9661
|
+
if (typeof window === "undefined") {
|
|
9662
|
+
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
9663
|
+
}
|
|
9664
|
+
}
|
|
9665
|
+
/**
|
|
9666
|
+
* Throws error if initialize hasn't been called
|
|
9667
|
+
* @param initialized
|
|
9668
|
+
*/
|
|
9669
|
+
function blockAPICallsBeforeInitialize(initialized) {
|
|
9670
|
+
if (!initialized) {
|
|
9671
|
+
throw createBrowserAuthError(uninitializedPublicClientApplication);
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
/**
|
|
9675
|
+
* Helper to validate app environment before making an auth request
|
|
9676
|
+
* @param initialized
|
|
9677
|
+
*/
|
|
9678
|
+
function preflightCheck(initialized) {
|
|
9679
|
+
// Block request if not in browser environment
|
|
9680
|
+
blockNonBrowserEnvironment();
|
|
9681
|
+
// Block auth requests inside a hidden iframe
|
|
9682
|
+
blockReloadInHiddenIframes();
|
|
9683
|
+
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
9684
|
+
blockAcquireTokenInPopups();
|
|
9685
|
+
// Block token acquisition before initialize has been called
|
|
9686
|
+
blockAPICallsBeforeInitialize(initialized);
|
|
9687
|
+
}
|
|
9688
|
+
/**
|
|
9689
|
+
* Helper to validate app enviornment before making redirect request
|
|
9690
|
+
* @param initialized
|
|
9691
|
+
* @param config
|
|
9692
|
+
*/
|
|
9693
|
+
function redirectPreflightCheck(initialized, config) {
|
|
9694
|
+
preflightCheck(initialized);
|
|
9695
|
+
blockRedirectInIframe(config.system.allowRedirectInIframe);
|
|
9696
|
+
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
9697
|
+
if (config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&
|
|
9698
|
+
!config.cache.storeAuthStateInCookie) {
|
|
9699
|
+
throw createBrowserConfigurationAuthError(inMemRedirectUnavailable);
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9702
|
+
/**
|
|
9703
|
+
* Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
|
|
9704
|
+
* @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
|
|
9705
|
+
* @returns
|
|
9706
|
+
*/
|
|
9707
|
+
function preconnect(authority) {
|
|
9708
|
+
const link = document.createElement("link");
|
|
9051
9709
|
link.rel = "preconnect";
|
|
9052
9710
|
link.href = new URL(authority).origin;
|
|
9053
9711
|
link.crossOrigin = "anonymous";
|
|
@@ -9060,6 +9718,13 @@
|
|
|
9060
9718
|
catch { }
|
|
9061
9719
|
}, 10000); // 10s Timeout
|
|
9062
9720
|
}
|
|
9721
|
+
/**
|
|
9722
|
+
* Wrapper function that creates a UUID v7 from the current timestamp.
|
|
9723
|
+
* @returns {string}
|
|
9724
|
+
*/
|
|
9725
|
+
function createGuid() {
|
|
9726
|
+
return createNewGuid();
|
|
9727
|
+
}
|
|
9063
9728
|
|
|
9064
9729
|
var BrowserUtils = /*#__PURE__*/Object.freeze({
|
|
9065
9730
|
__proto__: null,
|
|
@@ -9069,11 +9734,14 @@
|
|
|
9069
9734
|
blockRedirectInIframe: blockRedirectInIframe,
|
|
9070
9735
|
blockReloadInHiddenIframes: blockReloadInHiddenIframes,
|
|
9071
9736
|
clearHash: clearHash,
|
|
9737
|
+
createGuid: createGuid,
|
|
9072
9738
|
getCurrentUri: getCurrentUri,
|
|
9073
9739
|
getHomepage: getHomepage,
|
|
9074
9740
|
isInIframe: isInIframe,
|
|
9075
9741
|
isInPopup: isInPopup,
|
|
9076
9742
|
preconnect: preconnect,
|
|
9743
|
+
preflightCheck: preflightCheck,
|
|
9744
|
+
redirectPreflightCheck: redirectPreflightCheck,
|
|
9077
9745
|
replaceHash: replaceHash
|
|
9078
9746
|
});
|
|
9079
9747
|
|
|
@@ -9349,7 +10017,7 @@
|
|
|
9349
10017
|
|
|
9350
10018
|
/* eslint-disable header/header */
|
|
9351
10019
|
const name = "@azure/msal-browser";
|
|
9352
|
-
const version = "3.
|
|
10020
|
+
const version = "3.11.0";
|
|
9353
10021
|
|
|
9354
10022
|
/*
|
|
9355
10023
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9775,50 +10443,6 @@
|
|
|
9775
10443
|
}
|
|
9776
10444
|
}
|
|
9777
10445
|
|
|
9778
|
-
/*
|
|
9779
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9780
|
-
* Licensed under the MIT License.
|
|
9781
|
-
*/
|
|
9782
|
-
/**
|
|
9783
|
-
* Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:
|
|
9784
|
-
* 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
|
|
9785
|
-
*/
|
|
9786
|
-
/**
|
|
9787
|
-
* Returns URL Safe b64 encoded string from a plaintext string.
|
|
9788
|
-
* @param input
|
|
9789
|
-
*/
|
|
9790
|
-
function urlEncode(input) {
|
|
9791
|
-
return encodeURIComponent(base64Encode(input)
|
|
9792
|
-
.replace(/=/g, "")
|
|
9793
|
-
.replace(/\+/g, "-")
|
|
9794
|
-
.replace(/\//g, "_"));
|
|
9795
|
-
}
|
|
9796
|
-
/**
|
|
9797
|
-
* Returns URL Safe b64 encoded string from an int8Array.
|
|
9798
|
-
* @param inputArr
|
|
9799
|
-
*/
|
|
9800
|
-
function urlEncodeArr(inputArr) {
|
|
9801
|
-
return base64EncArr(inputArr)
|
|
9802
|
-
.replace(/=/g, "")
|
|
9803
|
-
.replace(/\+/g, "-")
|
|
9804
|
-
.replace(/\//g, "_");
|
|
9805
|
-
}
|
|
9806
|
-
/**
|
|
9807
|
-
* Returns b64 encoded string from plaintext string.
|
|
9808
|
-
* @param input
|
|
9809
|
-
*/
|
|
9810
|
-
function base64Encode(input) {
|
|
9811
|
-
return base64EncArr(new TextEncoder().encode(input));
|
|
9812
|
-
}
|
|
9813
|
-
/**
|
|
9814
|
-
* Base64 encode byte array
|
|
9815
|
-
* @param aBytes
|
|
9816
|
-
*/
|
|
9817
|
-
function base64EncArr(aBytes) {
|
|
9818
|
-
const binString = Array.from(aBytes, (x) => String.fromCodePoint(x)).join("");
|
|
9819
|
-
return btoa(binString);
|
|
9820
|
-
}
|
|
9821
|
-
|
|
9822
10446
|
/*
|
|
9823
10447
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9824
10448
|
* Licensed under the MIT License.
|
|
@@ -9856,149 +10480,6 @@
|
|
|
9856
10480
|
return Uint8Array.from(binString, (m) => m.codePointAt(0) || 0);
|
|
9857
10481
|
}
|
|
9858
10482
|
|
|
9859
|
-
/*
|
|
9860
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9861
|
-
* Licensed under the MIT License.
|
|
9862
|
-
*/
|
|
9863
|
-
/**
|
|
9864
|
-
* This file defines functions used by the browser library to perform cryptography operations such as
|
|
9865
|
-
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
9866
|
-
*/
|
|
9867
|
-
/**
|
|
9868
|
-
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
9869
|
-
*/
|
|
9870
|
-
// RSA KeyGen Algorithm
|
|
9871
|
-
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
9872
|
-
// SHA-256 hashing algorithm
|
|
9873
|
-
const S256_HASH_ALG = "SHA-256";
|
|
9874
|
-
// MOD length for PoP tokens
|
|
9875
|
-
const MODULUS_LENGTH = 2048;
|
|
9876
|
-
// Public Exponent
|
|
9877
|
-
const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
9878
|
-
// UUID hex digits
|
|
9879
|
-
const UUID_CHARS = "0123456789abcdef";
|
|
9880
|
-
// Array to store UINT32 random value
|
|
9881
|
-
const UINT32_ARR = new Uint32Array(1);
|
|
9882
|
-
const keygenAlgorithmOptions = {
|
|
9883
|
-
name: PKCS1_V15_KEYGEN_ALG,
|
|
9884
|
-
hash: S256_HASH_ALG,
|
|
9885
|
-
modulusLength: MODULUS_LENGTH,
|
|
9886
|
-
publicExponent: PUBLIC_EXPONENT,
|
|
9887
|
-
};
|
|
9888
|
-
/**
|
|
9889
|
-
* Check whether browser crypto is available.
|
|
9890
|
-
*/
|
|
9891
|
-
function validateCryptoAvailable(logger) {
|
|
9892
|
-
if ("crypto" in window) {
|
|
9893
|
-
logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
9894
|
-
}
|
|
9895
|
-
else {
|
|
9896
|
-
logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
9897
|
-
throw createBrowserAuthError(cryptoNonExistent);
|
|
9898
|
-
}
|
|
9899
|
-
}
|
|
9900
|
-
/**
|
|
9901
|
-
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
9902
|
-
* @param dataString {string} data string
|
|
9903
|
-
* @param performanceClient {?IPerformanceClient}
|
|
9904
|
-
* @param correlationId {?string} correlation id
|
|
9905
|
-
*/
|
|
9906
|
-
async function sha256Digest(dataString, performanceClient, correlationId) {
|
|
9907
|
-
performanceClient?.addQueueMeasurement(PerformanceEvents.Sha256Digest, correlationId);
|
|
9908
|
-
const encoder = new TextEncoder();
|
|
9909
|
-
const data = encoder.encode(dataString);
|
|
9910
|
-
return window.crypto.subtle.digest(S256_HASH_ALG, data);
|
|
9911
|
-
}
|
|
9912
|
-
/**
|
|
9913
|
-
* Populates buffer with cryptographically random values.
|
|
9914
|
-
* @param dataBuffer
|
|
9915
|
-
*/
|
|
9916
|
-
function getRandomValues(dataBuffer) {
|
|
9917
|
-
return window.crypto.getRandomValues(dataBuffer);
|
|
9918
|
-
}
|
|
9919
|
-
/**
|
|
9920
|
-
* Returns random Uint32 value.
|
|
9921
|
-
* @returns {number}
|
|
9922
|
-
*/
|
|
9923
|
-
function getRandomUint32() {
|
|
9924
|
-
window.crypto.getRandomValues(UINT32_ARR);
|
|
9925
|
-
return UINT32_ARR[0];
|
|
9926
|
-
}
|
|
9927
|
-
/**
|
|
9928
|
-
* Creates a UUID v7 from the current timestamp.
|
|
9929
|
-
* Implementation relies on the system clock to guarantee increasing order of generated identifiers.
|
|
9930
|
-
* @returns {number}
|
|
9931
|
-
*/
|
|
9932
|
-
function createNewGuid() {
|
|
9933
|
-
const currentTimestamp = Date.now();
|
|
9934
|
-
const baseRand = getRandomUint32() * 0x400 + (getRandomUint32() & 0x3ff);
|
|
9935
|
-
// Result byte array
|
|
9936
|
-
const bytes = new Uint8Array(16);
|
|
9937
|
-
// A 12-bit `rand_a` field value
|
|
9938
|
-
const randA = Math.trunc(baseRand / 2 ** 30);
|
|
9939
|
-
// The higher 30 bits of 62-bit `rand_b` field value
|
|
9940
|
-
const randBHi = baseRand & (2 ** 30 - 1);
|
|
9941
|
-
// The lower 32 bits of 62-bit `rand_b` field value
|
|
9942
|
-
const randBLo = getRandomUint32();
|
|
9943
|
-
bytes[0] = currentTimestamp / 2 ** 40;
|
|
9944
|
-
bytes[1] = currentTimestamp / 2 ** 32;
|
|
9945
|
-
bytes[2] = currentTimestamp / 2 ** 24;
|
|
9946
|
-
bytes[3] = currentTimestamp / 2 ** 16;
|
|
9947
|
-
bytes[4] = currentTimestamp / 2 ** 8;
|
|
9948
|
-
bytes[5] = currentTimestamp;
|
|
9949
|
-
bytes[6] = 0x70 | (randA >>> 8);
|
|
9950
|
-
bytes[7] = randA;
|
|
9951
|
-
bytes[8] = 0x80 | (randBHi >>> 24);
|
|
9952
|
-
bytes[9] = randBHi >>> 16;
|
|
9953
|
-
bytes[10] = randBHi >>> 8;
|
|
9954
|
-
bytes[11] = randBHi;
|
|
9955
|
-
bytes[12] = randBLo >>> 24;
|
|
9956
|
-
bytes[13] = randBLo >>> 16;
|
|
9957
|
-
bytes[14] = randBLo >>> 8;
|
|
9958
|
-
bytes[15] = randBLo;
|
|
9959
|
-
let text = "";
|
|
9960
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
9961
|
-
text += UUID_CHARS.charAt(bytes[i] >>> 4);
|
|
9962
|
-
text += UUID_CHARS.charAt(bytes[i] & 0xf);
|
|
9963
|
-
if (i === 3 || i === 5 || i === 7 || i === 9) {
|
|
9964
|
-
text += "-";
|
|
9965
|
-
}
|
|
9966
|
-
}
|
|
9967
|
-
return text;
|
|
9968
|
-
}
|
|
9969
|
-
/**
|
|
9970
|
-
* Generates a keypair based on current keygen algorithm config.
|
|
9971
|
-
* @param extractable
|
|
9972
|
-
* @param usages
|
|
9973
|
-
*/
|
|
9974
|
-
async function generateKeyPair(extractable, usages) {
|
|
9975
|
-
return window.crypto.subtle.generateKey(keygenAlgorithmOptions, extractable, usages);
|
|
9976
|
-
}
|
|
9977
|
-
/**
|
|
9978
|
-
* Export key as Json Web Key (JWK)
|
|
9979
|
-
* @param key
|
|
9980
|
-
*/
|
|
9981
|
-
async function exportJwk(key) {
|
|
9982
|
-
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
9983
|
-
}
|
|
9984
|
-
/**
|
|
9985
|
-
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
9986
|
-
* @param key
|
|
9987
|
-
* @param extractable
|
|
9988
|
-
* @param usages
|
|
9989
|
-
*/
|
|
9990
|
-
async function importJwk(key, extractable, usages) {
|
|
9991
|
-
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, keygenAlgorithmOptions, extractable, usages);
|
|
9992
|
-
}
|
|
9993
|
-
/**
|
|
9994
|
-
* Signs given data with given key
|
|
9995
|
-
* @param key
|
|
9996
|
-
* @param data
|
|
9997
|
-
*/
|
|
9998
|
-
async function sign(key, data) {
|
|
9999
|
-
return window.crypto.subtle.sign(keygenAlgorithmOptions, key, data);
|
|
10000
|
-
}
|
|
10001
|
-
|
|
10002
10483
|
/*
|
|
10003
10484
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10004
10485
|
* Licensed under the MIT License.
|
|
@@ -10183,9 +10664,19 @@
|
|
|
10183
10664
|
}
|
|
10184
10665
|
return new Promise((resolve, reject) => {
|
|
10185
10666
|
const deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
|
|
10186
|
-
|
|
10187
|
-
deleteDbRequest.addEventListener("
|
|
10188
|
-
|
|
10667
|
+
const id = setTimeout(() => reject(false), 200); // Reject if events aren't raised within 200ms
|
|
10668
|
+
deleteDbRequest.addEventListener("success", () => {
|
|
10669
|
+
clearTimeout(id);
|
|
10670
|
+
return resolve(true);
|
|
10671
|
+
});
|
|
10672
|
+
deleteDbRequest.addEventListener("blocked", () => {
|
|
10673
|
+
clearTimeout(id);
|
|
10674
|
+
return resolve(true);
|
|
10675
|
+
});
|
|
10676
|
+
deleteDbRequest.addEventListener("error", () => {
|
|
10677
|
+
clearTimeout(id);
|
|
10678
|
+
return reject(false);
|
|
10679
|
+
});
|
|
10189
10680
|
});
|
|
10190
10681
|
}
|
|
10191
10682
|
}
|
|
@@ -10231,11 +10722,10 @@
|
|
|
10231
10722
|
* backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
|
|
10232
10723
|
*/
|
|
10233
10724
|
class AsyncMemoryStorage {
|
|
10234
|
-
constructor(logger
|
|
10725
|
+
constructor(logger) {
|
|
10235
10726
|
this.inMemoryCache = new MemoryStorage();
|
|
10236
10727
|
this.indexedDBCache = new DatabaseStorage();
|
|
10237
10728
|
this.logger = logger;
|
|
10238
|
-
this.storeName = storeName;
|
|
10239
10729
|
}
|
|
10240
10730
|
handleDatabaseAccessError(error) {
|
|
10241
10731
|
if (error instanceof BrowserAuthError &&
|
|
@@ -10331,9 +10821,9 @@
|
|
|
10331
10821
|
*/
|
|
10332
10822
|
clearInMemory() {
|
|
10333
10823
|
// InMemory cache is a Map instance, clear is straightforward
|
|
10334
|
-
this.logger.verbose(`Deleting in-memory keystore
|
|
10824
|
+
this.logger.verbose(`Deleting in-memory keystore`);
|
|
10335
10825
|
this.inMemoryCache.clear();
|
|
10336
|
-
this.logger.verbose(`In-memory keystore
|
|
10826
|
+
this.logger.verbose(`In-memory keystore deleted`);
|
|
10337
10827
|
}
|
|
10338
10828
|
/**
|
|
10339
10829
|
* Tries to delete the IndexedDB database
|
|
@@ -10343,54 +10833,13 @@
|
|
|
10343
10833
|
try {
|
|
10344
10834
|
this.logger.verbose("Deleting persistent keystore");
|
|
10345
10835
|
const dbDeleted = await this.indexedDBCache.deleteDatabase();
|
|
10346
|
-
if (dbDeleted) {
|
|
10347
|
-
this.logger.verbose("Persistent keystore deleted");
|
|
10348
|
-
}
|
|
10349
|
-
return dbDeleted;
|
|
10350
|
-
}
|
|
10351
|
-
catch (e) {
|
|
10352
|
-
this.handleDatabaseAccessError(e);
|
|
10353
|
-
return false;
|
|
10354
|
-
}
|
|
10355
|
-
}
|
|
10356
|
-
}
|
|
10357
|
-
|
|
10358
|
-
/*
|
|
10359
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10360
|
-
* Licensed under the MIT License.
|
|
10361
|
-
*/
|
|
10362
|
-
const CryptoKeyStoreNames = {
|
|
10363
|
-
asymmetricKeys: "asymmetricKeys",
|
|
10364
|
-
symmetricKeys: "symmetricKeys",
|
|
10365
|
-
};
|
|
10366
|
-
/**
|
|
10367
|
-
* MSAL CryptoKeyStore DB Version 2
|
|
10368
|
-
*/
|
|
10369
|
-
class CryptoKeyStore {
|
|
10370
|
-
constructor(logger) {
|
|
10371
|
-
this.logger = logger;
|
|
10372
|
-
this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);
|
|
10373
|
-
this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);
|
|
10374
|
-
}
|
|
10375
|
-
async clear() {
|
|
10376
|
-
// Delete in-memory keystores
|
|
10377
|
-
this.asymmetricKeys.clearInMemory();
|
|
10378
|
-
this.symmetricKeys.clearInMemory();
|
|
10379
|
-
/**
|
|
10380
|
-
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
10381
|
-
* every persistent keystore
|
|
10382
|
-
*/
|
|
10383
|
-
try {
|
|
10384
|
-
await this.asymmetricKeys.clearPersistent();
|
|
10385
|
-
return true;
|
|
10386
|
-
}
|
|
10387
|
-
catch (e) {
|
|
10388
|
-
if (e instanceof Error) {
|
|
10389
|
-
this.logger.error(`Clearing keystore failed with error: ${e.message}`);
|
|
10390
|
-
}
|
|
10391
|
-
else {
|
|
10392
|
-
this.logger.error("Clearing keystore failed with unknown error");
|
|
10836
|
+
if (dbDeleted) {
|
|
10837
|
+
this.logger.verbose("Persistent keystore deleted");
|
|
10393
10838
|
}
|
|
10839
|
+
return dbDeleted;
|
|
10840
|
+
}
|
|
10841
|
+
catch (e) {
|
|
10842
|
+
this.handleDatabaseAccessError(e);
|
|
10394
10843
|
return false;
|
|
10395
10844
|
}
|
|
10396
10845
|
}
|
|
@@ -10409,7 +10858,7 @@
|
|
|
10409
10858
|
this.logger = logger;
|
|
10410
10859
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
10411
10860
|
validateCryptoAvailable(logger);
|
|
10412
|
-
this.cache = new
|
|
10861
|
+
this.cache = new AsyncMemoryStorage(this.logger);
|
|
10413
10862
|
this.performanceClient = performanceClient;
|
|
10414
10863
|
}
|
|
10415
10864
|
/**
|
|
@@ -10455,7 +10904,7 @@
|
|
|
10455
10904
|
// Re-import private key to make it unextractable
|
|
10456
10905
|
const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"]);
|
|
10457
10906
|
// Store Keypair data in keystore
|
|
10458
|
-
await this.cache.
|
|
10907
|
+
await this.cache.setItem(publicJwkHash, {
|
|
10459
10908
|
privateKey: unextractablePrivateKey,
|
|
10460
10909
|
publicKey: keyPair.publicKey,
|
|
10461
10910
|
requestMethod: request.resourceRequestMethod,
|
|
@@ -10473,15 +10922,33 @@
|
|
|
10473
10922
|
* @param kid
|
|
10474
10923
|
*/
|
|
10475
10924
|
async removeTokenBindingKey(kid) {
|
|
10476
|
-
await this.cache.
|
|
10477
|
-
const keyFound = await this.cache.
|
|
10925
|
+
await this.cache.removeItem(kid);
|
|
10926
|
+
const keyFound = await this.cache.containsKey(kid);
|
|
10478
10927
|
return !keyFound;
|
|
10479
10928
|
}
|
|
10480
10929
|
/**
|
|
10481
10930
|
* Removes all cryptographic keys from IndexedDB storage
|
|
10482
10931
|
*/
|
|
10483
10932
|
async clearKeystore() {
|
|
10484
|
-
|
|
10933
|
+
// Delete in-memory keystores
|
|
10934
|
+
this.cache.clearInMemory();
|
|
10935
|
+
/**
|
|
10936
|
+
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
10937
|
+
* every persistent keystore
|
|
10938
|
+
*/
|
|
10939
|
+
try {
|
|
10940
|
+
await this.cache.clearPersistent();
|
|
10941
|
+
return true;
|
|
10942
|
+
}
|
|
10943
|
+
catch (e) {
|
|
10944
|
+
if (e instanceof Error) {
|
|
10945
|
+
this.logger.error(`Clearing keystore failed with error: ${e.message}`);
|
|
10946
|
+
}
|
|
10947
|
+
else {
|
|
10948
|
+
this.logger.error("Clearing keystore failed with unknown error");
|
|
10949
|
+
}
|
|
10950
|
+
return false;
|
|
10951
|
+
}
|
|
10485
10952
|
}
|
|
10486
10953
|
/**
|
|
10487
10954
|
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
@@ -10490,7 +10957,7 @@
|
|
|
10490
10957
|
*/
|
|
10491
10958
|
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
10492
10959
|
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
10493
|
-
const cachedKeyPair = await this.cache.
|
|
10960
|
+
const cachedKeyPair = await this.cache.getItem(kid);
|
|
10494
10961
|
if (!cachedKeyPair) {
|
|
10495
10962
|
throw createBrowserAuthError(cryptoKeyNotFound);
|
|
10496
10963
|
}
|
|
@@ -10531,9 +10998,7 @@
|
|
|
10531
10998
|
* @param plainText
|
|
10532
10999
|
*/
|
|
10533
11000
|
async hashString(plainText) {
|
|
10534
|
-
|
|
10535
|
-
const hashBytes = new Uint8Array(hashBuffer);
|
|
10536
|
-
return urlEncodeArr(hashBytes);
|
|
11001
|
+
return hashString(plainText);
|
|
10537
11002
|
}
|
|
10538
11003
|
}
|
|
10539
11004
|
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
@@ -10542,62 +11007,6 @@
|
|
|
10542
11007
|
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
10543
11008
|
}
|
|
10544
11009
|
|
|
10545
|
-
/*
|
|
10546
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10547
|
-
* Licensed under the MIT License.
|
|
10548
|
-
*/
|
|
10549
|
-
const storageNotSupported = "storage_not_supported";
|
|
10550
|
-
const stubbedPublicClientApplicationCalled = "stubbed_public_client_application_called";
|
|
10551
|
-
const inMemRedirectUnavailable = "in_mem_redirect_unavailable";
|
|
10552
|
-
|
|
10553
|
-
var BrowserConfigurationAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
10554
|
-
__proto__: null,
|
|
10555
|
-
inMemRedirectUnavailable: inMemRedirectUnavailable,
|
|
10556
|
-
storageNotSupported: storageNotSupported,
|
|
10557
|
-
stubbedPublicClientApplicationCalled: stubbedPublicClientApplicationCalled
|
|
10558
|
-
});
|
|
10559
|
-
|
|
10560
|
-
/*
|
|
10561
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10562
|
-
* Licensed under the MIT License.
|
|
10563
|
-
*/
|
|
10564
|
-
const BrowserConfigurationAuthErrorMessages = {
|
|
10565
|
-
[storageNotSupported]: "Given storage configuration option was not supported.",
|
|
10566
|
-
[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",
|
|
10567
|
-
[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.",
|
|
10568
|
-
};
|
|
10569
|
-
/**
|
|
10570
|
-
* BrowserAuthErrorMessage class containing string constants used by error codes and messages.
|
|
10571
|
-
* @deprecated Use BrowserAuthErrorCodes instead
|
|
10572
|
-
*/
|
|
10573
|
-
const BrowserConfigurationAuthErrorMessage = {
|
|
10574
|
-
storageNotSupportedError: {
|
|
10575
|
-
code: storageNotSupported,
|
|
10576
|
-
desc: BrowserConfigurationAuthErrorMessages[storageNotSupported],
|
|
10577
|
-
},
|
|
10578
|
-
stubPcaInstanceCalled: {
|
|
10579
|
-
code: stubbedPublicClientApplicationCalled,
|
|
10580
|
-
desc: BrowserConfigurationAuthErrorMessages[stubbedPublicClientApplicationCalled],
|
|
10581
|
-
},
|
|
10582
|
-
inMemRedirectUnavailable: {
|
|
10583
|
-
code: inMemRedirectUnavailable,
|
|
10584
|
-
desc: BrowserConfigurationAuthErrorMessages[inMemRedirectUnavailable],
|
|
10585
|
-
},
|
|
10586
|
-
};
|
|
10587
|
-
/**
|
|
10588
|
-
* Browser library error class thrown by the MSAL.js library for SPAs
|
|
10589
|
-
*/
|
|
10590
|
-
class BrowserConfigurationAuthError extends AuthError {
|
|
10591
|
-
constructor(errorCode, errorMessage) {
|
|
10592
|
-
super(errorCode, errorMessage);
|
|
10593
|
-
this.name = "BrowserConfigurationAuthError";
|
|
10594
|
-
Object.setPrototypeOf(this, BrowserConfigurationAuthError.prototype);
|
|
10595
|
-
}
|
|
10596
|
-
}
|
|
10597
|
-
function createBrowserConfigurationAuthError(errorCode) {
|
|
10598
|
-
return new BrowserConfigurationAuthError(errorCode, BrowserConfigurationAuthErrorMessages[errorCode]);
|
|
10599
|
-
}
|
|
10600
|
-
|
|
10601
11010
|
/*
|
|
10602
11011
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10603
11012
|
* Licensed under the MIT License.
|
|
@@ -10746,18 +11155,12 @@
|
|
|
10746
11155
|
PersistentCacheKeys.ERROR,
|
|
10747
11156
|
PersistentCacheKeys.ERROR_DESC,
|
|
10748
11157
|
];
|
|
10749
|
-
keysToMigrate.forEach((cacheKey, index) =>
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
* @param storeAuthStateInCookie
|
|
10756
|
-
*/
|
|
10757
|
-
migrateCacheEntry(newKey, value) {
|
|
10758
|
-
if (value) {
|
|
10759
|
-
this.setTemporaryCache(newKey, value, true);
|
|
10760
|
-
}
|
|
11158
|
+
keysToMigrate.forEach((cacheKey, index) => {
|
|
11159
|
+
const value = values[index];
|
|
11160
|
+
if (value) {
|
|
11161
|
+
this.setTemporaryCache(cacheKey, value, true);
|
|
11162
|
+
}
|
|
11163
|
+
});
|
|
10761
11164
|
}
|
|
10762
11165
|
/**
|
|
10763
11166
|
* Searches all cache entries for MSAL accounts and creates the account key map
|
|
@@ -11454,33 +11857,28 @@
|
|
|
11454
11857
|
}
|
|
11455
11858
|
/**
|
|
11456
11859
|
* Removes the cache item with the given key.
|
|
11457
|
-
* Will also clear the cookie item if storeAuthStateInCookie is set to true.
|
|
11458
11860
|
* @param key
|
|
11459
11861
|
*/
|
|
11460
11862
|
removeItem(key) {
|
|
11461
11863
|
this.browserStorage.removeItem(key);
|
|
11864
|
+
}
|
|
11865
|
+
/**
|
|
11866
|
+
* Removes the temporary cache item with the given key.
|
|
11867
|
+
* Will also clear the cookie item if storeAuthStateInCookie is set to true.
|
|
11868
|
+
* @param key
|
|
11869
|
+
*/
|
|
11870
|
+
removeTemporaryItem(key) {
|
|
11462
11871
|
this.temporaryCacheStorage.removeItem(key);
|
|
11463
11872
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
11464
11873
|
this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie");
|
|
11465
11874
|
this.clearItemCookie(key);
|
|
11466
11875
|
}
|
|
11467
11876
|
}
|
|
11468
|
-
/**
|
|
11469
|
-
* Checks whether key is in cache.
|
|
11470
|
-
* @param key
|
|
11471
|
-
*/
|
|
11472
|
-
containsKey(key) {
|
|
11473
|
-
return (this.browserStorage.containsKey(key) ||
|
|
11474
|
-
this.temporaryCacheStorage.containsKey(key));
|
|
11475
|
-
}
|
|
11476
11877
|
/**
|
|
11477
11878
|
* Gets all keys in window.
|
|
11478
11879
|
*/
|
|
11479
11880
|
getKeys() {
|
|
11480
|
-
return
|
|
11481
|
-
...this.browserStorage.getKeys(),
|
|
11482
|
-
...this.temporaryCacheStorage.getKeys(),
|
|
11483
|
-
];
|
|
11881
|
+
return this.browserStorage.getKeys();
|
|
11484
11882
|
}
|
|
11485
11883
|
/**
|
|
11486
11884
|
* Clears all cache entries created by MSAL.
|
|
@@ -11489,14 +11887,18 @@
|
|
|
11489
11887
|
// Removes all accounts and their credentials
|
|
11490
11888
|
await this.removeAllAccounts();
|
|
11491
11889
|
this.removeAppMetadata();
|
|
11890
|
+
// Remove temp storage first to make sure any cookies are cleared
|
|
11891
|
+
this.temporaryCacheStorage.getKeys().forEach((cacheKey) => {
|
|
11892
|
+
if (cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11893
|
+
cacheKey.indexOf(this.clientId) !== -1) {
|
|
11894
|
+
this.removeTemporaryItem(cacheKey);
|
|
11895
|
+
}
|
|
11896
|
+
});
|
|
11492
11897
|
// Removes all remaining MSAL cache items
|
|
11493
|
-
this.getKeys().forEach((cacheKey) => {
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
this.
|
|
11497
|
-
(cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11498
|
-
cacheKey.indexOf(this.clientId) !== -1)) {
|
|
11499
|
-
this.removeItem(cacheKey);
|
|
11898
|
+
this.browserStorage.getKeys().forEach((cacheKey) => {
|
|
11899
|
+
if (cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
11900
|
+
cacheKey.indexOf(this.clientId) !== -1) {
|
|
11901
|
+
this.browserStorage.removeItem(cacheKey);
|
|
11500
11902
|
}
|
|
11501
11903
|
});
|
|
11502
11904
|
this.internalStorage.clear();
|
|
@@ -11529,6 +11931,7 @@
|
|
|
11529
11931
|
* @param cookieName
|
|
11530
11932
|
* @param cookieValue
|
|
11531
11933
|
* @param expires
|
|
11934
|
+
* @deprecated
|
|
11532
11935
|
*/
|
|
11533
11936
|
setItemCookie(cookieName, cookieValue, expires) {
|
|
11534
11937
|
let cookieStr = `${encodeURIComponent(cookieName)}=${encodeURIComponent(cookieValue)};path=/;SameSite=Lax;`;
|
|
@@ -11544,6 +11947,7 @@
|
|
|
11544
11947
|
/**
|
|
11545
11948
|
* Get one item by key from cookies
|
|
11546
11949
|
* @param cookieName
|
|
11950
|
+
* @deprecated
|
|
11547
11951
|
*/
|
|
11548
11952
|
getItemCookie(cookieName) {
|
|
11549
11953
|
const name = `${encodeURIComponent(cookieName)}=`;
|
|
@@ -11561,6 +11965,7 @@
|
|
|
11561
11965
|
}
|
|
11562
11966
|
/**
|
|
11563
11967
|
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
11968
|
+
* @deprecated
|
|
11564
11969
|
*/
|
|
11565
11970
|
clearMsalCookies() {
|
|
11566
11971
|
const cookiePrefix = `${Constants.CACHE_PREFIX}.${this.clientId}`;
|
|
@@ -11579,6 +11984,7 @@
|
|
|
11579
11984
|
/**
|
|
11580
11985
|
* Clear an item in the cookies by key
|
|
11581
11986
|
* @param cookieName
|
|
11987
|
+
* @deprecated
|
|
11582
11988
|
*/
|
|
11583
11989
|
clearItemCookie(cookieName) {
|
|
11584
11990
|
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
@@ -11586,24 +11992,13 @@
|
|
|
11586
11992
|
/**
|
|
11587
11993
|
* Get cookie expiration time
|
|
11588
11994
|
* @param cookieLifeDays
|
|
11995
|
+
* @deprecated
|
|
11589
11996
|
*/
|
|
11590
11997
|
getCookieExpirationTime(cookieLifeDays) {
|
|
11591
11998
|
const today = new Date();
|
|
11592
11999
|
const expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);
|
|
11593
12000
|
return expr.toUTCString();
|
|
11594
12001
|
}
|
|
11595
|
-
/**
|
|
11596
|
-
* Gets the cache object referenced by the browser
|
|
11597
|
-
*/
|
|
11598
|
-
getCache() {
|
|
11599
|
-
return this.browserStorage;
|
|
11600
|
-
}
|
|
11601
|
-
/**
|
|
11602
|
-
* interface compat, we cannot overwrite browser cache; Functionality is supported by individual entities in browser
|
|
11603
|
-
*/
|
|
11604
|
-
setCache() {
|
|
11605
|
-
// sets nothing
|
|
11606
|
-
}
|
|
11607
12002
|
/**
|
|
11608
12003
|
* 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)
|
|
11609
12004
|
* @param key
|
|
@@ -11696,22 +12091,22 @@
|
|
|
11696
12091
|
this.logger.trace("BrowserCacheManager.resetRequestCache called");
|
|
11697
12092
|
// check state and remove associated cache items
|
|
11698
12093
|
if (state) {
|
|
11699
|
-
this.getKeys().forEach((key) => {
|
|
12094
|
+
this.temporaryCacheStorage.getKeys().forEach((key) => {
|
|
11700
12095
|
if (key.indexOf(state) !== -1) {
|
|
11701
|
-
this.
|
|
12096
|
+
this.removeTemporaryItem(key);
|
|
11702
12097
|
}
|
|
11703
12098
|
});
|
|
11704
12099
|
// delete generic interactive request parameters
|
|
11705
|
-
this.
|
|
11706
|
-
this.
|
|
11707
|
-
this.
|
|
11708
|
-
}
|
|
11709
|
-
this.
|
|
11710
|
-
this.
|
|
11711
|
-
this.
|
|
11712
|
-
this.
|
|
11713
|
-
this.
|
|
11714
|
-
this.
|
|
12100
|
+
this.removeTemporaryItem(this.generateStateKey(state));
|
|
12101
|
+
this.removeTemporaryItem(this.generateNonceKey(state));
|
|
12102
|
+
this.removeTemporaryItem(this.generateAuthorityKey(state));
|
|
12103
|
+
}
|
|
12104
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
12105
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
|
|
12106
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
12107
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
|
|
12108
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
12109
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
11715
12110
|
this.setInteractionInProgress(false);
|
|
11716
12111
|
}
|
|
11717
12112
|
/**
|
|
@@ -11737,7 +12132,7 @@
|
|
|
11737
12132
|
cleanRequestByInteractionType(interactionType) {
|
|
11738
12133
|
this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called");
|
|
11739
12134
|
// Loop through all keys to find state key
|
|
11740
|
-
this.getKeys().forEach((key) => {
|
|
12135
|
+
this.temporaryCacheStorage.getKeys().forEach((key) => {
|
|
11741
12136
|
// If this key is not the state key, move on
|
|
11742
12137
|
if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
11743
12138
|
return;
|
|
@@ -11782,7 +12177,7 @@
|
|
|
11782
12177
|
this.logger.error(`Parsing cached token request threw with error: ${e}`);
|
|
11783
12178
|
throw createBrowserAuthError(unableToParseTokenRequestCacheError);
|
|
11784
12179
|
}
|
|
11785
|
-
this.
|
|
12180
|
+
this.removeTemporaryItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
11786
12181
|
// Get cached authority and use if no authority is cached with request.
|
|
11787
12182
|
if (!parsedRequest.authority) {
|
|
11788
12183
|
const authorityCacheKey = this.generateAuthorityKey(state);
|
|
@@ -11838,7 +12233,7 @@
|
|
|
11838
12233
|
}
|
|
11839
12234
|
else if (!inProgress &&
|
|
11840
12235
|
this.getInteractionInProgress() === this.clientId) {
|
|
11841
|
-
this.
|
|
12236
|
+
this.removeTemporaryItem(key);
|
|
11842
12237
|
}
|
|
11843
12238
|
}
|
|
11844
12239
|
/**
|
|
@@ -11855,7 +12250,7 @@
|
|
|
11855
12250
|
// Check for cached MSAL v1 id token
|
|
11856
12251
|
const msalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ID_TOKEN, true);
|
|
11857
12252
|
if (msalIdTokenString) {
|
|
11858
|
-
this.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
12253
|
+
this.browserStorage.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
11859
12254
|
this.logger.verbose("Cached MSAL.js v1 id token retrieved");
|
|
11860
12255
|
}
|
|
11861
12256
|
const cachedIdTokenString = msalIdTokenString || adalIdTokenString;
|
|
@@ -11883,7 +12278,7 @@
|
|
|
11883
12278
|
if (currentCacheKey !== updatedCacheKey) {
|
|
11884
12279
|
const cacheItem = this.getItem(currentCacheKey);
|
|
11885
12280
|
if (cacheItem) {
|
|
11886
|
-
this.removeItem(currentCacheKey);
|
|
12281
|
+
this.browserStorage.removeItem(currentCacheKey);
|
|
11887
12282
|
this.setItem(updatedCacheKey, cacheItem);
|
|
11888
12283
|
this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
|
|
11889
12284
|
return updatedCacheKey;
|
|
@@ -11894,19 +12289,6 @@
|
|
|
11894
12289
|
}
|
|
11895
12290
|
return currentCacheKey;
|
|
11896
12291
|
}
|
|
11897
|
-
/**
|
|
11898
|
-
* Returns application id as redirect context during AcquireTokenRedirect flow.
|
|
11899
|
-
*/
|
|
11900
|
-
getRedirectRequestContext() {
|
|
11901
|
-
return this.getTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, true);
|
|
11902
|
-
}
|
|
11903
|
-
/**
|
|
11904
|
-
* Sets application id as the redirect context during AcquireTokenRedirect flow.
|
|
11905
|
-
* @param value
|
|
11906
|
-
*/
|
|
11907
|
-
setRedirectRequestContext(value) {
|
|
11908
|
-
this.setTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, value, true);
|
|
11909
|
-
}
|
|
11910
12292
|
/**
|
|
11911
12293
|
* Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
|
|
11912
12294
|
* @param result
|
|
@@ -12141,47 +12523,6 @@
|
|
|
12141
12523
|
}
|
|
12142
12524
|
}
|
|
12143
12525
|
}
|
|
12144
|
-
/**
|
|
12145
|
-
* Initializer function for all request APIs
|
|
12146
|
-
* @param request
|
|
12147
|
-
*/
|
|
12148
|
-
async initializeBaseRequest(request) {
|
|
12149
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12150
|
-
const authority = request.authority || this.config.auth.authority;
|
|
12151
|
-
const scopes = [...((request && request.scopes) || [])];
|
|
12152
|
-
const validatedRequest = {
|
|
12153
|
-
...request,
|
|
12154
|
-
correlationId: this.correlationId,
|
|
12155
|
-
authority,
|
|
12156
|
-
scopes,
|
|
12157
|
-
};
|
|
12158
|
-
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
12159
|
-
if (!validatedRequest.authenticationScheme) {
|
|
12160
|
-
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
12161
|
-
this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
12162
|
-
}
|
|
12163
|
-
else {
|
|
12164
|
-
if (validatedRequest.authenticationScheme ===
|
|
12165
|
-
AuthenticationScheme.SSH) {
|
|
12166
|
-
if (!request.sshJwk) {
|
|
12167
|
-
throw createClientConfigurationError(missingSshJwk);
|
|
12168
|
-
}
|
|
12169
|
-
if (!request.sshKid) {
|
|
12170
|
-
throw createClientConfigurationError(missingSshKid);
|
|
12171
|
-
}
|
|
12172
|
-
}
|
|
12173
|
-
this.logger.verbose(`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`);
|
|
12174
|
-
}
|
|
12175
|
-
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
12176
|
-
if (this.config.cache.claimsBasedCachingEnabled &&
|
|
12177
|
-
request.claims &&
|
|
12178
|
-
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
12179
|
-
!StringUtils.isEmptyObj(request.claims)) {
|
|
12180
|
-
validatedRequest.requestedClaimsHash =
|
|
12181
|
-
await this.browserCrypto.hashString(request.claims);
|
|
12182
|
-
}
|
|
12183
|
-
return validatedRequest;
|
|
12184
|
-
}
|
|
12185
12526
|
/**
|
|
12186
12527
|
*
|
|
12187
12528
|
* Use to get the redirect uri configured in MSAL or null.
|
|
@@ -12299,6 +12640,60 @@
|
|
|
12299
12640
|
}
|
|
12300
12641
|
}
|
|
12301
12642
|
|
|
12643
|
+
/*
|
|
12644
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12645
|
+
* Licensed under the MIT License.
|
|
12646
|
+
*/
|
|
12647
|
+
/**
|
|
12648
|
+
* Initializer function for all request APIs
|
|
12649
|
+
* @param request
|
|
12650
|
+
*/
|
|
12651
|
+
async function initializeBaseRequest(request, config, performanceClient, logger) {
|
|
12652
|
+
performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
12653
|
+
const authority = request.authority || config.auth.authority;
|
|
12654
|
+
const scopes = [...((request && request.scopes) || [])];
|
|
12655
|
+
const validatedRequest = {
|
|
12656
|
+
...request,
|
|
12657
|
+
correlationId: request.correlationId,
|
|
12658
|
+
authority,
|
|
12659
|
+
scopes,
|
|
12660
|
+
};
|
|
12661
|
+
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
12662
|
+
if (!validatedRequest.authenticationScheme) {
|
|
12663
|
+
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
12664
|
+
logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
12665
|
+
}
|
|
12666
|
+
else {
|
|
12667
|
+
if (validatedRequest.authenticationScheme === AuthenticationScheme.SSH) {
|
|
12668
|
+
if (!request.sshJwk) {
|
|
12669
|
+
throw createClientConfigurationError(missingSshJwk);
|
|
12670
|
+
}
|
|
12671
|
+
if (!request.sshKid) {
|
|
12672
|
+
throw createClientConfigurationError(missingSshKid);
|
|
12673
|
+
}
|
|
12674
|
+
}
|
|
12675
|
+
logger.verbose(`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`);
|
|
12676
|
+
}
|
|
12677
|
+
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
12678
|
+
if (config.cache.claimsBasedCachingEnabled &&
|
|
12679
|
+
request.claims &&
|
|
12680
|
+
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
12681
|
+
!StringUtils.isEmptyObj(request.claims)) {
|
|
12682
|
+
validatedRequest.requestedClaimsHash = await hashString(request.claims);
|
|
12683
|
+
}
|
|
12684
|
+
return validatedRequest;
|
|
12685
|
+
}
|
|
12686
|
+
async function initializeSilentRequest(request, account, config, performanceClient, logger) {
|
|
12687
|
+
performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
12688
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, logger, performanceClient, request.correlationId)(request, config, performanceClient, logger);
|
|
12689
|
+
return {
|
|
12690
|
+
...request,
|
|
12691
|
+
...baseRequest,
|
|
12692
|
+
account: account,
|
|
12693
|
+
forceRefresh: request.forceRefresh || false,
|
|
12694
|
+
};
|
|
12695
|
+
}
|
|
12696
|
+
|
|
12302
12697
|
/*
|
|
12303
12698
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12304
12699
|
* Licensed under the MIT License.
|
|
@@ -12473,7 +12868,7 @@
|
|
|
12473
12868
|
interactionType: interactionType,
|
|
12474
12869
|
};
|
|
12475
12870
|
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
12476
|
-
const baseRequest = await invokeAsync(
|
|
12871
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)({ ...request, correlationId: this.correlationId }, this.config, this.performanceClient, this.logger);
|
|
12477
12872
|
const validatedRequest = {
|
|
12478
12873
|
...baseRequest,
|
|
12479
12874
|
redirectUri: redirectUri,
|
|
@@ -12592,7 +12987,8 @@
|
|
|
12592
12987
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
12593
12988
|
// Telemetry manager only used to increment cacheHits here
|
|
12594
12989
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
12595
|
-
const
|
|
12990
|
+
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
|
|
12991
|
+
const silentAuthClient = new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12596
12992
|
this.logger.verbose("Silent auth client created");
|
|
12597
12993
|
try {
|
|
12598
12994
|
const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
@@ -12619,26 +13015,6 @@
|
|
|
12619
13015
|
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
|
12620
13016
|
return this.clearCacheOnLogout(validLogoutRequest?.account);
|
|
12621
13017
|
}
|
|
12622
|
-
/**
|
|
12623
|
-
* Creates an Silent Flow Client with the given authority, or the default authority.
|
|
12624
|
-
* @param serverTelemetryManager
|
|
12625
|
-
* @param authorityUrl
|
|
12626
|
-
*/
|
|
12627
|
-
async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
|
|
12628
|
-
// Create auth module.
|
|
12629
|
-
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
|
|
12630
|
-
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12631
|
-
}
|
|
12632
|
-
async initializeSilentRequest(request, account) {
|
|
12633
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
12634
|
-
const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
12635
|
-
return {
|
|
12636
|
-
...request,
|
|
12637
|
-
...baseRequest,
|
|
12638
|
-
account: account,
|
|
12639
|
-
forceRefresh: request.forceRefresh || false,
|
|
12640
|
-
};
|
|
12641
|
-
}
|
|
12642
13018
|
}
|
|
12643
13019
|
|
|
12644
13020
|
/*
|
|
@@ -12750,6 +13126,7 @@
|
|
|
12750
13126
|
const fullAccount = {
|
|
12751
13127
|
...account,
|
|
12752
13128
|
idTokenClaims: result?.idTokenClaims,
|
|
13129
|
+
idToken: result?.idToken,
|
|
12753
13130
|
};
|
|
12754
13131
|
return {
|
|
12755
13132
|
...result,
|
|
@@ -12851,15 +13228,19 @@
|
|
|
12851
13228
|
*/
|
|
12852
13229
|
async handleNativeResponse(response, request, reqTimestamp) {
|
|
12853
13230
|
this.logger.trace("NativeInteractionClient - handleNativeResponse called.");
|
|
12854
|
-
|
|
13231
|
+
// generate identifiers
|
|
13232
|
+
const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
|
|
13233
|
+
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
|
13234
|
+
const cachedhomeAccountId = this.browserStorage.getAccountInfoFilteredBy({
|
|
13235
|
+
nativeAccountId: request.accountId,
|
|
13236
|
+
})?.homeAccountId;
|
|
13237
|
+
if (homeAccountIdentifier !== cachedhomeAccountId &&
|
|
13238
|
+
response.account.id !== request.accountId) {
|
|
12855
13239
|
// User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
|
|
12856
13240
|
throw createNativeAuthError(userSwitch);
|
|
12857
13241
|
}
|
|
12858
13242
|
// Get the preferred_cache domain for the given authority
|
|
12859
13243
|
const authority = await this.getDiscoveredAuthority(request.authority);
|
|
12860
|
-
// generate identifiers
|
|
12861
|
-
const idTokenClaims = extractTokenClaims(response.id_token, base64Decode);
|
|
12862
|
-
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
|
12863
13244
|
const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, idTokenClaims, base64Decode, response.client_info, undefined, // environment
|
|
12864
13245
|
idTokenClaims.tid, undefined, // auth code payload
|
|
12865
13246
|
response.account.id, this.logger);
|
|
@@ -12955,7 +13336,14 @@
|
|
|
12955
13336
|
idTokenClaims.tid ||
|
|
12956
13337
|
Constants.EMPTY_STRING;
|
|
12957
13338
|
const accountInfo = updateAccountTenantProfileData(accountEntity.getAccountInfo(), undefined, // tenantProfile optional
|
|
12958
|
-
idTokenClaims);
|
|
13339
|
+
idTokenClaims, response.id_token);
|
|
13340
|
+
/**
|
|
13341
|
+
* In pairwise broker flows, this check prevents the broker's native account id
|
|
13342
|
+
* from being returned over the embedded app's account id.
|
|
13343
|
+
*/
|
|
13344
|
+
if (accountInfo.nativeAccountId !== response.account.id) {
|
|
13345
|
+
accountInfo.nativeAccountId = response.account.id;
|
|
13346
|
+
}
|
|
12959
13347
|
// generate PoP token as needed
|
|
12960
13348
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
12961
13349
|
const tokenType = request.tokenType === AuthenticationScheme.POP
|
|
@@ -14617,17 +15005,20 @@
|
|
|
14617
15005
|
(!request.account || !request.account.username)) {
|
|
14618
15006
|
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
|
14619
15007
|
}
|
|
14620
|
-
// Check
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
15008
|
+
// Check the prompt value
|
|
15009
|
+
const inputRequest = { ...request };
|
|
15010
|
+
if (inputRequest.prompt) {
|
|
15011
|
+
if (inputRequest.prompt !== PromptValue.NONE &&
|
|
15012
|
+
inputRequest.prompt !== PromptValue.NO_SESSION) {
|
|
15013
|
+
this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${inputRequest.prompt} with ${PromptValue.NONE}`);
|
|
15014
|
+
inputRequest.prompt = PromptValue.NONE;
|
|
15015
|
+
}
|
|
15016
|
+
}
|
|
15017
|
+
else {
|
|
15018
|
+
inputRequest.prompt = PromptValue.NONE;
|
|
14625
15019
|
}
|
|
14626
15020
|
// Create silent request
|
|
14627
|
-
const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(
|
|
14628
|
-
...request,
|
|
14629
|
-
prompt: request.prompt || PromptValue.NONE,
|
|
14630
|
-
}, exports.InteractionType.Silent);
|
|
15021
|
+
const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, exports.InteractionType.Silent);
|
|
14631
15022
|
preconnect(silentRequest.authority);
|
|
14632
15023
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
14633
15024
|
try {
|
|
@@ -14703,7 +15094,7 @@
|
|
|
14703
15094
|
*/
|
|
14704
15095
|
async acquireToken(request) {
|
|
14705
15096
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
14706
|
-
const baseRequest = await invokeAsync(
|
|
15097
|
+
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger);
|
|
14707
15098
|
const silentRequest = {
|
|
14708
15099
|
...request,
|
|
14709
15100
|
...baseRequest,
|
|
@@ -15059,7 +15450,6 @@
|
|
|
15059
15450
|
* @param configuration Object for the MSAL PublicClientApplication instance
|
|
15060
15451
|
*/
|
|
15061
15452
|
constructor(operatingContext) {
|
|
15062
|
-
this.atsAsyncMeasurement = undefined;
|
|
15063
15453
|
this.operatingContext = operatingContext;
|
|
15064
15454
|
this.isBrowserEnvironment =
|
|
15065
15455
|
this.operatingContext.isBrowserEnvironment();
|
|
@@ -15111,14 +15501,12 @@
|
|
|
15111
15501
|
await controller.initialize();
|
|
15112
15502
|
return controller;
|
|
15113
15503
|
}
|
|
15114
|
-
trackPageVisibility() {
|
|
15115
|
-
if (!
|
|
15504
|
+
trackPageVisibility(correlationId) {
|
|
15505
|
+
if (!correlationId) {
|
|
15116
15506
|
return;
|
|
15117
15507
|
}
|
|
15118
15508
|
this.logger.info("Perf: Visibility change detected");
|
|
15119
|
-
this.
|
|
15120
|
-
visibilityChangeCount: 1,
|
|
15121
|
-
});
|
|
15509
|
+
this.performanceClient.incrementFields({ visibilityChangeCount: 1 }, correlationId);
|
|
15122
15510
|
}
|
|
15123
15511
|
/**
|
|
15124
15512
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
@@ -15223,18 +15611,9 @@
|
|
|
15223
15611
|
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15224
15612
|
}
|
|
15225
15613
|
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15226
|
-
|
|
15227
|
-
|
|
15228
|
-
|
|
15229
|
-
errorCode: eventError.errorCode,
|
|
15230
|
-
subErrorCode: eventError.subError,
|
|
15231
|
-
});
|
|
15232
|
-
}
|
|
15233
|
-
else {
|
|
15234
|
-
rootMeasurement.end({
|
|
15235
|
-
success: false,
|
|
15236
|
-
});
|
|
15237
|
-
}
|
|
15614
|
+
rootMeasurement.end({
|
|
15615
|
+
success: false,
|
|
15616
|
+
}, eventError);
|
|
15238
15617
|
throw e;
|
|
15239
15618
|
});
|
|
15240
15619
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
@@ -15260,7 +15639,8 @@
|
|
|
15260
15639
|
// Preflight request
|
|
15261
15640
|
const correlationId = this.getRequestCorrelationId(request);
|
|
15262
15641
|
this.logger.verbose("acquireTokenRedirect called", correlationId);
|
|
15263
|
-
this.
|
|
15642
|
+
redirectPreflightCheck(this.initialized, this.config);
|
|
15643
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15264
15644
|
// If logged in, emit acquire token events
|
|
15265
15645
|
const isLoggedIn = this.getAllAccounts().length > 0;
|
|
15266
15646
|
if (isLoggedIn) {
|
|
@@ -15286,7 +15666,7 @@
|
|
|
15286
15666
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
15287
15667
|
return redirectClient.acquireToken(request);
|
|
15288
15668
|
}
|
|
15289
|
-
this.
|
|
15669
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15290
15670
|
throw e;
|
|
15291
15671
|
});
|
|
15292
15672
|
}
|
|
@@ -15319,7 +15699,8 @@
|
|
|
15319
15699
|
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
15320
15700
|
try {
|
|
15321
15701
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
15322
|
-
this.
|
|
15702
|
+
preflightCheck(this.initialized);
|
|
15703
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15323
15704
|
}
|
|
15324
15705
|
catch (e) {
|
|
15325
15706
|
// Since this function is syncronous we need to reject
|
|
@@ -15340,7 +15721,7 @@
|
|
|
15340
15721
|
correlationId,
|
|
15341
15722
|
}, ApiId.acquireTokenPopup)
|
|
15342
15723
|
.then((response) => {
|
|
15343
|
-
this.
|
|
15724
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15344
15725
|
atPopupMeasurement.end({
|
|
15345
15726
|
success: true,
|
|
15346
15727
|
isNativeBroker: true,
|
|
@@ -15360,7 +15741,7 @@
|
|
|
15360
15741
|
const popupClient = this.createPopupClient(correlationId);
|
|
15361
15742
|
return popupClient.acquireToken(request);
|
|
15362
15743
|
}
|
|
15363
|
-
this.
|
|
15744
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
15364
15745
|
throw e;
|
|
15365
15746
|
});
|
|
15366
15747
|
}
|
|
@@ -15398,10 +15779,8 @@
|
|
|
15398
15779
|
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
15399
15780
|
}
|
|
15400
15781
|
atPopupMeasurement.end({
|
|
15401
|
-
errorCode: e.errorCode,
|
|
15402
|
-
subErrorCode: e.subError,
|
|
15403
15782
|
success: false,
|
|
15404
|
-
});
|
|
15783
|
+
}, e);
|
|
15405
15784
|
// Since this function is syncronous we need to reject
|
|
15406
15785
|
return Promise.reject(e);
|
|
15407
15786
|
});
|
|
@@ -15442,7 +15821,7 @@
|
|
|
15442
15821
|
prompt: request.prompt,
|
|
15443
15822
|
correlationId: correlationId,
|
|
15444
15823
|
};
|
|
15445
|
-
this.
|
|
15824
|
+
preflightCheck(this.initialized);
|
|
15446
15825
|
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
|
|
15447
15826
|
this.ssoSilentMeasurement?.increment({
|
|
15448
15827
|
visibilityChangeCount: 0,
|
|
@@ -15483,10 +15862,8 @@
|
|
|
15483
15862
|
.catch((e) => {
|
|
15484
15863
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15485
15864
|
this.ssoSilentMeasurement?.end({
|
|
15486
|
-
errorCode: e.errorCode,
|
|
15487
|
-
subErrorCode: e.subError,
|
|
15488
15865
|
success: false,
|
|
15489
|
-
});
|
|
15866
|
+
}, e);
|
|
15490
15867
|
throw e;
|
|
15491
15868
|
})
|
|
15492
15869
|
.finally(() => {
|
|
@@ -15505,8 +15882,8 @@
|
|
|
15505
15882
|
*/
|
|
15506
15883
|
async acquireTokenByCode(request) {
|
|
15507
15884
|
const correlationId = this.getRequestCorrelationId(request);
|
|
15508
|
-
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15509
15885
|
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
15886
|
+
preflightCheck(this.initialized);
|
|
15510
15887
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
15511
15888
|
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
|
|
15512
15889
|
try {
|
|
@@ -15541,10 +15918,8 @@
|
|
|
15541
15918
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
15542
15919
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
15543
15920
|
atbcMeasurement.end({
|
|
15544
|
-
errorCode: error.errorCode,
|
|
15545
|
-
subErrorCode: error.subError,
|
|
15546
15921
|
success: false,
|
|
15547
|
-
});
|
|
15922
|
+
}, error);
|
|
15548
15923
|
throw error;
|
|
15549
15924
|
});
|
|
15550
15925
|
this.hybridAuthCodeResponses.set(hybridAuthCode, response);
|
|
@@ -15580,10 +15955,8 @@
|
|
|
15580
15955
|
catch (e) {
|
|
15581
15956
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15582
15957
|
atbcMeasurement.end({
|
|
15583
|
-
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
15584
|
-
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
15585
15958
|
success: false,
|
|
15586
|
-
});
|
|
15959
|
+
}, e);
|
|
15587
15960
|
throw e;
|
|
15588
15961
|
}
|
|
15589
15962
|
}
|
|
@@ -15614,10 +15987,8 @@
|
|
|
15614
15987
|
})
|
|
15615
15988
|
.catch((tokenRenewalError) => {
|
|
15616
15989
|
this.acquireTokenByCodeAsyncMeasurement?.end({
|
|
15617
|
-
errorCode: tokenRenewalError.errorCode,
|
|
15618
|
-
subErrorCode: tokenRenewalError.subError,
|
|
15619
15990
|
success: false,
|
|
15620
|
-
});
|
|
15991
|
+
}, tokenRenewalError);
|
|
15621
15992
|
throw tokenRenewalError;
|
|
15622
15993
|
})
|
|
15623
15994
|
.finally(() => {
|
|
@@ -15632,12 +16003,13 @@
|
|
|
15632
16003
|
* @param silentRequest SilentRequest
|
|
15633
16004
|
* @returns A promise that, when resolved, returns the access token
|
|
15634
16005
|
*/
|
|
15635
|
-
async acquireTokenFromCache(
|
|
16006
|
+
async acquireTokenFromCache(commonRequest, cacheLookupPolicy) {
|
|
15636
16007
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
15637
16008
|
switch (cacheLookupPolicy) {
|
|
15638
16009
|
case CacheLookupPolicy.Default:
|
|
15639
16010
|
case CacheLookupPolicy.AccessToken:
|
|
15640
16011
|
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
16012
|
+
const silentCacheClient = this.createSilentCacheClient(commonRequest.correlationId);
|
|
15641
16013
|
return invokeAsync(silentCacheClient.acquireToken.bind(silentCacheClient), PerformanceEvents.SilentCacheClientAcquireToken, this.logger, this.performanceClient, commonRequest.correlationId)(commonRequest);
|
|
15642
16014
|
default:
|
|
15643
16015
|
throw createClientAuthError(tokenRefreshRequired);
|
|
@@ -15694,7 +16066,8 @@
|
|
|
15694
16066
|
*/
|
|
15695
16067
|
async logoutRedirect(logoutRequest) {
|
|
15696
16068
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
15697
|
-
this.
|
|
16069
|
+
redirectPreflightCheck(this.initialized, this.config);
|
|
16070
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15698
16071
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
15699
16072
|
return redirectClient.logout(logoutRequest);
|
|
15700
16073
|
}
|
|
@@ -15705,7 +16078,8 @@
|
|
|
15705
16078
|
logoutPopup(logoutRequest) {
|
|
15706
16079
|
try {
|
|
15707
16080
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
15708
|
-
this.
|
|
16081
|
+
preflightCheck(this.initialized);
|
|
16082
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15709
16083
|
const popupClient = this.createPopupClient(correlationId);
|
|
15710
16084
|
return popupClient.logout(logoutRequest);
|
|
15711
16085
|
}
|
|
@@ -15871,52 +16245,6 @@
|
|
|
15871
16245
|
}
|
|
15872
16246
|
}
|
|
15873
16247
|
// #region Helpers
|
|
15874
|
-
/**
|
|
15875
|
-
* Helper to validate app environment before making an auth request
|
|
15876
|
-
*
|
|
15877
|
-
* @protected
|
|
15878
|
-
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
15879
|
-
* @param {boolean} [isAppEmbedded=false] Whether to set interaction in progress temp cache flag
|
|
15880
|
-
*/
|
|
15881
|
-
preflightBrowserEnvironmentCheck(interactionType, isAppEmbedded = false) {
|
|
15882
|
-
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
15883
|
-
// Block request if not in browser environment
|
|
15884
|
-
blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
15885
|
-
// Block redirects if in an iframe
|
|
15886
|
-
blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);
|
|
15887
|
-
// Block auth requests inside a hidden iframe
|
|
15888
|
-
blockReloadInHiddenIframes();
|
|
15889
|
-
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
15890
|
-
blockAcquireTokenInPopups();
|
|
15891
|
-
// Block token acquisition before initialize has been called
|
|
15892
|
-
blockAPICallsBeforeInitialize(this.initialized);
|
|
15893
|
-
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
15894
|
-
if (interactionType === exports.InteractionType.Redirect &&
|
|
15895
|
-
this.config.cache.cacheLocation ===
|
|
15896
|
-
BrowserCacheLocation.MemoryStorage &&
|
|
15897
|
-
!this.config.cache.storeAuthStateInCookie) {
|
|
15898
|
-
throw createBrowserConfigurationAuthError(inMemRedirectUnavailable);
|
|
15899
|
-
}
|
|
15900
|
-
if (interactionType === exports.InteractionType.Redirect ||
|
|
15901
|
-
interactionType === exports.InteractionType.Popup) {
|
|
15902
|
-
this.preflightInteractiveRequest(!isAppEmbedded);
|
|
15903
|
-
}
|
|
15904
|
-
}
|
|
15905
|
-
/**
|
|
15906
|
-
* Preflight check for interactive requests
|
|
15907
|
-
*
|
|
15908
|
-
* @protected
|
|
15909
|
-
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
|
|
15910
|
-
*/
|
|
15911
|
-
preflightInteractiveRequest(setInteractionInProgress) {
|
|
15912
|
-
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
15913
|
-
// block the reload if it occurred inside a hidden iframe
|
|
15914
|
-
blockReloadInHiddenIframes();
|
|
15915
|
-
// Set interaction in progress temporary cache or throw if alread set.
|
|
15916
|
-
if (setInteractionInProgress) {
|
|
15917
|
-
this.getBrowserStorage().setInteractionInProgress(true);
|
|
15918
|
-
}
|
|
15919
|
-
}
|
|
15920
16248
|
/**
|
|
15921
16249
|
* Acquire a token from native device (e.g. WAM)
|
|
15922
16250
|
* @param request
|
|
@@ -16101,12 +16429,6 @@
|
|
|
16101
16429
|
getPerformanceClient() {
|
|
16102
16430
|
return this.performanceClient;
|
|
16103
16431
|
}
|
|
16104
|
-
/**
|
|
16105
|
-
* Returns the browser storage
|
|
16106
|
-
*/
|
|
16107
|
-
getBrowserStorage() {
|
|
16108
|
-
return this.browserStorage;
|
|
16109
|
-
}
|
|
16110
16432
|
/**
|
|
16111
16433
|
* Returns the browser env indicator
|
|
16112
16434
|
*/
|
|
@@ -16184,7 +16506,7 @@
|
|
|
16184
16506
|
atsMeasurement.add({
|
|
16185
16507
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
16186
16508
|
});
|
|
16187
|
-
this.
|
|
16509
|
+
preflightCheck(this.initialized);
|
|
16188
16510
|
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
16189
16511
|
const account = request.account || this.getActiveAccount();
|
|
16190
16512
|
if (!account) {
|
|
@@ -16229,10 +16551,8 @@
|
|
|
16229
16551
|
.catch((error) => {
|
|
16230
16552
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
16231
16553
|
atsMeasurement.end({
|
|
16232
|
-
errorCode: error.errorCode,
|
|
16233
|
-
subErrorCode: error.subError,
|
|
16234
16554
|
success: false,
|
|
16235
|
-
});
|
|
16555
|
+
}, error);
|
|
16236
16556
|
throw error;
|
|
16237
16557
|
});
|
|
16238
16558
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
@@ -16260,11 +16580,10 @@
|
|
|
16260
16580
|
async acquireTokenSilentAsync(request, account) {
|
|
16261
16581
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
16262
16582
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
document.addEventListener("visibilitychange", this.trackPageVisibility);
|
|
16583
|
+
if (request.correlationId) {
|
|
16584
|
+
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
16585
|
+
}
|
|
16586
|
+
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16268
16587
|
let result;
|
|
16269
16588
|
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) &&
|
|
16270
16589
|
account.nativeAccountId) {
|
|
@@ -16287,16 +16606,13 @@
|
|
|
16287
16606
|
}
|
|
16288
16607
|
else {
|
|
16289
16608
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16290
|
-
const
|
|
16291
|
-
const silentRequest = await invokeAsync(silentCacheClient.initializeSilentRequest.bind(silentCacheClient), PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account);
|
|
16609
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
16292
16610
|
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
16293
|
-
result = invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(
|
|
16611
|
+
result = invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
16294
16612
|
if (request.cacheLookupPolicy ===
|
|
16295
16613
|
CacheLookupPolicy.AccessToken) {
|
|
16296
16614
|
throw cacheError;
|
|
16297
16615
|
}
|
|
16298
|
-
// block the reload if it occurred inside a hidden iframe
|
|
16299
|
-
blockReloadInHiddenIframes();
|
|
16300
16616
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
16301
16617
|
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((refreshTokenError) => {
|
|
16302
16618
|
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, silentRequest, cacheLookupPolicy);
|
|
@@ -16314,25 +16630,21 @@
|
|
|
16314
16630
|
return result
|
|
16315
16631
|
.then((response) => {
|
|
16316
16632
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
16317
|
-
|
|
16318
|
-
|
|
16319
|
-
|
|
16320
|
-
|
|
16321
|
-
|
|
16322
|
-
|
|
16633
|
+
if (request.correlationId) {
|
|
16634
|
+
this.performanceClient.addFields({
|
|
16635
|
+
fromCache: response.fromCache,
|
|
16636
|
+
isNativeBroker: response.fromNativeBroker,
|
|
16637
|
+
requestId: response.requestId,
|
|
16638
|
+
}, request.correlationId);
|
|
16639
|
+
}
|
|
16323
16640
|
return response;
|
|
16324
16641
|
})
|
|
16325
16642
|
.catch((tokenRenewalError) => {
|
|
16326
16643
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
16327
|
-
this.atsAsyncMeasurement?.end({
|
|
16328
|
-
errorCode: tokenRenewalError.errorCode,
|
|
16329
|
-
subErrorCode: tokenRenewalError.subError,
|
|
16330
|
-
success: false,
|
|
16331
|
-
});
|
|
16332
16644
|
throw tokenRenewalError;
|
|
16333
16645
|
})
|
|
16334
16646
|
.finally(() => {
|
|
16335
|
-
document.removeEventListener("visibilitychange", this.trackPageVisibility);
|
|
16647
|
+
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16336
16648
|
});
|
|
16337
16649
|
}
|
|
16338
16650
|
}
|
|
@@ -16773,27 +17085,27 @@
|
|
|
16773
17085
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16774
17086
|
acquireTokenPopup(request) {
|
|
16775
17087
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16776
|
-
blockNonBrowserEnvironment(
|
|
17088
|
+
blockNonBrowserEnvironment();
|
|
16777
17089
|
return {};
|
|
16778
17090
|
}
|
|
16779
17091
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16780
17092
|
acquireTokenRedirect(request) {
|
|
16781
17093
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16782
|
-
blockNonBrowserEnvironment(
|
|
17094
|
+
blockNonBrowserEnvironment();
|
|
16783
17095
|
return Promise.resolve();
|
|
16784
17096
|
}
|
|
16785
17097
|
acquireTokenSilent(
|
|
16786
17098
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16787
17099
|
silentRequest) {
|
|
16788
17100
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16789
|
-
blockNonBrowserEnvironment(
|
|
17101
|
+
blockNonBrowserEnvironment();
|
|
16790
17102
|
return {};
|
|
16791
17103
|
}
|
|
16792
17104
|
acquireTokenByCode(
|
|
16793
17105
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16794
17106
|
request) {
|
|
16795
17107
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16796
|
-
blockNonBrowserEnvironment(
|
|
17108
|
+
blockNonBrowserEnvironment();
|
|
16797
17109
|
return {};
|
|
16798
17110
|
}
|
|
16799
17111
|
acquireTokenNative(
|
|
@@ -16804,7 +17116,7 @@
|
|
|
16804
17116
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16805
17117
|
accountId) {
|
|
16806
17118
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16807
|
-
blockNonBrowserEnvironment(
|
|
17119
|
+
blockNonBrowserEnvironment();
|
|
16808
17120
|
return {};
|
|
16809
17121
|
}
|
|
16810
17122
|
acquireTokenByRefreshToken(
|
|
@@ -16813,7 +17125,7 @@
|
|
|
16813
17125
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16814
17126
|
silentRequest) {
|
|
16815
17127
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16816
|
-
blockNonBrowserEnvironment(
|
|
17128
|
+
blockNonBrowserEnvironment();
|
|
16817
17129
|
return {};
|
|
16818
17130
|
}
|
|
16819
17131
|
addEventCallback(callback) {
|
|
@@ -16825,22 +17137,22 @@
|
|
|
16825
17137
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16826
17138
|
addPerformanceCallback(callback) {
|
|
16827
17139
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16828
|
-
blockNonBrowserEnvironment(
|
|
17140
|
+
blockNonBrowserEnvironment();
|
|
16829
17141
|
return "";
|
|
16830
17142
|
}
|
|
16831
17143
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16832
17144
|
removePerformanceCallback(callbackId) {
|
|
16833
17145
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16834
|
-
blockNonBrowserEnvironment(
|
|
17146
|
+
blockNonBrowserEnvironment();
|
|
16835
17147
|
return true;
|
|
16836
17148
|
}
|
|
16837
17149
|
enableAccountStorageEvents() {
|
|
16838
17150
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16839
|
-
blockNonBrowserEnvironment(
|
|
17151
|
+
blockNonBrowserEnvironment();
|
|
16840
17152
|
}
|
|
16841
17153
|
disableAccountStorageEvents() {
|
|
16842
17154
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16843
|
-
blockNonBrowserEnvironment(
|
|
17155
|
+
blockNonBrowserEnvironment();
|
|
16844
17156
|
}
|
|
16845
17157
|
handleRedirectPromise(
|
|
16846
17158
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -16852,45 +17164,45 @@
|
|
|
16852
17164
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16853
17165
|
request) {
|
|
16854
17166
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16855
|
-
blockNonBrowserEnvironment(
|
|
17167
|
+
blockNonBrowserEnvironment();
|
|
16856
17168
|
return {};
|
|
16857
17169
|
}
|
|
16858
17170
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16859
17171
|
loginRedirect(request) {
|
|
16860
17172
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16861
|
-
blockNonBrowserEnvironment(
|
|
17173
|
+
blockNonBrowserEnvironment();
|
|
16862
17174
|
return {};
|
|
16863
17175
|
}
|
|
16864
17176
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16865
17177
|
logout(logoutRequest) {
|
|
16866
17178
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16867
|
-
blockNonBrowserEnvironment(
|
|
17179
|
+
blockNonBrowserEnvironment();
|
|
16868
17180
|
return {};
|
|
16869
17181
|
}
|
|
16870
17182
|
logoutRedirect(
|
|
16871
17183
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16872
17184
|
logoutRequest) {
|
|
16873
17185
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16874
|
-
blockNonBrowserEnvironment(
|
|
17186
|
+
blockNonBrowserEnvironment();
|
|
16875
17187
|
return {};
|
|
16876
17188
|
}
|
|
16877
17189
|
logoutPopup(
|
|
16878
17190
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16879
17191
|
logoutRequest) {
|
|
16880
17192
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16881
|
-
blockNonBrowserEnvironment(
|
|
17193
|
+
blockNonBrowserEnvironment();
|
|
16882
17194
|
return {};
|
|
16883
17195
|
}
|
|
16884
17196
|
ssoSilent(
|
|
16885
17197
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16886
17198
|
request) {
|
|
16887
17199
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16888
|
-
blockNonBrowserEnvironment(
|
|
17200
|
+
blockNonBrowserEnvironment();
|
|
16889
17201
|
return {};
|
|
16890
17202
|
}
|
|
16891
17203
|
getTokenCache() {
|
|
16892
17204
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16893
|
-
blockNonBrowserEnvironment(
|
|
17205
|
+
blockNonBrowserEnvironment();
|
|
16894
17206
|
return {};
|
|
16895
17207
|
}
|
|
16896
17208
|
getLogger() {
|
|
@@ -16899,16 +17211,16 @@
|
|
|
16899
17211
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16900
17212
|
setLogger(logger) {
|
|
16901
17213
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16902
|
-
blockNonBrowserEnvironment(
|
|
17214
|
+
blockNonBrowserEnvironment();
|
|
16903
17215
|
}
|
|
16904
17216
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16905
17217
|
setActiveAccount(account) {
|
|
16906
17218
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16907
|
-
blockNonBrowserEnvironment(
|
|
17219
|
+
blockNonBrowserEnvironment();
|
|
16908
17220
|
}
|
|
16909
17221
|
getActiveAccount() {
|
|
16910
17222
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16911
|
-
blockNonBrowserEnvironment(
|
|
17223
|
+
blockNonBrowserEnvironment();
|
|
16912
17224
|
return null;
|
|
16913
17225
|
}
|
|
16914
17226
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -16918,43 +17230,35 @@
|
|
|
16918
17230
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16919
17231
|
setNavigationClient(navigationClient) {
|
|
16920
17232
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16921
|
-
blockNonBrowserEnvironment(
|
|
17233
|
+
blockNonBrowserEnvironment();
|
|
16922
17234
|
}
|
|
16923
17235
|
getConfiguration() {
|
|
16924
17236
|
return this.config;
|
|
16925
17237
|
}
|
|
16926
17238
|
isBrowserEnv() {
|
|
16927
17239
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16928
|
-
blockNonBrowserEnvironment(
|
|
17240
|
+
blockNonBrowserEnvironment();
|
|
16929
17241
|
return true;
|
|
16930
17242
|
}
|
|
16931
17243
|
getBrowserCrypto() {
|
|
16932
17244
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16933
|
-
blockNonBrowserEnvironment(
|
|
17245
|
+
blockNonBrowserEnvironment();
|
|
16934
17246
|
return {};
|
|
16935
17247
|
}
|
|
16936
17248
|
getPerformanceClient() {
|
|
16937
17249
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16938
|
-
blockNonBrowserEnvironment(
|
|
17250
|
+
blockNonBrowserEnvironment();
|
|
16939
17251
|
return {};
|
|
16940
17252
|
}
|
|
16941
17253
|
getRedirectResponse() {
|
|
16942
17254
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16943
|
-
blockNonBrowserEnvironment(
|
|
17255
|
+
blockNonBrowserEnvironment();
|
|
16944
17256
|
return {};
|
|
16945
17257
|
}
|
|
16946
|
-
preflightBrowserEnvironmentCheck(
|
|
16947
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16948
|
-
interactionType,
|
|
16949
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16950
|
-
isAppEmbedded) {
|
|
16951
|
-
blockAPICallsBeforeInitialize(this.initialized);
|
|
16952
|
-
blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
16953
|
-
}
|
|
16954
17258
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16955
17259
|
async clearCache(logoutRequest) {
|
|
16956
17260
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16957
|
-
blockNonBrowserEnvironment(
|
|
17261
|
+
blockNonBrowserEnvironment();
|
|
16958
17262
|
}
|
|
16959
17263
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16960
17264
|
async hydrateCache(
|
|
@@ -16963,7 +17267,7 @@
|
|
|
16963
17267
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16964
17268
|
request) {
|
|
16965
17269
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
16966
|
-
blockNonBrowserEnvironment(
|
|
17270
|
+
blockNonBrowserEnvironment();
|
|
16967
17271
|
}
|
|
16968
17272
|
}
|
|
16969
17273
|
|
|
@@ -17614,14 +17918,14 @@
|
|
|
17614
17918
|
return Math.round(window.performance.now() - startTime);
|
|
17615
17919
|
}
|
|
17616
17920
|
class BrowserPerformanceClient extends PerformanceClient {
|
|
17617
|
-
constructor(configuration, intFields) {
|
|
17921
|
+
constructor(configuration, intFields, abbreviations) {
|
|
17618
17922
|
super(configuration.auth.clientId, configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`, new Logger(configuration.system?.loggerOptions || {}, name, version), name, version, configuration.telemetry?.application || {
|
|
17619
17923
|
appName: "",
|
|
17620
17924
|
appVersion: "",
|
|
17621
|
-
}, intFields);
|
|
17925
|
+
}, intFields, abbreviations);
|
|
17622
17926
|
}
|
|
17623
17927
|
generateId() {
|
|
17624
|
-
return
|
|
17928
|
+
return createNewGuid();
|
|
17625
17929
|
}
|
|
17626
17930
|
getPageVisibility() {
|
|
17627
17931
|
return document.visibilityState?.toString() || null;
|
|
@@ -17662,13 +17966,13 @@
|
|
|
17662
17966
|
void browserMeasurement?.then((measurement) => measurement.startMeasurement());
|
|
17663
17967
|
return {
|
|
17664
17968
|
...inProgressEvent,
|
|
17665
|
-
end: (event) => {
|
|
17969
|
+
end: (event, error) => {
|
|
17666
17970
|
const res = inProgressEvent.end({
|
|
17667
17971
|
...event,
|
|
17668
17972
|
startPageVisibility,
|
|
17669
17973
|
endPageVisibility: this.getPageVisibility(),
|
|
17670
17974
|
durationMs: getPerfDurationMs(startTime),
|
|
17671
|
-
});
|
|
17975
|
+
}, error);
|
|
17672
17976
|
void browserMeasurement?.then((measurement) => measurement.endMeasurement());
|
|
17673
17977
|
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
17674
17978
|
return res;
|
|
@@ -17864,11 +18168,12 @@
|
|
|
17864
18168
|
}
|
|
17865
18169
|
const requestBuilder = new RequestParameterBuilder();
|
|
17866
18170
|
const claims = requestBuilder.addClientCapabilitiesToClaims(request.claims, this.clientCapabilities);
|
|
18171
|
+
const scopes = request.scopes || OIDC_DEFAULT_SCOPES;
|
|
17867
18172
|
const tokenRequest = {
|
|
17868
18173
|
platformBrokerId: request.account?.homeAccountId,
|
|
17869
18174
|
clientId: this.clientId,
|
|
17870
18175
|
authority: request.authority,
|
|
17871
|
-
scope:
|
|
18176
|
+
scope: scopes.join(" "),
|
|
17872
18177
|
correlationId: request.correlationId !== undefined
|
|
17873
18178
|
? request.correlationId
|
|
17874
18179
|
: this.crypto.createNewGuid(),
|
|
@@ -18050,12 +18355,22 @@
|
|
|
18050
18355
|
// do nothing not required by this controller
|
|
18051
18356
|
return Promise.resolve();
|
|
18052
18357
|
}
|
|
18358
|
+
ensureValidRequest(request) {
|
|
18359
|
+
if (request?.correlationId) {
|
|
18360
|
+
return request;
|
|
18361
|
+
}
|
|
18362
|
+
return {
|
|
18363
|
+
...request,
|
|
18364
|
+
correlationId: this.browserCrypto.createNewGuid(),
|
|
18365
|
+
};
|
|
18366
|
+
}
|
|
18053
18367
|
async acquireTokenInteractive(request) {
|
|
18054
|
-
this.
|
|
18055
|
-
|
|
18368
|
+
const validRequest = this.ensureValidRequest(request);
|
|
18369
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Popup, validRequest);
|
|
18370
|
+
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, validRequest.correlationId);
|
|
18056
18371
|
atPopupMeasurement?.add({ nestedAppAuthRequest: true });
|
|
18057
18372
|
try {
|
|
18058
|
-
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(
|
|
18373
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
18059
18374
|
const reqTimestamp = nowSeconds();
|
|
18060
18375
|
const response = await this.bridgeProxy.getTokenInteractive(naaRequest);
|
|
18061
18376
|
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
@@ -18075,16 +18390,15 @@
|
|
|
18075
18390
|
const error = this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
18076
18391
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
18077
18392
|
atPopupMeasurement.end({
|
|
18078
|
-
errorCode: error.errorCode,
|
|
18079
|
-
subErrorCode: error.subError,
|
|
18080
18393
|
success: false,
|
|
18081
|
-
});
|
|
18394
|
+
}, e);
|
|
18082
18395
|
throw error;
|
|
18083
18396
|
}
|
|
18084
18397
|
}
|
|
18085
18398
|
async acquireTokenSilentInternal(request) {
|
|
18086
|
-
this.
|
|
18087
|
-
|
|
18399
|
+
const validRequest = this.ensureValidRequest(request);
|
|
18400
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, validRequest);
|
|
18401
|
+
const ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, validRequest.correlationId);
|
|
18088
18402
|
ssoSilentMeasurement?.increment({
|
|
18089
18403
|
visibilityChangeCount: 0,
|
|
18090
18404
|
});
|
|
@@ -18092,7 +18406,7 @@
|
|
|
18092
18406
|
nestedAppAuthRequest: true,
|
|
18093
18407
|
});
|
|
18094
18408
|
try {
|
|
18095
|
-
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(
|
|
18409
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
18096
18410
|
const reqTimestamp = nowSeconds();
|
|
18097
18411
|
const response = await this.bridgeProxy.getTokenSilent(naaRequest);
|
|
18098
18412
|
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
@@ -18112,10 +18426,8 @@
|
|
|
18112
18426
|
const error = this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
18113
18427
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, e);
|
|
18114
18428
|
ssoSilentMeasurement?.end({
|
|
18115
|
-
errorCode: error.errorCode,
|
|
18116
|
-
subErrorCode: error.subError,
|
|
18117
18429
|
success: false,
|
|
18118
|
-
});
|
|
18430
|
+
}, e);
|
|
18119
18431
|
throw error;
|
|
18120
18432
|
}
|
|
18121
18433
|
}
|
|
@@ -18232,7 +18544,7 @@
|
|
|
18232
18544
|
}
|
|
18233
18545
|
handleRedirectPromise(hash // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18234
18546
|
) {
|
|
18235
|
-
|
|
18547
|
+
return Promise.resolve(null);
|
|
18236
18548
|
}
|
|
18237
18549
|
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18238
18550
|
) {
|
|
@@ -18325,11 +18637,6 @@
|
|
|
18325
18637
|
getRedirectResponse() {
|
|
18326
18638
|
throw NestedAppAuthError.createUnsupportedError();
|
|
18327
18639
|
}
|
|
18328
|
-
preflightBrowserEnvironmentCheck(interactionType, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18329
|
-
setInteractionInProgress // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18330
|
-
) {
|
|
18331
|
-
throw NestedAppAuthError.createUnsupportedError();
|
|
18332
|
-
}
|
|
18333
18640
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18334
18641
|
async clearCache(logoutRequest) {
|
|
18335
18642
|
throw NestedAppAuthError.createUnsupportedError();
|
|
@@ -18396,6 +18703,7 @@
|
|
|
18396
18703
|
exports.ServerResponseType = ServerResponseType;
|
|
18397
18704
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
18398
18705
|
exports.StringUtils = StringUtils;
|
|
18706
|
+
exports.StubPerformanceClient = StubPerformanceClient;
|
|
18399
18707
|
exports.UrlString = UrlString;
|
|
18400
18708
|
exports.WrapperSKU = WrapperSKU;
|
|
18401
18709
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|