@azure/msal-browser 3.11.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.d.ts +2 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +4 -1
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +10 -2
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +31 -3
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +2 -3
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +3 -8
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +14 -0
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +213 -117
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +2 -2
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +4 -5
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +5 -8
- 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 +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +2 -1
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.d.ts +0 -2
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +4 -10
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +10 -11
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.d.ts +3 -0
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +2 -1
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +486 -257
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +486 -257
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -66
- package/package.json +4 -4
- package/src/app/IPublicClientApplication.ts +5 -0
- package/src/cache/BrowserCacheManager.ts +49 -1
- package/src/controllers/ControllerFactory.ts +1 -4
- package/src/controllers/NestedAppAuthController.ts +7 -6
- package/src/controllers/StandardController.ts +380 -263
- package/src/controllers/UnknownOperatingContextController.ts +3 -1
- package/src/interaction_client/RedirectClient.ts +6 -12
- package/src/interaction_handler/SilentHandler.ts +1 -0
- package/src/naa/BridgeProxy.ts +3 -12
- package/src/operatingcontext/TeamsAppOperatingContext.ts +14 -8
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserUtils.ts +4 -1
package/lib/msal-browser.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.14.0 2024-05-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v14.
|
|
5
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -66,13 +66,24 @@ const Constants = {
|
|
|
66
66
|
INVALID_INSTANCE: "invalid_instance",
|
|
67
67
|
};
|
|
68
68
|
const HttpStatus = {
|
|
69
|
+
SUCCESS: 200,
|
|
69
70
|
SUCCESS_RANGE_START: 200,
|
|
70
71
|
SUCCESS_RANGE_END: 299,
|
|
71
72
|
REDIRECT: 302,
|
|
73
|
+
CLIENT_ERROR: 400,
|
|
72
74
|
CLIENT_ERROR_RANGE_START: 400,
|
|
75
|
+
BAD_REQUEST: 400,
|
|
76
|
+
UNAUTHORIZED: 401,
|
|
77
|
+
NOT_FOUND: 404,
|
|
78
|
+
REQUEST_TIMEOUT: 408,
|
|
79
|
+
TOO_MANY_REQUESTS: 429,
|
|
73
80
|
CLIENT_ERROR_RANGE_END: 499,
|
|
81
|
+
SERVER_ERROR: 500,
|
|
74
82
|
SERVER_ERROR_RANGE_START: 500,
|
|
83
|
+
SERVICE_UNAVAILABLE: 503,
|
|
84
|
+
GATEWAY_TIMEOUT: 504,
|
|
75
85
|
SERVER_ERROR_RANGE_END: 599,
|
|
86
|
+
MULTI_SIDED_ERROR: 600,
|
|
76
87
|
};
|
|
77
88
|
const OIDC_DEFAULT_SCOPES = [
|
|
78
89
|
Constants.OPENID_SCOPE,
|
|
@@ -296,8 +307,10 @@ const JsonWebTokenTypes = {
|
|
|
296
307
|
Jwk: "JWK",
|
|
297
308
|
Pop: "pop",
|
|
298
309
|
};
|
|
310
|
+
// Token renewal offset default in seconds
|
|
311
|
+
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
299
312
|
|
|
300
|
-
/*! @azure/msal-common v14.
|
|
313
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
301
314
|
/*
|
|
302
315
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
303
316
|
* Licensed under the MIT License.
|
|
@@ -314,7 +327,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
314
327
|
unexpectedError: unexpectedError
|
|
315
328
|
});
|
|
316
329
|
|
|
317
|
-
/*! @azure/msal-common v14.
|
|
330
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
318
331
|
|
|
319
332
|
/*
|
|
320
333
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -363,7 +376,7 @@ function createAuthError(code, additionalMessage) {
|
|
|
363
376
|
: AuthErrorMessages[code]);
|
|
364
377
|
}
|
|
365
378
|
|
|
366
|
-
/*! @azure/msal-common v14.
|
|
379
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
367
380
|
/*
|
|
368
381
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
369
382
|
* Licensed under the MIT License.
|
|
@@ -461,7 +474,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
461
474
|
userTimeoutReached: userTimeoutReached
|
|
462
475
|
});
|
|
463
476
|
|
|
464
|
-
/*! @azure/msal-common v14.
|
|
477
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
465
478
|
|
|
466
479
|
/*
|
|
467
480
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -713,7 +726,7 @@ function createClientAuthError(errorCode, additionalMessage) {
|
|
|
713
726
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
714
727
|
}
|
|
715
728
|
|
|
716
|
-
/*! @azure/msal-common v14.
|
|
729
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
717
730
|
|
|
718
731
|
/*
|
|
719
732
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -746,7 +759,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
746
759
|
},
|
|
747
760
|
};
|
|
748
761
|
|
|
749
|
-
/*! @azure/msal-common v14.
|
|
762
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
750
763
|
|
|
751
764
|
/*
|
|
752
765
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -937,12 +950,12 @@ class Logger {
|
|
|
937
950
|
}
|
|
938
951
|
}
|
|
939
952
|
|
|
940
|
-
/*! @azure/msal-common v14.
|
|
953
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
941
954
|
/* eslint-disable header/header */
|
|
942
955
|
const name$1 = "@azure/msal-common";
|
|
943
|
-
const version$1 = "14.
|
|
956
|
+
const version$1 = "14.10.0";
|
|
944
957
|
|
|
945
|
-
/*! @azure/msal-common v14.
|
|
958
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
946
959
|
/*
|
|
947
960
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
948
961
|
* Licensed under the MIT License.
|
|
@@ -962,7 +975,7 @@ const AzureCloudInstance = {
|
|
|
962
975
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
963
976
|
};
|
|
964
977
|
|
|
965
|
-
/*! @azure/msal-common v14.
|
|
978
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
966
979
|
|
|
967
980
|
/*
|
|
968
981
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1023,7 +1036,7 @@ function checkMaxAge(authTime, maxAge) {
|
|
|
1023
1036
|
}
|
|
1024
1037
|
}
|
|
1025
1038
|
|
|
1026
|
-
/*! @azure/msal-common v14.
|
|
1039
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1027
1040
|
/*
|
|
1028
1041
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1029
1042
|
* Licensed under the MIT License.
|
|
@@ -1060,7 +1073,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1060
1073
|
return cachedAtSec > nowSeconds();
|
|
1061
1074
|
}
|
|
1062
1075
|
|
|
1063
|
-
/*! @azure/msal-common v14.
|
|
1076
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1064
1077
|
|
|
1065
1078
|
/*
|
|
1066
1079
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1387,7 +1400,7 @@ function isAuthorityMetadataExpired(metadata) {
|
|
|
1387
1400
|
return metadata.expiresAt <= nowSeconds();
|
|
1388
1401
|
}
|
|
1389
1402
|
|
|
1390
|
-
/*! @azure/msal-common v14.
|
|
1403
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1391
1404
|
/*
|
|
1392
1405
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1393
1406
|
* Licensed under the MIT License.
|
|
@@ -1441,7 +1454,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
1441
1454
|
urlParseError: urlParseError
|
|
1442
1455
|
});
|
|
1443
1456
|
|
|
1444
|
-
/*! @azure/msal-common v14.
|
|
1457
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1445
1458
|
|
|
1446
1459
|
/*
|
|
1447
1460
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1579,7 +1592,7 @@ function createClientConfigurationError(errorCode) {
|
|
|
1579
1592
|
return new ClientConfigurationError(errorCode);
|
|
1580
1593
|
}
|
|
1581
1594
|
|
|
1582
|
-
/*! @azure/msal-common v14.
|
|
1595
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1583
1596
|
/*
|
|
1584
1597
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1585
1598
|
* Licensed under the MIT License.
|
|
@@ -1676,7 +1689,7 @@ class StringUtils {
|
|
|
1676
1689
|
}
|
|
1677
1690
|
}
|
|
1678
1691
|
|
|
1679
|
-
/*! @azure/msal-common v14.
|
|
1692
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1680
1693
|
|
|
1681
1694
|
/*
|
|
1682
1695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1876,7 +1889,7 @@ class ScopeSet {
|
|
|
1876
1889
|
}
|
|
1877
1890
|
}
|
|
1878
1891
|
|
|
1879
|
-
/*! @azure/msal-common v14.
|
|
1892
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1880
1893
|
|
|
1881
1894
|
/*
|
|
1882
1895
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1916,7 +1929,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1916
1929
|
};
|
|
1917
1930
|
}
|
|
1918
1931
|
|
|
1919
|
-
/*! @azure/msal-common v14.
|
|
1932
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1920
1933
|
/*
|
|
1921
1934
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1922
1935
|
* Licensed under the MIT License.
|
|
@@ -1978,7 +1991,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
1978
1991
|
return updatedAccountInfo;
|
|
1979
1992
|
}
|
|
1980
1993
|
|
|
1981
|
-
/*! @azure/msal-common v14.
|
|
1994
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1982
1995
|
/*
|
|
1983
1996
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1984
1997
|
* Licensed under the MIT License.
|
|
@@ -1993,7 +2006,7 @@ const AuthorityType = {
|
|
|
1993
2006
|
Ciam: 3,
|
|
1994
2007
|
};
|
|
1995
2008
|
|
|
1996
|
-
/*! @azure/msal-common v14.
|
|
2009
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
1997
2010
|
/*
|
|
1998
2011
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1999
2012
|
* Licensed under the MIT License.
|
|
@@ -2015,7 +2028,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
2015
2028
|
return null;
|
|
2016
2029
|
}
|
|
2017
2030
|
|
|
2018
|
-
/*! @azure/msal-common v14.
|
|
2031
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2019
2032
|
/*
|
|
2020
2033
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2021
2034
|
* Licensed under the MIT License.
|
|
@@ -2028,7 +2041,7 @@ const ProtocolMode = {
|
|
|
2028
2041
|
OIDC: "OIDC",
|
|
2029
2042
|
};
|
|
2030
2043
|
|
|
2031
|
-
/*! @azure/msal-common v14.
|
|
2044
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2032
2045
|
|
|
2033
2046
|
/*
|
|
2034
2047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2275,7 +2288,7 @@ class AccountEntity {
|
|
|
2275
2288
|
}
|
|
2276
2289
|
}
|
|
2277
2290
|
|
|
2278
|
-
/*! @azure/msal-common v14.
|
|
2291
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2279
2292
|
|
|
2280
2293
|
/*
|
|
2281
2294
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2322,7 +2335,7 @@ function getDeserializedResponse(responseString) {
|
|
|
2322
2335
|
return null;
|
|
2323
2336
|
}
|
|
2324
2337
|
|
|
2325
|
-
/*! @azure/msal-common v14.
|
|
2338
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2326
2339
|
|
|
2327
2340
|
/*
|
|
2328
2341
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2486,7 +2499,7 @@ class UrlString {
|
|
|
2486
2499
|
}
|
|
2487
2500
|
}
|
|
2488
2501
|
|
|
2489
|
-
/*! @azure/msal-common v14.
|
|
2502
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2490
2503
|
|
|
2491
2504
|
/*
|
|
2492
2505
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2626,7 +2639,42 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
2626
2639
|
return null;
|
|
2627
2640
|
}
|
|
2628
2641
|
|
|
2629
|
-
/*! @azure/msal-common v14.
|
|
2642
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2643
|
+
/*
|
|
2644
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2645
|
+
* Licensed under the MIT License.
|
|
2646
|
+
*/
|
|
2647
|
+
const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
|
|
2648
|
+
const cacheUnknownErrorCode = "cache_error_unknown";
|
|
2649
|
+
|
|
2650
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2651
|
+
|
|
2652
|
+
/*
|
|
2653
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2654
|
+
* Licensed under the MIT License.
|
|
2655
|
+
*/
|
|
2656
|
+
const CacheErrorMessages = {
|
|
2657
|
+
[cacheQuotaExceededErrorCode]: "Exceeded cache storage capacity.",
|
|
2658
|
+
[cacheUnknownErrorCode]: "Unexpected error occurred when using cache storage.",
|
|
2659
|
+
};
|
|
2660
|
+
/**
|
|
2661
|
+
* Error thrown when there is an error with the cache
|
|
2662
|
+
*/
|
|
2663
|
+
class CacheError extends Error {
|
|
2664
|
+
constructor(errorCode, errorMessage) {
|
|
2665
|
+
const message = errorMessage ||
|
|
2666
|
+
(CacheErrorMessages[errorCode]
|
|
2667
|
+
? CacheErrorMessages[errorCode]
|
|
2668
|
+
: CacheErrorMessages[cacheUnknownErrorCode]);
|
|
2669
|
+
super(`${errorCode}: ${message}`);
|
|
2670
|
+
Object.setPrototypeOf(this, CacheError.prototype);
|
|
2671
|
+
this.name = "CacheError";
|
|
2672
|
+
this.errorCode = errorCode;
|
|
2673
|
+
this.errorMessage = message;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
2630
2678
|
|
|
2631
2679
|
/*
|
|
2632
2680
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2790,27 +2838,51 @@ class CacheManager {
|
|
|
2790
2838
|
}
|
|
2791
2839
|
/**
|
|
2792
2840
|
* saves a cache record
|
|
2793
|
-
* @param cacheRecord
|
|
2841
|
+
* @param cacheRecord {CacheRecord}
|
|
2842
|
+
* @param storeInCache {?StoreInCache}
|
|
2843
|
+
* @param correlationId {?string} correlation id
|
|
2794
2844
|
*/
|
|
2795
|
-
async saveCacheRecord(cacheRecord, storeInCache) {
|
|
2845
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
2796
2846
|
if (!cacheRecord) {
|
|
2797
2847
|
throw createClientAuthError(invalidCacheRecord);
|
|
2798
2848
|
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2849
|
+
try {
|
|
2850
|
+
if (!!cacheRecord.account) {
|
|
2851
|
+
this.setAccount(cacheRecord.account);
|
|
2852
|
+
}
|
|
2853
|
+
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2854
|
+
this.setIdTokenCredential(cacheRecord.idToken);
|
|
2855
|
+
}
|
|
2856
|
+
if (!!cacheRecord.accessToken &&
|
|
2857
|
+
storeInCache?.accessToken !== false) {
|
|
2858
|
+
await this.saveAccessToken(cacheRecord.accessToken);
|
|
2859
|
+
}
|
|
2860
|
+
if (!!cacheRecord.refreshToken &&
|
|
2861
|
+
storeInCache?.refreshToken !== false) {
|
|
2862
|
+
this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2863
|
+
}
|
|
2864
|
+
if (!!cacheRecord.appMetadata) {
|
|
2865
|
+
this.setAppMetadata(cacheRecord.appMetadata);
|
|
2866
|
+
}
|
|
2811
2867
|
}
|
|
2812
|
-
|
|
2813
|
-
this.
|
|
2868
|
+
catch (e) {
|
|
2869
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);
|
|
2870
|
+
if (e instanceof Error) {
|
|
2871
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);
|
|
2872
|
+
if (e.name === "QuotaExceededError" ||
|
|
2873
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED" ||
|
|
2874
|
+
e.message.includes("exceeded the quota")) {
|
|
2875
|
+
this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);
|
|
2876
|
+
throw new CacheError(cacheQuotaExceededErrorCode);
|
|
2877
|
+
}
|
|
2878
|
+
else {
|
|
2879
|
+
throw new CacheError(e.name, e.message);
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
else {
|
|
2883
|
+
this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);
|
|
2884
|
+
throw new CacheError(cacheUnknownErrorCode);
|
|
2885
|
+
}
|
|
2814
2886
|
}
|
|
2815
2887
|
}
|
|
2816
2888
|
/**
|
|
@@ -3857,14 +3929,12 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3857
3929
|
}
|
|
3858
3930
|
}
|
|
3859
3931
|
|
|
3860
|
-
/*! @azure/msal-common v14.
|
|
3932
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
3861
3933
|
|
|
3862
3934
|
/*
|
|
3863
3935
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3864
3936
|
* Licensed under the MIT License.
|
|
3865
3937
|
*/
|
|
3866
|
-
// Token renewal offset default in seconds
|
|
3867
|
-
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3868
3938
|
const DEFAULT_SYSTEM_OPTIONS = {
|
|
3869
3939
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3870
3940
|
preventCorsPreflight: false,
|
|
@@ -3957,7 +4027,7 @@ function isOidcProtocolMode(config) {
|
|
|
3957
4027
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3958
4028
|
}
|
|
3959
4029
|
|
|
3960
|
-
/*! @azure/msal-common v14.
|
|
4030
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
3961
4031
|
|
|
3962
4032
|
/*
|
|
3963
4033
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3967,14 +4037,15 @@ function isOidcProtocolMode(config) {
|
|
|
3967
4037
|
* Error thrown when there is an error with the server code, for example, unavailability.
|
|
3968
4038
|
*/
|
|
3969
4039
|
class ServerError extends AuthError {
|
|
3970
|
-
constructor(errorCode, errorMessage, subError) {
|
|
4040
|
+
constructor(errorCode, errorMessage, subError, errorNo) {
|
|
3971
4041
|
super(errorCode, errorMessage, subError);
|
|
3972
4042
|
this.name = "ServerError";
|
|
4043
|
+
this.errorNo = errorNo;
|
|
3973
4044
|
Object.setPrototypeOf(this, ServerError.prototype);
|
|
3974
4045
|
}
|
|
3975
4046
|
}
|
|
3976
4047
|
|
|
3977
|
-
/*! @azure/msal-common v14.
|
|
4048
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
3978
4049
|
|
|
3979
4050
|
/*
|
|
3980
4051
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4072,7 +4143,7 @@ class ThrottlingUtils {
|
|
|
4072
4143
|
}
|
|
4073
4144
|
}
|
|
4074
4145
|
|
|
4075
|
-
/*! @azure/msal-common v14.
|
|
4146
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4076
4147
|
|
|
4077
4148
|
/*
|
|
4078
4149
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4109,7 +4180,7 @@ class NetworkManager {
|
|
|
4109
4180
|
}
|
|
4110
4181
|
}
|
|
4111
4182
|
|
|
4112
|
-
/*! @azure/msal-common v14.
|
|
4183
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4113
4184
|
/*
|
|
4114
4185
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4115
4186
|
* Licensed under the MIT License.
|
|
@@ -4119,7 +4190,7 @@ const CcsCredentialType = {
|
|
|
4119
4190
|
UPN: "UPN",
|
|
4120
4191
|
};
|
|
4121
4192
|
|
|
4122
|
-
/*! @azure/msal-common v14.
|
|
4193
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4123
4194
|
/*
|
|
4124
4195
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4125
4196
|
* Licensed under the MIT License.
|
|
@@ -4166,7 +4237,7 @@ const SID = "sid";
|
|
|
4166
4237
|
const LOGIN_HINT = "login_hint";
|
|
4167
4238
|
const DOMAIN_HINT = "domain_hint";
|
|
4168
4239
|
|
|
4169
|
-
/*! @azure/msal-common v14.
|
|
4240
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4170
4241
|
|
|
4171
4242
|
/*
|
|
4172
4243
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4250,7 +4321,7 @@ class RequestValidator {
|
|
|
4250
4321
|
}
|
|
4251
4322
|
}
|
|
4252
4323
|
|
|
4253
|
-
/*! @azure/msal-common v14.
|
|
4324
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4254
4325
|
|
|
4255
4326
|
/*
|
|
4256
4327
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4634,7 +4705,7 @@ class RequestParameterBuilder {
|
|
|
4634
4705
|
}
|
|
4635
4706
|
}
|
|
4636
4707
|
|
|
4637
|
-
/*! @azure/msal-common v14.
|
|
4708
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4638
4709
|
/*
|
|
4639
4710
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4640
4711
|
* Licensed under the MIT License.
|
|
@@ -4646,7 +4717,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
4646
4717
|
response.hasOwnProperty("jwks_uri"));
|
|
4647
4718
|
}
|
|
4648
4719
|
|
|
4649
|
-
/*! @azure/msal-common v14.
|
|
4720
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4650
4721
|
/*
|
|
4651
4722
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4652
4723
|
* Licensed under the MIT License.
|
|
@@ -4656,7 +4727,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
4656
4727
|
response.hasOwnProperty("metadata"));
|
|
4657
4728
|
}
|
|
4658
4729
|
|
|
4659
|
-
/*! @azure/msal-common v14.
|
|
4730
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4660
4731
|
/*
|
|
4661
4732
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4662
4733
|
* Licensed under the MIT License.
|
|
@@ -4666,7 +4737,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
4666
4737
|
response.hasOwnProperty("error_description"));
|
|
4667
4738
|
}
|
|
4668
4739
|
|
|
4669
|
-
/*! @azure/msal-common v14.
|
|
4740
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
4670
4741
|
/*
|
|
4671
4742
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4672
4743
|
* Licensed under the MIT License.
|
|
@@ -4728,6 +4799,7 @@ const PerformanceEvents = {
|
|
|
4728
4799
|
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4729
4800
|
*/
|
|
4730
4801
|
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4802
|
+
AwaitConcurrentIframe: "awaitConcurrentIframe",
|
|
4731
4803
|
/**
|
|
4732
4804
|
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4733
4805
|
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
@@ -5140,7 +5212,7 @@ const IntFields = new Set([
|
|
|
5140
5212
|
"multiMatchedRT",
|
|
5141
5213
|
]);
|
|
5142
5214
|
|
|
5143
|
-
/*! @azure/msal-common v14.
|
|
5215
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
5144
5216
|
/*
|
|
5145
5217
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5146
5218
|
* Licensed under the MIT License.
|
|
@@ -5236,7 +5308,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5236
5308
|
};
|
|
5237
5309
|
};
|
|
5238
5310
|
|
|
5239
|
-
/*! @azure/msal-common v14.
|
|
5311
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
5240
5312
|
|
|
5241
5313
|
/*
|
|
5242
5314
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5345,7 +5417,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5345
5417
|
},
|
|
5346
5418
|
};
|
|
5347
5419
|
|
|
5348
|
-
/*! @azure/msal-common v14.
|
|
5420
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
5349
5421
|
|
|
5350
5422
|
/*
|
|
5351
5423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5357,7 +5429,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5357
5429
|
* @internal
|
|
5358
5430
|
*/
|
|
5359
5431
|
class Authority {
|
|
5360
|
-
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
|
|
5432
|
+
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient, managedIdentity) {
|
|
5361
5433
|
this.canonicalAuthority = authority;
|
|
5362
5434
|
this._canonicalAuthority.validateAsUri();
|
|
5363
5435
|
this.networkInterface = networkInterface;
|
|
@@ -5371,6 +5443,7 @@ class Authority {
|
|
|
5371
5443
|
this.logger = logger;
|
|
5372
5444
|
this.performanceClient = performanceClient;
|
|
5373
5445
|
this.correlationId = correlationId;
|
|
5446
|
+
this.managedIdentity = managedIdentity || false;
|
|
5374
5447
|
this.regionDiscovery = new RegionDiscovery(networkInterface, this.logger, this.performanceClient, this.correlationId);
|
|
5375
5448
|
}
|
|
5376
5449
|
/**
|
|
@@ -5576,7 +5649,7 @@ class Authority {
|
|
|
5576
5649
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
5577
5650
|
}
|
|
5578
5651
|
/**
|
|
5579
|
-
* Boolean that returns
|
|
5652
|
+
* Boolean that returns whether or not tenant discovery has been completed.
|
|
5580
5653
|
*/
|
|
5581
5654
|
discoveryComplete() {
|
|
5582
5655
|
return !!this.metadata;
|
|
@@ -6028,7 +6101,10 @@ class Authority {
|
|
|
6028
6101
|
* helper function to generate environment from authority object
|
|
6029
6102
|
*/
|
|
6030
6103
|
getPreferredCache() {
|
|
6031
|
-
if (this.
|
|
6104
|
+
if (this.managedIdentity) {
|
|
6105
|
+
return Constants.DEFAULT_AUTHORITY_HOST;
|
|
6106
|
+
}
|
|
6107
|
+
else if (this.discoveryComplete()) {
|
|
6032
6108
|
return this.metadata.preferred_cache;
|
|
6033
6109
|
}
|
|
6034
6110
|
else {
|
|
@@ -6180,7 +6256,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
6180
6256
|
};
|
|
6181
6257
|
}
|
|
6182
6258
|
|
|
6183
|
-
/*! @azure/msal-common v14.
|
|
6259
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6184
6260
|
|
|
6185
6261
|
/*
|
|
6186
6262
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6211,7 +6287,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
6211
6287
|
}
|
|
6212
6288
|
}
|
|
6213
6289
|
|
|
6214
|
-
/*! @azure/msal-common v14.
|
|
6290
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6215
6291
|
|
|
6216
6292
|
/*
|
|
6217
6293
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6314,7 +6390,7 @@ class BaseClient {
|
|
|
6314
6390
|
}
|
|
6315
6391
|
}
|
|
6316
6392
|
|
|
6317
|
-
/*! @azure/msal-common v14.
|
|
6393
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6318
6394
|
/*
|
|
6319
6395
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6320
6396
|
* Licensed under the MIT License.
|
|
@@ -6340,7 +6416,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6340
6416
|
refreshTokenExpired: refreshTokenExpired
|
|
6341
6417
|
});
|
|
6342
6418
|
|
|
6343
|
-
/*! @azure/msal-common v14.
|
|
6419
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6344
6420
|
|
|
6345
6421
|
/*
|
|
6346
6422
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6391,7 +6467,7 @@ const InteractionRequiredAuthErrorMessage = {
|
|
|
6391
6467
|
* Error thrown when user interaction is required.
|
|
6392
6468
|
*/
|
|
6393
6469
|
class InteractionRequiredAuthError extends AuthError {
|
|
6394
|
-
constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims) {
|
|
6470
|
+
constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
|
|
6395
6471
|
super(errorCode, errorMessage, subError);
|
|
6396
6472
|
Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
|
|
6397
6473
|
this.timestamp = timestamp || Constants.EMPTY_STRING;
|
|
@@ -6399,6 +6475,7 @@ class InteractionRequiredAuthError extends AuthError {
|
|
|
6399
6475
|
this.correlationId = correlationId || Constants.EMPTY_STRING;
|
|
6400
6476
|
this.claims = claims || Constants.EMPTY_STRING;
|
|
6401
6477
|
this.name = "InteractionRequiredAuthError";
|
|
6478
|
+
this.errorNo = errorNo;
|
|
6402
6479
|
}
|
|
6403
6480
|
}
|
|
6404
6481
|
/**
|
|
@@ -6427,7 +6504,7 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6427
6504
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6428
6505
|
}
|
|
6429
6506
|
|
|
6430
|
-
/*! @azure/msal-common v14.
|
|
6507
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6431
6508
|
/*
|
|
6432
6509
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6433
6510
|
* Licensed under the MIT License.
|
|
@@ -6443,7 +6520,7 @@ class CacheRecord {
|
|
|
6443
6520
|
}
|
|
6444
6521
|
}
|
|
6445
6522
|
|
|
6446
|
-
/*! @azure/msal-common v14.
|
|
6523
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6447
6524
|
|
|
6448
6525
|
/*
|
|
6449
6526
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6515,7 +6592,7 @@ class ProtocolUtils {
|
|
|
6515
6592
|
}
|
|
6516
6593
|
}
|
|
6517
6594
|
|
|
6518
|
-
/*! @azure/msal-common v14.
|
|
6595
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6519
6596
|
|
|
6520
6597
|
/*
|
|
6521
6598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6600,7 +6677,7 @@ class PopTokenGenerator {
|
|
|
6600
6677
|
}
|
|
6601
6678
|
}
|
|
6602
6679
|
|
|
6603
|
-
/*! @azure/msal-common v14.
|
|
6680
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6604
6681
|
/*
|
|
6605
6682
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6606
6683
|
* Licensed under the MIT License.
|
|
@@ -6627,12 +6704,19 @@ class PopTokenGenerator {
|
|
|
6627
6704
|
}
|
|
6628
6705
|
}
|
|
6629
6706
|
|
|
6630
|
-
/*! @azure/msal-common v14.
|
|
6707
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6631
6708
|
|
|
6632
6709
|
/*
|
|
6633
6710
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6634
6711
|
* Licensed under the MIT License.
|
|
6635
6712
|
*/
|
|
6713
|
+
function parseServerErrorNo(serverResponse) {
|
|
6714
|
+
const errorCodePrefix = "code=";
|
|
6715
|
+
const errorCodePrefixIndex = serverResponse.error_uri?.lastIndexOf(errorCodePrefix);
|
|
6716
|
+
return errorCodePrefixIndex && errorCodePrefixIndex >= 0
|
|
6717
|
+
? serverResponse.error_uri?.substring(errorCodePrefixIndex + errorCodePrefix.length)
|
|
6718
|
+
: undefined;
|
|
6719
|
+
}
|
|
6636
6720
|
/**
|
|
6637
6721
|
* Class that handles response parsing.
|
|
6638
6722
|
* @internal
|
|
@@ -6680,10 +6764,11 @@ class ResponseHandler {
|
|
|
6680
6764
|
if (serverResponse.error ||
|
|
6681
6765
|
serverResponse.error_description ||
|
|
6682
6766
|
serverResponse.suberror) {
|
|
6767
|
+
const serverErrorNo = parseServerErrorNo(serverResponse);
|
|
6683
6768
|
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
6684
|
-
throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "");
|
|
6769
|
+
throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
|
|
6685
6770
|
}
|
|
6686
|
-
throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror);
|
|
6771
|
+
throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverErrorNo);
|
|
6687
6772
|
}
|
|
6688
6773
|
}
|
|
6689
6774
|
/**
|
|
@@ -6697,7 +6782,10 @@ class ResponseHandler {
|
|
|
6697
6782
|
serverResponse.error_description ||
|
|
6698
6783
|
serverResponse.suberror) {
|
|
6699
6784
|
const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
|
|
6700
|
-
const
|
|
6785
|
+
const serverErrorNo = serverResponse.error_codes?.length
|
|
6786
|
+
? serverResponse.error_codes[0]
|
|
6787
|
+
: undefined;
|
|
6788
|
+
const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
|
|
6701
6789
|
// check if 500 error
|
|
6702
6790
|
if (refreshAccessToken &&
|
|
6703
6791
|
serverResponse.status &&
|
|
@@ -6717,7 +6805,7 @@ class ResponseHandler {
|
|
|
6717
6805
|
return;
|
|
6718
6806
|
}
|
|
6719
6807
|
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
6720
|
-
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING);
|
|
6808
|
+
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING, serverErrorNo);
|
|
6721
6809
|
}
|
|
6722
6810
|
throw serverError;
|
|
6723
6811
|
}
|
|
@@ -6782,7 +6870,7 @@ class ResponseHandler {
|
|
|
6782
6870
|
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
|
|
6783
6871
|
}
|
|
6784
6872
|
}
|
|
6785
|
-
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache);
|
|
6873
|
+
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache, request.correlationId);
|
|
6786
6874
|
}
|
|
6787
6875
|
finally {
|
|
6788
6876
|
if (this.persistencePlugin &&
|
|
@@ -6980,7 +7068,25 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
|
|
|
6980
7068
|
return baseAccount;
|
|
6981
7069
|
}
|
|
6982
7070
|
|
|
6983
|
-
/*! @azure/msal-common v14.
|
|
7071
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7072
|
+
/*
|
|
7073
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7074
|
+
* Licensed under the MIT License.
|
|
7075
|
+
*/
|
|
7076
|
+
async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
|
|
7077
|
+
if (typeof clientAssertion === "string") {
|
|
7078
|
+
return clientAssertion;
|
|
7079
|
+
}
|
|
7080
|
+
else {
|
|
7081
|
+
const config = {
|
|
7082
|
+
clientId: clientId,
|
|
7083
|
+
tokenEndpoint: tokenEndpoint,
|
|
7084
|
+
};
|
|
7085
|
+
return clientAssertion(config);
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
7088
|
+
|
|
7089
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
6984
7090
|
|
|
6985
7091
|
/*
|
|
6986
7092
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7141,7 +7247,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7141
7247
|
}
|
|
7142
7248
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7143
7249
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7144
|
-
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
7250
|
+
parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7145
7251
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
7146
7252
|
}
|
|
7147
7253
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
@@ -7265,7 +7371,11 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7265
7371
|
}
|
|
7266
7372
|
else if (request.account) {
|
|
7267
7373
|
const accountSid = this.extractAccountSid(request.account);
|
|
7268
|
-
|
|
7374
|
+
let accountLoginHintClaim = this.extractLoginHint(request.account);
|
|
7375
|
+
if (accountLoginHintClaim && request.domainHint) {
|
|
7376
|
+
this.logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint`);
|
|
7377
|
+
accountLoginHintClaim = null;
|
|
7378
|
+
}
|
|
7269
7379
|
// If login_hint claim is present, use it over sid/username
|
|
7270
7380
|
if (accountLoginHintClaim) {
|
|
7271
7381
|
this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account");
|
|
@@ -7385,7 +7495,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7385
7495
|
}
|
|
7386
7496
|
}
|
|
7387
7497
|
|
|
7388
|
-
/*! @azure/msal-common v14.
|
|
7498
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7389
7499
|
|
|
7390
7500
|
/*
|
|
7391
7501
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7545,7 +7655,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7545
7655
|
}
|
|
7546
7656
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7547
7657
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7548
|
-
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
7658
|
+
parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7549
7659
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
7550
7660
|
}
|
|
7551
7661
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
@@ -7592,7 +7702,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7592
7702
|
}
|
|
7593
7703
|
}
|
|
7594
7704
|
|
|
7595
|
-
/*! @azure/msal-common v14.
|
|
7705
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7596
7706
|
|
|
7597
7707
|
/*
|
|
7598
7708
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7728,7 +7838,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
7728
7838
|
}
|
|
7729
7839
|
}
|
|
7730
7840
|
|
|
7731
|
-
/*! @azure/msal-common v14.
|
|
7841
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7732
7842
|
|
|
7733
7843
|
/*
|
|
7734
7844
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7743,7 +7853,7 @@ const StubbedNetworkModule = {
|
|
|
7743
7853
|
},
|
|
7744
7854
|
};
|
|
7745
7855
|
|
|
7746
|
-
/*! @azure/msal-common v14.
|
|
7856
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7747
7857
|
/*
|
|
7748
7858
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7749
7859
|
* Licensed under the MIT License.
|
|
@@ -7751,7 +7861,7 @@ const StubbedNetworkModule = {
|
|
|
7751
7861
|
const missingKidError = "missing_kid_error";
|
|
7752
7862
|
const missingAlgError = "missing_alg_error";
|
|
7753
7863
|
|
|
7754
|
-
/*! @azure/msal-common v14.
|
|
7864
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7755
7865
|
|
|
7756
7866
|
/*
|
|
7757
7867
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7776,7 +7886,7 @@ function createJoseHeaderError(code) {
|
|
|
7776
7886
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7777
7887
|
}
|
|
7778
7888
|
|
|
7779
|
-
/*! @azure/msal-common v14.
|
|
7889
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7780
7890
|
|
|
7781
7891
|
/*
|
|
7782
7892
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7816,7 +7926,7 @@ class JoseHeader {
|
|
|
7816
7926
|
}
|
|
7817
7927
|
}
|
|
7818
7928
|
|
|
7819
|
-
/*! @azure/msal-common v14.
|
|
7929
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7820
7930
|
|
|
7821
7931
|
/*
|
|
7822
7932
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7874,7 +7984,7 @@ class AuthenticationHeaderParser {
|
|
|
7874
7984
|
}
|
|
7875
7985
|
}
|
|
7876
7986
|
|
|
7877
|
-
/*! @azure/msal-common v14.
|
|
7987
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
7878
7988
|
|
|
7879
7989
|
/*
|
|
7880
7990
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8078,7 +8188,7 @@ class ServerTelemetryManager {
|
|
|
8078
8188
|
}
|
|
8079
8189
|
}
|
|
8080
8190
|
|
|
8081
|
-
/*! @azure/msal-common v14.
|
|
8191
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
8082
8192
|
|
|
8083
8193
|
/*
|
|
8084
8194
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8157,7 +8267,7 @@ class StubPerformanceClient {
|
|
|
8157
8267
|
}
|
|
8158
8268
|
}
|
|
8159
8269
|
|
|
8160
|
-
/*! @azure/msal-common v14.
|
|
8270
|
+
/*! @azure/msal-common v14.10.0 2024-05-07 */
|
|
8161
8271
|
|
|
8162
8272
|
/*
|
|
8163
8273
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8255,6 +8365,14 @@ function addError(error, logger, event, stackMaxSize = 5) {
|
|
|
8255
8365
|
else if (error instanceof AuthError) {
|
|
8256
8366
|
event.errorCode = error.errorCode;
|
|
8257
8367
|
event.subErrorCode = error.subError;
|
|
8368
|
+
if (error instanceof ServerError ||
|
|
8369
|
+
error instanceof InteractionRequiredAuthError) {
|
|
8370
|
+
event.serverErrorNo = error.errorNo;
|
|
8371
|
+
}
|
|
8372
|
+
return;
|
|
8373
|
+
}
|
|
8374
|
+
else if (error instanceof CacheError) {
|
|
8375
|
+
event.errorCode = error.errorCode;
|
|
8258
8376
|
return;
|
|
8259
8377
|
}
|
|
8260
8378
|
else if (event.errorStack?.length) {
|
|
@@ -8533,7 +8651,7 @@ class PerformanceClient {
|
|
|
8533
8651
|
const context = JSON.stringify(endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error));
|
|
8534
8652
|
if (isRoot) {
|
|
8535
8653
|
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8536
|
-
this.
|
|
8654
|
+
this.discardMeasurements(rootEvent.correlationId);
|
|
8537
8655
|
}
|
|
8538
8656
|
else {
|
|
8539
8657
|
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
@@ -8655,21 +8773,13 @@ class PerformanceClient {
|
|
|
8655
8773
|
};
|
|
8656
8774
|
}
|
|
8657
8775
|
/**
|
|
8658
|
-
* Removes measurements for a given correlation id.
|
|
8776
|
+
* Removes measurements and aux data for a given correlation id.
|
|
8659
8777
|
*
|
|
8660
8778
|
* @param {string} correlationId
|
|
8661
8779
|
*/
|
|
8662
8780
|
discardMeasurements(correlationId) {
|
|
8663
8781
|
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
8664
8782
|
this.eventsByCorrelationId.delete(correlationId);
|
|
8665
|
-
}
|
|
8666
|
-
/**
|
|
8667
|
-
* Removes cache for a given correlation id.
|
|
8668
|
-
*
|
|
8669
|
-
* @param {string} correlationId correlation identifier
|
|
8670
|
-
*/
|
|
8671
|
-
discardCache(correlationId) {
|
|
8672
|
-
this.discardMeasurements(correlationId);
|
|
8673
8783
|
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
8674
8784
|
this.queueMeasurements.delete(correlationId);
|
|
8675
8785
|
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
@@ -8684,6 +8794,12 @@ class PerformanceClient {
|
|
|
8684
8794
|
* @returns {string}
|
|
8685
8795
|
*/
|
|
8686
8796
|
addPerformanceCallback(callback) {
|
|
8797
|
+
for (const [id, cb] of this.callbacks) {
|
|
8798
|
+
if (cb.toString() === callback.toString()) {
|
|
8799
|
+
this.logger.warning(`PerformanceClient: Performance callback is already registered with id: ${id}`);
|
|
8800
|
+
return id;
|
|
8801
|
+
}
|
|
8802
|
+
}
|
|
8687
8803
|
const callbackId = this.generateId();
|
|
8688
8804
|
this.callbacks.set(callbackId, callback);
|
|
8689
8805
|
this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);
|
|
@@ -9733,6 +9849,8 @@ var BrowserUtils = /*#__PURE__*/Object.freeze({
|
|
|
9733
9849
|
createGuid: createGuid,
|
|
9734
9850
|
getCurrentUri: getCurrentUri,
|
|
9735
9851
|
getHomepage: getHomepage,
|
|
9852
|
+
invoke: invoke,
|
|
9853
|
+
invokeAsync: invokeAsync,
|
|
9736
9854
|
isInIframe: isInIframe,
|
|
9737
9855
|
isInPopup: isInPopup,
|
|
9738
9856
|
preconnect: preconnect,
|
|
@@ -10013,7 +10131,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
10013
10131
|
|
|
10014
10132
|
/* eslint-disable header/header */
|
|
10015
10133
|
const name = "@azure/msal-browser";
|
|
10016
|
-
const version = "3.
|
|
10134
|
+
const version = "3.14.0";
|
|
10017
10135
|
|
|
10018
10136
|
/*
|
|
10019
10137
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10148,11 +10266,7 @@ class BridgeProxy {
|
|
|
10148
10266
|
if (window.nestedAppAuthBridge === undefined) {
|
|
10149
10267
|
throw new Error("window.nestedAppAuthBridge is undefined");
|
|
10150
10268
|
}
|
|
10151
|
-
if (window.crypto === undefined) {
|
|
10152
|
-
throw new Error("window.crypto is undefined");
|
|
10153
|
-
}
|
|
10154
10269
|
try {
|
|
10155
|
-
BridgeProxy.crypto = window.crypto;
|
|
10156
10270
|
window.nestedAppAuthBridge.addEventListener("message", (response) => {
|
|
10157
10271
|
const responsePayload = typeof response === "string" ? response : response.data;
|
|
10158
10272
|
const responseEnvelope = JSON.parse(responsePayload);
|
|
@@ -10171,7 +10285,7 @@ class BridgeProxy {
|
|
|
10171
10285
|
const message = {
|
|
10172
10286
|
messageType: "NestedAppAuthRequest",
|
|
10173
10287
|
method: "GetInitContext",
|
|
10174
|
-
requestId:
|
|
10288
|
+
requestId: createNewGuid(),
|
|
10175
10289
|
};
|
|
10176
10290
|
const request = {
|
|
10177
10291
|
requestId: message.requestId,
|
|
@@ -10189,9 +10303,6 @@ class BridgeProxy {
|
|
|
10189
10303
|
throw error;
|
|
10190
10304
|
}
|
|
10191
10305
|
}
|
|
10192
|
-
static getRandomId() {
|
|
10193
|
-
return BridgeProxy.crypto.randomUUID();
|
|
10194
|
-
}
|
|
10195
10306
|
/**
|
|
10196
10307
|
* getTokenInteractive - Attempts to get a token interactively from the bridge
|
|
10197
10308
|
* @param request A token request
|
|
@@ -10233,7 +10344,7 @@ class BridgeProxy {
|
|
|
10233
10344
|
const message = {
|
|
10234
10345
|
messageType: "NestedAppAuthRequest",
|
|
10235
10346
|
method: method,
|
|
10236
|
-
requestId:
|
|
10347
|
+
requestId: createNewGuid(),
|
|
10237
10348
|
...requestParams,
|
|
10238
10349
|
};
|
|
10239
10350
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -10323,6 +10434,9 @@ class TeamsAppOperatingContext extends BaseOperatingContext {
|
|
|
10323
10434
|
* TODO: Add implementation to check for presence of inject Nested App Auth Bridge JavaScript interface
|
|
10324
10435
|
*
|
|
10325
10436
|
*/
|
|
10437
|
+
if (!this.getConfig().auth.supportsNestedAppAuth) {
|
|
10438
|
+
return false;
|
|
10439
|
+
}
|
|
10326
10440
|
try {
|
|
10327
10441
|
if (typeof window !== "undefined") {
|
|
10328
10442
|
const bridgeProxy = await BridgeProxy.create();
|
|
@@ -10337,22 +10451,18 @@ class TeamsAppOperatingContext extends BaseOperatingContext {
|
|
|
10337
10451
|
await bridgeProxy.getActiveAccount();
|
|
10338
10452
|
}
|
|
10339
10453
|
}
|
|
10340
|
-
catch
|
|
10341
|
-
|
|
10454
|
+
catch {
|
|
10455
|
+
// Ignore errors
|
|
10342
10456
|
}
|
|
10343
10457
|
this.bridgeProxy = bridgeProxy;
|
|
10344
10458
|
this.available = bridgeProxy !== undefined;
|
|
10345
10459
|
}
|
|
10346
|
-
else {
|
|
10347
|
-
this.available = false;
|
|
10348
|
-
}
|
|
10349
|
-
}
|
|
10350
|
-
catch (e) {
|
|
10351
|
-
this.available = false;
|
|
10352
10460
|
}
|
|
10353
|
-
|
|
10354
|
-
|
|
10461
|
+
catch (ex) {
|
|
10462
|
+
this.logger.infoPii(`Could not initialize Nested App Auth bridge (${ex})`);
|
|
10355
10463
|
}
|
|
10464
|
+
this.logger.info(`Nested App Auth Bridge available: ${this.available}`);
|
|
10465
|
+
return this.available;
|
|
10356
10466
|
}
|
|
10357
10467
|
}
|
|
10358
10468
|
/*
|
|
@@ -10424,8 +10534,7 @@ async function createController(config) {
|
|
|
10424
10534
|
const teamsApp = new TeamsAppOperatingContext(config);
|
|
10425
10535
|
const operatingContexts = [standard.initialize(), teamsApp.initialize()];
|
|
10426
10536
|
await Promise.all(operatingContexts);
|
|
10427
|
-
if (teamsApp.isAvailable()
|
|
10428
|
-
teamsApp.getConfig().auth.supportsNestedAppAuth) {
|
|
10537
|
+
if (teamsApp.isAvailable()) {
|
|
10429
10538
|
const controller = await Promise.resolve().then(function () { return NestedAppAuthController$1; });
|
|
10430
10539
|
return controller.NestedAppAuthController.createController(teamsApp);
|
|
10431
10540
|
}
|
|
@@ -11068,7 +11177,7 @@ function extractBrowserRequestState(browserCrypto, state) {
|
|
|
11068
11177
|
* parameters such as state and nonce, generally.
|
|
11069
11178
|
*/
|
|
11070
11179
|
class BrowserCacheManager extends CacheManager {
|
|
11071
|
-
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions) {
|
|
11180
|
+
constructor(clientId, cacheConfig, cryptoImpl, logger, staticAuthorityOptions, performanceClient) {
|
|
11072
11181
|
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
11073
11182
|
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
11074
11183
|
this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
@@ -11082,6 +11191,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11082
11191
|
this.migrateCacheEntries();
|
|
11083
11192
|
this.createKeyMaps();
|
|
11084
11193
|
}
|
|
11194
|
+
this.performanceClient = performanceClient;
|
|
11085
11195
|
}
|
|
11086
11196
|
/**
|
|
11087
11197
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
@@ -12302,6 +12412,33 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12302
12412
|
const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
|
|
12303
12413
|
return this.saveCacheRecord(cacheRecord);
|
|
12304
12414
|
}
|
|
12415
|
+
/**
|
|
12416
|
+
* saves a cache record
|
|
12417
|
+
* @param cacheRecord {CacheRecord}
|
|
12418
|
+
* @param storeInCache {?StoreInCache}
|
|
12419
|
+
* @param correlationId {?string} correlation id
|
|
12420
|
+
*/
|
|
12421
|
+
async saveCacheRecord(cacheRecord, storeInCache, correlationId) {
|
|
12422
|
+
try {
|
|
12423
|
+
await super.saveCacheRecord(cacheRecord, storeInCache, correlationId);
|
|
12424
|
+
}
|
|
12425
|
+
catch (e) {
|
|
12426
|
+
if (e instanceof CacheError &&
|
|
12427
|
+
this.performanceClient &&
|
|
12428
|
+
correlationId) {
|
|
12429
|
+
try {
|
|
12430
|
+
const tokenKeys = this.getTokenKeys();
|
|
12431
|
+
this.performanceClient.addFields({
|
|
12432
|
+
cacheRtCount: tokenKeys.refreshToken.length,
|
|
12433
|
+
cacheIdCount: tokenKeys.idToken.length,
|
|
12434
|
+
cacheAtCount: tokenKeys.accessToken.length,
|
|
12435
|
+
}, correlationId);
|
|
12436
|
+
}
|
|
12437
|
+
catch (e) { }
|
|
12438
|
+
}
|
|
12439
|
+
throw e;
|
|
12440
|
+
}
|
|
12441
|
+
}
|
|
12305
12442
|
}
|
|
12306
12443
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
12307
12444
|
const cacheOptions = {
|
|
@@ -14590,11 +14727,10 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
14590
14727
|
* Checks if navigateToLoginRequestUrl is set, and:
|
|
14591
14728
|
* - if true, performs logic to cache and navigate
|
|
14592
14729
|
* - if false, handles hash string and parses response
|
|
14593
|
-
* @param hash {string
|
|
14594
|
-
* @param
|
|
14595
|
-
* @param correlationId {string?} correlation identifier
|
|
14730
|
+
* @param hash {string} url hash
|
|
14731
|
+
* @param parentMeasurement {InProgressPerformanceEvent} parent measurement
|
|
14596
14732
|
*/
|
|
14597
|
-
async handleRedirectPromise(hash
|
|
14733
|
+
async handleRedirectPromise(hash = "", parentMeasurement) {
|
|
14598
14734
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise);
|
|
14599
14735
|
try {
|
|
14600
14736
|
if (!this.browserStorage.isInteractionInProgress(true)) {
|
|
@@ -14606,9 +14742,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
14606
14742
|
// Not a recognized server response hash or hash not associated with a redirect request
|
|
14607
14743
|
this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache.");
|
|
14608
14744
|
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
14609
|
-
|
|
14610
|
-
performanceClient?.addFields({ errorCode: "no_server_response" }, correlationId);
|
|
14611
|
-
}
|
|
14745
|
+
parentMeasurement.event.errorCode = "no_server_response";
|
|
14612
14746
|
return null;
|
|
14613
14747
|
}
|
|
14614
14748
|
// If navigateToLoginRequestUrl is true, get the url where the redirect request was initiated
|
|
@@ -14960,6 +15094,7 @@ function loadFrameSync(urlNavigate) {
|
|
|
14960
15094
|
*/
|
|
14961
15095
|
function createHiddenIframe() {
|
|
14962
15096
|
const authFrame = document.createElement("iframe");
|
|
15097
|
+
authFrame.className = "msalSilentIframe";
|
|
14963
15098
|
authFrame.style.visibility = "hidden";
|
|
14964
15099
|
authFrame.style.position = "absolute";
|
|
14965
15100
|
authFrame.style.width = authFrame.style.height = "0";
|
|
@@ -15423,6 +15558,19 @@ class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
15423
15558
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15424
15559
|
* Licensed under the MIT License.
|
|
15425
15560
|
*/
|
|
15561
|
+
function getAccountType(account) {
|
|
15562
|
+
const idTokenClaims = account?.idTokenClaims;
|
|
15563
|
+
if (idTokenClaims?.tfp || idTokenClaims?.acr) {
|
|
15564
|
+
return "B2C";
|
|
15565
|
+
}
|
|
15566
|
+
if (!idTokenClaims?.tid) {
|
|
15567
|
+
return undefined;
|
|
15568
|
+
}
|
|
15569
|
+
else if (idTokenClaims?.tid === "9188040d-6c67-4c5b-b112-36a304b66dad") {
|
|
15570
|
+
return "MSA";
|
|
15571
|
+
}
|
|
15572
|
+
return "AAD";
|
|
15573
|
+
}
|
|
15426
15574
|
class StandardController {
|
|
15427
15575
|
/**
|
|
15428
15576
|
* @constructor
|
|
@@ -15471,7 +15619,7 @@ class StandardController {
|
|
|
15471
15619
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
15472
15620
|
// Initialize the browser storage class.
|
|
15473
15621
|
this.browserStorage = this.isBrowserEnvironment
|
|
15474
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth))
|
|
15622
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, buildStaticAuthorityOptions(this.config.auth), this.performanceClient)
|
|
15475
15623
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
15476
15624
|
// initialize in memory storage for native flows
|
|
15477
15625
|
const nativeCacheOptions = {
|
|
@@ -15482,7 +15630,7 @@ class StandardController {
|
|
|
15482
15630
|
cacheMigrationEnabled: false,
|
|
15483
15631
|
claimsBasedCachingEnabled: false,
|
|
15484
15632
|
};
|
|
15485
|
-
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
15633
|
+
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, undefined, this.performanceClient);
|
|
15486
15634
|
// Initialize the token cache
|
|
15487
15635
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
15488
15636
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -15545,7 +15693,6 @@ class StandardController {
|
|
|
15545
15693
|
this.logger.verbose("handleRedirectPromise called");
|
|
15546
15694
|
// Block token acquisition before initialize has been called
|
|
15547
15695
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
15548
|
-
const loggedInAccounts = this.getAllAccounts();
|
|
15549
15696
|
if (this.isBrowserEnvironment) {
|
|
15550
15697
|
/**
|
|
15551
15698
|
* Store the promise on the PublicClientApplication instance if this is the first invocation of handleRedirectPromise,
|
|
@@ -15555,64 +15702,9 @@ class StandardController {
|
|
|
15555
15702
|
const redirectResponseKey = hash || "";
|
|
15556
15703
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
15557
15704
|
if (typeof response === "undefined") {
|
|
15558
|
-
|
|
15559
|
-
const useNative = request &&
|
|
15560
|
-
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15561
|
-
this.nativeExtensionProvider &&
|
|
15562
|
-
!hash;
|
|
15563
|
-
const correlationId = useNative
|
|
15564
|
-
? request?.correlationId
|
|
15565
|
-
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15566
|
-
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15567
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15568
|
-
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15569
|
-
let redirectResponse;
|
|
15570
|
-
if (useNative && this.nativeExtensionProvider) {
|
|
15571
|
-
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15572
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
15573
|
-
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15574
|
-
}
|
|
15575
|
-
else {
|
|
15576
|
-
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15577
|
-
const redirectClient = this.createRedirectClient(correlationId);
|
|
15578
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, this.performanceClient, rootMeasurement.event.correlationId);
|
|
15579
|
-
}
|
|
15580
|
-
response = redirectResponse
|
|
15581
|
-
.then((result) => {
|
|
15582
|
-
if (result) {
|
|
15583
|
-
// Emit login event if number of accounts change
|
|
15584
|
-
const isLoggingIn = loggedInAccounts.length <
|
|
15585
|
-
this.getAllAccounts().length;
|
|
15586
|
-
if (isLoggingIn) {
|
|
15587
|
-
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15588
|
-
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15589
|
-
}
|
|
15590
|
-
else {
|
|
15591
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15592
|
-
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15593
|
-
}
|
|
15594
|
-
rootMeasurement.end({ success: true });
|
|
15595
|
-
}
|
|
15596
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15597
|
-
rootMeasurement.end({ success: false });
|
|
15598
|
-
return result;
|
|
15599
|
-
})
|
|
15600
|
-
.catch((e) => {
|
|
15601
|
-
const eventError = e;
|
|
15602
|
-
// Emit login event if there is an account
|
|
15603
|
-
if (loggedInAccounts.length > 0) {
|
|
15604
|
-
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15605
|
-
}
|
|
15606
|
-
else {
|
|
15607
|
-
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15608
|
-
}
|
|
15609
|
-
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15610
|
-
rootMeasurement.end({
|
|
15611
|
-
success: false,
|
|
15612
|
-
}, eventError);
|
|
15613
|
-
throw e;
|
|
15614
|
-
});
|
|
15705
|
+
response = this.handleRedirectPromiseInternal(hash);
|
|
15615
15706
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
15707
|
+
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
15616
15708
|
}
|
|
15617
15709
|
else {
|
|
15618
15710
|
this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");
|
|
@@ -15622,6 +15714,83 @@ class StandardController {
|
|
|
15622
15714
|
this.logger.verbose("handleRedirectPromise returns null, not browser environment");
|
|
15623
15715
|
return null;
|
|
15624
15716
|
}
|
|
15717
|
+
/**
|
|
15718
|
+
* The internal details of handleRedirectPromise. This is separated out to a helper to allow handleRedirectPromise to memoize requests
|
|
15719
|
+
* @param hash
|
|
15720
|
+
* @returns
|
|
15721
|
+
*/
|
|
15722
|
+
async handleRedirectPromiseInternal(hash) {
|
|
15723
|
+
const loggedInAccounts = this.getAllAccounts();
|
|
15724
|
+
const request = this.browserStorage.getCachedNativeRequest();
|
|
15725
|
+
const useNative = request &&
|
|
15726
|
+
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15727
|
+
this.nativeExtensionProvider &&
|
|
15728
|
+
!hash;
|
|
15729
|
+
const correlationId = useNative
|
|
15730
|
+
? request?.correlationId
|
|
15731
|
+
: this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
15732
|
+
const rootMeasurement = this.performanceClient.startMeasurement("acquireTokenRedirect", correlationId);
|
|
15733
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
15734
|
+
let redirectResponse;
|
|
15735
|
+
if (useNative && this.nativeExtensionProvider) {
|
|
15736
|
+
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15737
|
+
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
15738
|
+
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), PerformanceEvents.HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(this.performanceClient, rootMeasurement.event.correlationId);
|
|
15739
|
+
}
|
|
15740
|
+
else {
|
|
15741
|
+
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
|
|
15742
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15743
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), PerformanceEvents.HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(hash, rootMeasurement);
|
|
15744
|
+
}
|
|
15745
|
+
return redirectResponse
|
|
15746
|
+
.then((result) => {
|
|
15747
|
+
if (result) {
|
|
15748
|
+
// Emit login event if number of accounts change
|
|
15749
|
+
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
15750
|
+
if (isLoggingIn) {
|
|
15751
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15752
|
+
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
15753
|
+
}
|
|
15754
|
+
else {
|
|
15755
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
15756
|
+
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
15757
|
+
}
|
|
15758
|
+
rootMeasurement.end({
|
|
15759
|
+
success: true,
|
|
15760
|
+
accountType: getAccountType(result.account),
|
|
15761
|
+
});
|
|
15762
|
+
}
|
|
15763
|
+
else {
|
|
15764
|
+
/*
|
|
15765
|
+
* Instrument an event only if an error code is set. Otherwise, discard it when the redirect response
|
|
15766
|
+
* is empty and the error code is missing.
|
|
15767
|
+
*/
|
|
15768
|
+
if (rootMeasurement.event.errorCode) {
|
|
15769
|
+
rootMeasurement.end({ success: false });
|
|
15770
|
+
}
|
|
15771
|
+
else {
|
|
15772
|
+
rootMeasurement.discard();
|
|
15773
|
+
}
|
|
15774
|
+
}
|
|
15775
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15776
|
+
return result;
|
|
15777
|
+
})
|
|
15778
|
+
.catch((e) => {
|
|
15779
|
+
const eventError = e;
|
|
15780
|
+
// Emit login event if there is an account
|
|
15781
|
+
if (loggedInAccounts.length > 0) {
|
|
15782
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15783
|
+
}
|
|
15784
|
+
else {
|
|
15785
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, eventError);
|
|
15786
|
+
}
|
|
15787
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
15788
|
+
rootMeasurement.end({
|
|
15789
|
+
success: false,
|
|
15790
|
+
}, eventError);
|
|
15791
|
+
throw e;
|
|
15792
|
+
});
|
|
15793
|
+
}
|
|
15625
15794
|
/**
|
|
15626
15795
|
* Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects
|
|
15627
15796
|
* the page, so any code that follows this function will not execute.
|
|
@@ -15693,6 +15862,10 @@ class StandardController {
|
|
|
15693
15862
|
acquireTokenPopup(request) {
|
|
15694
15863
|
const correlationId = this.getRequestCorrelationId(request);
|
|
15695
15864
|
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
15865
|
+
atPopupMeasurement.add({
|
|
15866
|
+
scenarioId: request.scenarioId,
|
|
15867
|
+
accountType: getAccountType(request.account),
|
|
15868
|
+
});
|
|
15696
15869
|
try {
|
|
15697
15870
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
15698
15871
|
preflightCheck(this.initialized);
|
|
@@ -15722,6 +15895,7 @@ class StandardController {
|
|
|
15722
15895
|
success: true,
|
|
15723
15896
|
isNativeBroker: true,
|
|
15724
15897
|
requestId: response.requestId,
|
|
15898
|
+
accountType: getAccountType(response.account),
|
|
15725
15899
|
});
|
|
15726
15900
|
return response;
|
|
15727
15901
|
})
|
|
@@ -15757,13 +15931,12 @@ class StandardController {
|
|
|
15757
15931
|
else {
|
|
15758
15932
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
|
|
15759
15933
|
}
|
|
15760
|
-
atPopupMeasurement.add({
|
|
15761
|
-
accessTokenSize: result.accessToken.length,
|
|
15762
|
-
idTokenSize: result.idToken.length,
|
|
15763
|
-
});
|
|
15764
15934
|
atPopupMeasurement.end({
|
|
15765
15935
|
success: true,
|
|
15766
15936
|
requestId: result.requestId,
|
|
15937
|
+
accessTokenSize: result.accessToken.length,
|
|
15938
|
+
idTokenSize: result.idToken.length,
|
|
15939
|
+
accountType: getAccountType(result.account),
|
|
15767
15940
|
});
|
|
15768
15941
|
return result;
|
|
15769
15942
|
})
|
|
@@ -15822,6 +15995,10 @@ class StandardController {
|
|
|
15822
15995
|
this.ssoSilentMeasurement?.increment({
|
|
15823
15996
|
visibilityChangeCount: 0,
|
|
15824
15997
|
});
|
|
15998
|
+
this.ssoSilentMeasurement?.add({
|
|
15999
|
+
scenarioId: request.scenarioId,
|
|
16000
|
+
accountType: getAccountType(request.account),
|
|
16001
|
+
});
|
|
15825
16002
|
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
15826
16003
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
15827
16004
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
@@ -15844,14 +16021,13 @@ class StandardController {
|
|
|
15844
16021
|
return result
|
|
15845
16022
|
.then((response) => {
|
|
15846
16023
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
15847
|
-
this.ssoSilentMeasurement?.add({
|
|
15848
|
-
accessTokenSize: response.accessToken.length,
|
|
15849
|
-
idTokenSize: response.idToken.length,
|
|
15850
|
-
});
|
|
15851
16024
|
this.ssoSilentMeasurement?.end({
|
|
15852
16025
|
success: true,
|
|
15853
16026
|
isNativeBroker: response.fromNativeBroker,
|
|
15854
16027
|
requestId: response.requestId,
|
|
16028
|
+
accessTokenSize: response.accessToken.length,
|
|
16029
|
+
idTokenSize: response.idToken.length,
|
|
16030
|
+
accountType: getAccountType(response.account),
|
|
15855
16031
|
});
|
|
15856
16032
|
return response;
|
|
15857
16033
|
})
|
|
@@ -15882,6 +16058,7 @@ class StandardController {
|
|
|
15882
16058
|
preflightCheck(this.initialized);
|
|
15883
16059
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
15884
16060
|
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
|
|
16061
|
+
atbcMeasurement.add({ scenarioId: request.scenarioId });
|
|
15885
16062
|
try {
|
|
15886
16063
|
if (request.code && request.nativeAccountId) {
|
|
15887
16064
|
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
@@ -15899,14 +16076,13 @@ class StandardController {
|
|
|
15899
16076
|
.then((result) => {
|
|
15900
16077
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
15901
16078
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
15902
|
-
atbcMeasurement.add({
|
|
15903
|
-
accessTokenSize: result.accessToken.length,
|
|
15904
|
-
idTokenSize: result.idToken.length,
|
|
15905
|
-
});
|
|
15906
16079
|
atbcMeasurement.end({
|
|
15907
16080
|
success: true,
|
|
15908
16081
|
isNativeBroker: result.fromNativeBroker,
|
|
15909
16082
|
requestId: result.requestId,
|
|
16083
|
+
accessTokenSize: result.accessToken.length,
|
|
16084
|
+
idTokenSize: result.idToken.length,
|
|
16085
|
+
accountType: getAccountType(result.account),
|
|
15910
16086
|
});
|
|
15911
16087
|
return result;
|
|
15912
16088
|
})
|
|
@@ -15928,7 +16104,7 @@ class StandardController {
|
|
|
15928
16104
|
}
|
|
15929
16105
|
else if (request.nativeAccountId) {
|
|
15930
16106
|
if (this.canUseNative(request, request.nativeAccountId)) {
|
|
15931
|
-
|
|
16107
|
+
const result = await this.acquireTokenNative({
|
|
15932
16108
|
...request,
|
|
15933
16109
|
correlationId,
|
|
15934
16110
|
}, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
|
|
@@ -15939,6 +16115,11 @@ class StandardController {
|
|
|
15939
16115
|
}
|
|
15940
16116
|
throw e;
|
|
15941
16117
|
});
|
|
16118
|
+
atbcMeasurement.end({
|
|
16119
|
+
accountType: getAccountType(result.account),
|
|
16120
|
+
success: true,
|
|
16121
|
+
});
|
|
16122
|
+
return result;
|
|
15942
16123
|
}
|
|
15943
16124
|
else {
|
|
15944
16125
|
throw createBrowserAuthError(unableToAcquireTokenFromNativePlatform);
|
|
@@ -16501,6 +16682,7 @@ class StandardController {
|
|
|
16501
16682
|
const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
16502
16683
|
atsMeasurement.add({
|
|
16503
16684
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
16685
|
+
scenarioId: request.scenarioId,
|
|
16504
16686
|
});
|
|
16505
16687
|
preflightCheck(this.initialized);
|
|
16506
16688
|
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
@@ -16508,6 +16690,7 @@ class StandardController {
|
|
|
16508
16690
|
if (!account) {
|
|
16509
16691
|
throw createBrowserAuthError(noAccountError);
|
|
16510
16692
|
}
|
|
16693
|
+
atsMeasurement.add({ accountType: getAccountType(account) });
|
|
16511
16694
|
const thumbprint = {
|
|
16512
16695
|
clientId: this.config.auth.clientId,
|
|
16513
16696
|
authority: request.authority || Constants.EMPTY_STRING,
|
|
@@ -16531,16 +16714,14 @@ class StandardController {
|
|
|
16531
16714
|
}, account)
|
|
16532
16715
|
.then((result) => {
|
|
16533
16716
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
16534
|
-
atsMeasurement.add({
|
|
16535
|
-
accessTokenSize: result.accessToken.length,
|
|
16536
|
-
idTokenSize: result.idToken.length,
|
|
16537
|
-
});
|
|
16538
16717
|
atsMeasurement.end({
|
|
16539
16718
|
success: true,
|
|
16540
16719
|
fromCache: result.fromCache,
|
|
16541
16720
|
isNativeBroker: result.fromNativeBroker,
|
|
16542
16721
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
16543
16722
|
requestId: result.requestId,
|
|
16723
|
+
accessTokenSize: result.accessToken.length,
|
|
16724
|
+
idTokenSize: result.idToken.length,
|
|
16544
16725
|
});
|
|
16545
16726
|
return result;
|
|
16546
16727
|
})
|
|
@@ -16580,49 +16761,67 @@ class StandardController {
|
|
|
16580
16761
|
this.performanceClient.incrementFields({ visibilityChangeCount: 0 }, request.correlationId);
|
|
16581
16762
|
}
|
|
16582
16763
|
document.addEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16591
|
-
|
|
16592
|
-
|
|
16593
|
-
|
|
16594
|
-
|
|
16595
|
-
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
return
|
|
16599
|
-
|
|
16600
|
-
|
|
16601
|
-
|
|
16602
|
-
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
|
|
16610
|
-
throw cacheError;
|
|
16764
|
+
const silentRequest = await invokeAsync(initializeSilentRequest, PerformanceEvents.InitializeSilentRequest, this.logger, this.performanceClient, request.correlationId)(request, account, this.config, this.performanceClient, this.logger);
|
|
16765
|
+
const cacheLookupPolicy = request.cacheLookupPolicy || CacheLookupPolicy.Default;
|
|
16766
|
+
const result = this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy).catch(async (refreshTokenError) => {
|
|
16767
|
+
const shouldTryToResolveSilently = checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy);
|
|
16768
|
+
if (shouldTryToResolveSilently) {
|
|
16769
|
+
if (!this.activeIframeRequest) {
|
|
16770
|
+
let _resolve;
|
|
16771
|
+
// Always set the active request tracker immediately after checking it to prevent races
|
|
16772
|
+
this.activeIframeRequest = [
|
|
16773
|
+
new Promise((resolve) => {
|
|
16774
|
+
_resolve = resolve;
|
|
16775
|
+
}),
|
|
16776
|
+
silentRequest.correlationId,
|
|
16777
|
+
];
|
|
16778
|
+
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", silentRequest.correlationId);
|
|
16779
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest)
|
|
16780
|
+
.then((iframeResult) => {
|
|
16781
|
+
_resolve(true);
|
|
16782
|
+
return iframeResult;
|
|
16783
|
+
})
|
|
16784
|
+
.catch((e) => {
|
|
16785
|
+
_resolve(false);
|
|
16786
|
+
throw e;
|
|
16787
|
+
})
|
|
16788
|
+
.finally(() => {
|
|
16789
|
+
this.activeIframeRequest = undefined;
|
|
16790
|
+
});
|
|
16611
16791
|
}
|
|
16612
|
-
|
|
16613
|
-
|
|
16614
|
-
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16792
|
+
else if (cacheLookupPolicy !== CacheLookupPolicy.Skip) {
|
|
16793
|
+
const [activePromise, activeCorrelationId] = this.activeIframeRequest;
|
|
16794
|
+
this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${activeCorrelationId}`, silentRequest.correlationId);
|
|
16795
|
+
const awaitConcurrentIframeMeasure = this.performanceClient.startMeasurement(PerformanceEvents.AwaitConcurrentIframe, silentRequest.correlationId);
|
|
16796
|
+
awaitConcurrentIframeMeasure.add({
|
|
16797
|
+
awaitIframeCorrelationId: activeCorrelationId,
|
|
16798
|
+
});
|
|
16799
|
+
const activePromiseResult = await activePromise;
|
|
16800
|
+
awaitConcurrentIframeMeasure.end({
|
|
16801
|
+
success: activePromiseResult,
|
|
16802
|
+
});
|
|
16803
|
+
if (activePromiseResult) {
|
|
16804
|
+
this.logger.verbose(`Parallel iframe request with correlationId: ${activeCorrelationId} succeeded. Retrying cache and/or RT redemption`, silentRequest.correlationId);
|
|
16805
|
+
// Retry cache lookup and/or RT exchange after iframe completes
|
|
16806
|
+
return this.acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy);
|
|
16618
16807
|
}
|
|
16619
16808
|
else {
|
|
16620
|
-
|
|
16809
|
+
this.logger.info(`Iframe request with correlationId: ${activeCorrelationId} failed. Interaction is required.`);
|
|
16810
|
+
// If previous iframe request failed, it's unlikely to succeed this time. Throw original error.
|
|
16621
16811
|
throw refreshTokenError;
|
|
16622
16812
|
}
|
|
16623
|
-
}
|
|
16624
|
-
|
|
16625
|
-
|
|
16813
|
+
}
|
|
16814
|
+
else {
|
|
16815
|
+
// Cache policy set to skip and another iframe request is already in progress
|
|
16816
|
+
this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.", silentRequest.correlationId);
|
|
16817
|
+
return invokeAsync(this.acquireTokenBySilentIframe.bind(this), PerformanceEvents.AcquireTokenBySilentIframe, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
16818
|
+
}
|
|
16819
|
+
}
|
|
16820
|
+
else {
|
|
16821
|
+
// Error cannot be silently resolved or iframe renewal is not allowed, interaction required
|
|
16822
|
+
throw refreshTokenError;
|
|
16823
|
+
}
|
|
16824
|
+
});
|
|
16626
16825
|
return result
|
|
16627
16826
|
.then((response) => {
|
|
16628
16827
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
@@ -16643,6 +16842,38 @@ class StandardController {
|
|
|
16643
16842
|
document.removeEventListener("visibilitychange", () => this.trackPageVisibility(request.correlationId));
|
|
16644
16843
|
});
|
|
16645
16844
|
}
|
|
16845
|
+
/**
|
|
16846
|
+
* AcquireTokenSilent without the iframe fallback. This is used to enable the correct fallbacks in cases where there's a potential for multiple silent requests to be made in parallel and prevent those requests from making concurrent iframe requests.
|
|
16847
|
+
* @param silentRequest
|
|
16848
|
+
* @param cacheLookupPolicy
|
|
16849
|
+
* @returns
|
|
16850
|
+
*/
|
|
16851
|
+
async acquireTokenSilentNoIframe(silentRequest, cacheLookupPolicy) {
|
|
16852
|
+
if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, silentRequest.authenticationScheme) &&
|
|
16853
|
+
silentRequest.account.nativeAccountId) {
|
|
16854
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
16855
|
+
return this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
16856
|
+
// If native token acquisition fails for availability reasons fallback to web flow
|
|
16857
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
16858
|
+
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
16859
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
16860
|
+
// Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal
|
|
16861
|
+
throw createClientAuthError(tokenRefreshRequired);
|
|
16862
|
+
}
|
|
16863
|
+
throw e;
|
|
16864
|
+
});
|
|
16865
|
+
}
|
|
16866
|
+
else {
|
|
16867
|
+
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16868
|
+
return invokeAsync(this.acquireTokenFromCache.bind(this), PerformanceEvents.AcquireTokenFromCache, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy).catch((cacheError) => {
|
|
16869
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
16870
|
+
throw cacheError;
|
|
16871
|
+
}
|
|
16872
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
16873
|
+
return invokeAsync(this.acquireTokenByRefreshToken.bind(this), PerformanceEvents.AcquireTokenByRefreshToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest, cacheLookupPolicy);
|
|
16874
|
+
});
|
|
16875
|
+
}
|
|
16876
|
+
}
|
|
16646
16877
|
}
|
|
16647
16878
|
/**
|
|
16648
16879
|
* Determines whether an error thrown by the refresh token endpoint can be resolved without interaction
|
|
@@ -16651,7 +16882,7 @@ class StandardController {
|
|
|
16651
16882
|
* @param cacheLookupPolicy
|
|
16652
16883
|
* @returns
|
|
16653
16884
|
*/
|
|
16654
|
-
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError,
|
|
16885
|
+
function checkIfRefreshTokenErrorCanBeResolvedSilently(refreshTokenError, cacheLookupPolicy) {
|
|
16655
16886
|
const noInteractionRequired = !(refreshTokenError instanceof InteractionRequiredAuthError &&
|
|
16656
16887
|
// For refresh token errors, bad_token does not always require interaction (silently resolvable)
|
|
16657
16888
|
refreshTokenError.subError !==
|
|
@@ -17045,7 +17276,7 @@ class UnknownOperatingContextController {
|
|
|
17045
17276
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
17046
17277
|
// Initialize the browser storage class.
|
|
17047
17278
|
this.browserStorage = this.isBrowserEnvironment
|
|
17048
|
-
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger)
|
|
17279
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, undefined, this.performanceClient)
|
|
17049
17280
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
17050
17281
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
17051
17282
|
}
|
|
@@ -17685,6 +17916,9 @@ const stubbedPublicClientApplication = {
|
|
|
17685
17916
|
getAllAccounts: () => {
|
|
17686
17917
|
return [];
|
|
17687
17918
|
},
|
|
17919
|
+
getAccount: () => {
|
|
17920
|
+
return null;
|
|
17921
|
+
},
|
|
17688
17922
|
getAccountByHomeId: () => {
|
|
17689
17923
|
return null;
|
|
17690
17924
|
},
|
|
@@ -18544,12 +18778,7 @@ class NestedAppAuthController {
|
|
|
18544
18778
|
}
|
|
18545
18779
|
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
18546
18780
|
) {
|
|
18547
|
-
|
|
18548
|
-
return this.acquireTokenInteractive(request);
|
|
18549
|
-
}
|
|
18550
|
-
else {
|
|
18551
|
-
throw NestedAppAuthError.createUnsupportedError();
|
|
18552
|
-
}
|
|
18781
|
+
return this.acquireTokenInteractive(request || DEFAULT_REQUEST);
|
|
18553
18782
|
}
|
|
18554
18783
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18555
18784
|
loginRedirect(request) {
|