@azure/msal-browser 3.0.0-beta.1 → 3.0.1
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/README.md +19 -80
- package/dist/app/IPublicClientApplication.d.ts +1 -0
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/{IPublicClientApplication.js → IPublicClientApplication.mjs} +6 -3
- package/dist/app/IPublicClientApplication.mjs.map +1 -0
- package/dist/app/PublicClientApplication.d.ts +7 -0
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/{PublicClientApplication.js → PublicClientApplication.mjs} +14 -5
- package/dist/app/PublicClientApplication.mjs.map +1 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/{NativeMessageHandler.js → NativeMessageHandler.mjs} +9 -9
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -0
- package/dist/broker/nativeBroker/NativeRequest.d.ts +2 -1
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/dist/cache/{AsyncMemoryStorage.js → AsyncMemoryStorage.mjs} +5 -5
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -0
- package/dist/cache/BrowserCacheManager.d.ts +8 -0
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/{BrowserCacheManager.js → BrowserCacheManager.mjs} +25 -8
- package/dist/cache/BrowserCacheManager.mjs.map +1 -0
- package/dist/cache/{BrowserStorage.js → BrowserStorage.mjs} +4 -4
- package/dist/cache/BrowserStorage.mjs.map +1 -0
- package/dist/cache/CryptoKeyStore.d.ts +1 -1
- package/dist/cache/CryptoKeyStore.d.ts.map +1 -1
- package/dist/cache/{CryptoKeyStore.js → CryptoKeyStore.mjs} +3 -3
- package/dist/cache/CryptoKeyStore.mjs.map +1 -0
- package/dist/cache/{DatabaseStorage.js → DatabaseStorage.mjs} +4 -4
- package/dist/cache/DatabaseStorage.mjs.map +1 -0
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/{MemoryStorage.js → MemoryStorage.mjs} +2 -2
- package/dist/cache/MemoryStorage.mjs.map +1 -0
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/{TokenCache.js → TokenCache.mjs} +22 -20
- package/dist/cache/TokenCache.mjs.map +1 -0
- package/dist/config/Configuration.d.ts +10 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/{Configuration.js → Configuration.mjs} +41 -8
- package/dist/config/Configuration.mjs.map +1 -0
- package/dist/controllers/{ControllerFactory.js → ControllerFactory.mjs} +7 -7
- package/dist/controllers/ControllerFactory.mjs.map +1 -0
- package/dist/controllers/IController.d.ts +1 -0
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +7 -0
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/{StandardController.js → StandardController.mjs} +77 -60
- package/dist/controllers/StandardController.mjs.map +1 -0
- package/dist/crypto/{BrowserCrypto.js → BrowserCrypto.mjs} +5 -5
- package/dist/crypto/BrowserCrypto.mjs.map +1 -0
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/{CryptoOps.js → CryptoOps.mjs} +12 -12
- package/dist/crypto/CryptoOps.mjs.map +1 -0
- package/dist/crypto/{GuidGenerator.js → GuidGenerator.mjs} +3 -3
- package/dist/crypto/GuidGenerator.mjs.map +1 -0
- package/dist/crypto/{ModernBrowserCrypto.js → ModernBrowserCrypto.mjs} +3 -3
- package/dist/crypto/ModernBrowserCrypto.mjs.map +1 -0
- package/dist/crypto/{PkceGenerator.js → PkceGenerator.mjs} +4 -4
- package/dist/crypto/PkceGenerator.mjs.map +1 -0
- package/dist/crypto/{SignedHttpRequest.js → SignedHttpRequest.mjs} +4 -4
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -0
- package/dist/encode/{Base64Decode.js → Base64Decode.mjs} +3 -3
- package/dist/encode/Base64Decode.mjs.map +1 -0
- package/dist/encode/{Base64Encode.js → Base64Encode.mjs} +3 -3
- package/dist/encode/Base64Encode.mjs.map +1 -0
- package/dist/error/BrowserAuthError.d.ts +2 -2
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/{BrowserAuthError.js → BrowserAuthError.mjs} +7 -7
- package/dist/error/BrowserAuthError.mjs.map +1 -0
- package/dist/error/{BrowserConfigurationAuthError.js → BrowserConfigurationAuthError.mjs} +2 -2
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -0
- package/dist/error/NativeAuthError.d.ts +1 -1
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/{NativeAuthError.js → NativeAuthError.mjs} +3 -3
- package/dist/error/NativeAuthError.mjs.map +1 -0
- package/dist/event/{EventHandler.js → EventHandler.mjs} +3 -3
- package/dist/event/EventHandler.mjs.map +1 -0
- package/dist/event/EventMessage.d.ts.map +1 -1
- package/dist/event/{EventMessage.js → EventMessage.mjs} +4 -4
- package/dist/event/EventMessage.mjs.map +1 -0
- package/dist/event/EventType.d.ts +1 -1
- package/dist/event/EventType.d.ts.map +1 -1
- package/dist/event/{EventType.js → EventType.mjs} +3 -3
- package/dist/event/EventType.mjs.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{index.js → index.mjs} +18 -16
- package/dist/index.mjs.map +1 -0
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/{BaseInteractionClient.js → BaseInteractionClient.mjs} +6 -5
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -0
- package/dist/interaction_client/{HybridSpaAuthorizationCodeClient.js → HybridSpaAuthorizationCodeClient.mjs} +2 -2
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map +1 -0
- package/dist/interaction_client/NativeInteractionClient.d.ts +7 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/{NativeInteractionClient.js → NativeInteractionClient.mjs} +58 -33
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -0
- package/dist/interaction_client/PopupClient.d.ts +4 -0
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/{PopupClient.js → PopupClient.mjs} +57 -18
- package/dist/interaction_client/PopupClient.mjs.map +1 -0
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/{RedirectClient.js → RedirectClient.mjs} +23 -11
- package/dist/interaction_client/RedirectClient.mjs.map +1 -0
- package/dist/interaction_client/{SilentAuthCodeClient.js → SilentAuthCodeClient.mjs} +7 -7
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -0
- package/dist/interaction_client/{SilentCacheClient.js → SilentCacheClient.mjs} +9 -9
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -0
- package/dist/interaction_client/{SilentIframeClient.js → SilentIframeClient.mjs} +11 -11
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -0
- package/dist/interaction_client/{SilentRefreshClient.js → SilentRefreshClient.mjs} +8 -8
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -0
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/{StandardInteractionClient.js → StandardInteractionClient.mjs} +14 -12
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -0
- package/dist/interaction_handler/{InteractionHandler.js → InteractionHandler.mjs} +5 -5
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -0
- package/dist/interaction_handler/{RedirectHandler.js → RedirectHandler.mjs} +6 -6
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -0
- package/dist/interaction_handler/{SilentHandler.js → SilentHandler.mjs} +5 -5
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -0
- package/dist/internals.d.ts +1 -3
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.mjs +28 -0
- package/dist/internals.mjs.map +1 -0
- package/dist/navigation/{NavigationClient.js → NavigationClient.mjs} +2 -2
- package/dist/navigation/NavigationClient.mjs.map +1 -0
- package/dist/network/{FetchClient.js → FetchClient.mjs} +4 -4
- package/dist/network/FetchClient.mjs.map +1 -0
- package/dist/network/{XhrClient.js → XhrClient.mjs} +4 -4
- package/dist/network/XhrClient.mjs.map +1 -0
- package/dist/operatingcontext/{BaseOperatingContext.js → BaseOperatingContext.mjs} +4 -4
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -0
- package/dist/operatingcontext/{StandardOperatingContext.js → StandardOperatingContext.mjs} +3 -3
- package/dist/operatingcontext/StandardOperatingContext.mjs.map +1 -0
- package/dist/operatingcontext/{TeamsAppOperatingContext.js → TeamsAppOperatingContext.mjs} +3 -3
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +8 -0
- package/dist/packageMetadata.mjs.map +1 -0
- package/dist/request/PopupRequest.d.ts +3 -1
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts +3 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/SilentRequest.d.ts +2 -0
- package/dist/request/SilentRequest.d.ts.map +1 -1
- package/dist/request/SsoSilentRequest.d.ts +5 -2
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/response/AuthenticationResult.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +3 -2
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/{BrowserPerformanceClient.js → BrowserPerformanceClient.mjs} +16 -12
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -0
- package/dist/telemetry/{BrowserPerformanceMeasurement.js → BrowserPerformanceMeasurement.mjs} +2 -2
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs.map +1 -0
- package/dist/utils/BrowserConstants.d.ts +10 -10
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/{BrowserConstants.js → BrowserConstants.mjs} +2 -2
- package/dist/utils/BrowserConstants.mjs.map +1 -0
- package/dist/utils/{BrowserProtocolUtils.js → BrowserProtocolUtils.mjs} +2 -2
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -0
- package/dist/utils/{BrowserStringUtils.js → BrowserStringUtils.mjs} +2 -2
- package/dist/utils/BrowserStringUtils.mjs.map +1 -0
- package/dist/utils/BrowserUtils.d.ts +2 -3
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/{BrowserUtils.js → BrowserUtils.mjs} +10 -11
- package/dist/utils/BrowserUtils.mjs.map +1 -0
- package/dist/utils/{MathUtils.js → MathUtils.mjs} +2 -2
- package/dist/utils/MathUtils.mjs.map +1 -0
- package/lib/{msal-browser.cjs.js → msal-browser.cjs} +989 -672
- package/lib/msal-browser.cjs.map +1 -0
- package/lib/msal-browser.js +988 -671
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +62 -62
- package/package.json +19 -15
- package/dist/app/IPublicClientApplication.js.map +0 -1
- package/dist/app/PublicClientApplication.js.map +0 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js.map +0 -1
- package/dist/cache/AsyncMemoryStorage.js.map +0 -1
- package/dist/cache/BrowserCacheManager.js.map +0 -1
- package/dist/cache/BrowserStorage.js.map +0 -1
- package/dist/cache/CryptoKeyStore.js.map +0 -1
- package/dist/cache/DatabaseStorage.js.map +0 -1
- package/dist/cache/MemoryStorage.js.map +0 -1
- package/dist/cache/TokenCache.js.map +0 -1
- package/dist/cache/entities/CacheRecord.d.ts +0 -6
- package/dist/cache/entities/CacheRecord.d.ts.map +0 -1
- package/dist/cache/entities/CacheRecord.js +0 -17
- package/dist/cache/entities/CacheRecord.js.map +0 -1
- package/dist/config/Configuration.js.map +0 -1
- package/dist/controllers/ControllerFactory.js.map +0 -1
- package/dist/controllers/StandardController.js.map +0 -1
- package/dist/crypto/BrowserCrypto.js.map +0 -1
- package/dist/crypto/CryptoOps.js.map +0 -1
- package/dist/crypto/GuidGenerator.js.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.js.map +0 -1
- package/dist/crypto/PkceGenerator.js.map +0 -1
- package/dist/crypto/SignedHttpRequest.js.map +0 -1
- package/dist/encode/Base64Decode.js.map +0 -1
- package/dist/encode/Base64Encode.js.map +0 -1
- package/dist/error/BrowserAuthError.js.map +0 -1
- package/dist/error/BrowserConfigurationAuthError.js.map +0 -1
- package/dist/error/NativeAuthError.js.map +0 -1
- package/dist/event/EventHandler.js.map +0 -1
- package/dist/event/EventMessage.js.map +0 -1
- package/dist/event/EventType.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interaction_client/BaseInteractionClient.js.map +0 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +0 -1
- package/dist/interaction_client/NativeInteractionClient.js.map +0 -1
- package/dist/interaction_client/PopupClient.js.map +0 -1
- package/dist/interaction_client/RedirectClient.js.map +0 -1
- package/dist/interaction_client/SilentAuthCodeClient.js.map +0 -1
- package/dist/interaction_client/SilentCacheClient.js.map +0 -1
- package/dist/interaction_client/SilentIframeClient.js.map +0 -1
- package/dist/interaction_client/SilentRefreshClient.js.map +0 -1
- package/dist/interaction_client/StandardInteractionClient.js.map +0 -1
- package/dist/interaction_handler/InteractionHandler.js.map +0 -1
- package/dist/interaction_handler/RedirectHandler.js.map +0 -1
- package/dist/interaction_handler/SilentHandler.js.map +0 -1
- package/dist/internals.js +0 -25
- package/dist/internals.js.map +0 -1
- package/dist/navigation/NavigationClient.js.map +0 -1
- package/dist/network/FetchClient.js.map +0 -1
- package/dist/network/XhrClient.js.map +0 -1
- package/dist/operatingcontext/BaseOperatingContext.js.map +0 -1
- package/dist/operatingcontext/StandardOperatingContext.js.map +0 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.js.map +0 -1
- package/dist/packageMetadata.js +0 -8
- package/dist/packageMetadata.js.map +0 -1
- package/dist/telemetry/BrowserPerformanceClient.js.map +0 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js.map +0 -1
- package/dist/utils/BrowserConstants.js.map +0 -1
- package/dist/utils/BrowserProtocolUtils.js.map +0 -1
- package/dist/utils/BrowserStringUtils.js.map +0 -1
- package/dist/utils/BrowserUtils.js.map +0 -1
- package/dist/utils/MathUtils.js.map +0 -1
- package/lib/msal-browser.cjs.js.map +0 -1
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.
|
|
1
|
+
/*! @azure/msal-browser v3.0.1 2023-08-11 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v14.0.
|
|
9
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -203,11 +203,17 @@
|
|
|
203
203
|
S256: "S256",
|
|
204
204
|
};
|
|
205
205
|
/**
|
|
206
|
-
* allowed values for
|
|
206
|
+
* allowed values for server response type
|
|
207
207
|
*/
|
|
208
|
-
const
|
|
208
|
+
const ServerResponseType = {
|
|
209
209
|
QUERY: "query",
|
|
210
210
|
FRAGMENT: "fragment",
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* allowed values for response_mode
|
|
214
|
+
*/
|
|
215
|
+
const ResponseMode = {
|
|
216
|
+
...ServerResponseType,
|
|
211
217
|
FORM_POST: "form_post",
|
|
212
218
|
};
|
|
213
219
|
/**
|
|
@@ -360,7 +366,7 @@
|
|
|
360
366
|
Pop: "pop",
|
|
361
367
|
};
|
|
362
368
|
|
|
363
|
-
/*! @azure/msal-common v14.0.
|
|
369
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
364
370
|
|
|
365
371
|
/*
|
|
366
372
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -414,7 +420,7 @@
|
|
|
414
420
|
}
|
|
415
421
|
}
|
|
416
422
|
|
|
417
|
-
/*! @azure/msal-common v14.0.
|
|
423
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
418
424
|
|
|
419
425
|
/*
|
|
420
426
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -459,7 +465,7 @@
|
|
|
459
465
|
},
|
|
460
466
|
};
|
|
461
467
|
|
|
462
|
-
/*! @azure/msal-common v14.0.
|
|
468
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
463
469
|
|
|
464
470
|
/*
|
|
465
471
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -981,7 +987,7 @@
|
|
|
981
987
|
}
|
|
982
988
|
}
|
|
983
989
|
|
|
984
|
-
/*! @azure/msal-common v14.0.
|
|
990
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
985
991
|
|
|
986
992
|
/*
|
|
987
993
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1108,7 +1114,7 @@
|
|
|
1108
1114
|
}
|
|
1109
1115
|
}
|
|
1110
1116
|
|
|
1111
|
-
/*! @azure/msal-common v14.0.
|
|
1117
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1112
1118
|
|
|
1113
1119
|
/*
|
|
1114
1120
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1308,12 +1314,12 @@
|
|
|
1308
1314
|
}
|
|
1309
1315
|
}
|
|
1310
1316
|
|
|
1311
|
-
/*! @azure/msal-common v14.0.
|
|
1317
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1312
1318
|
/* eslint-disable header/header */
|
|
1313
1319
|
const name$1 = "@azure/msal-common";
|
|
1314
|
-
const version$1 = "14.0.
|
|
1320
|
+
const version$1 = "14.0.1";
|
|
1315
1321
|
|
|
1316
|
-
/*! @azure/msal-common v14.0.
|
|
1322
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1317
1323
|
/*
|
|
1318
1324
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1319
1325
|
* Licensed under the MIT License.
|
|
@@ -1325,15 +1331,15 @@
|
|
|
1325
1331
|
AzurePublic: "https://login.microsoftonline.com",
|
|
1326
1332
|
// Microsoft PPE
|
|
1327
1333
|
AzurePpe: "https://login.windows-ppe.net",
|
|
1328
|
-
// Microsoft Chinese national cloud
|
|
1334
|
+
// Microsoft Chinese national/regional cloud
|
|
1329
1335
|
AzureChina: "https://login.chinacloudapi.cn",
|
|
1330
|
-
// Microsoft German national cloud ("Black Forest")
|
|
1336
|
+
// Microsoft German national/regional cloud ("Black Forest")
|
|
1331
1337
|
AzureGermany: "https://login.microsoftonline.de",
|
|
1332
1338
|
// US Government cloud
|
|
1333
1339
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1334
1340
|
};
|
|
1335
1341
|
|
|
1336
|
-
/*! @azure/msal-common v14.0.
|
|
1342
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1337
1343
|
|
|
1338
1344
|
/*
|
|
1339
1345
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1433,12 +1439,20 @@
|
|
|
1433
1439
|
},
|
|
1434
1440
|
invalidAuthenticationHeader: {
|
|
1435
1441
|
code: "invalid_authentication_header",
|
|
1436
|
-
desc: "Invalid authentication header provided"
|
|
1442
|
+
desc: "Invalid authentication header provided",
|
|
1443
|
+
},
|
|
1444
|
+
cannotSetOIDCOptions: {
|
|
1445
|
+
code: "cannot_set_OIDCOptions",
|
|
1446
|
+
desc: "Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",
|
|
1447
|
+
},
|
|
1448
|
+
cannotAllowNativeBroker: {
|
|
1449
|
+
code: "cannot_allow_native_broker",
|
|
1450
|
+
desc: "Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",
|
|
1437
1451
|
},
|
|
1438
1452
|
authorityMismatch: {
|
|
1439
1453
|
code: "authority_mismatch",
|
|
1440
|
-
desc: "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."
|
|
1441
|
-
}
|
|
1454
|
+
desc: "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.",
|
|
1455
|
+
},
|
|
1442
1456
|
};
|
|
1443
1457
|
/**
|
|
1444
1458
|
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
@@ -1587,6 +1601,18 @@
|
|
|
1587
1601
|
static createInvalidAuthenticationHeaderError(invalidHeaderName, details) {
|
|
1588
1602
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, `${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`);
|
|
1589
1603
|
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Throws error when provided non-default OIDCOptions when not in OIDC protocol mode
|
|
1606
|
+
*/
|
|
1607
|
+
static createCannotSetOIDCOptionsError() {
|
|
1608
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.cannotSetOIDCOptions.code, ClientConfigurationErrorMessage.cannotSetOIDCOptions.desc);
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Throws error when allowNativeBroker is set to true when not in AAD protocol mode
|
|
1612
|
+
*/
|
|
1613
|
+
static createCannotAllowNativeBrokerError() {
|
|
1614
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.cannotAllowNativeBroker.code, ClientConfigurationErrorMessage.cannotAllowNativeBroker.desc);
|
|
1615
|
+
}
|
|
1590
1616
|
/**
|
|
1591
1617
|
* Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
|
|
1592
1618
|
*/
|
|
@@ -1595,7 +1621,7 @@
|
|
|
1595
1621
|
}
|
|
1596
1622
|
}
|
|
1597
1623
|
|
|
1598
|
-
/*! @azure/msal-common v14.0.
|
|
1624
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1599
1625
|
|
|
1600
1626
|
/*
|
|
1601
1627
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1795,7 +1821,7 @@
|
|
|
1795
1821
|
}
|
|
1796
1822
|
}
|
|
1797
1823
|
|
|
1798
|
-
/*! @azure/msal-common v14.0.
|
|
1824
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1799
1825
|
|
|
1800
1826
|
/*
|
|
1801
1827
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1835,7 +1861,7 @@
|
|
|
1835
1861
|
};
|
|
1836
1862
|
}
|
|
1837
1863
|
|
|
1838
|
-
/*! @azure/msal-common v14.0.
|
|
1864
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1839
1865
|
/*
|
|
1840
1866
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1841
1867
|
* Licensed under the MIT License.
|
|
@@ -1847,10 +1873,23 @@
|
|
|
1847
1873
|
Default: 0,
|
|
1848
1874
|
Adfs: 1,
|
|
1849
1875
|
Dsts: 2,
|
|
1850
|
-
Ciam: 3
|
|
1876
|
+
Ciam: 3,
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1879
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1880
|
+
/*
|
|
1881
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1882
|
+
* Licensed under the MIT License.
|
|
1883
|
+
*/
|
|
1884
|
+
/**
|
|
1885
|
+
* Protocol modes supported by MSAL.
|
|
1886
|
+
*/
|
|
1887
|
+
const ProtocolMode = {
|
|
1888
|
+
AAD: "AAD",
|
|
1889
|
+
OIDC: "OIDC",
|
|
1851
1890
|
};
|
|
1852
1891
|
|
|
1853
|
-
/*! @azure/msal-common v14.0.
|
|
1892
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
1854
1893
|
|
|
1855
1894
|
/*
|
|
1856
1895
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1872,7 +1911,6 @@
|
|
|
1872
1911
|
* username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt
|
|
1873
1912
|
* authorityType: Accounts authority type as a string
|
|
1874
1913
|
* name: Full name for the account, including given name and family name,
|
|
1875
|
-
* clientInfo: Full base64 encoded client info received from ESTS
|
|
1876
1914
|
* lastModificationTime: last time this entity was modified in the cache
|
|
1877
1915
|
* lastModificationApp:
|
|
1878
1916
|
* idTokenClaims: Object containing claims parsed from ID token
|
|
@@ -1899,24 +1937,6 @@
|
|
|
1899
1937
|
localAccountId: this.localAccountId,
|
|
1900
1938
|
});
|
|
1901
1939
|
}
|
|
1902
|
-
/**
|
|
1903
|
-
* returns the type of the cache (in this case account)
|
|
1904
|
-
*/
|
|
1905
|
-
generateType() {
|
|
1906
|
-
switch (this.authorityType) {
|
|
1907
|
-
case CacheAccountType.ADFS_ACCOUNT_TYPE:
|
|
1908
|
-
return CacheType.ADFS;
|
|
1909
|
-
case CacheAccountType.MSAV1_ACCOUNT_TYPE:
|
|
1910
|
-
return CacheType.MSA;
|
|
1911
|
-
case CacheAccountType.MSSTS_ACCOUNT_TYPE:
|
|
1912
|
-
return CacheType.MSSTS;
|
|
1913
|
-
case CacheAccountType.GENERIC_ACCOUNT_TYPE:
|
|
1914
|
-
return CacheType.GENERIC;
|
|
1915
|
-
default: {
|
|
1916
|
-
throw ClientAuthError.createUnexpectedAccountTypeError();
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
1940
|
/**
|
|
1921
1941
|
* Returns the AccountInfo interface for this account.
|
|
1922
1942
|
*/
|
|
@@ -1930,6 +1950,7 @@
|
|
|
1930
1950
|
name: this.name,
|
|
1931
1951
|
idTokenClaims: this.idTokenClaims,
|
|
1932
1952
|
nativeAccountId: this.nativeAccountId,
|
|
1953
|
+
authorityType: this.authorityType,
|
|
1933
1954
|
};
|
|
1934
1955
|
}
|
|
1935
1956
|
/**
|
|
@@ -1946,84 +1967,74 @@
|
|
|
1946
1967
|
}
|
|
1947
1968
|
/**
|
|
1948
1969
|
* Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
|
|
1949
|
-
* @param
|
|
1950
|
-
* @param authority
|
|
1951
|
-
* @param idToken
|
|
1952
|
-
* @param policy
|
|
1970
|
+
* @param accountDetails
|
|
1953
1971
|
*/
|
|
1954
|
-
static createAccount(
|
|
1972
|
+
static createAccount(accountDetails, authority) {
|
|
1955
1973
|
const account = new AccountEntity();
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1974
|
+
if (authority.authorityType === AuthorityType.Adfs) {
|
|
1975
|
+
account.authorityType = CacheAccountType.ADFS_ACCOUNT_TYPE;
|
|
1976
|
+
}
|
|
1977
|
+
else if (authority.protocolMode === ProtocolMode.AAD) {
|
|
1978
|
+
account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;
|
|
1979
|
+
}
|
|
1980
|
+
else {
|
|
1981
|
+
account.authorityType = CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
1982
|
+
}
|
|
1983
|
+
account.clientInfo = accountDetails.clientInfo;
|
|
1984
|
+
account.homeAccountId = accountDetails.homeAccountId;
|
|
1985
|
+
account.nativeAccountId = accountDetails.nativeAccountId;
|
|
1986
|
+
const env = accountDetails.environment ||
|
|
1987
|
+
(authority && authority.getPreferredCache());
|
|
1961
1988
|
if (!env) {
|
|
1962
1989
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
1963
1990
|
}
|
|
1964
1991
|
account.environment = env;
|
|
1965
1992
|
// non AAD scenarios can have empty realm
|
|
1966
|
-
account.realm =
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
account.
|
|
1988
|
-
account.msGraphHost = msGraphHost;
|
|
1993
|
+
account.realm =
|
|
1994
|
+
accountDetails.idTokenClaims.tid || Constants.EMPTY_STRING;
|
|
1995
|
+
account.idTokenClaims = accountDetails.idTokenClaims;
|
|
1996
|
+
// How do you account for MSA CID here?
|
|
1997
|
+
account.localAccountId =
|
|
1998
|
+
accountDetails.idTokenClaims.oid ||
|
|
1999
|
+
accountDetails.idTokenClaims.sub ||
|
|
2000
|
+
Constants.EMPTY_STRING;
|
|
2001
|
+
/*
|
|
2002
|
+
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
2003
|
+
* In most cases it will contain a single email. This field should not be relied upon if a custom
|
|
2004
|
+
* policy is configured to return more than 1 email.
|
|
2005
|
+
*/
|
|
2006
|
+
const preferredUsername = accountDetails.idTokenClaims.preferred_username ||
|
|
2007
|
+
accountDetails.idTokenClaims.upn;
|
|
2008
|
+
const email = accountDetails.idTokenClaims.emails
|
|
2009
|
+
? accountDetails.idTokenClaims.emails[0]
|
|
2010
|
+
: null;
|
|
2011
|
+
account.username = preferredUsername || email || Constants.EMPTY_STRING;
|
|
2012
|
+
account.name = accountDetails.idTokenClaims.name;
|
|
2013
|
+
account.cloudGraphHostName = accountDetails.cloudGraphHostName;
|
|
2014
|
+
account.msGraphHost = accountDetails.msGraphHost;
|
|
1989
2015
|
return account;
|
|
1990
2016
|
}
|
|
1991
2017
|
/**
|
|
1992
|
-
*
|
|
1993
|
-
* @param
|
|
1994
|
-
* @param
|
|
2018
|
+
* Creates an AccountEntity object from AccountInfo
|
|
2019
|
+
* @param accountInfo
|
|
2020
|
+
* @param cloudGraphHostName
|
|
2021
|
+
* @param msGraphHost
|
|
2022
|
+
* @returns
|
|
1995
2023
|
*/
|
|
1996
|
-
static
|
|
2024
|
+
static createFromAccountInfo(accountInfo, cloudGraphHostName, msGraphHost) {
|
|
1997
2025
|
const account = new AccountEntity();
|
|
1998
2026
|
account.authorityType =
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
account.
|
|
2003
|
-
|
|
2004
|
-
account.
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
}
|
|
2009
|
-
if (idToken) {
|
|
2010
|
-
// How do you account for MSA CID here?
|
|
2011
|
-
account.localAccountId =
|
|
2012
|
-
idToken?.claims?.oid ||
|
|
2013
|
-
idToken?.claims?.sub ||
|
|
2014
|
-
Constants.EMPTY_STRING;
|
|
2015
|
-
// upn claim for most ADFS scenarios
|
|
2016
|
-
account.username = idToken?.claims?.upn || Constants.EMPTY_STRING;
|
|
2017
|
-
account.name = idToken?.claims?.name || Constants.EMPTY_STRING;
|
|
2018
|
-
account.idTokenClaims = idToken?.claims;
|
|
2019
|
-
}
|
|
2020
|
-
account.environment = env;
|
|
2027
|
+
accountInfo.authorityType || CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
2028
|
+
account.homeAccountId = accountInfo.homeAccountId;
|
|
2029
|
+
account.localAccountId = accountInfo.localAccountId;
|
|
2030
|
+
account.nativeAccountId = accountInfo.nativeAccountId;
|
|
2031
|
+
account.realm = accountInfo.tenantId;
|
|
2032
|
+
account.environment = accountInfo.environment;
|
|
2033
|
+
account.username = accountInfo.username;
|
|
2034
|
+
account.name = accountInfo.name;
|
|
2035
|
+
account.idTokenClaims = accountInfo.idTokenClaims;
|
|
2021
2036
|
account.cloudGraphHostName = cloudGraphHostName;
|
|
2022
2037
|
account.msGraphHost = msGraphHost;
|
|
2023
|
-
/*
|
|
2024
|
-
* add uniqueName to claims
|
|
2025
|
-
* account.name = idToken.claims.uniqueName;
|
|
2026
|
-
*/
|
|
2027
2038
|
return account;
|
|
2028
2039
|
}
|
|
2029
2040
|
/**
|
|
@@ -2031,9 +2042,9 @@
|
|
|
2031
2042
|
* @param serverClientInfo
|
|
2032
2043
|
* @param authType
|
|
2033
2044
|
*/
|
|
2034
|
-
static generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj,
|
|
2035
|
-
const accountId =
|
|
2036
|
-
?
|
|
2045
|
+
static generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, idTokenClaims) {
|
|
2046
|
+
const accountId = idTokenClaims?.sub
|
|
2047
|
+
? idTokenClaims.sub
|
|
2037
2048
|
: Constants.EMPTY_STRING;
|
|
2038
2049
|
// since ADFS does not have tid and does not set client_info
|
|
2039
2050
|
if (authType === AuthorityType.Adfs ||
|
|
@@ -2101,7 +2112,7 @@
|
|
|
2101
2112
|
}
|
|
2102
2113
|
}
|
|
2103
2114
|
|
|
2104
|
-
/*! @azure/msal-common v14.0.
|
|
2115
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
2105
2116
|
|
|
2106
2117
|
/*
|
|
2107
2118
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2152,7 +2163,7 @@
|
|
|
2152
2163
|
}
|
|
2153
2164
|
}
|
|
2154
2165
|
|
|
2155
|
-
/*! @azure/msal-common v14.0.
|
|
2166
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
2156
2167
|
|
|
2157
2168
|
/*
|
|
2158
2169
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2218,20 +2229,21 @@
|
|
|
2218
2229
|
* saves a cache record
|
|
2219
2230
|
* @param cacheRecord
|
|
2220
2231
|
*/
|
|
2221
|
-
async saveCacheRecord(cacheRecord) {
|
|
2232
|
+
async saveCacheRecord(cacheRecord, storeInCache) {
|
|
2222
2233
|
if (!cacheRecord) {
|
|
2223
2234
|
throw ClientAuthError.createNullOrUndefinedCacheRecord();
|
|
2224
2235
|
}
|
|
2225
2236
|
if (!!cacheRecord.account) {
|
|
2226
2237
|
this.setAccount(cacheRecord.account);
|
|
2227
2238
|
}
|
|
2228
|
-
if (!!cacheRecord.idToken) {
|
|
2239
|
+
if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
|
|
2229
2240
|
this.setIdTokenCredential(cacheRecord.idToken);
|
|
2230
2241
|
}
|
|
2231
|
-
if (!!cacheRecord.accessToken) {
|
|
2242
|
+
if (!!cacheRecord.accessToken && storeInCache?.accessToken !== false) {
|
|
2232
2243
|
await this.saveAccessToken(cacheRecord.accessToken);
|
|
2233
2244
|
}
|
|
2234
|
-
if (!!cacheRecord.refreshToken
|
|
2245
|
+
if (!!cacheRecord.refreshToken &&
|
|
2246
|
+
storeInCache?.refreshToken !== false) {
|
|
2235
2247
|
this.setRefreshTokenCredential(cacheRecord.refreshToken);
|
|
2236
2248
|
}
|
|
2237
2249
|
if (!!cacheRecord.appMetadata) {
|
|
@@ -2645,7 +2657,11 @@
|
|
|
2645
2657
|
return null;
|
|
2646
2658
|
}
|
|
2647
2659
|
else if (numIdTokens > 1) {
|
|
2648
|
-
|
|
2660
|
+
this.commonLogger.info("CacheManager:getIdToken - Multiple id tokens found, clearing them");
|
|
2661
|
+
idTokens.forEach((idToken) => {
|
|
2662
|
+
this.removeIdToken(idToken.generateCredentialKey());
|
|
2663
|
+
});
|
|
2664
|
+
return null;
|
|
2649
2665
|
}
|
|
2650
2666
|
this.commonLogger.info("CacheManager:getIdToken - Returning id token");
|
|
2651
2667
|
return idTokens[0];
|
|
@@ -2755,7 +2771,11 @@
|
|
|
2755
2771
|
return null;
|
|
2756
2772
|
}
|
|
2757
2773
|
else if (numAccessTokens > 1) {
|
|
2758
|
-
|
|
2774
|
+
this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them");
|
|
2775
|
+
accessTokens.forEach((accessToken) => {
|
|
2776
|
+
this.removeAccessToken(accessToken.generateCredentialKey());
|
|
2777
|
+
});
|
|
2778
|
+
return null;
|
|
2759
2779
|
}
|
|
2760
2780
|
this.commonLogger.info("CacheManager:getAccessToken - Returning access token");
|
|
2761
2781
|
return accessTokens[0];
|
|
@@ -3166,7 +3186,7 @@
|
|
|
3166
3186
|
}
|
|
3167
3187
|
}
|
|
3168
3188
|
|
|
3169
|
-
/*! @azure/msal-common v14.0.
|
|
3189
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3170
3190
|
|
|
3171
3191
|
/*
|
|
3172
3192
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3260,8 +3280,15 @@
|
|
|
3260
3280
|
...authOptions,
|
|
3261
3281
|
};
|
|
3262
3282
|
}
|
|
3283
|
+
/**
|
|
3284
|
+
* Returns true if config has protocolMode set to ProtocolMode.OIDC, false otherwise
|
|
3285
|
+
* @param ClientConfiguration
|
|
3286
|
+
*/
|
|
3287
|
+
function isOidcProtocolMode(config) {
|
|
3288
|
+
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
3289
|
+
}
|
|
3263
3290
|
|
|
3264
|
-
/*! @azure/msal-common v14.0.
|
|
3291
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3265
3292
|
|
|
3266
3293
|
/*
|
|
3267
3294
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3278,7 +3305,7 @@
|
|
|
3278
3305
|
}
|
|
3279
3306
|
}
|
|
3280
3307
|
|
|
3281
|
-
/*! @azure/msal-common v14.0.
|
|
3308
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3282
3309
|
|
|
3283
3310
|
/*
|
|
3284
3311
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3375,7 +3402,7 @@
|
|
|
3375
3402
|
}
|
|
3376
3403
|
}
|
|
3377
3404
|
|
|
3378
|
-
/*! @azure/msal-common v14.0.
|
|
3405
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3379
3406
|
|
|
3380
3407
|
/*
|
|
3381
3408
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3411,7 +3438,7 @@
|
|
|
3411
3438
|
}
|
|
3412
3439
|
}
|
|
3413
3440
|
|
|
3414
|
-
/*! @azure/msal-common v14.0.
|
|
3441
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3415
3442
|
/*
|
|
3416
3443
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3417
3444
|
* Licensed under the MIT License.
|
|
@@ -3421,7 +3448,7 @@
|
|
|
3421
3448
|
UPN: "UPN",
|
|
3422
3449
|
};
|
|
3423
3450
|
|
|
3424
|
-
/*! @azure/msal-common v14.0.
|
|
3451
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3425
3452
|
|
|
3426
3453
|
/*
|
|
3427
3454
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3502,11 +3529,11 @@
|
|
|
3502
3529
|
}
|
|
3503
3530
|
});
|
|
3504
3531
|
// remove empty string parameters
|
|
3505
|
-
return Object.fromEntries(Object.entries(eQParams).filter(kv => kv[1] !== ""));
|
|
3532
|
+
return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
|
|
3506
3533
|
}
|
|
3507
3534
|
}
|
|
3508
3535
|
|
|
3509
|
-
/*! @azure/msal-common v14.0.
|
|
3536
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3510
3537
|
|
|
3511
3538
|
/*
|
|
3512
3539
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3546,9 +3573,15 @@
|
|
|
3546
3573
|
* @param scopeSet
|
|
3547
3574
|
* @param addOidcScopes
|
|
3548
3575
|
*/
|
|
3549
|
-
addScopes(scopes, addOidcScopes = true) {
|
|
3576
|
+
addScopes(scopes, addOidcScopes = true, defaultScopes = OIDC_DEFAULT_SCOPES) {
|
|
3577
|
+
// Always add openid to the scopes when adding OIDC scopes
|
|
3578
|
+
if (addOidcScopes &&
|
|
3579
|
+
!defaultScopes.includes("openid") &&
|
|
3580
|
+
!scopes.includes("openid")) {
|
|
3581
|
+
defaultScopes.push("openid");
|
|
3582
|
+
}
|
|
3550
3583
|
const requestScopes = addOidcScopes
|
|
3551
|
-
? [...(scopes || []), ...
|
|
3584
|
+
? [...(scopes || []), ...defaultScopes]
|
|
3552
3585
|
: scopes || [];
|
|
3553
3586
|
const scopeSet = new ScopeSet(requestScopes);
|
|
3554
3587
|
this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));
|
|
@@ -3883,7 +3916,7 @@
|
|
|
3883
3916
|
}
|
|
3884
3917
|
}
|
|
3885
3918
|
|
|
3886
|
-
/*! @azure/msal-common v14.0.
|
|
3919
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3887
3920
|
|
|
3888
3921
|
/*
|
|
3889
3922
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3978,7 +4011,7 @@
|
|
|
3978
4011
|
}
|
|
3979
4012
|
}
|
|
3980
4013
|
|
|
3981
|
-
/*! @azure/msal-common v14.0.
|
|
4014
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
3982
4015
|
|
|
3983
4016
|
/*
|
|
3984
4017
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4117,7 +4150,7 @@
|
|
|
4117
4150
|
}
|
|
4118
4151
|
}
|
|
4119
4152
|
|
|
4120
|
-
/*! @azure/msal-common v14.0.
|
|
4153
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4121
4154
|
|
|
4122
4155
|
/*
|
|
4123
4156
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4176,7 +4209,7 @@
|
|
|
4176
4209
|
}
|
|
4177
4210
|
}
|
|
4178
4211
|
|
|
4179
|
-
/*! @azure/msal-common v14.0.
|
|
4212
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4180
4213
|
/*
|
|
4181
4214
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4182
4215
|
* Licensed under the MIT License.
|
|
@@ -4223,7 +4256,7 @@
|
|
|
4223
4256
|
}
|
|
4224
4257
|
}
|
|
4225
4258
|
|
|
4226
|
-
/*! @azure/msal-common v14.0.
|
|
4259
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4227
4260
|
|
|
4228
4261
|
/*
|
|
4229
4262
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4337,7 +4370,7 @@
|
|
|
4337
4370
|
}
|
|
4338
4371
|
}
|
|
4339
4372
|
|
|
4340
|
-
/*! @azure/msal-common v14.0.
|
|
4373
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4341
4374
|
|
|
4342
4375
|
/*
|
|
4343
4376
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4399,7 +4432,7 @@
|
|
|
4399
4432
|
}
|
|
4400
4433
|
}
|
|
4401
4434
|
|
|
4402
|
-
/*! @azure/msal-common v14.0.
|
|
4435
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4403
4436
|
|
|
4404
4437
|
/*
|
|
4405
4438
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4480,12 +4513,12 @@
|
|
|
4480
4513
|
}
|
|
4481
4514
|
}
|
|
4482
4515
|
|
|
4483
|
-
/*! @azure/msal-common v14.0.
|
|
4516
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4484
4517
|
/*
|
|
4485
4518
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4486
4519
|
* Licensed under the MIT License.
|
|
4487
4520
|
*/
|
|
4488
|
-
|
|
4521
|
+
class CacheRecord {
|
|
4489
4522
|
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
4490
4523
|
this.account = accountEntity || null;
|
|
4491
4524
|
this.idToken = idTokenEntity || null;
|
|
@@ -4493,9 +4526,9 @@
|
|
|
4493
4526
|
this.refreshToken = refreshTokenEntity || null;
|
|
4494
4527
|
this.appMetadata = appMetadataEntity || null;
|
|
4495
4528
|
}
|
|
4496
|
-
}
|
|
4529
|
+
}
|
|
4497
4530
|
|
|
4498
|
-
/*! @azure/msal-common v14.0.
|
|
4531
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4499
4532
|
|
|
4500
4533
|
/*
|
|
4501
4534
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4569,7 +4602,7 @@
|
|
|
4569
4602
|
}
|
|
4570
4603
|
}
|
|
4571
4604
|
|
|
4572
|
-
/*! @azure/msal-common v14.0.
|
|
4605
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4573
4606
|
|
|
4574
4607
|
/*
|
|
4575
4608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4753,6 +4786,30 @@
|
|
|
4753
4786
|
}
|
|
4754
4787
|
return Constants.EMPTY_STRING;
|
|
4755
4788
|
}
|
|
4789
|
+
/**
|
|
4790
|
+
* Parses query server response string from given string.
|
|
4791
|
+
* Extract hash between '?code=' and '#' if trailing '# is present.
|
|
4792
|
+
* Returns empty string if no query symbol is found.
|
|
4793
|
+
* @param queryString
|
|
4794
|
+
*/
|
|
4795
|
+
static parseQueryServerResponse(queryString) {
|
|
4796
|
+
const queryIndex1 = queryString.indexOf("?code");
|
|
4797
|
+
const queryIndex2 = queryString.indexOf("/?code");
|
|
4798
|
+
const hashIndex = queryString.indexOf("#");
|
|
4799
|
+
if (queryIndex2 > -1 && hashIndex > -1) {
|
|
4800
|
+
return queryString.substring(queryIndex2 + 2, hashIndex);
|
|
4801
|
+
}
|
|
4802
|
+
else if (queryIndex2 > -1) {
|
|
4803
|
+
return queryString.substring(queryIndex2 + 2);
|
|
4804
|
+
}
|
|
4805
|
+
else if (queryIndex1 > -1 && hashIndex > -1) {
|
|
4806
|
+
return queryString.substring(queryIndex1 + 1, hashIndex);
|
|
4807
|
+
}
|
|
4808
|
+
else if (queryIndex1 > -1) {
|
|
4809
|
+
return queryString.substring(queryIndex1 + 1);
|
|
4810
|
+
}
|
|
4811
|
+
return Constants.EMPTY_STRING;
|
|
4812
|
+
}
|
|
4756
4813
|
static constructAuthorityUriFromObject(urlObject) {
|
|
4757
4814
|
return new UrlString(urlObject.Protocol +
|
|
4758
4815
|
"//" +
|
|
@@ -4798,6 +4855,21 @@
|
|
|
4798
4855
|
}
|
|
4799
4856
|
return deserializedQueryString;
|
|
4800
4857
|
}
|
|
4858
|
+
/**
|
|
4859
|
+
* Returns either deserialized query string or deserialized hash, depending on the serverResponseType
|
|
4860
|
+
* as a server auth code response object.
|
|
4861
|
+
*/
|
|
4862
|
+
static getDeserializedCodeResponse(serverResponseType, hashFragment) {
|
|
4863
|
+
const hashUrlString = new UrlString(hashFragment);
|
|
4864
|
+
let serverParams;
|
|
4865
|
+
if (serverResponseType === ServerResponseType.QUERY) {
|
|
4866
|
+
serverParams = UrlString.getDeserializedQueryString(hashFragment);
|
|
4867
|
+
}
|
|
4868
|
+
else {
|
|
4869
|
+
serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());
|
|
4870
|
+
}
|
|
4871
|
+
return serverParams;
|
|
4872
|
+
}
|
|
4801
4873
|
/**
|
|
4802
4874
|
* Check if the hash of the URL string contains known properties
|
|
4803
4875
|
*/
|
|
@@ -4814,7 +4886,7 @@
|
|
|
4814
4886
|
}
|
|
4815
4887
|
}
|
|
4816
4888
|
|
|
4817
|
-
/*! @azure/msal-common v14.0.
|
|
4889
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
4818
4890
|
/*
|
|
4819
4891
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4820
4892
|
* Licensed under the MIT License.
|
|
@@ -5017,6 +5089,7 @@
|
|
|
5017
5089
|
UpdateCloudDiscoveryMetadataMeasurement: "updateCloudDiscoveryMetadataMeasurement",
|
|
5018
5090
|
UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
|
|
5019
5091
|
NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
|
|
5092
|
+
NativeGenerateAuthResult: "nativeGenerateAuthResult",
|
|
5020
5093
|
};
|
|
5021
5094
|
/**
|
|
5022
5095
|
* State of the performance event.
|
|
@@ -5041,7 +5114,7 @@
|
|
|
5041
5114
|
"status",
|
|
5042
5115
|
]);
|
|
5043
5116
|
|
|
5044
|
-
/*! @azure/msal-common v14.0.
|
|
5117
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5045
5118
|
|
|
5046
5119
|
/*
|
|
5047
5120
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5126,7 +5199,7 @@
|
|
|
5126
5199
|
}
|
|
5127
5200
|
}
|
|
5128
5201
|
|
|
5129
|
-
/*! @azure/msal-common v14.0.
|
|
5202
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5130
5203
|
|
|
5131
5204
|
/*
|
|
5132
5205
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5195,7 +5268,7 @@
|
|
|
5195
5268
|
}
|
|
5196
5269
|
}
|
|
5197
5270
|
|
|
5198
|
-
/*! @azure/msal-common v14.0.
|
|
5271
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5199
5272
|
/*
|
|
5200
5273
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5201
5274
|
* Licensed under the MIT License.
|
|
@@ -5222,7 +5295,7 @@
|
|
|
5222
5295
|
}
|
|
5223
5296
|
}
|
|
5224
5297
|
|
|
5225
|
-
/*! @azure/msal-common v14.0.
|
|
5298
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5226
5299
|
|
|
5227
5300
|
/*
|
|
5228
5301
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5249,12 +5322,25 @@
|
|
|
5249
5322
|
*/
|
|
5250
5323
|
validateServerAuthorizationCodeResponse(serverResponseHash, cachedState, cryptoObj) {
|
|
5251
5324
|
if (!serverResponseHash.state || !cachedState) {
|
|
5252
|
-
throw
|
|
5253
|
-
? ClientAuthError.createStateNotFoundError("
|
|
5254
|
-
: ClientAuthError.createStateNotFoundError("
|
|
5325
|
+
throw serverResponseHash.state
|
|
5326
|
+
? ClientAuthError.createStateNotFoundError("Cached State")
|
|
5327
|
+
: ClientAuthError.createStateNotFoundError("Server State");
|
|
5328
|
+
}
|
|
5329
|
+
let decodedServerResponseHash;
|
|
5330
|
+
let decodedCachedState;
|
|
5331
|
+
try {
|
|
5332
|
+
decodedServerResponseHash = decodeURIComponent(serverResponseHash.state);
|
|
5255
5333
|
}
|
|
5256
|
-
|
|
5257
|
-
|
|
5334
|
+
catch (e) {
|
|
5335
|
+
throw ClientAuthError.createInvalidStateError(serverResponseHash.state, `Server response hash URI could not be decoded`);
|
|
5336
|
+
}
|
|
5337
|
+
try {
|
|
5338
|
+
decodedCachedState = decodeURIComponent(cachedState);
|
|
5339
|
+
}
|
|
5340
|
+
catch (e) {
|
|
5341
|
+
throw ClientAuthError.createInvalidStateError(serverResponseHash.state, `Cached state URI could not be decoded`);
|
|
5342
|
+
}
|
|
5343
|
+
if (decodedServerResponseHash !== decodedCachedState) {
|
|
5258
5344
|
throw ClientAuthError.createStateMismatchError();
|
|
5259
5345
|
}
|
|
5260
5346
|
// Check for error
|
|
@@ -5314,7 +5400,7 @@
|
|
|
5314
5400
|
}
|
|
5315
5401
|
}
|
|
5316
5402
|
// generate homeAccountId
|
|
5317
|
-
this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);
|
|
5403
|
+
this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj?.claims);
|
|
5318
5404
|
// save the response tokens
|
|
5319
5405
|
let requestStateObj;
|
|
5320
5406
|
if (!!authCodePayload && !!authCodePayload.state) {
|
|
@@ -5347,7 +5433,7 @@
|
|
|
5347
5433
|
return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined, serverRequestId);
|
|
5348
5434
|
}
|
|
5349
5435
|
}
|
|
5350
|
-
await this.cacheStorage.saveCacheRecord(cacheRecord);
|
|
5436
|
+
await this.cacheStorage.saveCacheRecord(cacheRecord, request.storeInCache);
|
|
5351
5437
|
}
|
|
5352
5438
|
finally {
|
|
5353
5439
|
if (this.persistencePlugin &&
|
|
@@ -5376,7 +5462,13 @@
|
|
|
5376
5462
|
if (!StringUtils.isEmpty(serverTokenResponse.id_token) &&
|
|
5377
5463
|
!!idTokenObj) {
|
|
5378
5464
|
cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
5379
|
-
cachedAccount =
|
|
5465
|
+
cachedAccount = AccountEntity.createAccount({
|
|
5466
|
+
homeAccountId: this.homeAccountIdentifier,
|
|
5467
|
+
idTokenClaims: idTokenObj.claims,
|
|
5468
|
+
clientInfo: serverTokenResponse.client_info,
|
|
5469
|
+
cloudGraphHostName: authCodePayload?.cloud_graph_host_name,
|
|
5470
|
+
msGraphHost: authCodePayload?.msgraph_host,
|
|
5471
|
+
}, authority);
|
|
5380
5472
|
}
|
|
5381
5473
|
// AccessToken
|
|
5382
5474
|
let cachedAccessToken = null;
|
|
@@ -5418,35 +5510,7 @@
|
|
|
5418
5510
|
if (!StringUtils.isEmpty(serverTokenResponse.foci)) {
|
|
5419
5511
|
cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);
|
|
5420
5512
|
}
|
|
5421
|
-
return new CacheRecord
|
|
5422
|
-
}
|
|
5423
|
-
/**
|
|
5424
|
-
* Generate Account
|
|
5425
|
-
* @param serverTokenResponse
|
|
5426
|
-
* @param idToken
|
|
5427
|
-
* @param authority
|
|
5428
|
-
*/
|
|
5429
|
-
generateAccountEntity(serverTokenResponse, idToken, authority, authCodePayload) {
|
|
5430
|
-
const authorityType = authority.authorityType;
|
|
5431
|
-
const cloudGraphHostName = authCodePayload
|
|
5432
|
-
? authCodePayload.cloud_graph_host_name
|
|
5433
|
-
: Constants.EMPTY_STRING;
|
|
5434
|
-
const msGraphhost = authCodePayload
|
|
5435
|
-
? authCodePayload.msgraph_host
|
|
5436
|
-
: Constants.EMPTY_STRING;
|
|
5437
|
-
// ADFS does not require client_info in the response
|
|
5438
|
-
if (authorityType === AuthorityType.Adfs) {
|
|
5439
|
-
this.logger.verbose("Authority type is ADFS, creating ADFS account");
|
|
5440
|
-
return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
|
|
5441
|
-
}
|
|
5442
|
-
// This fallback applies to B2C as well as they fall under an AAD account type.
|
|
5443
|
-
if (StringUtils.isEmpty(serverTokenResponse.client_info) &&
|
|
5444
|
-
authority.protocolMode === "AAD") {
|
|
5445
|
-
throw ClientAuthError.createClientInfoEmptyError();
|
|
5446
|
-
}
|
|
5447
|
-
return serverTokenResponse.client_info
|
|
5448
|
-
? AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost)
|
|
5449
|
-
: AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
|
|
5513
|
+
return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
|
|
5450
5514
|
}
|
|
5451
5515
|
/**
|
|
5452
5516
|
* Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
|
|
@@ -5525,7 +5589,7 @@
|
|
|
5525
5589
|
}
|
|
5526
5590
|
}
|
|
5527
5591
|
|
|
5528
|
-
/*! @azure/msal-common v14.0.
|
|
5592
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5529
5593
|
|
|
5530
5594
|
/*
|
|
5531
5595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5539,6 +5603,8 @@
|
|
|
5539
5603
|
super(configuration, performanceClient);
|
|
5540
5604
|
// Flag to indicate if client is for hybrid spa auth code redemption
|
|
5541
5605
|
this.includeRedirectUri = true;
|
|
5606
|
+
this.oidcDefaultScopes =
|
|
5607
|
+
this.config.authOptions.authority.options.OIDCOptions?.defaultScopes;
|
|
5542
5608
|
}
|
|
5543
5609
|
/**
|
|
5544
5610
|
* Creates the URL of the authorization request letting the user input credentials and consent to the
|
|
@@ -5577,7 +5643,7 @@
|
|
|
5577
5643
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
5578
5644
|
const httpVerAuthority = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
|
|
5579
5645
|
if (httpVerAuthority) {
|
|
5580
|
-
atsMeasurement?.
|
|
5646
|
+
atsMeasurement?.add({
|
|
5581
5647
|
httpVerAuthority,
|
|
5582
5648
|
});
|
|
5583
5649
|
}
|
|
@@ -5588,14 +5654,14 @@
|
|
|
5588
5654
|
return responseHandler
|
|
5589
5655
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId)
|
|
5590
5656
|
.then((result) => {
|
|
5591
|
-
atsMeasurement?.
|
|
5657
|
+
atsMeasurement?.end({
|
|
5592
5658
|
success: true,
|
|
5593
5659
|
});
|
|
5594
5660
|
return result;
|
|
5595
5661
|
})
|
|
5596
5662
|
.catch((error) => {
|
|
5597
5663
|
this.logger.verbose("Error in fetching token in ACC", request.correlationId);
|
|
5598
|
-
atsMeasurement?.
|
|
5664
|
+
atsMeasurement?.end({
|
|
5599
5665
|
errorCode: error.errorCode,
|
|
5600
5666
|
subErrorCode: error.subError,
|
|
5601
5667
|
success: false,
|
|
@@ -5611,10 +5677,8 @@
|
|
|
5611
5677
|
handleFragmentResponse(hashFragment, cachedState) {
|
|
5612
5678
|
// Handle responses.
|
|
5613
5679
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
// Deserialize hash fragment response parameters.
|
|
5617
|
-
const serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());
|
|
5680
|
+
const serverParams = UrlString.getDeserializedCodeResponse(this.config.authOptions.authority.options.OIDCOptions
|
|
5681
|
+
?.serverResponseType, hashFragment);
|
|
5618
5682
|
// Get code response
|
|
5619
5683
|
responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);
|
|
5620
5684
|
// throw when there is no auth code in the response
|
|
@@ -5686,7 +5750,8 @@
|
|
|
5686
5750
|
async createTokenRequestBody(request) {
|
|
5687
5751
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5688
5752
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5689
|
-
parameterBuilder.addClientId(
|
|
5753
|
+
parameterBuilder.addClientId(request.tokenBodyParameters?.[AADServerParamKeys.CLIENT_ID] ||
|
|
5754
|
+
this.config.authOptions.clientId);
|
|
5690
5755
|
/*
|
|
5691
5756
|
* For hybrid spa flow, there will be a code but no verifier
|
|
5692
5757
|
* In this scenario, don't include redirect uri as auth code will not be bound to redirect URI
|
|
@@ -5700,14 +5765,14 @@
|
|
|
5700
5765
|
parameterBuilder.addRedirectUri(request.redirectUri);
|
|
5701
5766
|
}
|
|
5702
5767
|
// Add scope array, parameter builder will add default scopes and dedupe
|
|
5703
|
-
parameterBuilder.addScopes(request.scopes);
|
|
5768
|
+
parameterBuilder.addScopes(request.scopes, true, this.oidcDefaultScopes);
|
|
5704
5769
|
// add code: user set, not validated
|
|
5705
5770
|
parameterBuilder.addAuthorizationCode(request.code);
|
|
5706
5771
|
// Add library metadata
|
|
5707
5772
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5708
5773
|
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5709
5774
|
parameterBuilder.addThrottling();
|
|
5710
|
-
if (this.serverTelemetryManager) {
|
|
5775
|
+
if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {
|
|
5711
5776
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
5712
5777
|
}
|
|
5713
5778
|
// add code_verifier if passed
|
|
@@ -5801,12 +5866,13 @@
|
|
|
5801
5866
|
async createAuthCodeUrlQueryString(request) {
|
|
5802
5867
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5803
5868
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5804
|
-
parameterBuilder.addClientId(
|
|
5869
|
+
parameterBuilder.addClientId(request.extraQueryParameters?.[AADServerParamKeys.CLIENT_ID] ||
|
|
5870
|
+
this.config.authOptions.clientId);
|
|
5805
5871
|
const requestScopes = [
|
|
5806
5872
|
...(request.scopes || []),
|
|
5807
5873
|
...(request.extraScopesToConsent || []),
|
|
5808
5874
|
];
|
|
5809
|
-
parameterBuilder.addScopes(requestScopes);
|
|
5875
|
+
parameterBuilder.addScopes(requestScopes, true, this.oidcDefaultScopes);
|
|
5810
5876
|
// validate the redirectUri (to be a non null value)
|
|
5811
5877
|
parameterBuilder.addRedirectUri(request.redirectUri);
|
|
5812
5878
|
// generate the correlationId if not set by the user and add
|
|
@@ -5819,7 +5885,9 @@
|
|
|
5819
5885
|
parameterBuilder.addResponseTypeCode();
|
|
5820
5886
|
// add library info parameters
|
|
5821
5887
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5822
|
-
|
|
5888
|
+
if (!isOidcProtocolMode(this.config)) {
|
|
5889
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5890
|
+
}
|
|
5823
5891
|
// add client_info=1
|
|
5824
5892
|
parameterBuilder.addClientInfo();
|
|
5825
5893
|
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
@@ -5961,7 +6029,7 @@
|
|
|
5961
6029
|
}
|
|
5962
6030
|
}
|
|
5963
6031
|
|
|
5964
|
-
/*! @azure/msal-common v14.0.
|
|
6032
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
5965
6033
|
|
|
5966
6034
|
/*
|
|
5967
6035
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5982,11 +6050,11 @@
|
|
|
5982
6050
|
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
5983
6051
|
const response = await this.executeTokenRequest(request, this.authority);
|
|
5984
6052
|
const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
|
|
5985
|
-
atsMeasurement?.
|
|
6053
|
+
atsMeasurement?.add({
|
|
5986
6054
|
refreshTokenSize: response.body.refresh_token?.length || 0,
|
|
5987
6055
|
});
|
|
5988
6056
|
if (httpVerToken) {
|
|
5989
|
-
atsMeasurement?.
|
|
6057
|
+
atsMeasurement?.add({
|
|
5990
6058
|
httpVerToken,
|
|
5991
6059
|
});
|
|
5992
6060
|
}
|
|
@@ -5998,14 +6066,14 @@
|
|
|
5998
6066
|
return responseHandler
|
|
5999
6067
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId)
|
|
6000
6068
|
.then((result) => {
|
|
6001
|
-
atsMeasurement?.
|
|
6069
|
+
atsMeasurement?.end({
|
|
6002
6070
|
success: true,
|
|
6003
6071
|
});
|
|
6004
6072
|
return result;
|
|
6005
6073
|
})
|
|
6006
6074
|
.catch((error) => {
|
|
6007
6075
|
this.logger.verbose("Error in fetching refresh token", request.correlationId);
|
|
6008
|
-
atsMeasurement?.
|
|
6076
|
+
atsMeasurement?.end({
|
|
6009
6077
|
errorCode: error.errorCode,
|
|
6010
6078
|
subErrorCode: error.subError,
|
|
6011
6079
|
success: false,
|
|
@@ -6069,11 +6137,11 @@
|
|
|
6069
6137
|
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
6070
6138
|
const refreshToken = this.cacheManager.getRefreshToken(request.account, foci);
|
|
6071
6139
|
if (!refreshToken) {
|
|
6072
|
-
atsMeasurement?.
|
|
6140
|
+
atsMeasurement?.discard();
|
|
6073
6141
|
throw InteractionRequiredAuthError.createNoTokensFoundError();
|
|
6074
6142
|
}
|
|
6075
6143
|
// attach cached RT size to the current measurement
|
|
6076
|
-
atsMeasurement?.
|
|
6144
|
+
atsMeasurement?.end({
|
|
6077
6145
|
success: true,
|
|
6078
6146
|
});
|
|
6079
6147
|
const refreshTokenRequest = {
|
|
@@ -6114,13 +6182,13 @@
|
|
|
6114
6182
|
};
|
|
6115
6183
|
return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
|
|
6116
6184
|
.then((result) => {
|
|
6117
|
-
acquireTokenMeasurement?.
|
|
6185
|
+
acquireTokenMeasurement?.end({
|
|
6118
6186
|
success: true,
|
|
6119
6187
|
});
|
|
6120
6188
|
return result;
|
|
6121
6189
|
})
|
|
6122
6190
|
.catch((error) => {
|
|
6123
|
-
acquireTokenMeasurement?.
|
|
6191
|
+
acquireTokenMeasurement?.end({
|
|
6124
6192
|
success: false,
|
|
6125
6193
|
});
|
|
6126
6194
|
throw error;
|
|
@@ -6136,13 +6204,13 @@
|
|
|
6136
6204
|
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
|
|
6137
6205
|
const parameterBuilder = new RequestParameterBuilder();
|
|
6138
6206
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
6139
|
-
parameterBuilder.addScopes(request.scopes);
|
|
6207
|
+
parameterBuilder.addScopes(request.scopes, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);
|
|
6140
6208
|
parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);
|
|
6141
6209
|
parameterBuilder.addClientInfo();
|
|
6142
6210
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
6143
6211
|
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
6144
6212
|
parameterBuilder.addThrottling();
|
|
6145
|
-
if (this.serverTelemetryManager) {
|
|
6213
|
+
if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {
|
|
6146
6214
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
6147
6215
|
}
|
|
6148
6216
|
parameterBuilder.addCorrelationId(correlationId);
|
|
@@ -6167,7 +6235,7 @@
|
|
|
6167
6235
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
6168
6236
|
}
|
|
6169
6237
|
else {
|
|
6170
|
-
acquireTokenMeasurement?.
|
|
6238
|
+
acquireTokenMeasurement?.end({
|
|
6171
6239
|
success: false,
|
|
6172
6240
|
});
|
|
6173
6241
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
@@ -6196,14 +6264,14 @@
|
|
|
6196
6264
|
break;
|
|
6197
6265
|
}
|
|
6198
6266
|
}
|
|
6199
|
-
acquireTokenMeasurement?.
|
|
6267
|
+
acquireTokenMeasurement?.end({
|
|
6200
6268
|
success: true,
|
|
6201
6269
|
});
|
|
6202
6270
|
return parameterBuilder.createQueryString();
|
|
6203
6271
|
}
|
|
6204
6272
|
}
|
|
6205
6273
|
|
|
6206
|
-
/*! @azure/msal-common v14.0.
|
|
6274
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
6207
6275
|
|
|
6208
6276
|
/*
|
|
6209
6277
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6306,7 +6374,7 @@
|
|
|
6306
6374
|
}
|
|
6307
6375
|
}
|
|
6308
6376
|
|
|
6309
|
-
/*! @azure/msal-common v14.0.
|
|
6377
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
6310
6378
|
/*
|
|
6311
6379
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6312
6380
|
* Licensed under the MIT License.
|
|
@@ -6318,7 +6386,7 @@
|
|
|
6318
6386
|
response.hasOwnProperty("jwks_uri"));
|
|
6319
6387
|
}
|
|
6320
6388
|
|
|
6321
|
-
/*! @azure/msal-common v14.0.
|
|
6389
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
6322
6390
|
/*
|
|
6323
6391
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6324
6392
|
* Licensed under the MIT License.
|
|
@@ -7195,21 +7263,16 @@
|
|
|
7195
7263
|
};
|
|
7196
7264
|
const EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
7197
7265
|
const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
7266
|
+
const InstanceDiscoveryMetadataAliases = new Set();
|
|
7267
|
+
for (const key in InstanceDiscoveryMetadata) {
|
|
7268
|
+
for (const metadata of InstanceDiscoveryMetadata[key].metadata) {
|
|
7269
|
+
for (const alias of metadata.aliases) {
|
|
7270
|
+
InstanceDiscoveryMetadataAliases.add(alias);
|
|
7271
|
+
}
|
|
7272
|
+
}
|
|
7273
|
+
}
|
|
7198
7274
|
|
|
7199
|
-
/*! @azure/msal-common v14.0.
|
|
7200
|
-
/*
|
|
7201
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7202
|
-
* Licensed under the MIT License.
|
|
7203
|
-
*/
|
|
7204
|
-
/**
|
|
7205
|
-
* Protocol modes supported by MSAL.
|
|
7206
|
-
*/
|
|
7207
|
-
const ProtocolMode = {
|
|
7208
|
-
AAD: "AAD",
|
|
7209
|
-
OIDC: "OIDC",
|
|
7210
|
-
};
|
|
7211
|
-
|
|
7212
|
-
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7275
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
7213
7276
|
|
|
7214
7277
|
/*
|
|
7215
7278
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7289,7 +7352,7 @@
|
|
|
7289
7352
|
}
|
|
7290
7353
|
}
|
|
7291
7354
|
|
|
7292
|
-
/*! @azure/msal-common v14.0.
|
|
7355
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
7293
7356
|
/*
|
|
7294
7357
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7295
7358
|
* Licensed under the MIT License.
|
|
@@ -7299,7 +7362,7 @@
|
|
|
7299
7362
|
response.hasOwnProperty("metadata"));
|
|
7300
7363
|
}
|
|
7301
7364
|
|
|
7302
|
-
/*! @azure/msal-common v14.0.
|
|
7365
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
7303
7366
|
/*
|
|
7304
7367
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7305
7368
|
* Licensed under the MIT License.
|
|
@@ -7309,7 +7372,7 @@
|
|
|
7309
7372
|
response.hasOwnProperty("error_description"));
|
|
7310
7373
|
}
|
|
7311
7374
|
|
|
7312
|
-
/*! @azure/msal-common v14.0.
|
|
7375
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
7313
7376
|
|
|
7314
7377
|
/*
|
|
7315
7378
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7420,7 +7483,7 @@
|
|
|
7420
7483
|
},
|
|
7421
7484
|
};
|
|
7422
7485
|
|
|
7423
|
-
/*! @azure/msal-common v14.0.
|
|
7486
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
7424
7487
|
|
|
7425
7488
|
/*
|
|
7426
7489
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7593,10 +7656,10 @@
|
|
|
7593
7656
|
* @private
|
|
7594
7657
|
*/
|
|
7595
7658
|
canReplaceTenant(authorityUri) {
|
|
7596
|
-
return authorityUri.PathSegments.length === 1
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7659
|
+
return (authorityUri.PathSegments.length === 1 &&
|
|
7660
|
+
!Authority.reservedTenantDomains.has(authorityUri.PathSegments[0]) &&
|
|
7661
|
+
this.getAuthorityType(authorityUri) === AuthorityType.Default &&
|
|
7662
|
+
this.protocolMode === ProtocolMode.AAD);
|
|
7600
7663
|
}
|
|
7601
7664
|
/**
|
|
7602
7665
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
|
@@ -7617,8 +7680,9 @@
|
|
|
7617
7680
|
const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
|
|
7618
7681
|
currentAuthorityParts.forEach((currentPart, index) => {
|
|
7619
7682
|
let cachedPart = cachedAuthorityParts[index];
|
|
7620
|
-
if (index === 0 &&
|
|
7621
|
-
|
|
7683
|
+
if (index === 0 &&
|
|
7684
|
+
this.canReplaceTenant(cachedAuthorityUrlComponents)) {
|
|
7685
|
+
const tenantId = new UrlString(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];
|
|
7622
7686
|
/**
|
|
7623
7687
|
* Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
|
|
7624
7688
|
* by comparing its first path segment to the corresponding authorization endpoint path segment, which is
|
|
@@ -7639,8 +7703,9 @@
|
|
|
7639
7703
|
* The default open id configuration endpoint for any canonical authority.
|
|
7640
7704
|
*/
|
|
7641
7705
|
get defaultOpenIdConfigurationEndpoint() {
|
|
7706
|
+
const canonicalAuthorityHost = this.hostnameAndPort;
|
|
7642
7707
|
if (this.authorityType === AuthorityType.Adfs ||
|
|
7643
|
-
this.
|
|
7708
|
+
!this.isAliasOfKnownMicrosoftAuthority(canonicalAuthorityHost)) {
|
|
7644
7709
|
return `${this.canonicalAuthority}.well-known/openid-configuration`;
|
|
7645
7710
|
}
|
|
7646
7711
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
@@ -7683,41 +7748,65 @@
|
|
|
7683
7748
|
*/
|
|
7684
7749
|
async updateEndpointMetadata(metadataEntity) {
|
|
7685
7750
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
7751
|
+
this.logger.verbose("Attempting to get endpoint metadata from authority configuration");
|
|
7686
7752
|
let metadata = this.getEndpointMetadataFromConfig();
|
|
7687
7753
|
if (metadata) {
|
|
7754
|
+
this.logger.verbose("Found endpoint metadata in authority configuration");
|
|
7688
7755
|
metadataEntity.updateEndpointMetadata(metadata, false);
|
|
7689
7756
|
return AuthorityMetadataSource.CONFIG;
|
|
7690
7757
|
}
|
|
7758
|
+
this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.");
|
|
7759
|
+
// skipAuthorityMetadataCache is used to bypass hardcoded authority metadata and force a network metadata cache lookup and network metadata request if no cached response is available.
|
|
7760
|
+
if (this.authorityOptions.skipAuthorityMetadataCache) {
|
|
7761
|
+
this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");
|
|
7762
|
+
}
|
|
7763
|
+
else {
|
|
7764
|
+
let hardcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
|
|
7765
|
+
if (hardcodedMetadata) {
|
|
7766
|
+
this.logger.verbose("Found endpoint metadata from hardcoded values.");
|
|
7767
|
+
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7768
|
+
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7769
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7770
|
+
this.logger.verbose("Found azure region configuration. Updating endpoints with regional information.");
|
|
7771
|
+
hardcodedMetadata =
|
|
7772
|
+
await this.updateMetadataWithRegionalInformation(hardcodedMetadata);
|
|
7773
|
+
}
|
|
7774
|
+
metadataEntity.updateEndpointMetadata(hardcodedMetadata, false);
|
|
7775
|
+
return AuthorityMetadataSource.HARDCODED_VALUES;
|
|
7776
|
+
}
|
|
7777
|
+
else {
|
|
7778
|
+
this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.");
|
|
7779
|
+
}
|
|
7780
|
+
}
|
|
7781
|
+
// Check cached metadata entity expiration status
|
|
7782
|
+
const metadataEntityExpired = metadataEntity.isExpired();
|
|
7691
7783
|
if (this.isAuthoritySameType(metadataEntity) &&
|
|
7692
7784
|
metadataEntity.endpointsFromNetwork &&
|
|
7693
|
-
!
|
|
7785
|
+
!metadataEntityExpired) {
|
|
7694
7786
|
// No need to update
|
|
7787
|
+
this.logger.verbose("Found endpoint metadata in the cache.");
|
|
7695
7788
|
return AuthorityMetadataSource.CACHE;
|
|
7696
7789
|
}
|
|
7790
|
+
else if (metadataEntityExpired) {
|
|
7791
|
+
this.logger.verbose("The metadata entity is expired.");
|
|
7792
|
+
}
|
|
7793
|
+
this.logger.verbose("Did not find cached endpoint metadata... Attempting to get endpoint metadata from the network.");
|
|
7697
7794
|
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7698
7795
|
metadata = await this.getEndpointMetadataFromNetwork();
|
|
7699
7796
|
if (metadata) {
|
|
7797
|
+
this.logger.verbose("Endpoint metadata was successfully returned from getEndpointMetadataFromNetwork()");
|
|
7700
7798
|
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7701
7799
|
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7702
7800
|
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7801
|
+
this.logger.verbose("Found azure region configuration. Updating endpoints with regional information.");
|
|
7703
7802
|
metadata = await this.updateMetadataWithRegionalInformation(metadata);
|
|
7704
7803
|
}
|
|
7705
7804
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
7706
7805
|
return AuthorityMetadataSource.NETWORK;
|
|
7707
7806
|
}
|
|
7708
|
-
let harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
|
|
7709
|
-
if (harcodedMetadata &&
|
|
7710
|
-
!this.authorityOptions.skipAuthorityMetadataCache) {
|
|
7711
|
-
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7712
|
-
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7713
|
-
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7714
|
-
harcodedMetadata =
|
|
7715
|
-
await this.updateMetadataWithRegionalInformation(harcodedMetadata);
|
|
7716
|
-
}
|
|
7717
|
-
metadataEntity.updateEndpointMetadata(harcodedMetadata, false);
|
|
7718
|
-
return AuthorityMetadataSource.HARDCODED_VALUES;
|
|
7719
|
-
}
|
|
7720
7807
|
else {
|
|
7808
|
+
// Metadata could not be obtained from the config, cache, network or hardcoded values
|
|
7809
|
+
this.logger.error("Did not find endpoint metadata from network... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.");
|
|
7721
7810
|
throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
|
|
7722
7811
|
}
|
|
7723
7812
|
}
|
|
@@ -7766,17 +7855,23 @@
|
|
|
7766
7855
|
const response = await this.networkInterface.sendGetRequestAsync(openIdConfigurationEndpoint, options);
|
|
7767
7856
|
const isValidResponse = isOpenIdConfigResponse(response.body);
|
|
7768
7857
|
if (isValidResponse) {
|
|
7769
|
-
perfEvent?.
|
|
7858
|
+
perfEvent?.end({ success: true });
|
|
7770
7859
|
return response.body;
|
|
7771
7860
|
}
|
|
7772
7861
|
else {
|
|
7773
|
-
perfEvent?.
|
|
7862
|
+
perfEvent?.end({
|
|
7863
|
+
success: false,
|
|
7864
|
+
errorCode: "invalid_response",
|
|
7865
|
+
});
|
|
7774
7866
|
this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration`);
|
|
7775
7867
|
return null;
|
|
7776
7868
|
}
|
|
7777
7869
|
}
|
|
7778
7870
|
catch (e) {
|
|
7779
|
-
perfEvent?.
|
|
7871
|
+
perfEvent?.end({
|
|
7872
|
+
success: false,
|
|
7873
|
+
errorCode: "request_failure",
|
|
7874
|
+
});
|
|
7780
7875
|
this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${e}`);
|
|
7781
7876
|
return null;
|
|
7782
7877
|
}
|
|
@@ -7798,19 +7893,26 @@
|
|
|
7798
7893
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7799
7894
|
const userConfiguredAzureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion;
|
|
7800
7895
|
if (userConfiguredAzureRegion) {
|
|
7801
|
-
if (userConfiguredAzureRegion !==
|
|
7802
|
-
|
|
7803
|
-
this.regionDiscoveryMetadata.
|
|
7896
|
+
if (userConfiguredAzureRegion !==
|
|
7897
|
+
Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
7898
|
+
this.regionDiscoveryMetadata.region_outcome =
|
|
7899
|
+
RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
|
|
7900
|
+
this.regionDiscoveryMetadata.region_used =
|
|
7901
|
+
userConfiguredAzureRegion;
|
|
7804
7902
|
return Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion);
|
|
7805
7903
|
}
|
|
7806
7904
|
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7807
|
-
const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration
|
|
7905
|
+
const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration
|
|
7906
|
+
?.environmentRegion, this.regionDiscoveryMetadata);
|
|
7808
7907
|
if (autodetectedRegionName) {
|
|
7809
|
-
this.regionDiscoveryMetadata.region_outcome =
|
|
7810
|
-
|
|
7908
|
+
this.regionDiscoveryMetadata.region_outcome =
|
|
7909
|
+
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
|
|
7910
|
+
this.regionDiscoveryMetadata.region_used =
|
|
7911
|
+
autodetectedRegionName;
|
|
7811
7912
|
return Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName);
|
|
7812
7913
|
}
|
|
7813
|
-
this.regionDiscoveryMetadata.region_outcome =
|
|
7914
|
+
this.regionDiscoveryMetadata.region_outcome =
|
|
7915
|
+
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
7814
7916
|
}
|
|
7815
7917
|
return metadata;
|
|
7816
7918
|
}
|
|
@@ -7822,7 +7924,7 @@
|
|
|
7822
7924
|
*/
|
|
7823
7925
|
async updateCloudDiscoveryMetadata(metadataEntity) {
|
|
7824
7926
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7825
|
-
this.logger.verbose("Attempting to get cloud discovery metadata
|
|
7927
|
+
this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration");
|
|
7826
7928
|
this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities ||
|
|
7827
7929
|
Constants.NOT_APPLICABLE}`);
|
|
7828
7930
|
this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata ||
|
|
@@ -7830,17 +7932,29 @@
|
|
|
7830
7932
|
this.logger.verbosePii(`Canonical Authority: ${metadataEntity.canonical_authority || Constants.NOT_APPLICABLE}`);
|
|
7831
7933
|
let metadata = this.getCloudDiscoveryMetadataFromConfig();
|
|
7832
7934
|
if (metadata) {
|
|
7833
|
-
this.logger.verbose("Found cloud discovery metadata in
|
|
7935
|
+
this.logger.verbose("Found cloud discovery metadata in authority configuration");
|
|
7834
7936
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, false);
|
|
7835
7937
|
return AuthorityMetadataSource.CONFIG;
|
|
7836
7938
|
}
|
|
7837
|
-
// If the cached metadata came from config but that config was not passed to this instance, we must go to
|
|
7838
|
-
this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the
|
|
7939
|
+
// If the cached metadata came from config but that config was not passed to this instance, we must go to hardcoded values
|
|
7940
|
+
this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values.");
|
|
7941
|
+
if (this.options.skipAuthorityMetadataCache) {
|
|
7942
|
+
this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");
|
|
7943
|
+
}
|
|
7944
|
+
else {
|
|
7945
|
+
const hardcodedMetadata = this.getCloudDiscoveryMetadataFromHardcodedValues();
|
|
7946
|
+
if (hardcodedMetadata) {
|
|
7947
|
+
this.logger.verbose("Found cloud discovery metadata from hardcoded values.");
|
|
7948
|
+
metadataEntity.updateCloudDiscoveryMetadata(hardcodedMetadata, false);
|
|
7949
|
+
return AuthorityMetadataSource.HARDCODED_VALUES;
|
|
7950
|
+
}
|
|
7951
|
+
this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.");
|
|
7952
|
+
}
|
|
7839
7953
|
const metadataEntityExpired = metadataEntity.isExpired();
|
|
7840
7954
|
if (this.isAuthoritySameType(metadataEntity) &&
|
|
7841
7955
|
metadataEntity.aliasesFromNetwork &&
|
|
7842
7956
|
!metadataEntityExpired) {
|
|
7843
|
-
this.logger.verbose("Found metadata in the cache.");
|
|
7957
|
+
this.logger.verbose("Found cloud discovery metadata in the cache.");
|
|
7844
7958
|
// No need to update
|
|
7845
7959
|
return AuthorityMetadataSource.CACHE;
|
|
7846
7960
|
}
|
|
@@ -7855,15 +7969,8 @@
|
|
|
7855
7969
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
|
|
7856
7970
|
return AuthorityMetadataSource.NETWORK;
|
|
7857
7971
|
}
|
|
7858
|
-
this.logger.verbose("Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.");
|
|
7859
|
-
const harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
|
|
7860
|
-
if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
|
|
7861
|
-
this.logger.verbose("Found cloud discovery metadata from hardcoded values.");
|
|
7862
|
-
metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
|
|
7863
|
-
return AuthorityMetadataSource.HARDCODED_VALUES;
|
|
7864
|
-
}
|
|
7865
7972
|
// Metadata could not be obtained from the config, cache, network or hardcoded values
|
|
7866
|
-
this.logger.error("Did not find cloud discovery metadata from
|
|
7973
|
+
this.logger.error("Did not find cloud discovery metadata from network... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.");
|
|
7867
7974
|
throw ClientConfigurationError.createUntrustedAuthorityError();
|
|
7868
7975
|
}
|
|
7869
7976
|
/**
|
|
@@ -7968,9 +8075,11 @@
|
|
|
7968
8075
|
/**
|
|
7969
8076
|
* Get cloud discovery metadata for common authorities
|
|
7970
8077
|
*/
|
|
7971
|
-
|
|
8078
|
+
getCloudDiscoveryMetadataFromHardcodedValues() {
|
|
7972
8079
|
if (this.canonicalAuthority in InstanceDiscoveryMetadata) {
|
|
7973
|
-
|
|
8080
|
+
const hardcodedMetadataResponse = InstanceDiscoveryMetadata[this.canonicalAuthority];
|
|
8081
|
+
const metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(hardcodedMetadataResponse.metadata, this.hostnameAndPort);
|
|
8082
|
+
return metadata;
|
|
7974
8083
|
}
|
|
7975
8084
|
return null;
|
|
7976
8085
|
}
|
|
@@ -8045,6 +8154,13 @@
|
|
|
8045
8154
|
isAlias(host) {
|
|
8046
8155
|
return this.metadata.aliases.indexOf(host) > -1;
|
|
8047
8156
|
}
|
|
8157
|
+
/**
|
|
8158
|
+
* Returns whether or not the provided host is an alias of a known Microsoft authority for purposes of endpoint discovery
|
|
8159
|
+
* @param host
|
|
8160
|
+
*/
|
|
8161
|
+
isAliasOfKnownMicrosoftAuthority(host) {
|
|
8162
|
+
return InstanceDiscoveryMetadataAliases.has(host);
|
|
8163
|
+
}
|
|
8048
8164
|
/**
|
|
8049
8165
|
* Checks whether the provided host is that of a public cloud authority
|
|
8050
8166
|
*
|
|
@@ -8086,15 +8202,17 @@
|
|
|
8086
8202
|
* @param azureRegion string
|
|
8087
8203
|
*/
|
|
8088
8204
|
static replaceWithRegionalInformation(metadata, azureRegion) {
|
|
8089
|
-
metadata
|
|
8090
|
-
|
|
8205
|
+
const regionalMetadata = { ...metadata };
|
|
8206
|
+
regionalMetadata.authorization_endpoint =
|
|
8207
|
+
Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion);
|
|
8091
8208
|
// TODO: Enquire on whether we should leave the query string or remove it before releasing the feature
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8209
|
+
regionalMetadata.token_endpoint =
|
|
8210
|
+
Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING);
|
|
8211
|
+
if (regionalMetadata.end_session_endpoint) {
|
|
8212
|
+
regionalMetadata.end_session_endpoint =
|
|
8213
|
+
Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion);
|
|
8096
8214
|
}
|
|
8097
|
-
return
|
|
8215
|
+
return regionalMetadata;
|
|
8098
8216
|
}
|
|
8099
8217
|
/**
|
|
8100
8218
|
* Transform CIAM_AUTHORIY as per the below rules:
|
|
@@ -8106,11 +8224,14 @@
|
|
|
8106
8224
|
* @param authority
|
|
8107
8225
|
*/
|
|
8108
8226
|
static transformCIAMAuthority(authority) {
|
|
8109
|
-
let ciamAuthority = authority.endsWith(Constants.FORWARD_SLASH)
|
|
8227
|
+
let ciamAuthority = authority.endsWith(Constants.FORWARD_SLASH)
|
|
8228
|
+
? authority
|
|
8229
|
+
: `${authority}${Constants.FORWARD_SLASH}`;
|
|
8110
8230
|
const authorityUrl = new UrlString(authority);
|
|
8111
8231
|
const authorityUrlComponents = authorityUrl.getUrlComponents();
|
|
8112
8232
|
// check if transformation is needed
|
|
8113
|
-
if (authorityUrlComponents.PathSegments.length === 0 &&
|
|
8233
|
+
if (authorityUrlComponents.PathSegments.length === 0 &&
|
|
8234
|
+
authorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
|
|
8114
8235
|
const tenantIdOrDomain = authorityUrlComponents.HostNameAndPort.split(".")[0];
|
|
8115
8236
|
ciamAuthority = `${ciamAuthority}${tenantIdOrDomain}${Constants.AAD_TENANT_DOMAIN_SUFFIX}`;
|
|
8116
8237
|
}
|
|
@@ -8118,15 +8239,15 @@
|
|
|
8118
8239
|
}
|
|
8119
8240
|
}
|
|
8120
8241
|
// Reserved tenant domain names that will not be replaced with tenant id
|
|
8121
|
-
Authority.reservedTenantDomains =
|
|
8242
|
+
Authority.reservedTenantDomains = new Set([
|
|
8122
8243
|
"{tenant}",
|
|
8123
8244
|
"{tenantid}",
|
|
8124
8245
|
AADAuthorityConstants.COMMON,
|
|
8125
8246
|
AADAuthorityConstants.CONSUMERS,
|
|
8126
|
-
AADAuthorityConstants.ORGANIZATIONS
|
|
8127
|
-
])
|
|
8247
|
+
AADAuthorityConstants.ORGANIZATIONS,
|
|
8248
|
+
]);
|
|
8128
8249
|
|
|
8129
|
-
/*! @azure/msal-common v14.0.
|
|
8250
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8130
8251
|
|
|
8131
8252
|
/*
|
|
8132
8253
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8176,7 +8297,7 @@
|
|
|
8176
8297
|
}
|
|
8177
8298
|
}
|
|
8178
8299
|
|
|
8179
|
-
/*! @azure/msal-common v14.0.
|
|
8300
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8180
8301
|
|
|
8181
8302
|
/*
|
|
8182
8303
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8206,7 +8327,7 @@
|
|
|
8206
8327
|
}
|
|
8207
8328
|
}
|
|
8208
8329
|
|
|
8209
|
-
/*! @azure/msal-common v14.0.
|
|
8330
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8210
8331
|
|
|
8211
8332
|
/*
|
|
8212
8333
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8232,7 +8353,7 @@
|
|
|
8232
8353
|
}
|
|
8233
8354
|
}
|
|
8234
8355
|
|
|
8235
|
-
/*! @azure/msal-common v14.0.
|
|
8356
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8236
8357
|
|
|
8237
8358
|
/*
|
|
8238
8359
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8249,7 +8370,7 @@
|
|
|
8249
8370
|
},
|
|
8250
8371
|
};
|
|
8251
8372
|
|
|
8252
|
-
/*! @azure/msal-common v14.0.
|
|
8373
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8253
8374
|
|
|
8254
8375
|
/*
|
|
8255
8376
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8291,7 +8412,7 @@
|
|
|
8291
8412
|
}
|
|
8292
8413
|
}
|
|
8293
8414
|
|
|
8294
|
-
/*! @azure/msal-common v14.0.
|
|
8415
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8295
8416
|
|
|
8296
8417
|
/*
|
|
8297
8418
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8330,7 +8451,7 @@
|
|
|
8330
8451
|
}
|
|
8331
8452
|
}
|
|
8332
8453
|
|
|
8333
|
-
/*! @azure/msal-common v14.0.
|
|
8454
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8334
8455
|
|
|
8335
8456
|
/*
|
|
8336
8457
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8388,7 +8509,7 @@
|
|
|
8388
8509
|
}
|
|
8389
8510
|
}
|
|
8390
8511
|
|
|
8391
|
-
/*! @azure/msal-common v14.0.
|
|
8512
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8392
8513
|
|
|
8393
8514
|
/*
|
|
8394
8515
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8587,7 +8708,7 @@
|
|
|
8587
8708
|
}
|
|
8588
8709
|
}
|
|
8589
8710
|
|
|
8590
|
-
/*! @azure/msal-common v14.0.
|
|
8711
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
8591
8712
|
|
|
8592
8713
|
/*
|
|
8593
8714
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8604,8 +8725,10 @@
|
|
|
8604
8725
|
* @param {Logger} logger Logger used by the application
|
|
8605
8726
|
* @param {string} libraryName Name of the library
|
|
8606
8727
|
* @param {string} libraryVersion Version of the library
|
|
8728
|
+
* @param {ApplicationTelemetry} applicationTelemetry application name and version
|
|
8729
|
+
* @param {Set<String>} intFields integer fields to be truncated
|
|
8607
8730
|
*/
|
|
8608
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
8731
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields) {
|
|
8609
8732
|
this.authority = authority;
|
|
8610
8733
|
this.libraryName = libraryName;
|
|
8611
8734
|
this.libraryVersion = libraryVersion;
|
|
@@ -8616,6 +8739,10 @@
|
|
|
8616
8739
|
this.eventsByCorrelationId = new Map();
|
|
8617
8740
|
this.queueMeasurements = new Map();
|
|
8618
8741
|
this.preQueueTimeByCorrelationId = new Map();
|
|
8742
|
+
this.intFields = intFields || new Set();
|
|
8743
|
+
for (const item of IntFields) {
|
|
8744
|
+
this.intFields.add(item);
|
|
8745
|
+
}
|
|
8619
8746
|
}
|
|
8620
8747
|
/**
|
|
8621
8748
|
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
@@ -8630,13 +8757,6 @@
|
|
|
8630
8757
|
) {
|
|
8631
8758
|
return {};
|
|
8632
8759
|
}
|
|
8633
|
-
/**
|
|
8634
|
-
* Get integral fields.
|
|
8635
|
-
* Override to change the set.
|
|
8636
|
-
*/
|
|
8637
|
-
getIntFields() {
|
|
8638
|
-
return IntFields;
|
|
8639
|
-
}
|
|
8640
8760
|
/**
|
|
8641
8761
|
* Gets map of pre-queue times by correlation Id
|
|
8642
8762
|
*
|
|
@@ -8754,7 +8874,7 @@
|
|
|
8754
8874
|
this.cacheEventByCorrelationId(inProgressEvent);
|
|
8755
8875
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
8756
8876
|
return {
|
|
8757
|
-
|
|
8877
|
+
end: (event) => {
|
|
8758
8878
|
return this.endMeasurement({
|
|
8759
8879
|
// Initial set of event properties
|
|
8760
8880
|
...inProgressEvent,
|
|
@@ -8762,14 +8882,14 @@
|
|
|
8762
8882
|
...event,
|
|
8763
8883
|
}, performanceMeasurement);
|
|
8764
8884
|
},
|
|
8765
|
-
|
|
8885
|
+
discard: () => {
|
|
8766
8886
|
return this.discardMeasurements(inProgressEvent.correlationId);
|
|
8767
8887
|
},
|
|
8768
|
-
|
|
8769
|
-
return this.
|
|
8888
|
+
add: (fields) => {
|
|
8889
|
+
return this.addFields(fields, inProgressEvent.correlationId);
|
|
8770
8890
|
},
|
|
8771
|
-
increment: (
|
|
8772
|
-
return this.
|
|
8891
|
+
increment: (fields) => {
|
|
8892
|
+
return this.incrementFields(fields, inProgressEvent.correlationId);
|
|
8773
8893
|
},
|
|
8774
8894
|
measurement: performanceMeasurement,
|
|
8775
8895
|
event: inProgressEvent,
|
|
@@ -8834,7 +8954,7 @@
|
|
|
8834
8954
|
status: PerformanceEventStatus.Completed,
|
|
8835
8955
|
incompleteSubsCount,
|
|
8836
8956
|
};
|
|
8837
|
-
this.truncateIntegralFields(finalEvent
|
|
8957
|
+
this.truncateIntegralFields(finalEvent);
|
|
8838
8958
|
this.emitEvents([finalEvent], event.correlationId);
|
|
8839
8959
|
return finalEvent;
|
|
8840
8960
|
}
|
|
@@ -8843,7 +8963,7 @@
|
|
|
8843
8963
|
* @param fields
|
|
8844
8964
|
* @param correlationId
|
|
8845
8965
|
*/
|
|
8846
|
-
|
|
8966
|
+
addFields(fields, correlationId) {
|
|
8847
8967
|
this.logger.trace("PerformanceClient: Updating static fields");
|
|
8848
8968
|
const event = this.eventsByCorrelationId.get(correlationId);
|
|
8849
8969
|
if (event) {
|
|
@@ -8858,18 +8978,21 @@
|
|
|
8858
8978
|
}
|
|
8859
8979
|
/**
|
|
8860
8980
|
* Increment counters to be emitted when the measurements are flushed
|
|
8861
|
-
* @param
|
|
8981
|
+
* @param fields {string[]}
|
|
8862
8982
|
* @param correlationId {string} correlation identifier
|
|
8863
8983
|
*/
|
|
8864
|
-
|
|
8984
|
+
incrementFields(fields, correlationId) {
|
|
8865
8985
|
this.logger.trace("PerformanceClient: Updating counters");
|
|
8866
8986
|
const event = this.eventsByCorrelationId.get(correlationId);
|
|
8867
8987
|
if (event) {
|
|
8868
|
-
for (const counter in
|
|
8988
|
+
for (const counter in fields) {
|
|
8869
8989
|
if (!event.hasOwnProperty(counter)) {
|
|
8870
8990
|
event[counter] = 0;
|
|
8871
8991
|
}
|
|
8872
|
-
event[counter]
|
|
8992
|
+
else if (isNaN(Number(event[counter]))) {
|
|
8993
|
+
return;
|
|
8994
|
+
}
|
|
8995
|
+
event[counter] += fields[counter];
|
|
8873
8996
|
}
|
|
8874
8997
|
}
|
|
8875
8998
|
else {
|
|
@@ -8987,8 +9110,8 @@
|
|
|
8987
9110
|
* @param {PerformanceEvent} event performance event to update.
|
|
8988
9111
|
* @param {Set<string>} intFields integral fields.
|
|
8989
9112
|
*/
|
|
8990
|
-
truncateIntegralFields(event
|
|
8991
|
-
intFields.forEach((key) => {
|
|
9113
|
+
truncateIntegralFields(event) {
|
|
9114
|
+
this.intFields.forEach((key) => {
|
|
8992
9115
|
if (key in event && typeof event[key] === "number") {
|
|
8993
9116
|
event[key] = Math.floor(event[key]);
|
|
8994
9117
|
}
|
|
@@ -8996,16 +9119,22 @@
|
|
|
8996
9119
|
}
|
|
8997
9120
|
}
|
|
8998
9121
|
|
|
8999
|
-
/*! @azure/msal-common v14.0.
|
|
9122
|
+
/*! @azure/msal-common v14.0.1 2023-08-11 */
|
|
9000
9123
|
|
|
9001
9124
|
/*
|
|
9002
9125
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9003
9126
|
* Licensed under the MIT License.
|
|
9004
9127
|
*/
|
|
9005
9128
|
class StubPerformanceMeasurement {
|
|
9006
|
-
startMeasurement() {
|
|
9007
|
-
|
|
9008
|
-
|
|
9129
|
+
startMeasurement() {
|
|
9130
|
+
return;
|
|
9131
|
+
}
|
|
9132
|
+
endMeasurement() {
|
|
9133
|
+
return;
|
|
9134
|
+
}
|
|
9135
|
+
flushMeasurement() {
|
|
9136
|
+
return null;
|
|
9137
|
+
}
|
|
9009
9138
|
}
|
|
9010
9139
|
class StubPerformanceClient extends PerformanceClient {
|
|
9011
9140
|
generateId() {
|
|
@@ -9017,8 +9146,36 @@
|
|
|
9017
9146
|
calculateQueuedTime() {
|
|
9018
9147
|
return 0;
|
|
9019
9148
|
}
|
|
9020
|
-
addQueueMeasurement() {
|
|
9021
|
-
|
|
9149
|
+
addQueueMeasurement() {
|
|
9150
|
+
return;
|
|
9151
|
+
}
|
|
9152
|
+
setPreQueueTime() {
|
|
9153
|
+
return;
|
|
9154
|
+
}
|
|
9155
|
+
endMeasurement() {
|
|
9156
|
+
return null;
|
|
9157
|
+
}
|
|
9158
|
+
discardMeasurements() {
|
|
9159
|
+
return;
|
|
9160
|
+
}
|
|
9161
|
+
removePerformanceCallback() {
|
|
9162
|
+
return true;
|
|
9163
|
+
}
|
|
9164
|
+
addPerformanceCallback() {
|
|
9165
|
+
return "";
|
|
9166
|
+
}
|
|
9167
|
+
emitEvents() {
|
|
9168
|
+
return;
|
|
9169
|
+
}
|
|
9170
|
+
addFields() {
|
|
9171
|
+
return;
|
|
9172
|
+
}
|
|
9173
|
+
incrementFields() {
|
|
9174
|
+
return;
|
|
9175
|
+
}
|
|
9176
|
+
cacheEventByCorrelationId() {
|
|
9177
|
+
return;
|
|
9178
|
+
}
|
|
9022
9179
|
}
|
|
9023
9180
|
|
|
9024
9181
|
/*
|
|
@@ -9201,9 +9358,9 @@
|
|
|
9201
9358
|
code: "native_connection_not_established",
|
|
9202
9359
|
desc: "Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). For more please visit aka.ms/msaljs/browser-errors.",
|
|
9203
9360
|
},
|
|
9204
|
-
|
|
9205
|
-
code: "
|
|
9206
|
-
desc: "You must call and await the initialize function before attempting to call any other MSAL API
|
|
9361
|
+
uninitializedPublicClientApplication: {
|
|
9362
|
+
code: "uninitialized_public_client_application",
|
|
9363
|
+
desc: "You must call and await the initialize function before attempting to call any other MSAL API. For more please visit aka.ms/msaljs/browser-errors.",
|
|
9207
9364
|
},
|
|
9208
9365
|
nativePromptNotSupported: {
|
|
9209
9366
|
code: "native_prompt_not_supported",
|
|
@@ -9493,8 +9650,8 @@
|
|
|
9493
9650
|
/**
|
|
9494
9651
|
* Create an error thrown when the initialize function hasn't been called
|
|
9495
9652
|
*/
|
|
9496
|
-
static
|
|
9497
|
-
return new BrowserAuthError(BrowserAuthErrorMessage.
|
|
9653
|
+
static createUninitializedPublicClientApplication() {
|
|
9654
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.uninitializedPublicClientApplication.code, BrowserAuthErrorMessage.uninitializedPublicClientApplication.desc);
|
|
9498
9655
|
}
|
|
9499
9656
|
/**
|
|
9500
9657
|
* Create an error thrown when requesting a token directly from the native platform with an unsupported prompt parameter e.g. select_account, login or create
|
|
@@ -11175,6 +11332,23 @@
|
|
|
11175
11332
|
setRedirectRequestContext(value) {
|
|
11176
11333
|
this.setTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, value, true);
|
|
11177
11334
|
}
|
|
11335
|
+
/**
|
|
11336
|
+
* Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
|
|
11337
|
+
* @param result
|
|
11338
|
+
* @param request
|
|
11339
|
+
*/
|
|
11340
|
+
async hydrateCache(result, request) {
|
|
11341
|
+
const idTokenEntity = IdTokenEntity.createIdTokenEntity(result.account?.homeAccountId, result.account?.environment, result.idToken, this.clientId, result.tenantId);
|
|
11342
|
+
let claimsHash;
|
|
11343
|
+
if (request.claims) {
|
|
11344
|
+
claimsHash = await this.cryptoImpl.hashString(request.claims);
|
|
11345
|
+
}
|
|
11346
|
+
const accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(result.account?.homeAccountId, result.account.environment, result.accessToken, this.clientId, result.tenantId, result.scopes.join(" "), result.expiresOn?.getTime() || 0, result.extExpiresOn?.getTime() || 0, this.cryptoImpl, undefined, // refreshOn
|
|
11347
|
+
result.tokenType, undefined, // userAssertionHash
|
|
11348
|
+
request.sshKid, request.claims, claimsHash);
|
|
11349
|
+
const cacheRecord = new CacheRecord(undefined, idTokenEntity, accessTokenEntity);
|
|
11350
|
+
return this.saveCacheRecord(cacheRecord);
|
|
11351
|
+
}
|
|
11178
11352
|
}
|
|
11179
11353
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
11180
11354
|
const cacheOptions = {
|
|
@@ -11188,20 +11362,9 @@
|
|
|
11188
11362
|
return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);
|
|
11189
11363
|
};
|
|
11190
11364
|
|
|
11191
|
-
/*
|
|
11192
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11193
|
-
* Licensed under the MIT License.
|
|
11194
|
-
*/
|
|
11195
|
-
class CacheRecord extends CacheRecord$1 {
|
|
11196
|
-
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
11197
|
-
super(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity);
|
|
11198
|
-
this.account = accountEntity;
|
|
11199
|
-
}
|
|
11200
|
-
}
|
|
11201
|
-
|
|
11202
11365
|
/* eslint-disable header/header */
|
|
11203
11366
|
const name = "@azure/msal-browser";
|
|
11204
|
-
const version = "3.0.
|
|
11367
|
+
const version = "3.0.1";
|
|
11205
11368
|
|
|
11206
11369
|
/*
|
|
11207
11370
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11537,13 +11700,12 @@
|
|
|
11537
11700
|
}
|
|
11538
11701
|
}
|
|
11539
11702
|
/**
|
|
11540
|
-
* Throws error if
|
|
11541
|
-
* @param allowNativeBroker
|
|
11703
|
+
* Throws error if initialize hasn't been called
|
|
11542
11704
|
* @param initialized
|
|
11543
11705
|
*/
|
|
11544
|
-
static
|
|
11545
|
-
if (
|
|
11546
|
-
throw BrowserAuthError.
|
|
11706
|
+
static blockAPICallsBeforeInitialize(initialized) {
|
|
11707
|
+
if (!initialized) {
|
|
11708
|
+
throw BrowserAuthError.createUninitializedPublicClientApplication();
|
|
11547
11709
|
}
|
|
11548
11710
|
}
|
|
11549
11711
|
/**
|
|
@@ -11702,6 +11864,7 @@
|
|
|
11702
11864
|
this.logger.verbose("getDiscoveredAuthority called");
|
|
11703
11865
|
const authorityOptions = {
|
|
11704
11866
|
protocolMode: this.config.auth.protocolMode,
|
|
11867
|
+
OIDCOptions: this.config.auth.OIDCOptions,
|
|
11705
11868
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
11706
11869
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
11707
11870
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
@@ -11911,6 +12074,7 @@
|
|
|
11911
12074
|
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11912
12075
|
const authorityOptions = {
|
|
11913
12076
|
protocolMode: this.config.auth.protocolMode,
|
|
12077
|
+
OIDCOptions: this.config.auth.OIDCOptions,
|
|
11914
12078
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
11915
12079
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
11916
12080
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
@@ -11926,13 +12090,13 @@
|
|
|
11926
12090
|
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
11927
12091
|
return await AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
11928
12092
|
.then((result) => {
|
|
11929
|
-
getAuthorityMeasurement.
|
|
12093
|
+
getAuthorityMeasurement.end({
|
|
11930
12094
|
success: true,
|
|
11931
12095
|
});
|
|
11932
12096
|
return result;
|
|
11933
12097
|
})
|
|
11934
12098
|
.catch((error) => {
|
|
11935
|
-
getAuthorityMeasurement.
|
|
12099
|
+
getAuthorityMeasurement.end({
|
|
11936
12100
|
errorCode: error.errorCode,
|
|
11937
12101
|
subErrorCode: error.subError,
|
|
11938
12102
|
success: false,
|
|
@@ -11959,7 +12123,8 @@
|
|
|
11959
12123
|
redirectUri: redirectUri,
|
|
11960
12124
|
state: state,
|
|
11961
12125
|
nonce: request.nonce || this.browserCrypto.createNewGuid(),
|
|
11962
|
-
responseMode:
|
|
12126
|
+
responseMode: this.config.auth.OIDCOptions
|
|
12127
|
+
.serverResponseType,
|
|
11963
12128
|
};
|
|
11964
12129
|
const account = request.account || this.browserStorage.getActiveAccount();
|
|
11965
12130
|
if (account) {
|
|
@@ -12071,7 +12236,7 @@
|
|
|
12071
12236
|
}
|
|
12072
12237
|
// Acquire token with retrieved code.
|
|
12073
12238
|
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);
|
|
12074
|
-
const tokenResponse = await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse);
|
|
12239
|
+
const tokenResponse = (await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse));
|
|
12075
12240
|
this.browserStorage.cleanRequestByState(state);
|
|
12076
12241
|
return tokenResponse;
|
|
12077
12242
|
}
|
|
@@ -12219,7 +12384,7 @@
|
|
|
12219
12384
|
}
|
|
12220
12385
|
}
|
|
12221
12386
|
// Acquire token with retrieved code.
|
|
12222
|
-
const tokenResponse = await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse);
|
|
12387
|
+
const tokenResponse = (await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse));
|
|
12223
12388
|
this.browserStorage.cleanRequestByState(state);
|
|
12224
12389
|
return tokenResponse;
|
|
12225
12390
|
}
|
|
@@ -12254,7 +12419,7 @@
|
|
|
12254
12419
|
LOGOUT_SUCCESS: "msal:logoutSuccess",
|
|
12255
12420
|
LOGOUT_FAILURE: "msal:logoutFailure",
|
|
12256
12421
|
LOGOUT_END: "msal:logoutEnd",
|
|
12257
|
-
RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache"
|
|
12422
|
+
RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache",
|
|
12258
12423
|
};
|
|
12259
12424
|
|
|
12260
12425
|
/*
|
|
@@ -12367,8 +12532,8 @@
|
|
|
12367
12532
|
const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
12368
12533
|
this.logger.verbose("Silent auth client created");
|
|
12369
12534
|
try {
|
|
12370
|
-
const cachedToken = await silentAuthClient.acquireCachedToken(silentRequest);
|
|
12371
|
-
acquireTokenMeasurement.
|
|
12535
|
+
const cachedToken = (await silentAuthClient.acquireCachedToken(silentRequest));
|
|
12536
|
+
acquireTokenMeasurement.end({
|
|
12372
12537
|
success: true,
|
|
12373
12538
|
fromCache: true,
|
|
12374
12539
|
});
|
|
@@ -12380,7 +12545,7 @@
|
|
|
12380
12545
|
BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
|
|
12381
12546
|
this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
|
|
12382
12547
|
}
|
|
12383
|
-
acquireTokenMeasurement.
|
|
12548
|
+
acquireTokenMeasurement.end({
|
|
12384
12549
|
errorCode: (error instanceof AuthError && error.errorCode) ||
|
|
12385
12550
|
undefined,
|
|
12386
12551
|
subErrorCode: (error instanceof AuthError && error.subError) || undefined,
|
|
@@ -12412,7 +12577,7 @@
|
|
|
12412
12577
|
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12413
12578
|
return {
|
|
12414
12579
|
...request,
|
|
12415
|
-
...await this.initializeBaseRequest(request, account),
|
|
12580
|
+
...(await this.initializeBaseRequest(request, account)),
|
|
12416
12581
|
account: account,
|
|
12417
12582
|
forceRefresh: request.forceRefresh || false,
|
|
12418
12583
|
};
|
|
@@ -12423,6 +12588,10 @@
|
|
|
12423
12588
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12424
12589
|
* Licensed under the MIT License.
|
|
12425
12590
|
*/
|
|
12591
|
+
const BrokerServerParamKeys = {
|
|
12592
|
+
BROKER_CLIENT_ID: "brk_client_id",
|
|
12593
|
+
BROKER_REDIRECT_URI: "brk_redirect_uri",
|
|
12594
|
+
};
|
|
12426
12595
|
class NativeInteractionClient extends BaseInteractionClient {
|
|
12427
12596
|
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
|
|
12428
12597
|
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
|
|
@@ -12446,7 +12615,7 @@
|
|
|
12446
12615
|
// check if the tokens can be retrieved from internal cache
|
|
12447
12616
|
try {
|
|
12448
12617
|
const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
|
|
12449
|
-
nativeATMeasurement.
|
|
12618
|
+
nativeATMeasurement.end({
|
|
12450
12619
|
success: true,
|
|
12451
12620
|
isNativeBroker: false,
|
|
12452
12621
|
fromCache: true,
|
|
@@ -12466,7 +12635,7 @@
|
|
|
12466
12635
|
const validatedResponse = this.validateNativeResponse(response);
|
|
12467
12636
|
return this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)
|
|
12468
12637
|
.then((result) => {
|
|
12469
|
-
nativeATMeasurement.
|
|
12638
|
+
nativeATMeasurement.end({
|
|
12470
12639
|
success: true,
|
|
12471
12640
|
isNativeBroker: true,
|
|
12472
12641
|
requestId: result.requestId,
|
|
@@ -12474,7 +12643,7 @@
|
|
|
12474
12643
|
return result;
|
|
12475
12644
|
})
|
|
12476
12645
|
.catch((error) => {
|
|
12477
|
-
nativeATMeasurement.
|
|
12646
|
+
nativeATMeasurement.end({
|
|
12478
12647
|
success: false,
|
|
12479
12648
|
errorCode: error.errorCode,
|
|
12480
12649
|
subErrorCode: error.subError,
|
|
@@ -12520,7 +12689,10 @@
|
|
|
12520
12689
|
try {
|
|
12521
12690
|
const silentRequest = this.createSilentCacheRequest(request, account);
|
|
12522
12691
|
const result = await this.silentCacheClient.acquireToken(silentRequest);
|
|
12523
|
-
return
|
|
12692
|
+
return {
|
|
12693
|
+
...result,
|
|
12694
|
+
account,
|
|
12695
|
+
};
|
|
12524
12696
|
}
|
|
12525
12697
|
catch (e) {
|
|
12526
12698
|
throw e;
|
|
@@ -12618,16 +12790,20 @@
|
|
|
12618
12790
|
}
|
|
12619
12791
|
// Get the preferred_cache domain for the given authority
|
|
12620
12792
|
const authority = await this.getDiscoveredAuthority(request.authority);
|
|
12621
|
-
const authorityPreferredCache = authority.getPreferredCache();
|
|
12622
12793
|
// generate identifiers
|
|
12623
12794
|
const idTokenObj = this.createIdTokenObj(response);
|
|
12624
12795
|
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenObj);
|
|
12625
|
-
const accountEntity =
|
|
12796
|
+
const accountEntity = AccountEntity.createAccount({
|
|
12797
|
+
homeAccountId: homeAccountIdentifier,
|
|
12798
|
+
idTokenClaims: idTokenObj.claims,
|
|
12799
|
+
clientInfo: response.client_info,
|
|
12800
|
+
nativeAccountId: response.account.id,
|
|
12801
|
+
}, authority);
|
|
12626
12802
|
// generate authenticationResult
|
|
12627
12803
|
const result = await this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp);
|
|
12628
12804
|
// cache accounts and tokens in the appropriate storage
|
|
12629
12805
|
this.cacheAccount(accountEntity);
|
|
12630
|
-
this.cacheNativeTokens(response, request, homeAccountIdentifier,
|
|
12806
|
+
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
12631
12807
|
return result;
|
|
12632
12808
|
}
|
|
12633
12809
|
/**
|
|
@@ -12646,20 +12822,9 @@
|
|
|
12646
12822
|
*/
|
|
12647
12823
|
createHomeAccountIdentifier(response, idTokenObj) {
|
|
12648
12824
|
// Save account in browser storage
|
|
12649
|
-
const homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
|
|
12825
|
+
const homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj.claims);
|
|
12650
12826
|
return homeAccountIdentifier;
|
|
12651
12827
|
}
|
|
12652
|
-
/**
|
|
12653
|
-
* Creates account entity
|
|
12654
|
-
* @param response
|
|
12655
|
-
* @param homeAccountIdentifier
|
|
12656
|
-
* @param idTokenObj
|
|
12657
|
-
* @param authority
|
|
12658
|
-
* @returns
|
|
12659
|
-
*/
|
|
12660
|
-
createAccountEntity(response, homeAccountIdentifier, idTokenObj, authority) {
|
|
12661
|
-
return AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authority, response.account.id);
|
|
12662
|
-
}
|
|
12663
12828
|
/**
|
|
12664
12829
|
* Helper to generate scopes
|
|
12665
12830
|
* @param response
|
|
@@ -12778,7 +12943,7 @@
|
|
|
12778
12943
|
* @param tenantId
|
|
12779
12944
|
* @param reqTimestamp
|
|
12780
12945
|
*/
|
|
12781
|
-
cacheNativeTokens(response, request, homeAccountIdentifier,
|
|
12946
|
+
cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12782
12947
|
const cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12783
12948
|
// cache accessToken in inmemory storage
|
|
12784
12949
|
const expiresIn = request.tokenType === AuthenticationScheme.POP
|
|
@@ -12791,15 +12956,15 @@
|
|
|
12791
12956
|
const cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
|
|
12792
12957
|
? idTokenObj.claims.tid || Constants.EMPTY_STRING
|
|
12793
12958
|
: tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
12794
|
-
const nativeCacheRecord = new CacheRecord(
|
|
12795
|
-
this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
|
|
12959
|
+
const nativeCacheRecord = new CacheRecord(undefined, cachedIdToken, cachedAccessToken);
|
|
12960
|
+
this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, request.storeInCache);
|
|
12796
12961
|
}
|
|
12797
12962
|
addTelemetryFromNativeResponse(response) {
|
|
12798
12963
|
const mats = this.getMATSFromResponse(response);
|
|
12799
12964
|
if (!mats) {
|
|
12800
12965
|
return null;
|
|
12801
12966
|
}
|
|
12802
|
-
this.performanceClient.
|
|
12967
|
+
this.performanceClient.addFields({
|
|
12803
12968
|
extensionId: this.nativeMessageHandler.getExtensionId(),
|
|
12804
12969
|
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
|
12805
12970
|
matsBrokerVersion: mats.broker_version,
|
|
@@ -12918,10 +13083,14 @@
|
|
|
12918
13083
|
extraParameters: {
|
|
12919
13084
|
...request.extraQueryParameters,
|
|
12920
13085
|
...request.tokenQueryParameters,
|
|
12921
|
-
telemetry: NativeConstants.MATS_TELEMETRY,
|
|
12922
13086
|
},
|
|
12923
13087
|
extendedExpiryToken: false, // Make this configurable?
|
|
12924
13088
|
};
|
|
13089
|
+
this.handleExtraBrokerParams(validatedRequest);
|
|
13090
|
+
validatedRequest.extraParameters =
|
|
13091
|
+
validatedRequest.extraParameters || {};
|
|
13092
|
+
validatedRequest.extraParameters.telemetry =
|
|
13093
|
+
NativeConstants.MATS_TELEMETRY;
|
|
12925
13094
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
12926
13095
|
// add POP request type
|
|
12927
13096
|
const shrParameters = {
|
|
@@ -12938,6 +13107,28 @@
|
|
|
12938
13107
|
}
|
|
12939
13108
|
return validatedRequest;
|
|
12940
13109
|
}
|
|
13110
|
+
/**
|
|
13111
|
+
* Handles extra broker request parameters
|
|
13112
|
+
* @param request {NativeTokenRequest}
|
|
13113
|
+
* @private
|
|
13114
|
+
*/
|
|
13115
|
+
handleExtraBrokerParams(request) {
|
|
13116
|
+
if (!request.extraParameters) {
|
|
13117
|
+
return;
|
|
13118
|
+
}
|
|
13119
|
+
if (request.extraParameters.hasOwnProperty(BrokerServerParamKeys.BROKER_CLIENT_ID) &&
|
|
13120
|
+
request.extraParameters.hasOwnProperty(BrokerServerParamKeys.BROKER_REDIRECT_URI) &&
|
|
13121
|
+
request.extraParameters.hasOwnProperty(AADServerParamKeys.CLIENT_ID)) {
|
|
13122
|
+
const child_client_id = request.extraParameters[AADServerParamKeys.CLIENT_ID];
|
|
13123
|
+
const child_redirect_uri = request.redirectUri;
|
|
13124
|
+
const brk_redirect_uri = request.extraParameters[BrokerServerParamKeys.BROKER_REDIRECT_URI];
|
|
13125
|
+
request.extraParameters = {
|
|
13126
|
+
child_client_id,
|
|
13127
|
+
child_redirect_uri,
|
|
13128
|
+
};
|
|
13129
|
+
request.redirectUri = brk_redirect_uri;
|
|
13130
|
+
}
|
|
13131
|
+
}
|
|
12941
13132
|
}
|
|
12942
13133
|
|
|
12943
13134
|
/*
|
|
@@ -13012,7 +13203,7 @@
|
|
|
13012
13203
|
method: NativeExtensionMethod.HandshakeRequest,
|
|
13013
13204
|
},
|
|
13014
13205
|
};
|
|
13015
|
-
this.handshakeEvent.
|
|
13206
|
+
this.handshakeEvent.add({
|
|
13016
13207
|
extensionId: this.extensionId,
|
|
13017
13208
|
extensionHandshakeTimeoutMs: this.handshakeTimeoutMs,
|
|
13018
13209
|
});
|
|
@@ -13030,7 +13221,7 @@
|
|
|
13030
13221
|
window.removeEventListener("message", this.windowListener, false);
|
|
13031
13222
|
this.messageChannel.port1.close();
|
|
13032
13223
|
this.messageChannel.port2.close();
|
|
13033
|
-
this.handshakeEvent.
|
|
13224
|
+
this.handshakeEvent.end({
|
|
13034
13225
|
extensionHandshakeTimedOut: true,
|
|
13035
13226
|
success: false,
|
|
13036
13227
|
});
|
|
@@ -13075,7 +13266,7 @@
|
|
|
13075
13266
|
this.messageChannel.port1.close();
|
|
13076
13267
|
this.messageChannel.port2.close();
|
|
13077
13268
|
window.removeEventListener("message", this.windowListener, false);
|
|
13078
|
-
this.handshakeEvent.
|
|
13269
|
+
this.handshakeEvent.end({
|
|
13079
13270
|
success: false,
|
|
13080
13271
|
extensionInstalled: false,
|
|
13081
13272
|
});
|
|
@@ -13127,7 +13318,7 @@
|
|
|
13127
13318
|
this.extensionId = request.extensionId;
|
|
13128
13319
|
this.extensionVersion = request.body.version;
|
|
13129
13320
|
this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`);
|
|
13130
|
-
this.handshakeEvent.
|
|
13321
|
+
this.handshakeEvent.end({
|
|
13131
13322
|
extensionInstalled: true,
|
|
13132
13323
|
success: true,
|
|
13133
13324
|
});
|
|
@@ -13436,6 +13627,18 @@
|
|
|
13436
13627
|
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);
|
|
13437
13628
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority);
|
|
13438
13629
|
this.logger.verbose("Auth code client created");
|
|
13630
|
+
if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
|
13631
|
+
try {
|
|
13632
|
+
authClient.authority.endSessionEndpoint;
|
|
13633
|
+
}
|
|
13634
|
+
catch {
|
|
13635
|
+
if (validLogoutRequest.account?.homeAccountId) {
|
|
13636
|
+
this.browserStorage.removeAccount(validLogoutRequest.account?.homeAccountId);
|
|
13637
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Redirect, validLogoutRequest);
|
|
13638
|
+
return;
|
|
13639
|
+
}
|
|
13640
|
+
}
|
|
13641
|
+
}
|
|
13439
13642
|
// Create logout string and navigate user window to logout.
|
|
13440
13643
|
const logoutUri = authClient.getLogoutUri(validLogoutRequest);
|
|
13441
13644
|
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Redirect, validLogoutRequest);
|
|
@@ -13610,7 +13813,7 @@
|
|
|
13610
13813
|
this.logger.verbose("Account id found in hash, calling WAM for token");
|
|
13611
13814
|
// end measurement for server call with native brokering enabled
|
|
13612
13815
|
if (fetchNativeAccountIdMeasurement) {
|
|
13613
|
-
fetchNativeAccountIdMeasurement.
|
|
13816
|
+
fetchNativeAccountIdMeasurement.end({
|
|
13614
13817
|
success: true,
|
|
13615
13818
|
isNativeBroker: true,
|
|
13616
13819
|
});
|
|
@@ -13667,6 +13870,30 @@
|
|
|
13667
13870
|
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);
|
|
13668
13871
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);
|
|
13669
13872
|
this.logger.verbose("Auth code client created");
|
|
13873
|
+
try {
|
|
13874
|
+
authClient.authority.endSessionEndpoint;
|
|
13875
|
+
}
|
|
13876
|
+
catch {
|
|
13877
|
+
if (validRequest.account?.homeAccountId &&
|
|
13878
|
+
validRequest.postLogoutRedirectUri &&
|
|
13879
|
+
authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
|
13880
|
+
this.browserStorage.removeAccount(validRequest.account?.homeAccountId);
|
|
13881
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
|
|
13882
|
+
if (mainWindowRedirectUri) {
|
|
13883
|
+
const navigationOptions = {
|
|
13884
|
+
apiId: ApiId.logoutPopup,
|
|
13885
|
+
timeout: this.config.system.redirectNavigationTimeout,
|
|
13886
|
+
noHistory: false,
|
|
13887
|
+
};
|
|
13888
|
+
const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
|
|
13889
|
+
await this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
|
|
13890
|
+
}
|
|
13891
|
+
if (popup) {
|
|
13892
|
+
popup.close();
|
|
13893
|
+
}
|
|
13894
|
+
return;
|
|
13895
|
+
}
|
|
13896
|
+
}
|
|
13670
13897
|
// Create logout string and navigate user window to logout.
|
|
13671
13898
|
const logoutUri = authClient.getLogoutUri(validRequest);
|
|
13672
13899
|
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
|
|
@@ -13751,7 +13978,7 @@
|
|
|
13751
13978
|
return;
|
|
13752
13979
|
}
|
|
13753
13980
|
let href = Constants.EMPTY_STRING;
|
|
13754
|
-
let
|
|
13981
|
+
let serverResponseString = Constants.EMPTY_STRING;
|
|
13755
13982
|
try {
|
|
13756
13983
|
/*
|
|
13757
13984
|
* Will throw if cross origin,
|
|
@@ -13759,7 +13986,8 @@
|
|
|
13759
13986
|
* since we need the interval to keep running while on STS UI.
|
|
13760
13987
|
*/
|
|
13761
13988
|
href = popupWindow.location.href;
|
|
13762
|
-
|
|
13989
|
+
serverResponseString =
|
|
13990
|
+
this.extractServerResponseStringFromPopup(popupWindow, href);
|
|
13763
13991
|
}
|
|
13764
13992
|
catch (e) { }
|
|
13765
13993
|
// Don't process blank pages or cross domain
|
|
@@ -13772,17 +14000,17 @@
|
|
|
13772
14000
|
* as popup operations can take a long time.
|
|
13773
14001
|
*/
|
|
13774
14002
|
ticks++;
|
|
13775
|
-
if (
|
|
14003
|
+
if (serverResponseString) {
|
|
13776
14004
|
this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url");
|
|
13777
14005
|
clearInterval(intervalId);
|
|
13778
14006
|
this.cleanPopup(popupWindow);
|
|
13779
|
-
if (UrlString.hashContainsKnownProperties(
|
|
14007
|
+
if (UrlString.hashContainsKnownProperties(serverResponseString)) {
|
|
13780
14008
|
this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning.");
|
|
13781
|
-
resolve(
|
|
14009
|
+
resolve(serverResponseString);
|
|
13782
14010
|
}
|
|
13783
14011
|
else {
|
|
13784
14012
|
this.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.");
|
|
13785
|
-
this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${
|
|
14013
|
+
this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${serverResponseString}`);
|
|
13786
14014
|
reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());
|
|
13787
14015
|
}
|
|
13788
14016
|
}
|
|
@@ -13963,6 +14191,20 @@
|
|
|
13963
14191
|
const homeAccountId = request.account && request.account.homeAccountId;
|
|
13964
14192
|
return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
|
|
13965
14193
|
}
|
|
14194
|
+
/**
|
|
14195
|
+
* Extracts the server response from the popup window
|
|
14196
|
+
*/
|
|
14197
|
+
extractServerResponseStringFromPopup(popupWindow, href) {
|
|
14198
|
+
let serverResponseString;
|
|
14199
|
+
if (this.config.auth.OIDCOptions?.serverResponseType ===
|
|
14200
|
+
ServerResponseType.QUERY) {
|
|
14201
|
+
serverResponseString = UrlString.parseQueryServerResponse(href);
|
|
14202
|
+
}
|
|
14203
|
+
else {
|
|
14204
|
+
serverResponseString = popupWindow.location.hash;
|
|
14205
|
+
}
|
|
14206
|
+
return serverResponseString;
|
|
14207
|
+
}
|
|
13966
14208
|
}
|
|
13967
14209
|
|
|
13968
14210
|
/*
|
|
@@ -14037,7 +14279,15 @@
|
|
|
14037
14279
|
navigateToLoginRequestUrl: true,
|
|
14038
14280
|
clientCapabilities: [],
|
|
14039
14281
|
protocolMode: ProtocolMode.AAD,
|
|
14040
|
-
|
|
14282
|
+
OIDCOptions: {
|
|
14283
|
+
serverResponseType: ServerResponseType.FRAGMENT,
|
|
14284
|
+
defaultScopes: [
|
|
14285
|
+
Constants.OPENID_SCOPE,
|
|
14286
|
+
Constants.PROFILE_SCOPE,
|
|
14287
|
+
Constants.OFFLINE_ACCESS_SCOPE,
|
|
14288
|
+
],
|
|
14289
|
+
},
|
|
14290
|
+
azureCloudOptions: {
|
|
14041
14291
|
azureCloudInstance: AzureCloudInstance.None,
|
|
14042
14292
|
tenant: Constants.EMPTY_STRING,
|
|
14043
14293
|
},
|
|
@@ -14081,7 +14331,7 @@
|
|
|
14081
14331
|
redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
|
|
14082
14332
|
asyncPopups: false,
|
|
14083
14333
|
allowRedirectInIframe: false,
|
|
14084
|
-
allowNativeBroker:
|
|
14334
|
+
allowNativeBroker: false,
|
|
14085
14335
|
nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout ||
|
|
14086
14336
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
14087
14337
|
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS,
|
|
@@ -14095,9 +14345,33 @@
|
|
|
14095
14345
|
appName: Constants.EMPTY_STRING,
|
|
14096
14346
|
appVersion: Constants.EMPTY_STRING,
|
|
14097
14347
|
},
|
|
14348
|
+
client: new StubPerformanceClient(DEFAULT_AUTH_OPTIONS.clientId, DEFAULT_AUTH_OPTIONS.authority, new Logger(DEFAULT_LOGGER_OPTIONS, name, version), name, version, {
|
|
14349
|
+
appName: Constants.EMPTY_STRING,
|
|
14350
|
+
appVersion: Constants.EMPTY_STRING,
|
|
14351
|
+
}),
|
|
14098
14352
|
};
|
|
14353
|
+
// Throw an error if user has set OIDCOptions without being in OIDC protocol mode
|
|
14354
|
+
if (userInputAuth?.protocolMode !== ProtocolMode.OIDC &&
|
|
14355
|
+
userInputAuth?.OIDCOptions) {
|
|
14356
|
+
// Logger has not been created yet
|
|
14357
|
+
// eslint-disable-next-line no-console
|
|
14358
|
+
console.warn(ClientConfigurationError.createCannotSetOIDCOptionsError());
|
|
14359
|
+
}
|
|
14360
|
+
// Throw an error if user has set allowNativeBroker to true without being in AAD protocol mode
|
|
14361
|
+
if (userInputAuth?.protocolMode &&
|
|
14362
|
+
userInputAuth.protocolMode !== ProtocolMode.AAD &&
|
|
14363
|
+
providedSystemOptions?.allowNativeBroker) {
|
|
14364
|
+
throw ClientConfigurationError.createCannotAllowNativeBrokerError();
|
|
14365
|
+
}
|
|
14099
14366
|
const overlayedConfig = {
|
|
14100
|
-
auth: {
|
|
14367
|
+
auth: {
|
|
14368
|
+
...DEFAULT_AUTH_OPTIONS,
|
|
14369
|
+
...userInputAuth,
|
|
14370
|
+
OIDCOptions: {
|
|
14371
|
+
...DEFAULT_AUTH_OPTIONS.OIDCOptions,
|
|
14372
|
+
...userInputAuth?.OIDCOptions,
|
|
14373
|
+
},
|
|
14374
|
+
},
|
|
14101
14375
|
cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },
|
|
14102
14376
|
system: { ...DEFAULT_BROWSER_SYSTEM_OPTIONS, ...providedSystemOptions },
|
|
14103
14377
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
|
|
@@ -14296,7 +14570,7 @@
|
|
|
14296
14570
|
if (request.prompt &&
|
|
14297
14571
|
request.prompt !== PromptValue.NONE &&
|
|
14298
14572
|
request.prompt !== PromptValue.NO_SESSION) {
|
|
14299
|
-
acquireTokenMeasurement.
|
|
14573
|
+
acquireTokenMeasurement.end({
|
|
14300
14574
|
success: false,
|
|
14301
14575
|
});
|
|
14302
14576
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
@@ -14316,7 +14590,7 @@
|
|
|
14316
14590
|
this.logger.verbose("Auth code client created");
|
|
14317
14591
|
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
14318
14592
|
return await this.silentTokenHelper(authClient, silentRequest).then((result) => {
|
|
14319
|
-
acquireTokenMeasurement.
|
|
14593
|
+
acquireTokenMeasurement.end({
|
|
14320
14594
|
success: true,
|
|
14321
14595
|
fromCache: false,
|
|
14322
14596
|
requestId: result.requestId,
|
|
@@ -14330,7 +14604,7 @@
|
|
|
14330
14604
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
14331
14605
|
}
|
|
14332
14606
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
14333
|
-
acquireTokenMeasurement.
|
|
14607
|
+
acquireTokenMeasurement.end({
|
|
14334
14608
|
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
14335
14609
|
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
14336
14610
|
success: false,
|
|
@@ -14410,7 +14684,7 @@
|
|
|
14410
14684
|
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
14411
14685
|
const silentRequest = {
|
|
14412
14686
|
...request,
|
|
14413
|
-
...await this.initializeBaseRequest(request, request.account)
|
|
14687
|
+
...(await this.initializeBaseRequest(request, request.account)),
|
|
14414
14688
|
};
|
|
14415
14689
|
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
14416
14690
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
@@ -14422,7 +14696,7 @@
|
|
|
14422
14696
|
.acquireTokenByRefreshToken(silentRequest)
|
|
14423
14697
|
.then((result) => result)
|
|
14424
14698
|
.then((result) => {
|
|
14425
|
-
acquireTokenMeasurement.
|
|
14699
|
+
acquireTokenMeasurement.end({
|
|
14426
14700
|
success: true,
|
|
14427
14701
|
fromCache: result.fromCache,
|
|
14428
14702
|
requestId: result.requestId,
|
|
@@ -14432,7 +14706,7 @@
|
|
|
14432
14706
|
.catch((e) => {
|
|
14433
14707
|
e.setCorrelationId(this.correlationId);
|
|
14434
14708
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
14435
|
-
acquireTokenMeasurement.
|
|
14709
|
+
acquireTokenMeasurement.end({
|
|
14436
14710
|
errorCode: e.errorCode,
|
|
14437
14711
|
subErrorCode: e.subError,
|
|
14438
14712
|
success: false,
|
|
@@ -15610,7 +15884,7 @@
|
|
|
15610
15884
|
requestUri: request.resourceRequestUri,
|
|
15611
15885
|
});
|
|
15612
15886
|
if (publicKeyThumbMeasurement) {
|
|
15613
|
-
publicKeyThumbMeasurement.
|
|
15887
|
+
publicKeyThumbMeasurement.end({
|
|
15614
15888
|
success: true,
|
|
15615
15889
|
});
|
|
15616
15890
|
}
|
|
@@ -15666,7 +15940,7 @@
|
|
|
15666
15940
|
const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
15667
15941
|
const signedJwt = `${tokenString}.${encodedSignature}`;
|
|
15668
15942
|
if (signJwtMeasurement) {
|
|
15669
|
-
signJwtMeasurement.
|
|
15943
|
+
signJwtMeasurement.end({
|
|
15670
15944
|
success: true,
|
|
15671
15945
|
});
|
|
15672
15946
|
}
|
|
@@ -15689,231 +15963,16 @@
|
|
|
15689
15963
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15690
15964
|
* Licensed under the MIT License.
|
|
15691
15965
|
*/
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
this.measureName = BrowserPerformanceMeasurement.makeMeasureName(name, correlationId);
|
|
15696
|
-
this.startMark = BrowserPerformanceMeasurement.makeStartMark(name, correlationId);
|
|
15697
|
-
this.endMark = BrowserPerformanceMeasurement.makeEndMark(name, correlationId);
|
|
15698
|
-
}
|
|
15699
|
-
static makeMeasureName(name, correlationId) {
|
|
15700
|
-
return `msal.measure.${name}.${correlationId}`;
|
|
15701
|
-
}
|
|
15702
|
-
static makeStartMark(name, correlationId) {
|
|
15703
|
-
return `msal.start.${name}.${correlationId}`;
|
|
15704
|
-
}
|
|
15705
|
-
static makeEndMark(name, correlationId) {
|
|
15706
|
-
return `msal.end.${name}.${correlationId}`;
|
|
15707
|
-
}
|
|
15708
|
-
static supportsBrowserPerformance() {
|
|
15709
|
-
return (typeof window !== "undefined" &&
|
|
15710
|
-
typeof window.performance !== "undefined" &&
|
|
15711
|
-
typeof window.performance.mark === "function" &&
|
|
15712
|
-
typeof window.performance.measure === "function" &&
|
|
15713
|
-
typeof window.performance.clearMarks === "function" &&
|
|
15714
|
-
typeof window.performance.clearMeasures === "function" &&
|
|
15715
|
-
typeof window.performance.getEntriesByName === "function");
|
|
15716
|
-
}
|
|
15717
|
-
/**
|
|
15718
|
-
* Flush browser marks and measurements.
|
|
15719
|
-
* @param {string} correlationId
|
|
15720
|
-
* @param {SubMeasurement} measurements
|
|
15721
|
-
*/
|
|
15722
|
-
static flushMeasurements(correlationId, measurements) {
|
|
15723
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15724
|
-
try {
|
|
15725
|
-
measurements.forEach((measurement) => {
|
|
15726
|
-
const measureName = BrowserPerformanceMeasurement.makeMeasureName(measurement.name, correlationId);
|
|
15727
|
-
const entriesForMeasurement = window.performance.getEntriesByName(measureName, "measure");
|
|
15728
|
-
if (entriesForMeasurement.length > 0) {
|
|
15729
|
-
window.performance.clearMeasures(measureName);
|
|
15730
|
-
window.performance.clearMarks(BrowserPerformanceMeasurement.makeStartMark(measureName, correlationId));
|
|
15731
|
-
window.performance.clearMarks(BrowserPerformanceMeasurement.makeEndMark(measureName, correlationId));
|
|
15732
|
-
}
|
|
15733
|
-
});
|
|
15734
|
-
}
|
|
15735
|
-
catch (e) {
|
|
15736
|
-
// Silently catch and return null
|
|
15737
|
-
}
|
|
15738
|
-
}
|
|
15739
|
-
}
|
|
15740
|
-
startMeasurement() {
|
|
15741
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15742
|
-
try {
|
|
15743
|
-
window.performance.mark(this.startMark);
|
|
15744
|
-
}
|
|
15745
|
-
catch (e) {
|
|
15746
|
-
// Silently catch
|
|
15747
|
-
}
|
|
15748
|
-
}
|
|
15749
|
-
}
|
|
15750
|
-
endMeasurement() {
|
|
15751
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15752
|
-
try {
|
|
15753
|
-
window.performance.mark(this.endMark);
|
|
15754
|
-
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
15755
|
-
}
|
|
15756
|
-
catch (e) {
|
|
15757
|
-
// Silently catch
|
|
15758
|
-
}
|
|
15759
|
-
}
|
|
15760
|
-
}
|
|
15761
|
-
flushMeasurement() {
|
|
15762
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15763
|
-
try {
|
|
15764
|
-
const entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
15765
|
-
if (entriesForMeasurement.length > 0) {
|
|
15766
|
-
const durationMs = entriesForMeasurement[0].duration;
|
|
15767
|
-
window.performance.clearMeasures(this.measureName);
|
|
15768
|
-
window.performance.clearMarks(this.startMark);
|
|
15769
|
-
window.performance.clearMarks(this.endMark);
|
|
15770
|
-
return durationMs;
|
|
15771
|
-
}
|
|
15772
|
-
}
|
|
15773
|
-
catch (e) {
|
|
15774
|
-
// Silently catch and return null
|
|
15775
|
-
}
|
|
15776
|
-
}
|
|
15777
|
-
return null;
|
|
15778
|
-
}
|
|
15779
|
-
}
|
|
15780
|
-
|
|
15781
|
-
/*
|
|
15782
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15783
|
-
* Licensed under the MIT License.
|
|
15784
|
-
*/
|
|
15785
|
-
class BrowserPerformanceClient extends PerformanceClient {
|
|
15786
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
15787
|
-
super(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry);
|
|
15788
|
-
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
15789
|
-
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
15790
|
-
}
|
|
15791
|
-
startPerformanceMeasurement(measureName, correlationId) {
|
|
15792
|
-
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
15793
|
-
}
|
|
15794
|
-
generateId() {
|
|
15795
|
-
return this.guidGenerator.generateGuid();
|
|
15796
|
-
}
|
|
15797
|
-
getPageVisibility() {
|
|
15798
|
-
return document.visibilityState?.toString() || null;
|
|
15799
|
-
}
|
|
15800
|
-
deleteIncompleteSubMeasurements(inProgressEvent) {
|
|
15801
|
-
const rootEvent = this.eventsByCorrelationId.get(inProgressEvent.event.correlationId);
|
|
15802
|
-
const isRootEvent = rootEvent && rootEvent.eventId === inProgressEvent.event.eventId;
|
|
15803
|
-
const incompleteMeasurements = [];
|
|
15804
|
-
if (isRootEvent && rootEvent?.incompleteSubMeasurements) {
|
|
15805
|
-
rootEvent.incompleteSubMeasurements.forEach((subMeasurement) => {
|
|
15806
|
-
incompleteMeasurements.push({ ...subMeasurement });
|
|
15807
|
-
});
|
|
15808
|
-
}
|
|
15809
|
-
// Clean up remaining marks for incomplete sub-measurements
|
|
15810
|
-
if (incompleteMeasurements.length > 0) {
|
|
15811
|
-
BrowserPerformanceMeasurement.flushMeasurements(inProgressEvent.event.correlationId, incompleteMeasurements);
|
|
15812
|
-
}
|
|
15813
|
-
}
|
|
15814
|
-
supportsBrowserPerformanceNow() {
|
|
15815
|
-
return (typeof window !== "undefined" &&
|
|
15816
|
-
typeof window.performance !== "undefined" &&
|
|
15817
|
-
typeof window.performance.now === "function");
|
|
15818
|
-
}
|
|
15819
|
-
/**
|
|
15820
|
-
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
15821
|
-
* Also captures browser page visibilityState.
|
|
15822
|
-
*
|
|
15823
|
-
* @param {PerformanceEvents} measureName
|
|
15824
|
-
* @param {?string} [correlationId]
|
|
15825
|
-
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
15826
|
-
*/
|
|
15827
|
-
startMeasurement(measureName, correlationId) {
|
|
15828
|
-
// Capture page visibilityState and then invoke start/end measurement
|
|
15829
|
-
const startPageVisibility = this.getPageVisibility();
|
|
15830
|
-
const inProgressEvent = super.startMeasurement(measureName, correlationId);
|
|
15831
|
-
return {
|
|
15832
|
-
...inProgressEvent,
|
|
15833
|
-
endMeasurement: (event) => {
|
|
15834
|
-
const res = inProgressEvent.endMeasurement({
|
|
15835
|
-
startPageVisibility,
|
|
15836
|
-
endPageVisibility: this.getPageVisibility(),
|
|
15837
|
-
...event,
|
|
15838
|
-
});
|
|
15839
|
-
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
15840
|
-
return res;
|
|
15841
|
-
},
|
|
15842
|
-
discardMeasurement: () => {
|
|
15843
|
-
inProgressEvent.discardMeasurement();
|
|
15844
|
-
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
15845
|
-
inProgressEvent.measurement.flushMeasurement();
|
|
15846
|
-
},
|
|
15847
|
-
};
|
|
15848
|
-
}
|
|
15849
|
-
/**
|
|
15850
|
-
* Adds pre-queue time to preQueueTimeByCorrelationId map.
|
|
15851
|
-
* @param {PerformanceEvents} eventName
|
|
15852
|
-
* @param {?string} correlationId
|
|
15853
|
-
* @returns
|
|
15854
|
-
*/
|
|
15855
|
-
setPreQueueTime(eventName, correlationId) {
|
|
15856
|
-
if (!this.supportsBrowserPerformanceNow()) {
|
|
15857
|
-
this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for ${eventName}`);
|
|
15858
|
-
return;
|
|
15859
|
-
}
|
|
15860
|
-
if (!correlationId) {
|
|
15861
|
-
this.logger.trace(`BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to set telemetry queue time`);
|
|
15862
|
-
return;
|
|
15863
|
-
}
|
|
15864
|
-
const preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
15865
|
-
/**
|
|
15866
|
-
* Manually complete queue measurement if there is an incomplete pre-queue event.
|
|
15867
|
-
* Incomplete pre-queue events are instrumentation bugs that should be fixed.
|
|
15868
|
-
*/
|
|
15869
|
-
if (preQueueEvent) {
|
|
15870
|
-
this.logger.trace(`BrowserPerformanceClient: Incomplete pre-queue ${preQueueEvent.name} found`, correlationId);
|
|
15871
|
-
this.addQueueMeasurement(preQueueEvent.name, correlationId, undefined, true);
|
|
15872
|
-
}
|
|
15873
|
-
this.preQueueTimeByCorrelationId.set(correlationId, {
|
|
15874
|
-
name: eventName,
|
|
15875
|
-
time: window.performance.now(),
|
|
15876
|
-
});
|
|
15877
|
-
}
|
|
15878
|
-
/**
|
|
15879
|
-
* Calculates and adds queue time measurement for given performance event.
|
|
15880
|
-
*
|
|
15881
|
-
* @param {PerformanceEvents} eventName
|
|
15882
|
-
* @param {?string} correlationId
|
|
15883
|
-
* @param {?number} queueTime
|
|
15884
|
-
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
|
|
15885
|
-
* @returns
|
|
15886
|
-
*/
|
|
15887
|
-
addQueueMeasurement(eventName, correlationId, queueTime, manuallyCompleted) {
|
|
15888
|
-
if (!this.supportsBrowserPerformanceNow()) {
|
|
15889
|
-
this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to add queue measurement for ${eventName}`);
|
|
15890
|
-
return;
|
|
15891
|
-
}
|
|
15892
|
-
if (!correlationId) {
|
|
15893
|
-
this.logger.trace(`BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to add queue measurement`);
|
|
15894
|
-
return;
|
|
15895
|
-
}
|
|
15896
|
-
const preQueueTime = super.getPreQueueTime(eventName, correlationId);
|
|
15897
|
-
if (!preQueueTime) {
|
|
15898
|
-
return;
|
|
15899
|
-
}
|
|
15900
|
-
const currentTime = window.performance.now();
|
|
15901
|
-
const resQueueTime = queueTime || super.calculateQueuedTime(preQueueTime, currentTime);
|
|
15902
|
-
return super.addQueueMeasurement(eventName, correlationId, resQueueTime, manuallyCompleted);
|
|
15903
|
-
}
|
|
15904
|
-
}
|
|
15905
|
-
|
|
15906
|
-
/*
|
|
15907
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15908
|
-
* Licensed under the MIT License.
|
|
15966
|
+
/**
|
|
15967
|
+
* Warning: This set of exports is purely intended to be used by other MSAL libraries, and should be considered potentially unstable. We strongly discourage using them directly, you do so at your own risk.
|
|
15968
|
+
* Breaking changes to these APIs will be shipped under a minor version, instead of a major version.
|
|
15909
15969
|
*/
|
|
15970
|
+
// Cache Manager
|
|
15910
15971
|
|
|
15911
15972
|
var internals = /*#__PURE__*/Object.freeze({
|
|
15912
15973
|
__proto__: null,
|
|
15913
15974
|
BrowserCacheManager: BrowserCacheManager,
|
|
15914
15975
|
BrowserConstants: BrowserConstants,
|
|
15915
|
-
BrowserPerformanceClient: BrowserPerformanceClient,
|
|
15916
|
-
BrowserPerformanceMeasurement: BrowserPerformanceMeasurement,
|
|
15917
15976
|
CacheRecord: CacheRecord,
|
|
15918
15977
|
CryptoOps: CryptoOps,
|
|
15919
15978
|
EventHandler: EventHandler,
|
|
@@ -16131,8 +16190,9 @@
|
|
|
16131
16190
|
const idToken = new AuthToken(response.id_token, this.cryptoObj);
|
|
16132
16191
|
let cacheRecord;
|
|
16133
16192
|
let authority;
|
|
16193
|
+
let cacheRecordAccount;
|
|
16134
16194
|
if (request.account) {
|
|
16135
|
-
|
|
16195
|
+
cacheRecordAccount = AccountEntity.createFromAccountInfo(request.account);
|
|
16136
16196
|
cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment));
|
|
16137
16197
|
}
|
|
16138
16198
|
else if (request.authority) {
|
|
@@ -16148,12 +16208,12 @@
|
|
|
16148
16208
|
// "clientInfo" from options takes precedence over "clientInfo" in response
|
|
16149
16209
|
if (options.clientInfo) {
|
|
16150
16210
|
this.logger.trace("TokenCache - homeAccountId from options");
|
|
16151
|
-
|
|
16211
|
+
cacheRecordAccount = this.loadAccount(idToken, authority, options.clientInfo);
|
|
16152
16212
|
cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
|
|
16153
16213
|
}
|
|
16154
16214
|
else if (response.client_info) {
|
|
16155
16215
|
this.logger.trace("TokenCache - homeAccountId from response");
|
|
16156
|
-
|
|
16216
|
+
cacheRecordAccount = this.loadAccount(idToken, authority, response.client_info);
|
|
16157
16217
|
cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));
|
|
16158
16218
|
}
|
|
16159
16219
|
else {
|
|
@@ -16163,7 +16223,7 @@
|
|
|
16163
16223
|
else {
|
|
16164
16224
|
throw BrowserAuthError.createUnableToLoadTokenError("Please provide a request with an account or a request with authority.");
|
|
16165
16225
|
}
|
|
16166
|
-
return this.generateAuthenticationResult(request, idToken, cacheRecord, authority);
|
|
16226
|
+
return this.generateAuthenticationResult(request, idToken, cacheRecord, cacheRecordAccount, authority);
|
|
16167
16227
|
}
|
|
16168
16228
|
/**
|
|
16169
16229
|
* Helper function to load account to msal-browser cache
|
|
@@ -16174,20 +16234,23 @@
|
|
|
16174
16234
|
* @param requestHomeAccountId
|
|
16175
16235
|
* @returns `AccountEntity`
|
|
16176
16236
|
*/
|
|
16177
|
-
loadAccount(idToken,
|
|
16237
|
+
loadAccount(idToken, authority, clientInfo, requestHomeAccountId) {
|
|
16178
16238
|
let homeAccountId;
|
|
16179
16239
|
if (requestHomeAccountId) {
|
|
16180
16240
|
homeAccountId = requestHomeAccountId;
|
|
16181
16241
|
}
|
|
16182
|
-
else if (authorityType !== undefined && clientInfo) {
|
|
16183
|
-
homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authorityType, this.logger, this.cryptoObj, idToken);
|
|
16242
|
+
else if (authority.authorityType !== undefined && clientInfo) {
|
|
16243
|
+
homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authority.authorityType, this.logger, this.cryptoObj, idToken.claims);
|
|
16184
16244
|
}
|
|
16185
16245
|
if (!homeAccountId) {
|
|
16186
16246
|
throw BrowserAuthError.createUnableToLoadTokenError("Unexpected missing homeAccountId");
|
|
16187
16247
|
}
|
|
16188
|
-
const accountEntity =
|
|
16189
|
-
|
|
16190
|
-
:
|
|
16248
|
+
const accountEntity = AccountEntity.createAccount({
|
|
16249
|
+
homeAccountId,
|
|
16250
|
+
idTokenClaims: idToken.claims,
|
|
16251
|
+
clientInfo,
|
|
16252
|
+
environment: authority.hostnameAndPort,
|
|
16253
|
+
}, authority);
|
|
16191
16254
|
if (this.isBrowserEnvironment) {
|
|
16192
16255
|
this.logger.verbose("TokenCache - loading account");
|
|
16193
16256
|
this.storage.setAccount(accountEntity);
|
|
@@ -16281,7 +16344,7 @@
|
|
|
16281
16344
|
* @param authority
|
|
16282
16345
|
* @returns `AuthenticationResult`
|
|
16283
16346
|
*/
|
|
16284
|
-
generateAuthenticationResult(request, idTokenObj, cacheRecord, authority) {
|
|
16347
|
+
generateAuthenticationResult(request, idTokenObj, cacheRecord, accountEntity, authority) {
|
|
16285
16348
|
let accessToken = Constants.EMPTY_STRING;
|
|
16286
16349
|
let responseScopes = [];
|
|
16287
16350
|
let expiresOn = null;
|
|
@@ -16303,7 +16366,7 @@
|
|
|
16303
16366
|
uniqueId: uid,
|
|
16304
16367
|
tenantId: tid,
|
|
16305
16368
|
scopes: responseScopes,
|
|
16306
|
-
account:
|
|
16369
|
+
account: accountEntity.getAccountInfo(),
|
|
16307
16370
|
idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,
|
|
16308
16371
|
idTokenClaims: idTokenObj ? idTokenObj.claims : {},
|
|
16309
16372
|
accessToken: accessToken,
|
|
@@ -16315,9 +16378,8 @@
|
|
|
16315
16378
|
familyId: Constants.EMPTY_STRING,
|
|
16316
16379
|
tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,
|
|
16317
16380
|
state: Constants.EMPTY_STRING,
|
|
16318
|
-
cloudGraphHostName:
|
|
16319
|
-
|
|
16320
|
-
msGraphHost: cacheRecord?.account?.msGraphHost || Constants.EMPTY_STRING,
|
|
16381
|
+
cloudGraphHostName: accountEntity.cloudGraphHostName || Constants.EMPTY_STRING,
|
|
16382
|
+
msGraphHost: accountEntity.msGraphHost || Constants.EMPTY_STRING,
|
|
16321
16383
|
code: undefined,
|
|
16322
16384
|
fromNativeBroker: false,
|
|
16323
16385
|
};
|
|
@@ -16443,9 +16505,7 @@
|
|
|
16443
16505
|
// Initial hybrid spa map
|
|
16444
16506
|
this.hybridAuthCodeResponses = new Map();
|
|
16445
16507
|
// Initialize performance client
|
|
16446
|
-
this.performanceClient = this.
|
|
16447
|
-
? new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application)
|
|
16448
|
-
: new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
16508
|
+
this.performanceClient = this.config.telemetry.client;
|
|
16449
16509
|
// Initialize the crypto class.
|
|
16450
16510
|
this.browserCrypto = this.isBrowserEnvironment
|
|
16451
16511
|
? new CryptoOps(this.logger, this.performanceClient)
|
|
@@ -16511,7 +16571,7 @@
|
|
|
16511
16571
|
}
|
|
16512
16572
|
this.initialized = true;
|
|
16513
16573
|
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16514
|
-
initMeasurement.
|
|
16574
|
+
initMeasurement.end({ allowNativeBroker, success: true });
|
|
16515
16575
|
}
|
|
16516
16576
|
// #region Redirect Flow
|
|
16517
16577
|
/**
|
|
@@ -16523,8 +16583,14 @@
|
|
|
16523
16583
|
*/
|
|
16524
16584
|
async handleRedirectPromise(hash) {
|
|
16525
16585
|
this.logger.verbose("handleRedirectPromise called");
|
|
16526
|
-
// Block token acquisition before initialize has been called
|
|
16527
|
-
BrowserUtils.
|
|
16586
|
+
// Block token acquisition before initialize has been called
|
|
16587
|
+
BrowserUtils.blockAPICallsBeforeInitialize(this.initialized);
|
|
16588
|
+
let foundServerResponse = hash;
|
|
16589
|
+
if (this.config.auth.OIDCOptions?.serverResponseType ===
|
|
16590
|
+
ServerResponseType.QUERY) {
|
|
16591
|
+
const url = window.location.href;
|
|
16592
|
+
foundServerResponse = UrlString.parseQueryServerResponse(url);
|
|
16593
|
+
}
|
|
16528
16594
|
const loggedInAccounts = this.getAllAccounts();
|
|
16529
16595
|
if (this.isBrowserEnvironment) {
|
|
16530
16596
|
/**
|
|
@@ -16532,7 +16598,7 @@
|
|
|
16532
16598
|
* otherwise return the promise from the first invocation. Prevents race conditions when handleRedirectPromise is called
|
|
16533
16599
|
* several times concurrently.
|
|
16534
16600
|
*/
|
|
16535
|
-
const redirectResponseKey =
|
|
16601
|
+
const redirectResponseKey = foundServerResponse || Constants.EMPTY_STRING;
|
|
16536
16602
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
16537
16603
|
if (typeof response === "undefined") {
|
|
16538
16604
|
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
@@ -16542,7 +16608,7 @@
|
|
|
16542
16608
|
if (request &&
|
|
16543
16609
|
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
16544
16610
|
this.nativeExtensionProvider &&
|
|
16545
|
-
!
|
|
16611
|
+
!foundServerResponse) {
|
|
16546
16612
|
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
16547
16613
|
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);
|
|
16548
16614
|
redirectResponse = nativeClient.handleRedirectPromise();
|
|
@@ -16552,7 +16618,7 @@
|
|
|
16552
16618
|
const correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
|
|
16553
16619
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
16554
16620
|
redirectResponse =
|
|
16555
|
-
redirectClient.handleRedirectPromise(
|
|
16621
|
+
redirectClient.handleRedirectPromise(foundServerResponse);
|
|
16556
16622
|
}
|
|
16557
16623
|
response = redirectResponse
|
|
16558
16624
|
.then((result) => {
|
|
@@ -16683,7 +16749,7 @@
|
|
|
16683
16749
|
result = this.acquireTokenNative(request, ApiId.acquireTokenPopup)
|
|
16684
16750
|
.then((response) => {
|
|
16685
16751
|
this.browserStorage.setInteractionInProgress(false);
|
|
16686
|
-
atPopupMeasurement.
|
|
16752
|
+
atPopupMeasurement.end({
|
|
16687
16753
|
success: true,
|
|
16688
16754
|
isNativeBroker: true,
|
|
16689
16755
|
requestId: response.requestId,
|
|
@@ -16721,11 +16787,11 @@
|
|
|
16721
16787
|
else {
|
|
16722
16788
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
|
|
16723
16789
|
}
|
|
16724
|
-
atPopupMeasurement.
|
|
16790
|
+
atPopupMeasurement.add({
|
|
16725
16791
|
accessTokenSize: result.accessToken.length,
|
|
16726
16792
|
idTokenSize: result.idToken.length,
|
|
16727
16793
|
});
|
|
16728
|
-
atPopupMeasurement.
|
|
16794
|
+
atPopupMeasurement.end({
|
|
16729
16795
|
success: true,
|
|
16730
16796
|
requestId: result.requestId,
|
|
16731
16797
|
});
|
|
@@ -16738,7 +16804,7 @@
|
|
|
16738
16804
|
else {
|
|
16739
16805
|
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
16740
16806
|
}
|
|
16741
|
-
atPopupMeasurement.
|
|
16807
|
+
atPopupMeasurement.end({
|
|
16742
16808
|
errorCode: e.errorCode,
|
|
16743
16809
|
subErrorCode: e.subError,
|
|
16744
16810
|
success: false,
|
|
@@ -16810,11 +16876,11 @@
|
|
|
16810
16876
|
return result
|
|
16811
16877
|
.then((response) => {
|
|
16812
16878
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
16813
|
-
this.ssoSilentMeasurement?.
|
|
16879
|
+
this.ssoSilentMeasurement?.add({
|
|
16814
16880
|
accessTokenSize: response.accessToken.length,
|
|
16815
16881
|
idTokenSize: response.idToken.length,
|
|
16816
16882
|
});
|
|
16817
|
-
this.ssoSilentMeasurement?.
|
|
16883
|
+
this.ssoSilentMeasurement?.end({
|
|
16818
16884
|
success: true,
|
|
16819
16885
|
isNativeBroker: response.fromNativeBroker,
|
|
16820
16886
|
requestId: response.requestId,
|
|
@@ -16823,7 +16889,7 @@
|
|
|
16823
16889
|
})
|
|
16824
16890
|
.catch((e) => {
|
|
16825
16891
|
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
16826
|
-
this.ssoSilentMeasurement?.
|
|
16892
|
+
this.ssoSilentMeasurement?.end({
|
|
16827
16893
|
errorCode: e.errorCode,
|
|
16828
16894
|
subErrorCode: e.subError,
|
|
16829
16895
|
success: false,
|
|
@@ -16867,11 +16933,11 @@
|
|
|
16867
16933
|
.then((result) => {
|
|
16868
16934
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
16869
16935
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
16870
|
-
atbcMeasurement.
|
|
16936
|
+
atbcMeasurement.add({
|
|
16871
16937
|
accessTokenSize: result.accessToken.length,
|
|
16872
16938
|
idTokenSize: result.idToken.length,
|
|
16873
16939
|
});
|
|
16874
|
-
atbcMeasurement.
|
|
16940
|
+
atbcMeasurement.end({
|
|
16875
16941
|
success: true,
|
|
16876
16942
|
isNativeBroker: result.fromNativeBroker,
|
|
16877
16943
|
requestId: result.requestId,
|
|
@@ -16881,7 +16947,7 @@
|
|
|
16881
16947
|
.catch((error) => {
|
|
16882
16948
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
16883
16949
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
16884
|
-
atbcMeasurement.
|
|
16950
|
+
atbcMeasurement.end({
|
|
16885
16951
|
errorCode: error.errorCode,
|
|
16886
16952
|
subErrorCode: error.subError,
|
|
16887
16953
|
success: false,
|
|
@@ -16892,7 +16958,7 @@
|
|
|
16892
16958
|
}
|
|
16893
16959
|
else {
|
|
16894
16960
|
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
|
|
16895
|
-
atbcMeasurement.
|
|
16961
|
+
atbcMeasurement.discard();
|
|
16896
16962
|
}
|
|
16897
16963
|
return response;
|
|
16898
16964
|
}
|
|
@@ -16916,7 +16982,7 @@
|
|
|
16916
16982
|
}
|
|
16917
16983
|
catch (e) {
|
|
16918
16984
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
16919
|
-
atbcMeasurement.
|
|
16985
|
+
atbcMeasurement.end({
|
|
16920
16986
|
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
16921
16987
|
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
16922
16988
|
success: false,
|
|
@@ -16941,7 +17007,7 @@
|
|
|
16941
17007
|
const silentTokenResult = await silentAuthCodeClient
|
|
16942
17008
|
.acquireToken(request)
|
|
16943
17009
|
.then((response) => {
|
|
16944
|
-
this.acquireTokenByCodeAsyncMeasurement?.
|
|
17010
|
+
this.acquireTokenByCodeAsyncMeasurement?.end({
|
|
16945
17011
|
success: true,
|
|
16946
17012
|
fromCache: response.fromCache,
|
|
16947
17013
|
isNativeBroker: response.fromNativeBroker,
|
|
@@ -16950,7 +17016,7 @@
|
|
|
16950
17016
|
return response;
|
|
16951
17017
|
})
|
|
16952
17018
|
.catch((tokenRenewalError) => {
|
|
16953
|
-
this.acquireTokenByCodeAsyncMeasurement?.
|
|
17019
|
+
this.acquireTokenByCodeAsyncMeasurement?.end({
|
|
16954
17020
|
errorCode: tokenRenewalError.errorCode,
|
|
16955
17021
|
subErrorCode: tokenRenewalError.subError,
|
|
16956
17022
|
success: false,
|
|
@@ -17160,6 +17226,26 @@
|
|
|
17160
17226
|
return this.browserStorage.getActiveAccount();
|
|
17161
17227
|
}
|
|
17162
17228
|
// #endregion
|
|
17229
|
+
/**
|
|
17230
|
+
* Hydrates the cache with the tokens from an AuthenticationResult
|
|
17231
|
+
* @param result
|
|
17232
|
+
* @param request
|
|
17233
|
+
* @returns
|
|
17234
|
+
*/
|
|
17235
|
+
async hydrateCache(result, request) {
|
|
17236
|
+
this.logger.verbose("hydrateCache called");
|
|
17237
|
+
// Account gets saved to browser storage regardless of native or not
|
|
17238
|
+
const accountEntity = AccountEntity.createFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
17239
|
+
this.browserStorage.setAccount(accountEntity);
|
|
17240
|
+
if (result.fromNativeBroker) {
|
|
17241
|
+
this.logger.verbose("Response was from native broker, storing in-memory");
|
|
17242
|
+
// Tokens from native broker are stored in-memory
|
|
17243
|
+
return this.nativeInternalStorage.hydrateCache(result, request);
|
|
17244
|
+
}
|
|
17245
|
+
else {
|
|
17246
|
+
return this.browserStorage.hydrateCache(result, request);
|
|
17247
|
+
}
|
|
17248
|
+
}
|
|
17163
17249
|
// #region Helpers
|
|
17164
17250
|
/**
|
|
17165
17251
|
* Helper to validate app environment before making an auth request
|
|
@@ -17178,13 +17264,8 @@
|
|
|
17178
17264
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
17179
17265
|
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
17180
17266
|
BrowserUtils.blockAcquireTokenInPopups();
|
|
17181
|
-
|
|
17182
|
-
|
|
17183
|
-
* Skip check if application is embedded.
|
|
17184
|
-
*/
|
|
17185
|
-
if (!isAppEmbedded) {
|
|
17186
|
-
BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);
|
|
17187
|
-
}
|
|
17267
|
+
// Block token acquisition before initialize has been called
|
|
17268
|
+
BrowserUtils.blockAPICallsBeforeInitialize(this.initialized);
|
|
17188
17269
|
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
17189
17270
|
if (interactionType === exports.InteractionType.Redirect &&
|
|
17190
17271
|
this.config.cache.cacheLocation ===
|
|
@@ -17510,7 +17591,7 @@
|
|
|
17510
17591
|
async acquireTokenSilent(request) {
|
|
17511
17592
|
const correlationId = this.getRequestCorrelationId(request);
|
|
17512
17593
|
const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
17513
|
-
atsMeasurement.
|
|
17594
|
+
atsMeasurement.add({
|
|
17514
17595
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
17515
17596
|
});
|
|
17516
17597
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
@@ -17542,11 +17623,11 @@
|
|
|
17542
17623
|
}, account)
|
|
17543
17624
|
.then((result) => {
|
|
17544
17625
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
17545
|
-
atsMeasurement.
|
|
17626
|
+
atsMeasurement.add({
|
|
17546
17627
|
accessTokenSize: result.accessToken.length,
|
|
17547
17628
|
idTokenSize: result.idToken.length,
|
|
17548
17629
|
});
|
|
17549
|
-
atsMeasurement.
|
|
17630
|
+
atsMeasurement.end({
|
|
17550
17631
|
success: true,
|
|
17551
17632
|
fromCache: result.fromCache,
|
|
17552
17633
|
isNativeBroker: result.fromNativeBroker,
|
|
@@ -17557,7 +17638,7 @@
|
|
|
17557
17638
|
})
|
|
17558
17639
|
.catch((error) => {
|
|
17559
17640
|
this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
17560
|
-
atsMeasurement.
|
|
17641
|
+
atsMeasurement.end({
|
|
17561
17642
|
errorCode: error.errorCode,
|
|
17562
17643
|
subErrorCode: error.subError,
|
|
17563
17644
|
success: false,
|
|
@@ -17570,7 +17651,7 @@
|
|
|
17570
17651
|
else {
|
|
17571
17652
|
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
|
|
17572
17653
|
// Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics
|
|
17573
|
-
atsMeasurement.
|
|
17654
|
+
atsMeasurement.discard();
|
|
17574
17655
|
return cachedResponse;
|
|
17575
17656
|
}
|
|
17576
17657
|
}
|
|
@@ -17654,7 +17735,7 @@
|
|
|
17654
17735
|
return result
|
|
17655
17736
|
.then((response) => {
|
|
17656
17737
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
17657
|
-
this.atsAsyncMeasurement?.
|
|
17738
|
+
this.atsAsyncMeasurement?.end({
|
|
17658
17739
|
success: true,
|
|
17659
17740
|
fromCache: response.fromCache,
|
|
17660
17741
|
isNativeBroker: response.fromNativeBroker,
|
|
@@ -17664,7 +17745,7 @@
|
|
|
17664
17745
|
})
|
|
17665
17746
|
.catch((tokenRenewalError) => {
|
|
17666
17747
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
17667
|
-
this.atsAsyncMeasurement?.
|
|
17748
|
+
this.atsAsyncMeasurement?.end({
|
|
17668
17749
|
errorCode: tokenRenewalError.errorCode,
|
|
17669
17750
|
subErrorCode: tokenRenewalError.subError,
|
|
17670
17751
|
success: false,
|
|
@@ -17988,6 +18069,15 @@
|
|
|
17988
18069
|
getConfiguration() {
|
|
17989
18070
|
return this.controller.getConfiguration();
|
|
17990
18071
|
}
|
|
18072
|
+
/**
|
|
18073
|
+
* Hydrates cache with the tokens and account in the AuthenticationResult object
|
|
18074
|
+
* @param result
|
|
18075
|
+
* @param request - The request object that was used to obtain the AuthenticationResult
|
|
18076
|
+
* @returns
|
|
18077
|
+
*/
|
|
18078
|
+
async hydrateCache(result, request) {
|
|
18079
|
+
return this.controller.hydrateCache(result, request);
|
|
18080
|
+
}
|
|
17991
18081
|
}
|
|
17992
18082
|
|
|
17993
18083
|
/*
|
|
@@ -18085,6 +18175,9 @@
|
|
|
18085
18175
|
getConfiguration: () => {
|
|
18086
18176
|
throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();
|
|
18087
18177
|
},
|
|
18178
|
+
hydrateCache: () => {
|
|
18179
|
+
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
|
|
18180
|
+
},
|
|
18088
18181
|
};
|
|
18089
18182
|
|
|
18090
18183
|
/*
|
|
@@ -18196,6 +18289,227 @@
|
|
|
18196
18289
|
}
|
|
18197
18290
|
}
|
|
18198
18291
|
|
|
18292
|
+
/*
|
|
18293
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18294
|
+
* Licensed under the MIT License.
|
|
18295
|
+
*/
|
|
18296
|
+
class BrowserPerformanceMeasurement {
|
|
18297
|
+
constructor(name, correlationId) {
|
|
18298
|
+
this.correlationId = correlationId;
|
|
18299
|
+
this.measureName = BrowserPerformanceMeasurement.makeMeasureName(name, correlationId);
|
|
18300
|
+
this.startMark = BrowserPerformanceMeasurement.makeStartMark(name, correlationId);
|
|
18301
|
+
this.endMark = BrowserPerformanceMeasurement.makeEndMark(name, correlationId);
|
|
18302
|
+
}
|
|
18303
|
+
static makeMeasureName(name, correlationId) {
|
|
18304
|
+
return `msal.measure.${name}.${correlationId}`;
|
|
18305
|
+
}
|
|
18306
|
+
static makeStartMark(name, correlationId) {
|
|
18307
|
+
return `msal.start.${name}.${correlationId}`;
|
|
18308
|
+
}
|
|
18309
|
+
static makeEndMark(name, correlationId) {
|
|
18310
|
+
return `msal.end.${name}.${correlationId}`;
|
|
18311
|
+
}
|
|
18312
|
+
static supportsBrowserPerformance() {
|
|
18313
|
+
return (typeof window !== "undefined" &&
|
|
18314
|
+
typeof window.performance !== "undefined" &&
|
|
18315
|
+
typeof window.performance.mark === "function" &&
|
|
18316
|
+
typeof window.performance.measure === "function" &&
|
|
18317
|
+
typeof window.performance.clearMarks === "function" &&
|
|
18318
|
+
typeof window.performance.clearMeasures === "function" &&
|
|
18319
|
+
typeof window.performance.getEntriesByName === "function");
|
|
18320
|
+
}
|
|
18321
|
+
/**
|
|
18322
|
+
* Flush browser marks and measurements.
|
|
18323
|
+
* @param {string} correlationId
|
|
18324
|
+
* @param {SubMeasurement} measurements
|
|
18325
|
+
*/
|
|
18326
|
+
static flushMeasurements(correlationId, measurements) {
|
|
18327
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
18328
|
+
try {
|
|
18329
|
+
measurements.forEach((measurement) => {
|
|
18330
|
+
const measureName = BrowserPerformanceMeasurement.makeMeasureName(measurement.name, correlationId);
|
|
18331
|
+
const entriesForMeasurement = window.performance.getEntriesByName(measureName, "measure");
|
|
18332
|
+
if (entriesForMeasurement.length > 0) {
|
|
18333
|
+
window.performance.clearMeasures(measureName);
|
|
18334
|
+
window.performance.clearMarks(BrowserPerformanceMeasurement.makeStartMark(measureName, correlationId));
|
|
18335
|
+
window.performance.clearMarks(BrowserPerformanceMeasurement.makeEndMark(measureName, correlationId));
|
|
18336
|
+
}
|
|
18337
|
+
});
|
|
18338
|
+
}
|
|
18339
|
+
catch (e) {
|
|
18340
|
+
// Silently catch and return null
|
|
18341
|
+
}
|
|
18342
|
+
}
|
|
18343
|
+
}
|
|
18344
|
+
startMeasurement() {
|
|
18345
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
18346
|
+
try {
|
|
18347
|
+
window.performance.mark(this.startMark);
|
|
18348
|
+
}
|
|
18349
|
+
catch (e) {
|
|
18350
|
+
// Silently catch
|
|
18351
|
+
}
|
|
18352
|
+
}
|
|
18353
|
+
}
|
|
18354
|
+
endMeasurement() {
|
|
18355
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
18356
|
+
try {
|
|
18357
|
+
window.performance.mark(this.endMark);
|
|
18358
|
+
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
18359
|
+
}
|
|
18360
|
+
catch (e) {
|
|
18361
|
+
// Silently catch
|
|
18362
|
+
}
|
|
18363
|
+
}
|
|
18364
|
+
}
|
|
18365
|
+
flushMeasurement() {
|
|
18366
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
18367
|
+
try {
|
|
18368
|
+
const entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
18369
|
+
if (entriesForMeasurement.length > 0) {
|
|
18370
|
+
const durationMs = entriesForMeasurement[0].duration;
|
|
18371
|
+
window.performance.clearMeasures(this.measureName);
|
|
18372
|
+
window.performance.clearMarks(this.startMark);
|
|
18373
|
+
window.performance.clearMarks(this.endMark);
|
|
18374
|
+
return durationMs;
|
|
18375
|
+
}
|
|
18376
|
+
}
|
|
18377
|
+
catch (e) {
|
|
18378
|
+
// Silently catch and return null
|
|
18379
|
+
}
|
|
18380
|
+
}
|
|
18381
|
+
return null;
|
|
18382
|
+
}
|
|
18383
|
+
}
|
|
18384
|
+
|
|
18385
|
+
/*
|
|
18386
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18387
|
+
* Licensed under the MIT License.
|
|
18388
|
+
*/
|
|
18389
|
+
class BrowserPerformanceClient extends PerformanceClient {
|
|
18390
|
+
constructor(configuration, intFields) {
|
|
18391
|
+
super(configuration.auth.clientId, configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`, new Logger(configuration.system?.loggerOptions || {}, name, version), name, version, configuration.telemetry?.application || {
|
|
18392
|
+
appName: "",
|
|
18393
|
+
appVersion: "",
|
|
18394
|
+
}, intFields);
|
|
18395
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
18396
|
+
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
18397
|
+
}
|
|
18398
|
+
startPerformanceMeasurement(measureName, correlationId) {
|
|
18399
|
+
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
18400
|
+
}
|
|
18401
|
+
generateId() {
|
|
18402
|
+
return this.guidGenerator.generateGuid();
|
|
18403
|
+
}
|
|
18404
|
+
getPageVisibility() {
|
|
18405
|
+
return document.visibilityState?.toString() || null;
|
|
18406
|
+
}
|
|
18407
|
+
deleteIncompleteSubMeasurements(inProgressEvent) {
|
|
18408
|
+
const rootEvent = this.eventsByCorrelationId.get(inProgressEvent.event.correlationId);
|
|
18409
|
+
const isRootEvent = rootEvent && rootEvent.eventId === inProgressEvent.event.eventId;
|
|
18410
|
+
const incompleteMeasurements = [];
|
|
18411
|
+
if (isRootEvent && rootEvent?.incompleteSubMeasurements) {
|
|
18412
|
+
rootEvent.incompleteSubMeasurements.forEach((subMeasurement) => {
|
|
18413
|
+
incompleteMeasurements.push({ ...subMeasurement });
|
|
18414
|
+
});
|
|
18415
|
+
}
|
|
18416
|
+
// Clean up remaining marks for incomplete sub-measurements
|
|
18417
|
+
if (incompleteMeasurements.length > 0) {
|
|
18418
|
+
BrowserPerformanceMeasurement.flushMeasurements(inProgressEvent.event.correlationId, incompleteMeasurements);
|
|
18419
|
+
}
|
|
18420
|
+
}
|
|
18421
|
+
supportsBrowserPerformanceNow() {
|
|
18422
|
+
return (typeof window !== "undefined" &&
|
|
18423
|
+
typeof window.performance !== "undefined" &&
|
|
18424
|
+
typeof window.performance.now === "function");
|
|
18425
|
+
}
|
|
18426
|
+
/**
|
|
18427
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
18428
|
+
* Also captures browser page visibilityState.
|
|
18429
|
+
*
|
|
18430
|
+
* @param {PerformanceEvents} measureName
|
|
18431
|
+
* @param {?string} [correlationId]
|
|
18432
|
+
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
18433
|
+
*/
|
|
18434
|
+
startMeasurement(measureName, correlationId) {
|
|
18435
|
+
// Capture page visibilityState and then invoke start/end measurement
|
|
18436
|
+
const startPageVisibility = this.getPageVisibility();
|
|
18437
|
+
const inProgressEvent = super.startMeasurement(measureName, correlationId);
|
|
18438
|
+
return {
|
|
18439
|
+
...inProgressEvent,
|
|
18440
|
+
end: (event) => {
|
|
18441
|
+
const res = inProgressEvent.end({
|
|
18442
|
+
startPageVisibility,
|
|
18443
|
+
endPageVisibility: this.getPageVisibility(),
|
|
18444
|
+
...event,
|
|
18445
|
+
});
|
|
18446
|
+
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
18447
|
+
return res;
|
|
18448
|
+
},
|
|
18449
|
+
discard: () => {
|
|
18450
|
+
inProgressEvent.discard();
|
|
18451
|
+
this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
18452
|
+
inProgressEvent.measurement.flushMeasurement();
|
|
18453
|
+
},
|
|
18454
|
+
};
|
|
18455
|
+
}
|
|
18456
|
+
/**
|
|
18457
|
+
* Adds pre-queue time to preQueueTimeByCorrelationId map.
|
|
18458
|
+
* @param {PerformanceEvents} eventName
|
|
18459
|
+
* @param {?string} correlationId
|
|
18460
|
+
* @returns
|
|
18461
|
+
*/
|
|
18462
|
+
setPreQueueTime(eventName, correlationId) {
|
|
18463
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
18464
|
+
this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for ${eventName}`);
|
|
18465
|
+
return;
|
|
18466
|
+
}
|
|
18467
|
+
if (!correlationId) {
|
|
18468
|
+
this.logger.trace(`BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to set telemetry queue time`);
|
|
18469
|
+
return;
|
|
18470
|
+
}
|
|
18471
|
+
const preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
18472
|
+
/**
|
|
18473
|
+
* Manually complete queue measurement if there is an incomplete pre-queue event.
|
|
18474
|
+
* Incomplete pre-queue events are instrumentation bugs that should be fixed.
|
|
18475
|
+
*/
|
|
18476
|
+
if (preQueueEvent) {
|
|
18477
|
+
this.logger.trace(`BrowserPerformanceClient: Incomplete pre-queue ${preQueueEvent.name} found`, correlationId);
|
|
18478
|
+
this.addQueueMeasurement(preQueueEvent.name, correlationId, undefined, true);
|
|
18479
|
+
}
|
|
18480
|
+
this.preQueueTimeByCorrelationId.set(correlationId, {
|
|
18481
|
+
name: eventName,
|
|
18482
|
+
time: window.performance.now(),
|
|
18483
|
+
});
|
|
18484
|
+
}
|
|
18485
|
+
/**
|
|
18486
|
+
* Calculates and adds queue time measurement for given performance event.
|
|
18487
|
+
*
|
|
18488
|
+
* @param {PerformanceEvents} eventName
|
|
18489
|
+
* @param {?string} correlationId
|
|
18490
|
+
* @param {?number} queueTime
|
|
18491
|
+
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
|
|
18492
|
+
* @returns
|
|
18493
|
+
*/
|
|
18494
|
+
addQueueMeasurement(eventName, correlationId, queueTime, manuallyCompleted) {
|
|
18495
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
18496
|
+
this.logger.trace(`BrowserPerformanceClient: window performance API not available, unable to add queue measurement for ${eventName}`);
|
|
18497
|
+
return;
|
|
18498
|
+
}
|
|
18499
|
+
if (!correlationId) {
|
|
18500
|
+
this.logger.trace(`BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to add queue measurement`);
|
|
18501
|
+
return;
|
|
18502
|
+
}
|
|
18503
|
+
const preQueueTime = super.getPreQueueTime(eventName, correlationId);
|
|
18504
|
+
if (!preQueueTime) {
|
|
18505
|
+
return;
|
|
18506
|
+
}
|
|
18507
|
+
const currentTime = window.performance.now();
|
|
18508
|
+
const resQueueTime = queueTime || super.calculateQueuedTime(preQueueTime, currentTime);
|
|
18509
|
+
return super.addQueueMeasurement(eventName, correlationId, resQueueTime, manuallyCompleted);
|
|
18510
|
+
}
|
|
18511
|
+
}
|
|
18512
|
+
|
|
18199
18513
|
exports.AccountEntity = AccountEntity;
|
|
18200
18514
|
exports.ApiId = ApiId;
|
|
18201
18515
|
exports.AuthError = AuthError;
|
|
@@ -18208,6 +18522,8 @@
|
|
|
18208
18522
|
exports.BrowserCacheLocation = BrowserCacheLocation;
|
|
18209
18523
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
18210
18524
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
18525
|
+
exports.BrowserPerformanceClient = BrowserPerformanceClient;
|
|
18526
|
+
exports.BrowserPerformanceMeasurement = BrowserPerformanceMeasurement;
|
|
18211
18527
|
exports.BrowserUtils = BrowserUtils;
|
|
18212
18528
|
exports.CacheLookupPolicy = CacheLookupPolicy;
|
|
18213
18529
|
exports.ClientAuthError = ClientAuthError;
|
|
@@ -18228,6 +18544,7 @@
|
|
|
18228
18544
|
exports.ProtocolMode = ProtocolMode;
|
|
18229
18545
|
exports.PublicClientApplication = PublicClientApplication;
|
|
18230
18546
|
exports.ServerError = ServerError;
|
|
18547
|
+
exports.ServerResponseType = ServerResponseType;
|
|
18231
18548
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
18232
18549
|
exports.StringUtils = StringUtils;
|
|
18233
18550
|
exports.UrlString = UrlString;
|