@azure/msal-browser 4.0.0-alpha.0 → 4.0.2
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.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +4 -2
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +8 -8
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +10 -15
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +42 -43
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/CookieStorage.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/IWindowStorage.d.ts +2 -2
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.d.ts +7 -3
- package/dist/cache/LocalStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.mjs +48 -34
- package/dist/cache/LocalStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +15 -14
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +2 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +5 -5
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +6 -3
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +34 -18
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +2 -2
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +27 -23
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +2 -2
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +3 -3
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +1 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +3 -3
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +3 -3
- 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/NativeAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +2 -3
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +11 -9
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +4 -4
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +2 -2
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +2 -2
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +1 -1
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/request/SsoSilentRequest.d.ts +1 -1
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +4 -2
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +298 -249
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +298 -249
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +63 -63
- package/lib/types/app/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/broker/nativeBroker/NativeMessageHandler.d.ts +1 -1
- package/lib/types/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/lib/types/broker/nativeBroker/NativeResponse.d.ts +1 -1
- package/lib/types/cache/BrowserCacheManager.d.ts +10 -15
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/IWindowStorage.d.ts +2 -2
- package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/types/cache/LocalStorage.d.ts +7 -3
- package/lib/types/cache/LocalStorage.d.ts.map +1 -1
- package/lib/types/cache/TokenCache.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +2 -2
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/controllers/NestedAppAuthController.d.ts +6 -3
- package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts +2 -2
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/controllers/UnknownOperatingContextController.d.ts +2 -2
- package/lib/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/crypto/CryptoOps.d.ts +1 -1
- package/lib/types/crypto/CryptoOps.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts +2 -3
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/PopupRequest.d.ts +1 -1
- package/lib/types/request/PopupRequest.d.ts.map +1 -1
- package/lib/types/request/RedirectRequest.d.ts +1 -1
- package/lib/types/request/RedirectRequest.d.ts.map +1 -1
- package/lib/types/request/SsoSilentRequest.d.ts +1 -1
- package/lib/types/request/SsoSilentRequest.d.ts.map +1 -1
- package/lib/types/utils/BrowserUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +6 -1
- package/src/broker/nativeBroker/NativeMessageHandler.ts +7 -7
- package/src/broker/nativeBroker/NativeResponse.ts +1 -1
- package/src/cache/BrowserCacheManager.ts +88 -57
- package/src/cache/IWindowStorage.ts +2 -2
- package/src/cache/LocalStorage.ts +142 -43
- package/src/cache/TokenCache.ts +28 -11
- package/src/config/Configuration.ts +6 -6
- package/src/controllers/NestedAppAuthController.ts +51 -23
- package/src/controllers/StandardController.ts +41 -24
- package/src/controllers/UnknownOperatingContextController.ts +6 -5
- package/src/crypto/BrowserCrypto.ts +4 -2
- package/src/crypto/CryptoOps.ts +8 -2
- package/src/interaction_client/NativeInteractionClient.ts +16 -16
- package/src/interaction_client/PopupClient.ts +9 -8
- package/src/interaction_client/RedirectClient.ts +1 -1
- package/src/interaction_client/SilentIframeClient.ts +1 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthorizationUrlRequest.ts +1 -1
- package/src/request/PopupRequest.ts +1 -1
- package/src/request/RedirectRequest.ts +1 -1
- package/src/request/SsoSilentRequest.ts +1 -1
- package/src/utils/BrowserUtils.ts +3 -1
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v4.0.
|
|
1
|
+
/*! @azure/msal-browser v4.0.2 2025-01-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 v15.0.
|
|
9
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -310,7 +310,7 @@
|
|
|
310
310
|
// Token renewal offset default in seconds
|
|
311
311
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
312
312
|
|
|
313
|
-
/*! @azure/msal-common v15.0.
|
|
313
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
314
314
|
/*
|
|
315
315
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
316
316
|
* Licensed under the MIT License.
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
unexpectedError: unexpectedError
|
|
328
328
|
});
|
|
329
329
|
|
|
330
|
-
/*! @azure/msal-common v15.0.
|
|
330
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
331
331
|
|
|
332
332
|
/*
|
|
333
333
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
: AuthErrorMessages[code]);
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
/*! @azure/msal-common v15.0.
|
|
379
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
380
380
|
/*
|
|
381
381
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
382
382
|
* Licensed under the MIT License.
|
|
@@ -474,7 +474,7 @@
|
|
|
474
474
|
userTimeoutReached: userTimeoutReached
|
|
475
475
|
});
|
|
476
476
|
|
|
477
|
-
/*! @azure/msal-common v15.0.
|
|
477
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
478
478
|
|
|
479
479
|
/*
|
|
480
480
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -726,7 +726,7 @@
|
|
|
726
726
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
727
727
|
}
|
|
728
728
|
|
|
729
|
-
/*! @azure/msal-common v15.0.
|
|
729
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
730
730
|
|
|
731
731
|
/*
|
|
732
732
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -765,7 +765,7 @@
|
|
|
765
765
|
},
|
|
766
766
|
};
|
|
767
767
|
|
|
768
|
-
/*! @azure/msal-common v15.0.
|
|
768
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
769
769
|
|
|
770
770
|
/*
|
|
771
771
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -956,12 +956,12 @@
|
|
|
956
956
|
}
|
|
957
957
|
}
|
|
958
958
|
|
|
959
|
-
/*! @azure/msal-common v15.0.
|
|
959
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
960
960
|
/* eslint-disable header/header */
|
|
961
961
|
const name$1 = "@azure/msal-common";
|
|
962
|
-
const version$1 = "15.0.
|
|
962
|
+
const version$1 = "15.0.2";
|
|
963
963
|
|
|
964
|
-
/*! @azure/msal-common v15.0.
|
|
964
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
965
965
|
/*
|
|
966
966
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
967
967
|
* Licensed under the MIT License.
|
|
@@ -981,7 +981,7 @@
|
|
|
981
981
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
982
982
|
};
|
|
983
983
|
|
|
984
|
-
/*! @azure/msal-common v15.0.
|
|
984
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
985
985
|
|
|
986
986
|
/*
|
|
987
987
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1042,7 +1042,7 @@
|
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
|
-
/*! @azure/msal-common v15.0.
|
|
1045
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1046
1046
|
/*
|
|
1047
1047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1048
1048
|
* Licensed under the MIT License.
|
|
@@ -1079,7 +1079,7 @@
|
|
|
1079
1079
|
return cachedAtSec > nowSeconds();
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
1082
|
-
/*! @azure/msal-common v15.0.
|
|
1082
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1083
1083
|
|
|
1084
1084
|
/*
|
|
1085
1085
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1406,7 +1406,7 @@
|
|
|
1406
1406
|
return metadata.expiresAt <= nowSeconds();
|
|
1407
1407
|
}
|
|
1408
1408
|
|
|
1409
|
-
/*! @azure/msal-common v15.0.
|
|
1409
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1410
1410
|
/*
|
|
1411
1411
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1412
1412
|
* Licensed under the MIT License.
|
|
@@ -1431,14 +1431,14 @@
|
|
|
1431
1431
|
const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
|
|
1432
1432
|
const invalidAuthenticationHeader = "invalid_authentication_header";
|
|
1433
1433
|
const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
|
|
1434
|
-
const
|
|
1434
|
+
const cannotAllowPlatformBroker = "cannot_allow_platform_broker";
|
|
1435
1435
|
const authorityMismatch = "authority_mismatch";
|
|
1436
1436
|
|
|
1437
1437
|
var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
1438
1438
|
__proto__: null,
|
|
1439
1439
|
authorityMismatch: authorityMismatch,
|
|
1440
1440
|
authorityUriInsecure: authorityUriInsecure,
|
|
1441
|
-
|
|
1441
|
+
cannotAllowPlatformBroker: cannotAllowPlatformBroker,
|
|
1442
1442
|
cannotSetOIDCOptions: cannotSetOIDCOptions,
|
|
1443
1443
|
claimsRequestParsingError: claimsRequestParsingError,
|
|
1444
1444
|
emptyInputScopesError: emptyInputScopesError,
|
|
@@ -1460,7 +1460,7 @@
|
|
|
1460
1460
|
urlParseError: urlParseError
|
|
1461
1461
|
});
|
|
1462
1462
|
|
|
1463
|
-
/*! @azure/msal-common v15.0.
|
|
1463
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1464
1464
|
|
|
1465
1465
|
/*
|
|
1466
1466
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1487,7 +1487,7 @@
|
|
|
1487
1487
|
[missingNonceAuthenticationHeader]: "Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",
|
|
1488
1488
|
[invalidAuthenticationHeader]: "Invalid authentication header provided",
|
|
1489
1489
|
[cannotSetOIDCOptions]: "Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",
|
|
1490
|
-
[
|
|
1490
|
+
[cannotAllowPlatformBroker]: "Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",
|
|
1491
1491
|
[authorityMismatch]: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",
|
|
1492
1492
|
};
|
|
1493
1493
|
/**
|
|
@@ -1575,9 +1575,9 @@
|
|
|
1575
1575
|
code: cannotSetOIDCOptions,
|
|
1576
1576
|
desc: ClientConfigurationErrorMessages[cannotSetOIDCOptions],
|
|
1577
1577
|
},
|
|
1578
|
-
|
|
1579
|
-
code:
|
|
1580
|
-
desc: ClientConfigurationErrorMessages[
|
|
1578
|
+
cannotAllowPlatformBroker: {
|
|
1579
|
+
code: cannotAllowPlatformBroker,
|
|
1580
|
+
desc: ClientConfigurationErrorMessages[cannotAllowPlatformBroker],
|
|
1581
1581
|
},
|
|
1582
1582
|
authorityMismatch: {
|
|
1583
1583
|
code: authorityMismatch,
|
|
@@ -1598,7 +1598,7 @@
|
|
|
1598
1598
|
return new ClientConfigurationError(errorCode);
|
|
1599
1599
|
}
|
|
1600
1600
|
|
|
1601
|
-
/*! @azure/msal-common v15.0.
|
|
1601
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1602
1602
|
/*
|
|
1603
1603
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1604
1604
|
* Licensed under the MIT License.
|
|
@@ -1695,7 +1695,7 @@
|
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
|
-
/*! @azure/msal-common v15.0.
|
|
1698
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1699
1699
|
|
|
1700
1700
|
/*
|
|
1701
1701
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1715,8 +1715,10 @@
|
|
|
1715
1715
|
const filteredInput = scopeArr
|
|
1716
1716
|
? StringUtils.removeEmptyStringsFromArray(scopeArr)
|
|
1717
1717
|
: [];
|
|
1718
|
-
//
|
|
1719
|
-
|
|
1718
|
+
// Check if scopes array has at least one member
|
|
1719
|
+
if (!filteredInput || !filteredInput.length) {
|
|
1720
|
+
throw createClientConfigurationError(emptyInputScopesError);
|
|
1721
|
+
}
|
|
1720
1722
|
this.scopes = new Set(); // Iterator in constructor not supported by IE11
|
|
1721
1723
|
filteredInput.forEach((scope) => this.scopes.add(scope));
|
|
1722
1724
|
}
|
|
@@ -1746,17 +1748,6 @@
|
|
|
1746
1748
|
}
|
|
1747
1749
|
return scopeSet;
|
|
1748
1750
|
}
|
|
1749
|
-
/**
|
|
1750
|
-
* Used to validate the scopes input parameter requested by the developer.
|
|
1751
|
-
* @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.
|
|
1752
|
-
* @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not
|
|
1753
|
-
*/
|
|
1754
|
-
validateInputScopes(inputScopes) {
|
|
1755
|
-
// Check if scopes are required but not given or is an empty array
|
|
1756
|
-
if (!inputScopes || inputScopes.length < 1) {
|
|
1757
|
-
throw createClientConfigurationError(emptyInputScopesError);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
1751
|
/**
|
|
1761
1752
|
* Check if a given scope is present in this set of scopes.
|
|
1762
1753
|
* @param scope
|
|
@@ -1895,7 +1886,7 @@
|
|
|
1895
1886
|
}
|
|
1896
1887
|
}
|
|
1897
1888
|
|
|
1898
|
-
/*! @azure/msal-common v15.0.
|
|
1889
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1899
1890
|
|
|
1900
1891
|
/*
|
|
1901
1892
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1935,7 +1926,7 @@
|
|
|
1935
1926
|
};
|
|
1936
1927
|
}
|
|
1937
1928
|
|
|
1938
|
-
/*! @azure/msal-common v15.0.
|
|
1929
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
1939
1930
|
/*
|
|
1940
1931
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1941
1932
|
* Licensed under the MIT License.
|
|
@@ -2014,7 +2005,7 @@
|
|
|
2014
2005
|
return updatedAccountInfo;
|
|
2015
2006
|
}
|
|
2016
2007
|
|
|
2017
|
-
/*! @azure/msal-common v15.0.
|
|
2008
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2018
2009
|
/*
|
|
2019
2010
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2020
2011
|
* Licensed under the MIT License.
|
|
@@ -2029,7 +2020,7 @@
|
|
|
2029
2020
|
Ciam: 3,
|
|
2030
2021
|
};
|
|
2031
2022
|
|
|
2032
|
-
/*! @azure/msal-common v15.0.
|
|
2023
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2033
2024
|
/*
|
|
2034
2025
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2035
2026
|
* Licensed under the MIT License.
|
|
@@ -2051,7 +2042,7 @@
|
|
|
2051
2042
|
return null;
|
|
2052
2043
|
}
|
|
2053
2044
|
|
|
2054
|
-
/*! @azure/msal-common v15.0.
|
|
2045
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2055
2046
|
/*
|
|
2056
2047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2057
2048
|
* Licensed under the MIT License.
|
|
@@ -2064,7 +2055,7 @@
|
|
|
2064
2055
|
OIDC: "OIDC",
|
|
2065
2056
|
};
|
|
2066
2057
|
|
|
2067
|
-
/*! @azure/msal-common v15.0.
|
|
2058
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2068
2059
|
|
|
2069
2060
|
/*
|
|
2070
2061
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2307,7 +2298,7 @@
|
|
|
2307
2298
|
}
|
|
2308
2299
|
}
|
|
2309
2300
|
|
|
2310
|
-
/*! @azure/msal-common v15.0.
|
|
2301
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2311
2302
|
|
|
2312
2303
|
/*
|
|
2313
2304
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2354,7 +2345,7 @@
|
|
|
2354
2345
|
return null;
|
|
2355
2346
|
}
|
|
2356
2347
|
|
|
2357
|
-
/*! @azure/msal-common v15.0.
|
|
2348
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2358
2349
|
|
|
2359
2350
|
/*
|
|
2360
2351
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2518,7 +2509,7 @@
|
|
|
2518
2509
|
}
|
|
2519
2510
|
}
|
|
2520
2511
|
|
|
2521
|
-
/*! @azure/msal-common v15.0.
|
|
2512
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2522
2513
|
|
|
2523
2514
|
/*
|
|
2524
2515
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2658,7 +2649,7 @@
|
|
|
2658
2649
|
return null;
|
|
2659
2650
|
}
|
|
2660
2651
|
|
|
2661
|
-
/*! @azure/msal-common v15.0.
|
|
2652
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2662
2653
|
/*
|
|
2663
2654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2664
2655
|
* Licensed under the MIT License.
|
|
@@ -2666,7 +2657,7 @@
|
|
|
2666
2657
|
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2667
2658
|
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2668
2659
|
|
|
2669
|
-
/*! @azure/msal-common v15.0.
|
|
2660
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2670
2661
|
|
|
2671
2662
|
/*
|
|
2672
2663
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2693,7 +2684,7 @@
|
|
|
2693
2684
|
}
|
|
2694
2685
|
}
|
|
2695
2686
|
|
|
2696
|
-
/*! @azure/msal-common v15.0.
|
|
2687
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
2697
2688
|
|
|
2698
2689
|
/*
|
|
2699
2690
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2858,24 +2849,24 @@
|
|
|
2858
2849
|
* @param storeInCache {?StoreInCache}
|
|
2859
2850
|
* @param correlationId {?string} correlation id
|
|
2860
2851
|
*/
|
|
2861
|
-
async saveCacheRecord(cacheRecord,
|
|
2852
|
+
async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
|
|
2862
2853
|
if (!cacheRecord) {
|
|
2863
2854
|
throw createClientAuthError(invalidCacheRecord);
|
|
2864
2855
|
}
|
|
2865
2856
|
try {
|
|
2866
2857
|
if (!!cacheRecord.account) {
|
|
2867
|
-
await this.setAccount(cacheRecord.account);
|
|
2858
|
+
await this.setAccount(cacheRecord.account, correlationId);
|
|
2868
2859
|
}
|
|
2869
2860
|
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2870
|
-
await this.setIdTokenCredential(cacheRecord.idToken);
|
|
2861
|
+
await this.setIdTokenCredential(cacheRecord.idToken, correlationId);
|
|
2871
2862
|
}
|
|
2872
2863
|
if (!!cacheRecord.accessToken &&
|
|
2873
2864
|
storeInCache?.accessToken !== false) {
|
|
2874
|
-
await this.saveAccessToken(cacheRecord.accessToken);
|
|
2865
|
+
await this.saveAccessToken(cacheRecord.accessToken, correlationId);
|
|
2875
2866
|
}
|
|
2876
2867
|
if (!!cacheRecord.refreshToken &&
|
|
2877
2868
|
storeInCache?.refreshToken !== false) {
|
|
2878
|
-
await this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2869
|
+
await this.setRefreshTokenCredential(cacheRecord.refreshToken, correlationId);
|
|
2879
2870
|
}
|
|
2880
2871
|
if (!!cacheRecord.appMetadata) {
|
|
2881
2872
|
this.setAppMetadata(cacheRecord.appMetadata);
|
|
@@ -2905,7 +2896,7 @@
|
|
|
2905
2896
|
* saves access token credential
|
|
2906
2897
|
* @param credential
|
|
2907
2898
|
*/
|
|
2908
|
-
async saveAccessToken(credential) {
|
|
2899
|
+
async saveAccessToken(credential, correlationId) {
|
|
2909
2900
|
const accessTokenFilter = {
|
|
2910
2901
|
clientId: credential.clientId,
|
|
2911
2902
|
credentialType: credential.credentialType,
|
|
@@ -2932,7 +2923,7 @@
|
|
|
2932
2923
|
}
|
|
2933
2924
|
});
|
|
2934
2925
|
await Promise.all(removedAccessTokens);
|
|
2935
|
-
await this.setAccessTokenCredential(credential);
|
|
2926
|
+
await this.setAccessTokenCredential(credential, correlationId);
|
|
2936
2927
|
}
|
|
2937
2928
|
/**
|
|
2938
2929
|
* Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
|
|
@@ -3878,7 +3869,7 @@
|
|
|
3878
3869
|
}
|
|
3879
3870
|
}
|
|
3880
3871
|
|
|
3881
|
-
/*! @azure/msal-common v15.0.
|
|
3872
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
3882
3873
|
|
|
3883
3874
|
/*
|
|
3884
3875
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3977,7 +3968,7 @@
|
|
|
3977
3968
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3978
3969
|
}
|
|
3979
3970
|
|
|
3980
|
-
/*! @azure/msal-common v15.0.
|
|
3971
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
3981
3972
|
/*
|
|
3982
3973
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3983
3974
|
* Licensed under the MIT License.
|
|
@@ -3987,7 +3978,7 @@
|
|
|
3987
3978
|
UPN: "UPN",
|
|
3988
3979
|
};
|
|
3989
3980
|
|
|
3990
|
-
/*! @azure/msal-common v15.0.
|
|
3981
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
3991
3982
|
/*
|
|
3992
3983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3993
3984
|
* Licensed under the MIT License.
|
|
@@ -4037,7 +4028,7 @@
|
|
|
4037
4028
|
const BROKER_CLIENT_ID = "brk_client_id";
|
|
4038
4029
|
const BROKER_REDIRECT_URI = "brk_redirect_uri";
|
|
4039
4030
|
|
|
4040
|
-
/*! @azure/msal-common v15.0.
|
|
4031
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4041
4032
|
|
|
4042
4033
|
/*
|
|
4043
4034
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4104,7 +4095,7 @@
|
|
|
4104
4095
|
}
|
|
4105
4096
|
}
|
|
4106
4097
|
|
|
4107
|
-
/*! @azure/msal-common v15.0.
|
|
4098
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4108
4099
|
|
|
4109
4100
|
/*
|
|
4110
4101
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4512,7 +4503,7 @@
|
|
|
4512
4503
|
}
|
|
4513
4504
|
}
|
|
4514
4505
|
|
|
4515
|
-
/*! @azure/msal-common v15.0.
|
|
4506
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4516
4507
|
/*
|
|
4517
4508
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4518
4509
|
* Licensed under the MIT License.
|
|
@@ -4524,7 +4515,7 @@
|
|
|
4524
4515
|
response.hasOwnProperty("jwks_uri"));
|
|
4525
4516
|
}
|
|
4526
4517
|
|
|
4527
|
-
/*! @azure/msal-common v15.0.
|
|
4518
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4528
4519
|
/*
|
|
4529
4520
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4530
4521
|
* Licensed under the MIT License.
|
|
@@ -4534,7 +4525,7 @@
|
|
|
4534
4525
|
response.hasOwnProperty("metadata"));
|
|
4535
4526
|
}
|
|
4536
4527
|
|
|
4537
|
-
/*! @azure/msal-common v15.0.
|
|
4528
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4538
4529
|
/*
|
|
4539
4530
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4540
4531
|
* Licensed under the MIT License.
|
|
@@ -4544,7 +4535,7 @@
|
|
|
4544
4535
|
response.hasOwnProperty("error_description"));
|
|
4545
4536
|
}
|
|
4546
4537
|
|
|
4547
|
-
/*! @azure/msal-common v15.0.
|
|
4538
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
4548
4539
|
/*
|
|
4549
4540
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4550
4541
|
* Licensed under the MIT License.
|
|
@@ -4702,6 +4693,7 @@
|
|
|
4702
4693
|
*/
|
|
4703
4694
|
InitializeSilentRequest: "initializeSilentRequest",
|
|
4704
4695
|
InitializeClientApplication: "initializeClientApplication",
|
|
4696
|
+
InitializeCache: "initializeCache",
|
|
4705
4697
|
/**
|
|
4706
4698
|
* Helper function in SilentIframeClient class (msal-browser).
|
|
4707
4699
|
*/
|
|
@@ -4779,6 +4771,8 @@
|
|
|
4779
4771
|
*/
|
|
4780
4772
|
ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
|
|
4781
4773
|
CacheManagerGetRefreshToken: "cacheManagerGetRefreshToken",
|
|
4774
|
+
ImportExistingCache: "importExistingCache",
|
|
4775
|
+
SetUserData: "setUserData",
|
|
4782
4776
|
/**
|
|
4783
4777
|
* Crypto Operations
|
|
4784
4778
|
*/
|
|
@@ -4787,6 +4781,12 @@
|
|
|
4787
4781
|
GenerateCodeChallengeFromVerifier: "generateCodeChallengeFromVerifier",
|
|
4788
4782
|
Sha256Digest: "sha256Digest",
|
|
4789
4783
|
GetRandomValues: "getRandomValues",
|
|
4784
|
+
GenerateHKDF: "generateHKDF",
|
|
4785
|
+
GenerateBaseKey: "generateBaseKey",
|
|
4786
|
+
Base64Decode: "base64Decode",
|
|
4787
|
+
UrlEncodeArr: "urlEncodeArr",
|
|
4788
|
+
Encrypt: "encrypt",
|
|
4789
|
+
Decrypt: "decrypt",
|
|
4790
4790
|
};
|
|
4791
4791
|
const PerformanceEventAbbreviations = new Map([
|
|
4792
4792
|
[PerformanceEvents.AcquireTokenByCode, "ATByCode"],
|
|
@@ -4871,6 +4871,9 @@
|
|
|
4871
4871
|
PerformanceEvents.InitializeClientApplication,
|
|
4872
4872
|
"InitClientApplication",
|
|
4873
4873
|
],
|
|
4874
|
+
[PerformanceEvents.InitializeCache, "InitCache"],
|
|
4875
|
+
[PerformanceEvents.ImportExistingCache, "importCache"],
|
|
4876
|
+
[PerformanceEvents.SetUserData, "setUserData"],
|
|
4874
4877
|
[PerformanceEvents.SilentIframeClientTokenHelper, "SIClientTHelper"],
|
|
4875
4878
|
[
|
|
4876
4879
|
PerformanceEvents.SilentHandlerInitiateAuthRequest,
|
|
@@ -5004,6 +5007,12 @@
|
|
|
5004
5007
|
],
|
|
5005
5008
|
[PerformanceEvents.Sha256Digest, "Sha256Digest"],
|
|
5006
5009
|
[PerformanceEvents.GetRandomValues, "GetRandomValues"],
|
|
5010
|
+
[PerformanceEvents.GenerateHKDF, "genHKDF"],
|
|
5011
|
+
[PerformanceEvents.GenerateBaseKey, "genBaseKey"],
|
|
5012
|
+
[PerformanceEvents.Base64Decode, "b64Decode"],
|
|
5013
|
+
[PerformanceEvents.UrlEncodeArr, "urlEncArr"],
|
|
5014
|
+
[PerformanceEvents.Encrypt, "encrypt"],
|
|
5015
|
+
[PerformanceEvents.Decrypt, "decrypt"],
|
|
5007
5016
|
]);
|
|
5008
5017
|
/**
|
|
5009
5018
|
* State of the performance event.
|
|
@@ -5029,9 +5038,11 @@
|
|
|
5029
5038
|
"multiMatchedAT",
|
|
5030
5039
|
"multiMatchedID",
|
|
5031
5040
|
"multiMatchedRT",
|
|
5041
|
+
"unencryptedCacheCount",
|
|
5042
|
+
"encryptedCacheExpiredCount",
|
|
5032
5043
|
]);
|
|
5033
5044
|
|
|
5034
|
-
/*! @azure/msal-common v15.0.
|
|
5045
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
5035
5046
|
/*
|
|
5036
5047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5037
5048
|
* Licensed under the MIT License.
|
|
@@ -5127,7 +5138,7 @@
|
|
|
5127
5138
|
};
|
|
5128
5139
|
};
|
|
5129
5140
|
|
|
5130
|
-
/*! @azure/msal-common v15.0.
|
|
5141
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
5131
5142
|
|
|
5132
5143
|
/*
|
|
5133
5144
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5236,7 +5247,7 @@
|
|
|
5236
5247
|
},
|
|
5237
5248
|
};
|
|
5238
5249
|
|
|
5239
|
-
/*! @azure/msal-common v15.0.
|
|
5250
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
5240
5251
|
|
|
5241
5252
|
/*
|
|
5242
5253
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6075,7 +6086,7 @@
|
|
|
6075
6086
|
};
|
|
6076
6087
|
}
|
|
6077
6088
|
|
|
6078
|
-
/*! @azure/msal-common v15.0.
|
|
6089
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6079
6090
|
|
|
6080
6091
|
/*
|
|
6081
6092
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6106,7 +6117,7 @@
|
|
|
6106
6117
|
}
|
|
6107
6118
|
}
|
|
6108
6119
|
|
|
6109
|
-
/*! @azure/msal-common v15.0.
|
|
6120
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6110
6121
|
|
|
6111
6122
|
/*
|
|
6112
6123
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6125,7 +6136,7 @@
|
|
|
6125
6136
|
}
|
|
6126
6137
|
}
|
|
6127
6138
|
|
|
6128
|
-
/*! @azure/msal-common v15.0.
|
|
6139
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6129
6140
|
|
|
6130
6141
|
/*
|
|
6131
6142
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6223,7 +6234,7 @@
|
|
|
6223
6234
|
}
|
|
6224
6235
|
}
|
|
6225
6236
|
|
|
6226
|
-
/*! @azure/msal-common v15.0.
|
|
6237
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6227
6238
|
|
|
6228
6239
|
/*
|
|
6229
6240
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6253,7 +6264,7 @@
|
|
|
6253
6264
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6254
6265
|
}
|
|
6255
6266
|
|
|
6256
|
-
/*! @azure/msal-common v15.0.
|
|
6267
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6257
6268
|
|
|
6258
6269
|
/*
|
|
6259
6270
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6403,7 +6414,7 @@
|
|
|
6403
6414
|
}
|
|
6404
6415
|
}
|
|
6405
6416
|
|
|
6406
|
-
/*! @azure/msal-common v15.0.
|
|
6417
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6407
6418
|
/*
|
|
6408
6419
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6409
6420
|
* Licensed under the MIT License.
|
|
@@ -6429,7 +6440,7 @@
|
|
|
6429
6440
|
refreshTokenExpired: refreshTokenExpired
|
|
6430
6441
|
});
|
|
6431
6442
|
|
|
6432
|
-
/*! @azure/msal-common v15.0.
|
|
6443
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6433
6444
|
|
|
6434
6445
|
/*
|
|
6435
6446
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6517,7 +6528,7 @@
|
|
|
6517
6528
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6518
6529
|
}
|
|
6519
6530
|
|
|
6520
|
-
/*! @azure/msal-common v15.0.
|
|
6531
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6521
6532
|
|
|
6522
6533
|
/*
|
|
6523
6534
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6589,7 +6600,7 @@
|
|
|
6589
6600
|
}
|
|
6590
6601
|
}
|
|
6591
6602
|
|
|
6592
|
-
/*! @azure/msal-common v15.0.
|
|
6603
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6593
6604
|
|
|
6594
6605
|
/*
|
|
6595
6606
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6673,7 +6684,7 @@
|
|
|
6673
6684
|
}
|
|
6674
6685
|
}
|
|
6675
6686
|
|
|
6676
|
-
/*! @azure/msal-common v15.0.
|
|
6687
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6677
6688
|
/*
|
|
6678
6689
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6679
6690
|
* Licensed under the MIT License.
|
|
@@ -6700,7 +6711,7 @@
|
|
|
6700
6711
|
}
|
|
6701
6712
|
}
|
|
6702
6713
|
|
|
6703
|
-
/*! @azure/msal-common v15.0.
|
|
6714
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
6704
6715
|
|
|
6705
6716
|
/*
|
|
6706
6717
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6866,7 +6877,7 @@
|
|
|
6866
6877
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
6867
6878
|
}
|
|
6868
6879
|
}
|
|
6869
|
-
await this.cacheStorage.saveCacheRecord(cacheRecord, request.
|
|
6880
|
+
await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, request.storeInCache);
|
|
6870
6881
|
}
|
|
6871
6882
|
finally {
|
|
6872
6883
|
if (this.persistencePlugin &&
|
|
@@ -7077,7 +7088,7 @@
|
|
|
7077
7088
|
return baseAccount;
|
|
7078
7089
|
}
|
|
7079
7090
|
|
|
7080
|
-
/*! @azure/msal-common v15.0.
|
|
7091
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7081
7092
|
/*
|
|
7082
7093
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7083
7094
|
* Licensed under the MIT License.
|
|
@@ -7095,7 +7106,7 @@
|
|
|
7095
7106
|
}
|
|
7096
7107
|
}
|
|
7097
7108
|
|
|
7098
|
-
/*! @azure/msal-common v15.0.
|
|
7109
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7099
7110
|
|
|
7100
7111
|
/*
|
|
7101
7112
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7469,7 +7480,7 @@
|
|
|
7469
7480
|
});
|
|
7470
7481
|
}
|
|
7471
7482
|
this.addExtraQueryParams(request, parameterBuilder);
|
|
7472
|
-
if (request.
|
|
7483
|
+
if (request.platformBroker) {
|
|
7473
7484
|
// signal ests that this is a WAM call
|
|
7474
7485
|
parameterBuilder.addNativeBroker();
|
|
7475
7486
|
// pass the req_cnf for POP
|
|
@@ -7537,7 +7548,7 @@
|
|
|
7537
7548
|
}
|
|
7538
7549
|
}
|
|
7539
7550
|
|
|
7540
|
-
/*! @azure/msal-common v15.0.
|
|
7551
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7541
7552
|
|
|
7542
7553
|
/*
|
|
7543
7554
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7757,7 +7768,7 @@
|
|
|
7757
7768
|
}
|
|
7758
7769
|
}
|
|
7759
7770
|
|
|
7760
|
-
/*! @azure/msal-common v15.0.
|
|
7771
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7761
7772
|
|
|
7762
7773
|
/*
|
|
7763
7774
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7893,7 +7904,7 @@
|
|
|
7893
7904
|
}
|
|
7894
7905
|
}
|
|
7895
7906
|
|
|
7896
|
-
/*! @azure/msal-common v15.0.
|
|
7907
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7897
7908
|
|
|
7898
7909
|
/*
|
|
7899
7910
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7908,7 +7919,7 @@
|
|
|
7908
7919
|
},
|
|
7909
7920
|
};
|
|
7910
7921
|
|
|
7911
|
-
/*! @azure/msal-common v15.0.
|
|
7922
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7912
7923
|
|
|
7913
7924
|
/*
|
|
7914
7925
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7966,7 +7977,7 @@
|
|
|
7966
7977
|
}
|
|
7967
7978
|
}
|
|
7968
7979
|
|
|
7969
|
-
/*! @azure/msal-common v15.0.
|
|
7980
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
7970
7981
|
|
|
7971
7982
|
/*
|
|
7972
7983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8229,7 +8240,7 @@
|
|
|
8229
8240
|
}
|
|
8230
8241
|
}
|
|
8231
8242
|
|
|
8232
|
-
/*! @azure/msal-common v15.0.
|
|
8243
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
8233
8244
|
/*
|
|
8234
8245
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8235
8246
|
* Licensed under the MIT License.
|
|
@@ -8237,7 +8248,7 @@
|
|
|
8237
8248
|
const missingKidError = "missing_kid_error";
|
|
8238
8249
|
const missingAlgError = "missing_alg_error";
|
|
8239
8250
|
|
|
8240
|
-
/*! @azure/msal-common v15.0.
|
|
8251
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
8241
8252
|
|
|
8242
8253
|
/*
|
|
8243
8254
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8262,7 +8273,7 @@
|
|
|
8262
8273
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
8263
8274
|
}
|
|
8264
8275
|
|
|
8265
|
-
/*! @azure/msal-common v15.0.
|
|
8276
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
8266
8277
|
|
|
8267
8278
|
/*
|
|
8268
8279
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8302,7 +8313,7 @@
|
|
|
8302
8313
|
}
|
|
8303
8314
|
}
|
|
8304
8315
|
|
|
8305
|
-
/*! @azure/msal-common v15.0.
|
|
8316
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
8306
8317
|
|
|
8307
8318
|
/*
|
|
8308
8319
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8381,7 +8392,7 @@
|
|
|
8381
8392
|
}
|
|
8382
8393
|
}
|
|
8383
8394
|
|
|
8384
|
-
/*! @azure/msal-common v15.0.
|
|
8395
|
+
/*! @azure/msal-common v15.0.2 2025-01-22 */
|
|
8385
8396
|
|
|
8386
8397
|
/*
|
|
8387
8398
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9697,14 +9708,14 @@
|
|
|
9697
9708
|
/**
|
|
9698
9709
|
* Check whether browser crypto is available.
|
|
9699
9710
|
*/
|
|
9700
|
-
function validateCryptoAvailable() {
|
|
9711
|
+
function validateCryptoAvailable(skipValidateSubtleCrypto) {
|
|
9701
9712
|
if (!window) {
|
|
9702
9713
|
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
9703
9714
|
}
|
|
9704
9715
|
if (!window.crypto) {
|
|
9705
9716
|
throw createBrowserAuthError(cryptoNonExistent);
|
|
9706
9717
|
}
|
|
9707
|
-
if (!window.crypto.subtle) {
|
|
9718
|
+
if (!skipValidateSubtleCrypto && !window.crypto.subtle) {
|
|
9708
9719
|
throw createBrowserAuthError(cryptoNonExistent, SUBTLE_SUBERROR);
|
|
9709
9720
|
}
|
|
9710
9721
|
}
|
|
@@ -9989,7 +10000,9 @@
|
|
|
9989
10000
|
* Returns current window URL as redirect uri
|
|
9990
10001
|
*/
|
|
9991
10002
|
function getCurrentUri() {
|
|
9992
|
-
return window
|
|
10003
|
+
return typeof window !== "undefined" && window.location
|
|
10004
|
+
? window.location.href.split("?")[0].split("#")[0]
|
|
10005
|
+
: "";
|
|
9993
10006
|
}
|
|
9994
10007
|
/**
|
|
9995
10008
|
* Gets the homepage url for the current window location.
|
|
@@ -10369,7 +10382,7 @@
|
|
|
10369
10382
|
redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
|
|
10370
10383
|
asyncPopups: false,
|
|
10371
10384
|
allowRedirectInIframe: false,
|
|
10372
|
-
|
|
10385
|
+
allowPlatformBroker: false,
|
|
10373
10386
|
nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout ||
|
|
10374
10387
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
10375
10388
|
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS,
|
|
@@ -10392,11 +10405,11 @@
|
|
|
10392
10405
|
const logger = new Logger(providedSystemOptions.loggerOptions);
|
|
10393
10406
|
logger.warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions)));
|
|
10394
10407
|
}
|
|
10395
|
-
// Throw an error if user has set
|
|
10408
|
+
// Throw an error if user has set allowPlatformBroker to true without being in AAD protocol mode
|
|
10396
10409
|
if (userInputAuth?.protocolMode &&
|
|
10397
10410
|
userInputAuth.protocolMode !== ProtocolMode.AAD &&
|
|
10398
|
-
providedSystemOptions?.
|
|
10399
|
-
throw createClientConfigurationError(
|
|
10411
|
+
providedSystemOptions?.allowPlatformBroker) {
|
|
10412
|
+
throw createClientConfigurationError(cannotAllowPlatformBroker);
|
|
10400
10413
|
}
|
|
10401
10414
|
const overlayedConfig = {
|
|
10402
10415
|
auth: {
|
|
@@ -10416,7 +10429,7 @@
|
|
|
10416
10429
|
|
|
10417
10430
|
/* eslint-disable header/header */
|
|
10418
10431
|
const name = "@azure/msal-browser";
|
|
10419
|
-
const version = "4.0.
|
|
10432
|
+
const version = "4.0.2";
|
|
10420
10433
|
|
|
10421
10434
|
/*
|
|
10422
10435
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11175,10 +11188,10 @@
|
|
|
11175
11188
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
11176
11189
|
*/
|
|
11177
11190
|
class CryptoOps {
|
|
11178
|
-
constructor(logger, performanceClient) {
|
|
11191
|
+
constructor(logger, performanceClient, skipValidateSubtleCrypto) {
|
|
11179
11192
|
this.logger = logger;
|
|
11180
11193
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
11181
|
-
validateCryptoAvailable();
|
|
11194
|
+
validateCryptoAvailable(skipValidateSubtleCrypto ?? false);
|
|
11182
11195
|
this.cache = new AsyncMemoryStorage(this.logger);
|
|
11183
11196
|
this.performanceClient = performanceClient;
|
|
11184
11197
|
}
|
|
@@ -11456,15 +11469,17 @@
|
|
|
11456
11469
|
*/
|
|
11457
11470
|
const ENCRYPTION_KEY = "msal.cache.encryption";
|
|
11458
11471
|
class LocalStorage {
|
|
11459
|
-
constructor(clientId) {
|
|
11472
|
+
constructor(clientId, logger, performanceClient) {
|
|
11460
11473
|
if (!window.localStorage) {
|
|
11461
11474
|
throw createBrowserConfigurationAuthError(storageNotSupported);
|
|
11462
11475
|
}
|
|
11463
11476
|
this.memoryStorage = new MemoryStorage();
|
|
11464
11477
|
this.initialized = false;
|
|
11465
11478
|
this.clientId = clientId;
|
|
11479
|
+
this.logger = logger;
|
|
11480
|
+
this.performanceClient = performanceClient;
|
|
11466
11481
|
}
|
|
11467
|
-
async initialize() {
|
|
11482
|
+
async initialize(correlationId) {
|
|
11468
11483
|
this.initialized = true;
|
|
11469
11484
|
const cookies = new CookieStorage();
|
|
11470
11485
|
const cookieString = cookies.getItem(ENCRYPTION_KEY);
|
|
@@ -11473,27 +11488,26 @@
|
|
|
11473
11488
|
try {
|
|
11474
11489
|
parsedCookie = JSON.parse(cookieString);
|
|
11475
11490
|
}
|
|
11476
|
-
catch (e) {
|
|
11477
|
-
// TODO: Log telemetry but don't throw
|
|
11478
|
-
}
|
|
11491
|
+
catch (e) { }
|
|
11479
11492
|
}
|
|
11480
11493
|
if (parsedCookie.key && parsedCookie.id) {
|
|
11481
11494
|
// Encryption key already exists, import
|
|
11495
|
+
const baseKey = invoke(base64DecToArr, PerformanceEvents.Base64Decode, this.logger, this.performanceClient, correlationId)(parsedCookie.key);
|
|
11482
11496
|
this.encryptionCookie = {
|
|
11483
11497
|
id: parsedCookie.id,
|
|
11484
|
-
key: await generateHKDF
|
|
11498
|
+
key: await invokeAsync(generateHKDF, PerformanceEvents.GenerateHKDF, this.logger, this.performanceClient, correlationId)(baseKey),
|
|
11485
11499
|
};
|
|
11486
|
-
await this.importExistingCache();
|
|
11500
|
+
await invokeAsync(this.importExistingCache.bind(this), PerformanceEvents.ImportExistingCache, this.logger, this.performanceClient, correlationId)(correlationId);
|
|
11487
11501
|
}
|
|
11488
11502
|
else {
|
|
11489
11503
|
// Encryption key doesn't exist or is invalid, generate a new one and clear existing cache
|
|
11490
11504
|
this.clear();
|
|
11491
11505
|
const id = createNewGuid();
|
|
11492
|
-
const baseKey = await generateBaseKey();
|
|
11493
|
-
const keyStr = urlEncodeArr(new Uint8Array(baseKey));
|
|
11506
|
+
const baseKey = await invokeAsync(generateBaseKey, PerformanceEvents.GenerateBaseKey, this.logger, this.performanceClient, correlationId)();
|
|
11507
|
+
const keyStr = invoke(urlEncodeArr, PerformanceEvents.UrlEncodeArr, this.logger, this.performanceClient, correlationId)(new Uint8Array(baseKey));
|
|
11494
11508
|
this.encryptionCookie = {
|
|
11495
11509
|
id: id,
|
|
11496
|
-
key: await generateHKDF(baseKey),
|
|
11510
|
+
key: await invokeAsync(generateHKDF, PerformanceEvents.GenerateHKDF, this.logger, this.performanceClient, correlationId)(baseKey),
|
|
11497
11511
|
};
|
|
11498
11512
|
const cookieData = {
|
|
11499
11513
|
id: id,
|
|
@@ -11514,11 +11528,11 @@
|
|
|
11514
11528
|
setItem(key, value) {
|
|
11515
11529
|
window.localStorage.setItem(key, value);
|
|
11516
11530
|
}
|
|
11517
|
-
async setUserData(key, value) {
|
|
11531
|
+
async setUserData(key, value, correlationId) {
|
|
11518
11532
|
if (!this.initialized || !this.encryptionCookie) {
|
|
11519
11533
|
throw createBrowserAuthError(uninitializedPublicClientApplication);
|
|
11520
11534
|
}
|
|
11521
|
-
const { data, nonce } = await encrypt(this.encryptionCookie.key, value, this.getContext(key));
|
|
11535
|
+
const { data, nonce } = await invokeAsync(encrypt, PerformanceEvents.Encrypt, this.logger, this.performanceClient, correlationId)(this.encryptionCookie.key, value, this.getContext(key));
|
|
11522
11536
|
const encryptedData = {
|
|
11523
11537
|
id: this.encryptionCookie.id,
|
|
11524
11538
|
nonce: nonce,
|
|
@@ -11561,25 +11575,27 @@
|
|
|
11561
11575
|
* Helper to decrypt all known MSAL keys in localStorage and save them to inMemory storage
|
|
11562
11576
|
* @returns
|
|
11563
11577
|
*/
|
|
11564
|
-
async importExistingCache() {
|
|
11578
|
+
async importExistingCache(correlationId) {
|
|
11565
11579
|
if (!this.encryptionCookie) {
|
|
11566
11580
|
return;
|
|
11567
11581
|
}
|
|
11568
|
-
|
|
11569
|
-
await this.importArray(accountKeys);
|
|
11582
|
+
let accountKeys = getAccountKeys(this);
|
|
11583
|
+
accountKeys = await this.importArray(accountKeys, correlationId);
|
|
11584
|
+
// Write valid account keys back to map
|
|
11585
|
+
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
11570
11586
|
const tokenKeys = getTokenKeys(this.clientId, this);
|
|
11571
|
-
await
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11587
|
+
tokenKeys.idToken = await this.importArray(tokenKeys.idToken, correlationId);
|
|
11588
|
+
tokenKeys.accessToken = await this.importArray(tokenKeys.accessToken, correlationId);
|
|
11589
|
+
tokenKeys.refreshToken = await this.importArray(tokenKeys.refreshToken, correlationId);
|
|
11590
|
+
// Write valid token keys back to map
|
|
11591
|
+
this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
11576
11592
|
}
|
|
11577
11593
|
/**
|
|
11578
11594
|
* Helper to decrypt and save cache entries
|
|
11579
11595
|
* @param key
|
|
11580
11596
|
* @returns
|
|
11581
11597
|
*/
|
|
11582
|
-
async getItemFromEncryptedCache(key) {
|
|
11598
|
+
async getItemFromEncryptedCache(key, correlationId) {
|
|
11583
11599
|
if (!this.encryptionCookie) {
|
|
11584
11600
|
return null;
|
|
11585
11601
|
}
|
|
@@ -11590,36 +11606,46 @@
|
|
|
11590
11606
|
let encObj;
|
|
11591
11607
|
try {
|
|
11592
11608
|
encObj = JSON.parse(rawCache);
|
|
11593
|
-
if (!encObj.id || !encObj.nonce || !encObj.data) {
|
|
11594
|
-
throw "Not encrypted!"; // TODO: Typed error
|
|
11595
|
-
}
|
|
11596
|
-
if (encObj.id !== this.encryptionCookie.id) {
|
|
11597
|
-
throw "Old item!"; // TODO: Typed error
|
|
11598
|
-
}
|
|
11599
11609
|
}
|
|
11600
11610
|
catch (e) {
|
|
11601
11611
|
// Not a valid encrypted object, remove
|
|
11602
|
-
this.removeItem(key);
|
|
11603
|
-
// TODO: Log to telemetry
|
|
11604
11612
|
return null;
|
|
11605
11613
|
}
|
|
11606
|
-
|
|
11614
|
+
if (!encObj.id || !encObj.nonce || !encObj.data) {
|
|
11615
|
+
// Data is not encrypted, likely from old version of MSAL. It must be removed because we don't know how old it is.
|
|
11616
|
+
this.performanceClient.incrementFields({ unencryptedCacheCount: 1 }, correlationId);
|
|
11617
|
+
return null;
|
|
11618
|
+
}
|
|
11619
|
+
if (encObj.id !== this.encryptionCookie.id) {
|
|
11620
|
+
// Data was encrypted with a different key. It must be removed because it is from a previous session.
|
|
11621
|
+
this.performanceClient.incrementFields({ encryptedCacheExpiredCount: 1 }, correlationId);
|
|
11622
|
+
return null;
|
|
11623
|
+
}
|
|
11624
|
+
return invokeAsync(decrypt, PerformanceEvents.Decrypt, this.logger, this.performanceClient, correlationId)(this.encryptionCookie.key, encObj.nonce, this.getContext(key), encObj.data);
|
|
11607
11625
|
}
|
|
11608
11626
|
/**
|
|
11609
11627
|
* Helper to decrypt and save an array of cache keys
|
|
11610
11628
|
* @param arr
|
|
11629
|
+
* @returns Array of keys successfully imported
|
|
11611
11630
|
*/
|
|
11612
|
-
async importArray(arr) {
|
|
11631
|
+
async importArray(arr, correlationId) {
|
|
11632
|
+
const importedArr = [];
|
|
11613
11633
|
const promiseArr = [];
|
|
11614
11634
|
arr.forEach((key) => {
|
|
11615
|
-
const promise = this.getItemFromEncryptedCache(key).then((value) => {
|
|
11635
|
+
const promise = this.getItemFromEncryptedCache(key, correlationId).then((value) => {
|
|
11616
11636
|
if (value) {
|
|
11617
11637
|
this.memoryStorage.setItem(key, value);
|
|
11638
|
+
importedArr.push(key);
|
|
11639
|
+
}
|
|
11640
|
+
else {
|
|
11641
|
+
// If value is empty, unencrypted or expired remove
|
|
11642
|
+
this.removeItem(key);
|
|
11618
11643
|
}
|
|
11619
11644
|
});
|
|
11620
11645
|
promiseArr.push(promise);
|
|
11621
11646
|
});
|
|
11622
11647
|
await Promise.all(promiseArr);
|
|
11648
|
+
return importedArr;
|
|
11623
11649
|
}
|
|
11624
11650
|
/**
|
|
11625
11651
|
* Gets encryption context for a given cache entry. This is clientId for app specific entries, empty string for shared entries
|
|
@@ -11703,40 +11729,18 @@
|
|
|
11703
11729
|
* parameters such as state and nonce, generally.
|
|
11704
11730
|
*/
|
|
11705
11731
|
class BrowserCacheManager extends CacheManager {
|
|
11706
|
-
constructor(clientId, cacheConfig, cryptoImpl, logger,
|
|
11732
|
+
constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
|
|
11707
11733
|
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
11708
11734
|
this.cacheConfig = cacheConfig;
|
|
11709
11735
|
this.logger = logger;
|
|
11710
11736
|
this.internalStorage = new MemoryStorage();
|
|
11711
|
-
this.browserStorage =
|
|
11712
|
-
this.temporaryCacheStorage =
|
|
11737
|
+
this.browserStorage = getStorageImplementation(clientId, cacheConfig.cacheLocation, logger, performanceClient);
|
|
11738
|
+
this.temporaryCacheStorage = getStorageImplementation(clientId, cacheConfig.temporaryCacheLocation, logger, performanceClient);
|
|
11713
11739
|
this.cookieStorage = new CookieStorage();
|
|
11714
11740
|
this.performanceClient = performanceClient;
|
|
11715
11741
|
}
|
|
11716
|
-
async initialize() {
|
|
11717
|
-
await this.browserStorage.initialize();
|
|
11718
|
-
}
|
|
11719
|
-
/**
|
|
11720
|
-
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
11721
|
-
* @param cacheLocation
|
|
11722
|
-
*/
|
|
11723
|
-
setupBrowserStorage(cacheLocation) {
|
|
11724
|
-
try {
|
|
11725
|
-
switch (cacheLocation) {
|
|
11726
|
-
case BrowserCacheLocation.LocalStorage:
|
|
11727
|
-
return new LocalStorage(this.clientId);
|
|
11728
|
-
case BrowserCacheLocation.SessionStorage:
|
|
11729
|
-
return new SessionStorage();
|
|
11730
|
-
case BrowserCacheLocation.MemoryStorage:
|
|
11731
|
-
default:
|
|
11732
|
-
break;
|
|
11733
|
-
}
|
|
11734
|
-
}
|
|
11735
|
-
catch (e) {
|
|
11736
|
-
this.logger.error(e);
|
|
11737
|
-
}
|
|
11738
|
-
this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;
|
|
11739
|
-
return new MemoryStorage();
|
|
11742
|
+
async initialize(correlationId) {
|
|
11743
|
+
await this.browserStorage.initialize(correlationId);
|
|
11740
11744
|
}
|
|
11741
11745
|
/**
|
|
11742
11746
|
* Parses passed value as JSON object, JSON.parse() will throw an error.
|
|
@@ -11783,10 +11787,10 @@
|
|
|
11783
11787
|
* set account entity in the platform cache
|
|
11784
11788
|
* @param account
|
|
11785
11789
|
*/
|
|
11786
|
-
async setAccount(account) {
|
|
11790
|
+
async setAccount(account, correlationId) {
|
|
11787
11791
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
11788
11792
|
const key = account.generateAccountKey();
|
|
11789
|
-
await this.browserStorage.setUserData(key, JSON.stringify(account));
|
|
11793
|
+
await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(key, JSON.stringify(account), correlationId);
|
|
11790
11794
|
this.addAccountKeyToMap(key);
|
|
11791
11795
|
}
|
|
11792
11796
|
/**
|
|
@@ -11976,10 +11980,10 @@
|
|
|
11976
11980
|
* set IdToken credential to the platform cache
|
|
11977
11981
|
* @param idToken
|
|
11978
11982
|
*/
|
|
11979
|
-
async setIdTokenCredential(idToken) {
|
|
11983
|
+
async setIdTokenCredential(idToken, correlationId) {
|
|
11980
11984
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
11981
11985
|
const idTokenKey = generateCredentialKey(idToken);
|
|
11982
|
-
await this.browserStorage.setUserData(idTokenKey, JSON.stringify(idToken));
|
|
11986
|
+
await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(idTokenKey, JSON.stringify(idToken), correlationId);
|
|
11983
11987
|
this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
11984
11988
|
}
|
|
11985
11989
|
/**
|
|
@@ -12007,10 +12011,10 @@
|
|
|
12007
12011
|
* set accessToken credential to the platform cache
|
|
12008
12012
|
* @param accessToken
|
|
12009
12013
|
*/
|
|
12010
|
-
async setAccessTokenCredential(accessToken) {
|
|
12014
|
+
async setAccessTokenCredential(accessToken, correlationId) {
|
|
12011
12015
|
this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");
|
|
12012
12016
|
const accessTokenKey = generateCredentialKey(accessToken);
|
|
12013
|
-
await this.browserStorage.setUserData(accessTokenKey, JSON.stringify(accessToken));
|
|
12017
|
+
await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(accessTokenKey, JSON.stringify(accessToken), correlationId);
|
|
12014
12018
|
this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
12015
12019
|
}
|
|
12016
12020
|
/**
|
|
@@ -12038,10 +12042,10 @@
|
|
|
12038
12042
|
* set refreshToken credential to the platform cache
|
|
12039
12043
|
* @param refreshToken
|
|
12040
12044
|
*/
|
|
12041
|
-
async setRefreshTokenCredential(refreshToken) {
|
|
12045
|
+
async setRefreshTokenCredential(refreshToken, correlationId) {
|
|
12042
12046
|
this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");
|
|
12043
12047
|
const refreshTokenKey = generateCredentialKey(refreshToken);
|
|
12044
|
-
await this.browserStorage.setUserData(refreshTokenKey, JSON.stringify(refreshToken));
|
|
12048
|
+
await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(refreshTokenKey, JSON.stringify(refreshToken), correlationId);
|
|
12045
12049
|
this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
12046
12050
|
}
|
|
12047
12051
|
/**
|
|
@@ -12600,7 +12604,7 @@
|
|
|
12600
12604
|
idToken: idTokenEntity,
|
|
12601
12605
|
accessToken: accessTokenEntity,
|
|
12602
12606
|
};
|
|
12603
|
-
return this.saveCacheRecord(cacheRecord);
|
|
12607
|
+
return this.saveCacheRecord(cacheRecord, result.correlationId);
|
|
12604
12608
|
}
|
|
12605
12609
|
/**
|
|
12606
12610
|
* saves a cache record
|
|
@@ -12608,9 +12612,9 @@
|
|
|
12608
12612
|
* @param storeInCache {?StoreInCache}
|
|
12609
12613
|
* @param correlationId {?string} correlation id
|
|
12610
12614
|
*/
|
|
12611
|
-
async saveCacheRecord(cacheRecord,
|
|
12615
|
+
async saveCacheRecord(cacheRecord, correlationId, storeInCache) {
|
|
12612
12616
|
try {
|
|
12613
|
-
await super.saveCacheRecord(cacheRecord,
|
|
12617
|
+
await super.saveCacheRecord(cacheRecord, correlationId, storeInCache);
|
|
12614
12618
|
}
|
|
12615
12619
|
catch (e) {
|
|
12616
12620
|
if (e instanceof CacheError &&
|
|
@@ -12630,7 +12634,28 @@
|
|
|
12630
12634
|
}
|
|
12631
12635
|
}
|
|
12632
12636
|
}
|
|
12633
|
-
|
|
12637
|
+
/**
|
|
12638
|
+
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
12639
|
+
* @param cacheLocation
|
|
12640
|
+
*/
|
|
12641
|
+
function getStorageImplementation(clientId, cacheLocation, logger, performanceClient) {
|
|
12642
|
+
try {
|
|
12643
|
+
switch (cacheLocation) {
|
|
12644
|
+
case BrowserCacheLocation.LocalStorage:
|
|
12645
|
+
return new LocalStorage(clientId, logger, performanceClient);
|
|
12646
|
+
case BrowserCacheLocation.SessionStorage:
|
|
12647
|
+
return new SessionStorage();
|
|
12648
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
12649
|
+
default:
|
|
12650
|
+
break;
|
|
12651
|
+
}
|
|
12652
|
+
}
|
|
12653
|
+
catch (e) {
|
|
12654
|
+
logger.error(e);
|
|
12655
|
+
}
|
|
12656
|
+
return new MemoryStorage();
|
|
12657
|
+
}
|
|
12658
|
+
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient) => {
|
|
12634
12659
|
const cacheOptions = {
|
|
12635
12660
|
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
12636
12661
|
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
@@ -12639,7 +12664,7 @@
|
|
|
12639
12664
|
cacheMigrationEnabled: false,
|
|
12640
12665
|
claimsBasedCachingEnabled: false,
|
|
12641
12666
|
};
|
|
12642
|
-
return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);
|
|
12667
|
+
return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient);
|
|
12643
12668
|
};
|
|
12644
12669
|
|
|
12645
12670
|
/*
|
|
@@ -13445,7 +13470,6 @@
|
|
|
13445
13470
|
this.nativeMessageHandler = provider;
|
|
13446
13471
|
this.nativeStorageManager = nativeStorageImpl;
|
|
13447
13472
|
this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
|
|
13448
|
-
this.serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
13449
13473
|
const extensionName = this.nativeMessageHandler.getExtensionId() ===
|
|
13450
13474
|
NativeConstants.PREFERRED_EXTENSION_ID
|
|
13451
13475
|
? "chrome"
|
|
@@ -13480,6 +13504,7 @@
|
|
|
13480
13504
|
// start the perf measurement
|
|
13481
13505
|
const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
|
|
13482
13506
|
const reqTimestamp = nowSeconds();
|
|
13507
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
13483
13508
|
try {
|
|
13484
13509
|
// initialize native request
|
|
13485
13510
|
const nativeRequest = await this.initializeNativeRequest(request);
|
|
@@ -13512,7 +13537,7 @@
|
|
|
13512
13537
|
isNativeBroker: true,
|
|
13513
13538
|
requestId: result.requestId,
|
|
13514
13539
|
});
|
|
13515
|
-
|
|
13540
|
+
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
13516
13541
|
return result;
|
|
13517
13542
|
})
|
|
13518
13543
|
.catch((error) => {
|
|
@@ -13527,7 +13552,7 @@
|
|
|
13527
13552
|
}
|
|
13528
13553
|
catch (e) {
|
|
13529
13554
|
if (e instanceof NativeAuthError) {
|
|
13530
|
-
|
|
13555
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
13531
13556
|
}
|
|
13532
13557
|
throw e;
|
|
13533
13558
|
}
|
|
@@ -13604,7 +13629,8 @@
|
|
|
13604
13629
|
catch (e) {
|
|
13605
13630
|
// Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
|
|
13606
13631
|
if (e instanceof NativeAuthError) {
|
|
13607
|
-
this.
|
|
13632
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
13633
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
13608
13634
|
if (isFatalNativeAuthError(e)) {
|
|
13609
13635
|
throw e;
|
|
13610
13636
|
}
|
|
@@ -13659,7 +13685,8 @@
|
|
|
13659
13685
|
const result = this.handleNativeResponse(response, request, reqTimestamp);
|
|
13660
13686
|
this.browserStorage.setInteractionInProgress(false);
|
|
13661
13687
|
const res = await result;
|
|
13662
|
-
this.
|
|
13688
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
13689
|
+
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
13663
13690
|
return res;
|
|
13664
13691
|
}
|
|
13665
13692
|
catch (e) {
|
|
@@ -13705,7 +13732,7 @@
|
|
|
13705
13732
|
const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
|
13706
13733
|
// cache accounts and tokens in the appropriate storage
|
|
13707
13734
|
await this.cacheAccount(baseAccount);
|
|
13708
|
-
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
|
|
13735
|
+
await this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
|
|
13709
13736
|
return result;
|
|
13710
13737
|
}
|
|
13711
13738
|
/**
|
|
@@ -13831,7 +13858,7 @@
|
|
|
13831
13858
|
*/
|
|
13832
13859
|
async cacheAccount(accountEntity) {
|
|
13833
13860
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
13834
|
-
await this.browserStorage.setAccount(accountEntity);
|
|
13861
|
+
await this.browserStorage.setAccount(accountEntity, this.correlationId);
|
|
13835
13862
|
// Remove any existing cached tokens for this account in browser storage
|
|
13836
13863
|
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
|
13837
13864
|
this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);
|
|
@@ -13862,7 +13889,7 @@
|
|
|
13862
13889
|
idToken: cachedIdToken,
|
|
13863
13890
|
accessToken: cachedAccessToken,
|
|
13864
13891
|
};
|
|
13865
|
-
|
|
13892
|
+
return this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, this.correlationId, request.storeInCache);
|
|
13866
13893
|
}
|
|
13867
13894
|
addTelemetryFromNativeResponse(response) {
|
|
13868
13895
|
const mats = this.getMATSFromResponse(response);
|
|
@@ -14297,15 +14324,15 @@
|
|
|
14297
14324
|
* @param nativeExtensionProvider
|
|
14298
14325
|
* @param authenticationScheme
|
|
14299
14326
|
*/
|
|
14300
|
-
static
|
|
14301
|
-
logger.trace("
|
|
14302
|
-
if (!config.system.
|
|
14303
|
-
logger.trace("
|
|
14327
|
+
static isPlatformBrokerAvailable(config, logger, nativeExtensionProvider, authenticationScheme) {
|
|
14328
|
+
logger.trace("isPlatformBrokerAvailable called");
|
|
14329
|
+
if (!config.system.allowPlatformBroker) {
|
|
14330
|
+
logger.trace("isPlatformBrokerAvailable: allowPlatformBroker is not enabled, returning false");
|
|
14304
14331
|
// Developer disabled WAM
|
|
14305
14332
|
return false;
|
|
14306
14333
|
}
|
|
14307
14334
|
if (!nativeExtensionProvider) {
|
|
14308
|
-
logger.trace("
|
|
14335
|
+
logger.trace("isPlatformBrokerAvailable: Platform extension provider is not initialized, returning false");
|
|
14309
14336
|
// Extension is not available
|
|
14310
14337
|
return false;
|
|
14311
14338
|
}
|
|
@@ -14313,10 +14340,10 @@
|
|
|
14313
14340
|
switch (authenticationScheme) {
|
|
14314
14341
|
case AuthenticationScheme.BEARER:
|
|
14315
14342
|
case AuthenticationScheme.POP:
|
|
14316
|
-
logger.trace("
|
|
14343
|
+
logger.trace("isPlatformBrokerAvailable: authenticationScheme is supported, returning true");
|
|
14317
14344
|
return true;
|
|
14318
14345
|
default:
|
|
14319
|
-
logger.trace("
|
|
14346
|
+
logger.trace("isPlatformBrokerAvailable: authenticationScheme is not supported, returning false");
|
|
14320
14347
|
return false;
|
|
14321
14348
|
}
|
|
14322
14349
|
}
|
|
@@ -14553,17 +14580,17 @@
|
|
|
14553
14580
|
requestExtraQueryParameters: validRequest.extraQueryParameters,
|
|
14554
14581
|
account: validRequest.account,
|
|
14555
14582
|
});
|
|
14556
|
-
const
|
|
14583
|
+
const isPlatformBroker = NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
|
|
14557
14584
|
// Start measurement for server calls with native brokering enabled
|
|
14558
14585
|
let fetchNativeAccountIdMeasurement;
|
|
14559
|
-
if (
|
|
14586
|
+
if (isPlatformBroker) {
|
|
14560
14587
|
fetchNativeAccountIdMeasurement =
|
|
14561
14588
|
this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);
|
|
14562
14589
|
}
|
|
14563
14590
|
// Create acquire token url.
|
|
14564
14591
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
14565
14592
|
...validRequest,
|
|
14566
|
-
|
|
14593
|
+
platformBroker: isPlatformBroker,
|
|
14567
14594
|
});
|
|
14568
14595
|
// Create popup interaction handler.
|
|
14569
14596
|
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
|
@@ -15080,7 +15107,7 @@
|
|
|
15080
15107
|
// Create acquire token url.
|
|
15081
15108
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
15082
15109
|
...validRequest,
|
|
15083
|
-
|
|
15110
|
+
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme),
|
|
15084
15111
|
});
|
|
15085
15112
|
const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
15086
15113
|
this.logger.verbosePii(`Redirect start page: ${redirectStartPage}`);
|
|
@@ -15594,7 +15621,7 @@
|
|
|
15594
15621
|
// Create authorize request url
|
|
15595
15622
|
const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
|
|
15596
15623
|
...silentRequest,
|
|
15597
|
-
|
|
15624
|
+
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
|
|
15598
15625
|
});
|
|
15599
15626
|
// Create silent handler
|
|
15600
15627
|
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
|
@@ -15713,6 +15740,7 @@
|
|
|
15713
15740
|
if (!this.isBrowserEnvironment) {
|
|
15714
15741
|
throw createBrowserAuthError(nonBrowserEnvironment);
|
|
15715
15742
|
}
|
|
15743
|
+
const correlationId = request.correlationId || createNewGuid();
|
|
15716
15744
|
const idTokenClaims = response.id_token
|
|
15717
15745
|
? extractTokenClaims(response.id_token, base64Decode)
|
|
15718
15746
|
: undefined;
|
|
@@ -15726,10 +15754,10 @@
|
|
|
15726
15754
|
const authority = request.authority
|
|
15727
15755
|
? new Authority(Authority.generateAuthority(request.authority, request.azureCloudOptions), this.config.system.networkClient, this.storage, authorityOptions, this.logger, request.correlationId || createNewGuid())
|
|
15728
15756
|
: undefined;
|
|
15729
|
-
const cacheRecordAccount = await this.loadAccount(request, options.clientInfo || response.client_info || "", idTokenClaims, authority);
|
|
15730
|
-
const idToken = await this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm);
|
|
15731
|
-
const accessToken = await this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options);
|
|
15732
|
-
const refreshToken = await this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment);
|
|
15757
|
+
const cacheRecordAccount = await this.loadAccount(request, options.clientInfo || response.client_info || "", correlationId, idTokenClaims, authority);
|
|
15758
|
+
const idToken = await this.loadIdToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, correlationId);
|
|
15759
|
+
const accessToken = await this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, cacheRecordAccount.realm, options, correlationId);
|
|
15760
|
+
const refreshToken = await this.loadRefreshToken(response, cacheRecordAccount.homeAccountId, cacheRecordAccount.environment, correlationId);
|
|
15733
15761
|
return this.generateAuthenticationResult(request, {
|
|
15734
15762
|
account: cacheRecordAccount,
|
|
15735
15763
|
idToken,
|
|
@@ -15746,11 +15774,11 @@
|
|
|
15746
15774
|
* @param requestHomeAccountId
|
|
15747
15775
|
* @returns `AccountEntity`
|
|
15748
15776
|
*/
|
|
15749
|
-
async loadAccount(request, clientInfo, idTokenClaims, authority) {
|
|
15777
|
+
async loadAccount(request, clientInfo, correlationId, idTokenClaims, authority) {
|
|
15750
15778
|
this.logger.verbose("TokenCache - loading account");
|
|
15751
15779
|
if (request.account) {
|
|
15752
15780
|
const accountEntity = AccountEntity.createFromAccountInfo(request.account);
|
|
15753
|
-
await this.storage.setAccount(accountEntity);
|
|
15781
|
+
await this.storage.setAccount(accountEntity, correlationId);
|
|
15754
15782
|
return accountEntity;
|
|
15755
15783
|
}
|
|
15756
15784
|
else if (!authority || (!clientInfo && !idTokenClaims)) {
|
|
@@ -15762,7 +15790,7 @@
|
|
|
15762
15790
|
const cachedAccount = buildAccountToCache(this.storage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, authority.hostnameAndPort, claimsTenantId, undefined, // authCodePayload
|
|
15763
15791
|
undefined, // nativeAccountId
|
|
15764
15792
|
this.logger);
|
|
15765
|
-
await this.storage.setAccount(cachedAccount);
|
|
15793
|
+
await this.storage.setAccount(cachedAccount, correlationId);
|
|
15766
15794
|
return cachedAccount;
|
|
15767
15795
|
}
|
|
15768
15796
|
/**
|
|
@@ -15773,14 +15801,14 @@
|
|
|
15773
15801
|
* @param tenantId
|
|
15774
15802
|
* @returns `IdTokenEntity`
|
|
15775
15803
|
*/
|
|
15776
|
-
async loadIdToken(response, homeAccountId, environment, tenantId) {
|
|
15804
|
+
async loadIdToken(response, homeAccountId, environment, tenantId, correlationId) {
|
|
15777
15805
|
if (!response.id_token) {
|
|
15778
15806
|
this.logger.verbose("TokenCache - no id token found in response");
|
|
15779
15807
|
return null;
|
|
15780
15808
|
}
|
|
15781
15809
|
this.logger.verbose("TokenCache - loading id token");
|
|
15782
15810
|
const idTokenEntity = createIdTokenEntity(homeAccountId, environment, response.id_token, this.config.auth.clientId, tenantId);
|
|
15783
|
-
await this.storage.setIdTokenCredential(idTokenEntity);
|
|
15811
|
+
await this.storage.setIdTokenCredential(idTokenEntity, correlationId);
|
|
15784
15812
|
return idTokenEntity;
|
|
15785
15813
|
}
|
|
15786
15814
|
/**
|
|
@@ -15792,7 +15820,7 @@
|
|
|
15792
15820
|
* @param tenantId
|
|
15793
15821
|
* @returns `AccessTokenEntity`
|
|
15794
15822
|
*/
|
|
15795
|
-
async loadAccessToken(request, response, homeAccountId, environment, tenantId, options) {
|
|
15823
|
+
async loadAccessToken(request, response, homeAccountId, environment, tenantId, options, correlationId) {
|
|
15796
15824
|
if (!response.access_token) {
|
|
15797
15825
|
this.logger.verbose("TokenCache - no access token found in response");
|
|
15798
15826
|
return null;
|
|
@@ -15816,7 +15844,7 @@
|
|
|
15816
15844
|
(response.ext_expires_in || response.expires_in) +
|
|
15817
15845
|
new Date().getTime() / 1000;
|
|
15818
15846
|
const accessTokenEntity = createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes.printScopes(), expiresOn, extendedExpiresOn, base64Decode);
|
|
15819
|
-
await this.storage.setAccessTokenCredential(accessTokenEntity);
|
|
15847
|
+
await this.storage.setAccessTokenCredential(accessTokenEntity, correlationId);
|
|
15820
15848
|
return accessTokenEntity;
|
|
15821
15849
|
}
|
|
15822
15850
|
/**
|
|
@@ -15827,7 +15855,7 @@
|
|
|
15827
15855
|
* @param environment
|
|
15828
15856
|
* @returns `RefreshTokenEntity`
|
|
15829
15857
|
*/
|
|
15830
|
-
async loadRefreshToken(response, homeAccountId, environment) {
|
|
15858
|
+
async loadRefreshToken(response, homeAccountId, environment, correlationId) {
|
|
15831
15859
|
if (!response.refresh_token) {
|
|
15832
15860
|
this.logger.verbose("TokenCache - no refresh token found in response");
|
|
15833
15861
|
return null;
|
|
@@ -15835,7 +15863,7 @@
|
|
|
15835
15863
|
this.logger.verbose("TokenCache - loading refresh token");
|
|
15836
15864
|
const refreshTokenEntity = createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId, response.foci, undefined, // userAssertionHash
|
|
15837
15865
|
response.refresh_token_expires_in);
|
|
15838
|
-
await this.storage.setRefreshTokenCredential(refreshTokenEntity);
|
|
15866
|
+
await this.storage.setRefreshTokenCredential(refreshTokenEntity, correlationId);
|
|
15839
15867
|
return refreshTokenEntity;
|
|
15840
15868
|
}
|
|
15841
15869
|
/**
|
|
@@ -16031,8 +16059,8 @@
|
|
|
16031
16059
|
this.eventHandler = new EventHandler(this.logger);
|
|
16032
16060
|
// Initialize the browser storage class.
|
|
16033
16061
|
this.browserStorage = this.isBrowserEnvironment
|
|
16034
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth)
|
|
16035
|
-
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
16062
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
|
|
16063
|
+
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
|
|
16036
16064
|
// initialize in memory storage for native flows
|
|
16037
16065
|
const nativeCacheOptions = {
|
|
16038
16066
|
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
@@ -16042,7 +16070,7 @@
|
|
|
16042
16070
|
cacheMigrationEnabled: false,
|
|
16043
16071
|
claimsBasedCachingEnabled: false,
|
|
16044
16072
|
};
|
|
16045
|
-
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger,
|
|
16073
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient);
|
|
16046
16074
|
// Initialize the token cache
|
|
16047
16075
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
16048
16076
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -16084,12 +16112,12 @@
|
|
|
16084
16112
|
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16085
16113
|
return;
|
|
16086
16114
|
}
|
|
16087
|
-
await this.browserStorage.initialize();
|
|
16088
16115
|
const initCorrelationId = request?.correlationId || this.getRequestCorrelationId();
|
|
16089
|
-
const
|
|
16116
|
+
const allowPlatformBroker = this.config.system.allowPlatformBroker;
|
|
16090
16117
|
const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication, initCorrelationId);
|
|
16091
16118
|
this.eventHandler.emitEvent(EventType.INITIALIZE_START);
|
|
16092
|
-
|
|
16119
|
+
await invokeAsync(this.browserStorage.initialize.bind(this.browserStorage), PerformanceEvents.InitializeCache, this.logger, this.performanceClient, initCorrelationId)(initCorrelationId);
|
|
16120
|
+
if (allowPlatformBroker) {
|
|
16093
16121
|
try {
|
|
16094
16122
|
this.nativeExtensionProvider =
|
|
16095
16123
|
await NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout, this.performanceClient);
|
|
@@ -16104,7 +16132,10 @@
|
|
|
16104
16132
|
}
|
|
16105
16133
|
this.initialized = true;
|
|
16106
16134
|
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16107
|
-
initMeasurement.end({
|
|
16135
|
+
initMeasurement.end({
|
|
16136
|
+
allowPlatformBroker: allowPlatformBroker,
|
|
16137
|
+
success: true,
|
|
16138
|
+
});
|
|
16108
16139
|
}
|
|
16109
16140
|
// #region Redirect Flow
|
|
16110
16141
|
/**
|
|
@@ -16148,7 +16179,7 @@
|
|
|
16148
16179
|
const loggedInAccounts = this.getAllAccounts();
|
|
16149
16180
|
const request = this.browserStorage.getCachedNativeRequest();
|
|
16150
16181
|
const useNative = request &&
|
|
16151
|
-
NativeMessageHandler.
|
|
16182
|
+
NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
16152
16183
|
this.nativeExtensionProvider &&
|
|
16153
16184
|
!hash;
|
|
16154
16185
|
const correlationId = useNative
|
|
@@ -16277,7 +16308,8 @@
|
|
|
16277
16308
|
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Redirect, request);
|
|
16278
16309
|
}
|
|
16279
16310
|
let result;
|
|
16280
|
-
if (this.nativeExtensionProvider &&
|
|
16311
|
+
if (this.nativeExtensionProvider &&
|
|
16312
|
+
this.canUsePlatformBroker(request)) {
|
|
16281
16313
|
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
|
|
16282
16314
|
result = nativeClient
|
|
16283
16315
|
.acquireTokenRedirect(request, atrMeasurement)
|
|
@@ -16348,7 +16380,7 @@
|
|
|
16348
16380
|
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Popup, request);
|
|
16349
16381
|
}
|
|
16350
16382
|
let result;
|
|
16351
|
-
if (this.
|
|
16383
|
+
if (this.canUsePlatformBroker(request)) {
|
|
16352
16384
|
result = this.acquireTokenNative({
|
|
16353
16385
|
...request,
|
|
16354
16386
|
correlationId,
|
|
@@ -16465,7 +16497,7 @@
|
|
|
16465
16497
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
16466
16498
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
16467
16499
|
let result;
|
|
16468
|
-
if (this.
|
|
16500
|
+
if (this.canUsePlatformBroker(validRequest)) {
|
|
16469
16501
|
result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch((e) => {
|
|
16470
16502
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
16471
16503
|
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
@@ -16563,7 +16595,7 @@
|
|
|
16563
16595
|
return await response;
|
|
16564
16596
|
}
|
|
16565
16597
|
else if (request.nativeAccountId) {
|
|
16566
|
-
if (this.
|
|
16598
|
+
if (this.canUsePlatformBroker(request, request.nativeAccountId)) {
|
|
16567
16599
|
const result = await this.acquireTokenNative({
|
|
16568
16600
|
...request,
|
|
16569
16601
|
correlationId,
|
|
@@ -16810,7 +16842,7 @@
|
|
|
16810
16842
|
this.logger.verbose("hydrateCache called");
|
|
16811
16843
|
// Account gets saved to browser storage regardless of native or not
|
|
16812
16844
|
const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
16813
|
-
await this.browserStorage.setAccount(accountEntity);
|
|
16845
|
+
await this.browserStorage.setAccount(accountEntity, result.correlationId);
|
|
16814
16846
|
if (result.fromNativeBroker) {
|
|
16815
16847
|
this.logger.verbose("Response was from native broker, storing in-memory");
|
|
16816
16848
|
// Tokens from native broker are stored in-memory
|
|
@@ -16834,13 +16866,13 @@
|
|
|
16834
16866
|
return nativeClient.acquireToken(request);
|
|
16835
16867
|
}
|
|
16836
16868
|
/**
|
|
16837
|
-
* Returns boolean indicating if this request can use the
|
|
16869
|
+
* Returns boolean indicating if this request can use the platform broker
|
|
16838
16870
|
* @param request
|
|
16839
16871
|
*/
|
|
16840
|
-
|
|
16841
|
-
this.logger.trace("
|
|
16842
|
-
if (!NativeMessageHandler.
|
|
16843
|
-
this.logger.trace("
|
|
16872
|
+
canUsePlatformBroker(request, accountId) {
|
|
16873
|
+
this.logger.trace("canUsePlatformBroker called");
|
|
16874
|
+
if (!NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme)) {
|
|
16875
|
+
this.logger.trace("canUsePlatformBroker: isPlatformBrokerAvailable returned false, returning false");
|
|
16844
16876
|
return false;
|
|
16845
16877
|
}
|
|
16846
16878
|
if (request.prompt) {
|
|
@@ -16848,15 +16880,15 @@
|
|
|
16848
16880
|
case PromptValue.NONE:
|
|
16849
16881
|
case PromptValue.CONSENT:
|
|
16850
16882
|
case PromptValue.LOGIN:
|
|
16851
|
-
this.logger.trace("
|
|
16883
|
+
this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");
|
|
16852
16884
|
break;
|
|
16853
16885
|
default:
|
|
16854
|
-
this.logger.trace(`
|
|
16886
|
+
this.logger.trace(`canUsePlatformBroker: prompt = ${request.prompt} is not compatible with platform broker flow, returning false`);
|
|
16855
16887
|
return false;
|
|
16856
16888
|
}
|
|
16857
16889
|
}
|
|
16858
16890
|
if (!accountId && !this.getNativeAccountId(request)) {
|
|
16859
|
-
this.logger.trace("
|
|
16891
|
+
this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false");
|
|
16860
16892
|
return false;
|
|
16861
16893
|
}
|
|
16862
16894
|
return true;
|
|
@@ -17297,7 +17329,7 @@
|
|
|
17297
17329
|
* @returns
|
|
17298
17330
|
*/
|
|
17299
17331
|
async acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy) {
|
|
17300
|
-
if (NativeMessageHandler.
|
|
17332
|
+
if (NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeExtensionProvider, silentRequest.authenticationScheme) &&
|
|
17301
17333
|
silentRequest.account.nativeAccountId) {
|
|
17302
17334
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
17303
17335
|
return this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
@@ -17583,20 +17615,17 @@
|
|
|
17583
17615
|
this.performanceClient = this.config.telemetry.client;
|
|
17584
17616
|
// Initialize the crypto class.
|
|
17585
17617
|
this.browserCrypto = operatingContext.isBrowserEnvironment()
|
|
17586
|
-
? new CryptoOps(this.logger, this.performanceClient)
|
|
17618
|
+
? new CryptoOps(this.logger, this.performanceClient, true)
|
|
17587
17619
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
17588
17620
|
// Initialize the browser storage class.
|
|
17589
17621
|
this.browserStorage = this.operatingContext.isBrowserEnvironment()
|
|
17590
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth))
|
|
17591
|
-
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
17622
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, buildStaticAuthorityOptions(this.config.auth))
|
|
17623
|
+
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
|
|
17592
17624
|
this.eventHandler = new EventHandler(this.logger);
|
|
17593
17625
|
this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
|
|
17594
17626
|
// Set the active account if available
|
|
17595
17627
|
const accountContext = this.bridgeProxy.getAccountContext();
|
|
17596
|
-
|
|
17597
|
-
const cachedAccount = getAccount(accountContext, this.logger, this.browserStorage);
|
|
17598
|
-
setActiveAccount(cachedAccount, this.browserStorage);
|
|
17599
|
-
}
|
|
17628
|
+
this.currentAccountContext = accountContext ? accountContext : null;
|
|
17600
17629
|
}
|
|
17601
17630
|
/**
|
|
17602
17631
|
* Factory function to create a new instance of NestedAppAuthController
|
|
@@ -17611,8 +17640,9 @@
|
|
|
17611
17640
|
* Specific implementation of initialize function for NestedAppAuthController
|
|
17612
17641
|
* @returns
|
|
17613
17642
|
*/
|
|
17614
|
-
async initialize() {
|
|
17615
|
-
|
|
17643
|
+
async initialize(request) {
|
|
17644
|
+
const initCorrelationId = request?.correlationId || createNewGuid();
|
|
17645
|
+
await this.browserStorage.initialize(initCorrelationId);
|
|
17616
17646
|
return Promise.resolve();
|
|
17617
17647
|
}
|
|
17618
17648
|
/**
|
|
@@ -17648,7 +17678,12 @@
|
|
|
17648
17678
|
};
|
|
17649
17679
|
// cache the tokens in the response
|
|
17650
17680
|
await this.hydrateCache(result, request);
|
|
17651
|
-
|
|
17681
|
+
// cache the account context in memory after successful token fetch
|
|
17682
|
+
this.currentAccountContext = {
|
|
17683
|
+
homeAccountId: result.account.homeAccountId,
|
|
17684
|
+
environment: result.account.environment,
|
|
17685
|
+
tenantId: result.account.tenantId,
|
|
17686
|
+
};
|
|
17652
17687
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
|
|
17653
17688
|
atPopupMeasurement.add({
|
|
17654
17689
|
accessTokenSize: result.accessToken.length,
|
|
@@ -17698,7 +17733,12 @@
|
|
|
17698
17733
|
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
17699
17734
|
// cache the tokens in the response
|
|
17700
17735
|
await this.hydrateCache(result, request);
|
|
17701
|
-
|
|
17736
|
+
// cache the account context in memory after successful token fetch
|
|
17737
|
+
this.currentAccountContext = {
|
|
17738
|
+
homeAccountId: result.account.homeAccountId,
|
|
17739
|
+
environment: result.account.environment,
|
|
17740
|
+
tenantId: result.account.tenantId,
|
|
17741
|
+
};
|
|
17702
17742
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, result);
|
|
17703
17743
|
ssoSilentMeasurement?.add({
|
|
17704
17744
|
accessTokenSize: result.accessToken.length,
|
|
@@ -17734,8 +17774,16 @@
|
|
|
17734
17774
|
this.logger.verbose("Claims are present in the request, skipping cache lookup");
|
|
17735
17775
|
return null;
|
|
17736
17776
|
}
|
|
17777
|
+
// if the request has forceRefresh, we cannot look up in the cache
|
|
17778
|
+
if (request.forceRefresh) {
|
|
17779
|
+
this.logger.verbose("forceRefresh is set to true, skipping cache lookup");
|
|
17780
|
+
return null;
|
|
17781
|
+
}
|
|
17737
17782
|
// respect cache lookup policy
|
|
17738
17783
|
let result = null;
|
|
17784
|
+
if (!request.cacheLookupPolicy) {
|
|
17785
|
+
request.cacheLookupPolicy = CacheLookupPolicy.Default;
|
|
17786
|
+
}
|
|
17739
17787
|
switch (request.cacheLookupPolicy) {
|
|
17740
17788
|
case CacheLookupPolicy.Default:
|
|
17741
17789
|
case CacheLookupPolicy.AccessToken:
|
|
@@ -17769,12 +17817,11 @@
|
|
|
17769
17817
|
* @returns
|
|
17770
17818
|
*/
|
|
17771
17819
|
async acquireTokenFromCacheInternal(request) {
|
|
17772
|
-
|
|
17820
|
+
// always prioritize the account context from the bridge
|
|
17821
|
+
const accountContext = this.bridgeProxy.getAccountContext() || this.currentAccountContext;
|
|
17773
17822
|
let currentAccount = null;
|
|
17774
17823
|
if (accountContext) {
|
|
17775
|
-
|
|
17776
|
-
// always prioritize for hub account context, the reqirement of `request.account` will be removed soon
|
|
17777
|
-
currentAccount = hubAccount || request.account;
|
|
17824
|
+
currentAccount = getAccount(accountContext, this.logger, this.browserStorage);
|
|
17778
17825
|
}
|
|
17779
17826
|
// fall back to brokering if no cached account is found
|
|
17780
17827
|
if (!currentAccount) {
|
|
@@ -18038,7 +18085,7 @@
|
|
|
18038
18085
|
async hydrateCache(result, request) {
|
|
18039
18086
|
this.logger.verbose("hydrateCache called");
|
|
18040
18087
|
const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
18041
|
-
await this.browserStorage.setAccount(accountEntity);
|
|
18088
|
+
await this.browserStorage.setAccount(accountEntity, result.correlationId);
|
|
18042
18089
|
return this.browserStorage.hydrateCache(result, request);
|
|
18043
18090
|
}
|
|
18044
18091
|
}
|
|
@@ -18418,7 +18465,9 @@
|
|
|
18418
18465
|
await nestedAppAuth.initialize();
|
|
18419
18466
|
if (nestedAppAuth.isAvailable()) {
|
|
18420
18467
|
const controller = new NestedAppAuthController(nestedAppAuth);
|
|
18421
|
-
|
|
18468
|
+
const nestablePCA = new PublicClientApplication(configuration, controller);
|
|
18469
|
+
await nestablePCA.initialize();
|
|
18470
|
+
return nestablePCA;
|
|
18422
18471
|
}
|
|
18423
18472
|
return createStandardPublicClientApplication(configuration);
|
|
18424
18473
|
}
|
|
@@ -18470,8 +18519,8 @@
|
|
|
18470
18519
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
18471
18520
|
// Initialize the browser storage class.
|
|
18472
18521
|
this.browserStorage = this.isBrowserEnvironment
|
|
18473
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger,
|
|
18474
|
-
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
18522
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, undefined)
|
|
18523
|
+
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient);
|
|
18475
18524
|
}
|
|
18476
18525
|
getBrowserStorage() {
|
|
18477
18526
|
return this.browserStorage;
|