@azure/msal-browser 2.32.2 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +3 -0
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +65 -13
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.d.ts +2 -0
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +37 -10
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.js +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/CryptoKeyStore.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.js +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.js +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/ModernBrowserCrypto.js +1 -1
- package/dist/crypto/MsBrowserCrypto.js +1 -1
- package/dist/crypto/MsrBrowserCrypto.js +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.js +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/index.cjs.js +1345 -761
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +3 -2
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +9 -2
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +13 -5
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +7 -3
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +7 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +21 -4
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +9 -3
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +16 -5
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +3 -2
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +12 -4
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +2 -2
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +3 -3
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +2 -2
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +13 -15
- package/dist/interaction_handler/SilentHandler.js.map +1 -1
- package/dist/internals.d.ts +2 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +3 -1
- package/dist/internals.js.map +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/EndSessionRequest.d.ts +1 -1
- package/dist/request/EndSessionRequest.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +18 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +58 -2
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +1345 -761
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +43 -44
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.33.0 2023-02-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -117,7 +117,7 @@ function __spread() {
|
|
|
117
117
|
return ar;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/*! @azure/msal-common
|
|
120
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
121
121
|
/*! *****************************************************************************
|
|
122
122
|
Copyright (c) Microsoft Corporation.
|
|
123
123
|
|
|
@@ -204,7 +204,7 @@ function __spreadArrays() {
|
|
|
204
204
|
return r;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
/*! @azure/msal-common
|
|
207
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
208
208
|
|
|
209
209
|
/*
|
|
210
210
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -588,7 +588,7 @@ var JsonTypes;
|
|
|
588
588
|
JsonTypes["Jwk"] = "JWK";
|
|
589
589
|
})(JsonTypes || (JsonTypes = {}));
|
|
590
590
|
|
|
591
|
-
/*! @azure/msal-common
|
|
591
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
592
592
|
|
|
593
593
|
/*
|
|
594
594
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -644,7 +644,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
644
644
|
return AuthError;
|
|
645
645
|
}(Error));
|
|
646
646
|
|
|
647
|
-
/*! @azure/msal-common
|
|
647
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
648
648
|
|
|
649
649
|
/*
|
|
650
650
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -719,7 +719,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
719
719
|
}
|
|
720
720
|
};
|
|
721
721
|
|
|
722
|
-
/*! @azure/msal-common
|
|
722
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
723
723
|
|
|
724
724
|
/*
|
|
725
725
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1214,7 +1214,7 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1214
1214
|
return ClientAuthError;
|
|
1215
1215
|
}(AuthError));
|
|
1216
1216
|
|
|
1217
|
-
/*! @azure/msal-common
|
|
1217
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1218
1218
|
|
|
1219
1219
|
/*
|
|
1220
1220
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1339,7 +1339,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1339
1339
|
return StringUtils;
|
|
1340
1340
|
}());
|
|
1341
1341
|
|
|
1342
|
-
/*! @azure/msal-common
|
|
1342
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1343
1343
|
|
|
1344
1344
|
/*
|
|
1345
1345
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1529,12 +1529,12 @@ var Logger = /** @class */ (function () {
|
|
|
1529
1529
|
return Logger;
|
|
1530
1530
|
}());
|
|
1531
1531
|
|
|
1532
|
-
/*! @azure/msal-common
|
|
1532
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1533
1533
|
/* eslint-disable header/header */
|
|
1534
1534
|
var name$1 = "@azure/msal-common";
|
|
1535
|
-
var version$1 = "
|
|
1535
|
+
var version$1 = "10.0.0";
|
|
1536
1536
|
|
|
1537
|
-
/*! @azure/msal-common
|
|
1537
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1538
1538
|
/*
|
|
1539
1539
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1540
1540
|
* Licensed under the MIT License.
|
|
@@ -1555,7 +1555,7 @@ exports.AzureCloudInstance = void 0;
|
|
|
1555
1555
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1556
1556
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1557
1557
|
|
|
1558
|
-
/*! @azure/msal-common
|
|
1558
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1559
1559
|
|
|
1560
1560
|
/*
|
|
1561
1561
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1586,6 +1586,25 @@ exports.AzureCloudInstance = void 0;
|
|
|
1586
1586
|
var CredentialEntity = /** @class */ (function () {
|
|
1587
1587
|
function CredentialEntity() {
|
|
1588
1588
|
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Initializes a map with credential {CredentialType} regular expressions.
|
|
1591
|
+
*/
|
|
1592
|
+
CredentialEntity._initRegex = function () {
|
|
1593
|
+
var separator = Separators.CACHE_KEY_SEPARATOR;
|
|
1594
|
+
CredentialEntity.credentialRegexMap = new Map();
|
|
1595
|
+
for (var _i = 0, _a = Object.keys(CredentialType); _i < _a.length; _i++) {
|
|
1596
|
+
var credKey = _a[_i];
|
|
1597
|
+
var credVal = CredentialType[credKey].toLowerCase();
|
|
1598
|
+
try {
|
|
1599
|
+
// Verify credential type is preceded by a valid host name (environment) using lookbehind
|
|
1600
|
+
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("(?<=" + separator + CredentialEntity.credentialDomainRegex + ")" + separator + credVal + separator));
|
|
1601
|
+
}
|
|
1602
|
+
catch (err) {
|
|
1603
|
+
// Lookbehind is not supported (Safari or older versions of IE) - removing it
|
|
1604
|
+
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("" + separator + CredentialEntity.credentialDomainRegex + separator + credVal + separator));
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1589
1608
|
/**
|
|
1590
1609
|
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
1591
1610
|
*/
|
|
@@ -1632,14 +1651,10 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1632
1651
|
* @param key
|
|
1633
1652
|
*/
|
|
1634
1653
|
CredentialEntity.getCredentialType = function (key) {
|
|
1635
|
-
var
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
var credKey = _a[_i];
|
|
1640
|
-
var credVal = CredentialType[credKey].toLowerCase();
|
|
1641
|
-
// Verify credential type is preceded by a valid host name (environment)
|
|
1642
|
-
if (key.toLowerCase().search("(?<=" + separator + domainRe + ")" + separator + credVal + separator) !== -1) {
|
|
1654
|
+
var _a;
|
|
1655
|
+
for (var _i = 0, _b = Object.keys(CredentialType); _i < _b.length; _i++) {
|
|
1656
|
+
var credKey = _b[_i];
|
|
1657
|
+
if ((_a = this.credentialRegexMap.get(CredentialType[credKey])) === null || _a === void 0 ? void 0 : _a.test(key.toLowerCase())) {
|
|
1643
1658
|
return CredentialType[credKey];
|
|
1644
1659
|
}
|
|
1645
1660
|
}
|
|
@@ -1708,10 +1723,13 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1708
1723
|
*/
|
|
1709
1724
|
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
1710
1725
|
};
|
|
1726
|
+
// Match host names like "login.microsoftonline.com", "https://accounts.google.com:4000", https://localhost:5000, etc.
|
|
1727
|
+
CredentialEntity.credentialDomainRegex = "(https?:\\/\\/)?((([\\w-]+\\.)*([\\w-]{1,63})(\\.(\\w{2,63})))|(localhost))(\\:[0-9]{4,5})?";
|
|
1711
1728
|
return CredentialEntity;
|
|
1712
|
-
}());
|
|
1729
|
+
}());
|
|
1730
|
+
CredentialEntity._initRegex();
|
|
1713
1731
|
|
|
1714
|
-
/*! @azure/msal-common
|
|
1732
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1715
1733
|
|
|
1716
1734
|
/*
|
|
1717
1735
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1966,7 +1984,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1966
1984
|
return ClientConfigurationError;
|
|
1967
1985
|
}(ClientAuthError));
|
|
1968
1986
|
|
|
1969
|
-
/*! @azure/msal-common
|
|
1987
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1970
1988
|
|
|
1971
1989
|
/*
|
|
1972
1990
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2150,7 +2168,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2150
2168
|
return ScopeSet;
|
|
2151
2169
|
}());
|
|
2152
2170
|
|
|
2153
|
-
/*! @azure/msal-common
|
|
2171
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2154
2172
|
|
|
2155
2173
|
/*
|
|
2156
2174
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2188,7 +2206,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2188
2206
|
};
|
|
2189
2207
|
}
|
|
2190
2208
|
|
|
2191
|
-
/*! @azure/msal-common
|
|
2209
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2192
2210
|
/*
|
|
2193
2211
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2194
2212
|
* Licensed under the MIT License.
|
|
@@ -2203,7 +2221,7 @@ var AuthorityType;
|
|
|
2203
2221
|
AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
|
|
2204
2222
|
})(AuthorityType || (AuthorityType = {}));
|
|
2205
2223
|
|
|
2206
|
-
/*! @azure/msal-common
|
|
2224
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2207
2225
|
|
|
2208
2226
|
/*
|
|
2209
2227
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2442,7 +2460,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2442
2460
|
return AccountEntity;
|
|
2443
2461
|
}());
|
|
2444
2462
|
|
|
2445
|
-
/*! @azure/msal-common
|
|
2463
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2446
2464
|
|
|
2447
2465
|
/*
|
|
2448
2466
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2494,7 +2512,7 @@ var AuthToken = /** @class */ (function () {
|
|
|
2494
2512
|
return AuthToken;
|
|
2495
2513
|
}());
|
|
2496
2514
|
|
|
2497
|
-
/*! @azure/msal-common
|
|
2515
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2498
2516
|
|
|
2499
2517
|
/*
|
|
2500
2518
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3373,7 +3391,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3373
3391
|
return DefaultStorageClass;
|
|
3374
3392
|
}(CacheManager));
|
|
3375
3393
|
|
|
3376
|
-
/*! @azure/msal-common
|
|
3394
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3377
3395
|
|
|
3378
3396
|
/*
|
|
3379
3397
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3383,8 +3401,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3383
3401
|
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3384
3402
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3385
3403
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3386
|
-
preventCorsPreflight: false
|
|
3387
|
-
proxyUrl: Constants.EMPTY_STRING
|
|
3404
|
+
preventCorsPreflight: false
|
|
3388
3405
|
};
|
|
3389
3406
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3390
3407
|
loggerCallback: function () {
|
|
@@ -3467,7 +3484,7 @@ function buildAuthOptions(authOptions) {
|
|
|
3467
3484
|
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
|
|
3468
3485
|
}
|
|
3469
3486
|
|
|
3470
|
-
/*! @azure/msal-common
|
|
3487
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3471
3488
|
|
|
3472
3489
|
/*
|
|
3473
3490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3487,7 +3504,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3487
3504
|
return ServerError;
|
|
3488
3505
|
}(AuthError));
|
|
3489
3506
|
|
|
3490
|
-
/*! @azure/msal-common
|
|
3507
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3491
3508
|
|
|
3492
3509
|
/*
|
|
3493
3510
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3583,7 +3600,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3583
3600
|
return ThrottlingUtils;
|
|
3584
3601
|
}());
|
|
3585
3602
|
|
|
3586
|
-
/*! @azure/msal-common
|
|
3603
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3587
3604
|
|
|
3588
3605
|
/*
|
|
3589
3606
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3632,7 +3649,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3632
3649
|
return NetworkManager;
|
|
3633
3650
|
}());
|
|
3634
3651
|
|
|
3635
|
-
/*! @azure/msal-common
|
|
3652
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3636
3653
|
/*
|
|
3637
3654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3638
3655
|
* Licensed under the MIT License.
|
|
@@ -3643,98 +3660,7 @@ var CcsCredentialType;
|
|
|
3643
3660
|
CcsCredentialType["UPN"] = "UPN";
|
|
3644
3661
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3645
3662
|
|
|
3646
|
-
/*! @azure/msal-common
|
|
3647
|
-
|
|
3648
|
-
/*
|
|
3649
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3650
|
-
* Licensed under the MIT License.
|
|
3651
|
-
*/
|
|
3652
|
-
/**
|
|
3653
|
-
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
|
|
3654
|
-
*/
|
|
3655
|
-
var BaseClient = /** @class */ (function () {
|
|
3656
|
-
function BaseClient(configuration, performanceClient) {
|
|
3657
|
-
// Set the configuration
|
|
3658
|
-
this.config = buildClientConfiguration(configuration);
|
|
3659
|
-
// Initialize the logger
|
|
3660
|
-
this.logger = new Logger(this.config.loggerOptions, name$1, version$1);
|
|
3661
|
-
// Initialize crypto
|
|
3662
|
-
this.cryptoUtils = this.config.cryptoInterface;
|
|
3663
|
-
// Initialize storage interface
|
|
3664
|
-
this.cacheManager = this.config.storageInterface;
|
|
3665
|
-
// Set the network interface
|
|
3666
|
-
this.networkClient = this.config.networkInterface;
|
|
3667
|
-
// Set the NetworkManager
|
|
3668
|
-
this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);
|
|
3669
|
-
// Set TelemetryManager
|
|
3670
|
-
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
3671
|
-
// set Authority
|
|
3672
|
-
this.authority = this.config.authOptions.authority;
|
|
3673
|
-
// set performance telemetry client
|
|
3674
|
-
this.performanceClient = performanceClient;
|
|
3675
|
-
}
|
|
3676
|
-
/**
|
|
3677
|
-
* Creates default headers for requests to token endpoint
|
|
3678
|
-
*/
|
|
3679
|
-
BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {
|
|
3680
|
-
var headers = {};
|
|
3681
|
-
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
3682
|
-
if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
|
|
3683
|
-
switch (ccsCred.type) {
|
|
3684
|
-
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
3685
|
-
try {
|
|
3686
|
-
var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
|
|
3687
|
-
headers[HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
|
|
3688
|
-
}
|
|
3689
|
-
catch (e) {
|
|
3690
|
-
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
3691
|
-
}
|
|
3692
|
-
break;
|
|
3693
|
-
case CcsCredentialType.UPN:
|
|
3694
|
-
headers[HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
|
|
3695
|
-
break;
|
|
3696
|
-
}
|
|
3697
|
-
}
|
|
3698
|
-
return headers;
|
|
3699
|
-
};
|
|
3700
|
-
/**
|
|
3701
|
-
* Http post to token endpoint
|
|
3702
|
-
* @param tokenEndpoint
|
|
3703
|
-
* @param queryString
|
|
3704
|
-
* @param headers
|
|
3705
|
-
* @param thumbprint
|
|
3706
|
-
*/
|
|
3707
|
-
BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {
|
|
3708
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3709
|
-
var response;
|
|
3710
|
-
return __generator(this, function (_a) {
|
|
3711
|
-
switch (_a.label) {
|
|
3712
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
|
|
3713
|
-
case 1:
|
|
3714
|
-
response = _a.sent();
|
|
3715
|
-
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
3716
|
-
// Telemetry data successfully logged by server, clear Telemetry cache
|
|
3717
|
-
this.config.serverTelemetryManager.clearTelemetryCache();
|
|
3718
|
-
}
|
|
3719
|
-
return [2 /*return*/, response];
|
|
3720
|
-
}
|
|
3721
|
-
});
|
|
3722
|
-
});
|
|
3723
|
-
};
|
|
3724
|
-
/**
|
|
3725
|
-
* Updates the authority object of the client. Endpoint discovery must be completed.
|
|
3726
|
-
* @param updatedAuthority
|
|
3727
|
-
*/
|
|
3728
|
-
BaseClient.prototype.updateAuthority = function (updatedAuthority) {
|
|
3729
|
-
if (!updatedAuthority.discoveryComplete()) {
|
|
3730
|
-
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");
|
|
3731
|
-
}
|
|
3732
|
-
this.authority = updatedAuthority;
|
|
3733
|
-
};
|
|
3734
|
-
return BaseClient;
|
|
3735
|
-
}());
|
|
3736
|
-
|
|
3737
|
-
/*! @azure/msal-common v9.0.2 2023-01-10 */
|
|
3663
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3738
3664
|
|
|
3739
3665
|
/*
|
|
3740
3666
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3802,7 +3728,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3802
3728
|
}
|
|
3803
3729
|
};
|
|
3804
3730
|
/**
|
|
3805
|
-
* Removes unnecessary
|
|
3731
|
+
* Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
|
|
3806
3732
|
* @param request
|
|
3807
3733
|
*/
|
|
3808
3734
|
RequestValidator.sanitizeEQParams = function (eQParams, queryParams) {
|
|
@@ -3815,12 +3741,17 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3815
3741
|
delete eQParams[key];
|
|
3816
3742
|
}
|
|
3817
3743
|
});
|
|
3818
|
-
|
|
3744
|
+
// remove empty string parameters
|
|
3745
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3746
|
+
return Object.fromEntries(Object.entries(eQParams).filter(function (_a) {
|
|
3747
|
+
var value = _a[1];
|
|
3748
|
+
return value !== "";
|
|
3749
|
+
}));
|
|
3819
3750
|
};
|
|
3820
3751
|
return RequestValidator;
|
|
3821
3752
|
}());
|
|
3822
3753
|
|
|
3823
|
-
/*! @azure/msal-common
|
|
3754
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3824
3755
|
|
|
3825
3756
|
/*
|
|
3826
3757
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4097,13 +4028,13 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4097
4028
|
};
|
|
4098
4029
|
/**
|
|
4099
4030
|
* add extraQueryParams
|
|
4100
|
-
* @param
|
|
4031
|
+
* @param eQParams
|
|
4101
4032
|
*/
|
|
4102
|
-
RequestParameterBuilder.prototype.addExtraQueryParameters = function (
|
|
4033
|
+
RequestParameterBuilder.prototype.addExtraQueryParameters = function (eQParams) {
|
|
4103
4034
|
var _this = this;
|
|
4104
|
-
RequestValidator.sanitizeEQParams(
|
|
4105
|
-
Object.keys(
|
|
4106
|
-
_this.parameters.set(key,
|
|
4035
|
+
var sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
|
|
4036
|
+
Object.keys(sanitizedEQParams).forEach(function (key) {
|
|
4037
|
+
_this.parameters.set(key, eQParams[key]);
|
|
4107
4038
|
});
|
|
4108
4039
|
};
|
|
4109
4040
|
RequestParameterBuilder.prototype.addClientCapabilitiesToClaims = function (claims, clientCapabilities) {
|
|
@@ -4198,7 +4129,109 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4198
4129
|
return RequestParameterBuilder;
|
|
4199
4130
|
}());
|
|
4200
4131
|
|
|
4201
|
-
/*! @azure/msal-common
|
|
4132
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4133
|
+
|
|
4134
|
+
/*
|
|
4135
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4136
|
+
* Licensed under the MIT License.
|
|
4137
|
+
*/
|
|
4138
|
+
/**
|
|
4139
|
+
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
|
|
4140
|
+
*/
|
|
4141
|
+
var BaseClient = /** @class */ (function () {
|
|
4142
|
+
function BaseClient(configuration, performanceClient) {
|
|
4143
|
+
// Set the configuration
|
|
4144
|
+
this.config = buildClientConfiguration(configuration);
|
|
4145
|
+
// Initialize the logger
|
|
4146
|
+
this.logger = new Logger(this.config.loggerOptions, name$1, version$1);
|
|
4147
|
+
// Initialize crypto
|
|
4148
|
+
this.cryptoUtils = this.config.cryptoInterface;
|
|
4149
|
+
// Initialize storage interface
|
|
4150
|
+
this.cacheManager = this.config.storageInterface;
|
|
4151
|
+
// Set the network interface
|
|
4152
|
+
this.networkClient = this.config.networkInterface;
|
|
4153
|
+
// Set the NetworkManager
|
|
4154
|
+
this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);
|
|
4155
|
+
// Set TelemetryManager
|
|
4156
|
+
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
4157
|
+
// set Authority
|
|
4158
|
+
this.authority = this.config.authOptions.authority;
|
|
4159
|
+
// set performance telemetry client
|
|
4160
|
+
this.performanceClient = performanceClient;
|
|
4161
|
+
}
|
|
4162
|
+
/**
|
|
4163
|
+
* Creates default headers for requests to token endpoint
|
|
4164
|
+
*/
|
|
4165
|
+
BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {
|
|
4166
|
+
var headers = {};
|
|
4167
|
+
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
4168
|
+
if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
|
|
4169
|
+
switch (ccsCred.type) {
|
|
4170
|
+
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
4171
|
+
try {
|
|
4172
|
+
var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
|
|
4173
|
+
headers[HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
|
|
4174
|
+
}
|
|
4175
|
+
catch (e) {
|
|
4176
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
4177
|
+
}
|
|
4178
|
+
break;
|
|
4179
|
+
case CcsCredentialType.UPN:
|
|
4180
|
+
headers[HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
|
|
4181
|
+
break;
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
return headers;
|
|
4185
|
+
};
|
|
4186
|
+
/**
|
|
4187
|
+
* Http post to token endpoint
|
|
4188
|
+
* @param tokenEndpoint
|
|
4189
|
+
* @param queryString
|
|
4190
|
+
* @param headers
|
|
4191
|
+
* @param thumbprint
|
|
4192
|
+
*/
|
|
4193
|
+
BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {
|
|
4194
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4195
|
+
var response;
|
|
4196
|
+
return __generator(this, function (_a) {
|
|
4197
|
+
switch (_a.label) {
|
|
4198
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
|
|
4199
|
+
case 1:
|
|
4200
|
+
response = _a.sent();
|
|
4201
|
+
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
4202
|
+
// Telemetry data successfully logged by server, clear Telemetry cache
|
|
4203
|
+
this.config.serverTelemetryManager.clearTelemetryCache();
|
|
4204
|
+
}
|
|
4205
|
+
return [2 /*return*/, response];
|
|
4206
|
+
}
|
|
4207
|
+
});
|
|
4208
|
+
});
|
|
4209
|
+
};
|
|
4210
|
+
/**
|
|
4211
|
+
* Updates the authority object of the client. Endpoint discovery must be completed.
|
|
4212
|
+
* @param updatedAuthority
|
|
4213
|
+
*/
|
|
4214
|
+
BaseClient.prototype.updateAuthority = function (updatedAuthority) {
|
|
4215
|
+
if (!updatedAuthority.discoveryComplete()) {
|
|
4216
|
+
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");
|
|
4217
|
+
}
|
|
4218
|
+
this.authority = updatedAuthority;
|
|
4219
|
+
};
|
|
4220
|
+
/**
|
|
4221
|
+
* Creates query string for the /token request
|
|
4222
|
+
* @param request
|
|
4223
|
+
*/
|
|
4224
|
+
BaseClient.prototype.createTokenQueryParameters = function (request) {
|
|
4225
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
4226
|
+
if (request.tokenQueryParameters) {
|
|
4227
|
+
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
4228
|
+
}
|
|
4229
|
+
return parameterBuilder.createQueryString();
|
|
4230
|
+
};
|
|
4231
|
+
return BaseClient;
|
|
4232
|
+
}());
|
|
4233
|
+
|
|
4234
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4202
4235
|
|
|
4203
4236
|
/*
|
|
4204
4237
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4262,7 +4295,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4262
4295
|
return IdTokenEntity;
|
|
4263
4296
|
}(CredentialEntity));
|
|
4264
4297
|
|
|
4265
|
-
/*! @azure/msal-common
|
|
4298
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4266
4299
|
/*
|
|
4267
4300
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4268
4301
|
* Licensed under the MIT License.
|
|
@@ -4312,7 +4345,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4312
4345
|
return TimeUtils;
|
|
4313
4346
|
}());
|
|
4314
4347
|
|
|
4315
|
-
/*! @azure/msal-common
|
|
4348
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4316
4349
|
|
|
4317
4350
|
/*
|
|
4318
4351
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4426,7 +4459,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4426
4459
|
return AccessTokenEntity;
|
|
4427
4460
|
}(CredentialEntity));
|
|
4428
4461
|
|
|
4429
|
-
/*! @azure/msal-common
|
|
4462
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4430
4463
|
|
|
4431
4464
|
/*
|
|
4432
4465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4493,7 +4526,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4493
4526
|
return RefreshTokenEntity;
|
|
4494
4527
|
}(CredentialEntity));
|
|
4495
4528
|
|
|
4496
|
-
/*! @azure/msal-common
|
|
4529
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4497
4530
|
|
|
4498
4531
|
/*
|
|
4499
4532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4532,10 +4565,14 @@ var InteractionRequiredAuthErrorMessage = {
|
|
|
4532
4565
|
*/
|
|
4533
4566
|
var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
4534
4567
|
__extends(InteractionRequiredAuthError, _super);
|
|
4535
|
-
function InteractionRequiredAuthError(errorCode, errorMessage, subError) {
|
|
4568
|
+
function InteractionRequiredAuthError(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims) {
|
|
4536
4569
|
var _this = _super.call(this, errorCode, errorMessage, subError) || this;
|
|
4537
|
-
_this.name = "InteractionRequiredAuthError";
|
|
4538
4570
|
Object.setPrototypeOf(_this, InteractionRequiredAuthError.prototype);
|
|
4571
|
+
_this.timestamp = timestamp || Constants.EMPTY_STRING;
|
|
4572
|
+
_this.traceId = traceId || Constants.EMPTY_STRING;
|
|
4573
|
+
_this.correlationId = correlationId || Constants.EMPTY_STRING;
|
|
4574
|
+
_this.claims = claims || Constants.EMPTY_STRING;
|
|
4575
|
+
_this.name = "InteractionRequiredAuthError";
|
|
4539
4576
|
return _this;
|
|
4540
4577
|
}
|
|
4541
4578
|
/**
|
|
@@ -4568,7 +4605,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4568
4605
|
return InteractionRequiredAuthError;
|
|
4569
4606
|
}(AuthError));
|
|
4570
4607
|
|
|
4571
|
-
/*! @azure/msal-common
|
|
4608
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4572
4609
|
/*
|
|
4573
4610
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4574
4611
|
* Licensed under the MIT License.
|
|
@@ -4584,7 +4621,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4584
4621
|
return CacheRecord;
|
|
4585
4622
|
}());
|
|
4586
4623
|
|
|
4587
|
-
/*! @azure/msal-common
|
|
4624
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4588
4625
|
|
|
4589
4626
|
/*
|
|
4590
4627
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4655,7 +4692,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4655
4692
|
return ProtocolUtils;
|
|
4656
4693
|
}());
|
|
4657
4694
|
|
|
4658
|
-
/*! @azure/msal-common
|
|
4695
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4659
4696
|
|
|
4660
4697
|
/*
|
|
4661
4698
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4889,60 +4926,295 @@ var UrlString = /** @class */ (function () {
|
|
|
4889
4926
|
return UrlString;
|
|
4890
4927
|
}());
|
|
4891
4928
|
|
|
4892
|
-
/*! @azure/msal-common
|
|
4893
|
-
|
|
4929
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4894
4930
|
/*
|
|
4895
4931
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4896
4932
|
* Licensed under the MIT License.
|
|
4897
4933
|
*/
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
}
|
|
4934
|
+
/**
|
|
4935
|
+
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
4936
|
+
*
|
|
4937
|
+
* @export
|
|
4938
|
+
* @enum {number}
|
|
4939
|
+
*/
|
|
4940
|
+
exports.PerformanceEvents = void 0;
|
|
4941
|
+
(function (PerformanceEvents) {
|
|
4907
4942
|
/**
|
|
4908
|
-
*
|
|
4909
|
-
*
|
|
4910
|
-
* @param request
|
|
4911
|
-
* @returns
|
|
4943
|
+
* acquireTokenByCode API (msal-browser and msal-node).
|
|
4944
|
+
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
4912
4945
|
*/
|
|
4913
|
-
|
|
4914
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4915
|
-
var reqCnf, reqCnfString, _a;
|
|
4916
|
-
return __generator(this, function (_b) {
|
|
4917
|
-
switch (_b.label) {
|
|
4918
|
-
case 0: return [4 /*yield*/, this.generateKid(request)];
|
|
4919
|
-
case 1:
|
|
4920
|
-
reqCnf = _b.sent();
|
|
4921
|
-
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
4922
|
-
_a = {
|
|
4923
|
-
kid: reqCnf.kid,
|
|
4924
|
-
reqCnfString: reqCnfString
|
|
4925
|
-
};
|
|
4926
|
-
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
4927
|
-
case 2: return [2 /*return*/, (_a.reqCnfHash = _b.sent(),
|
|
4928
|
-
_a)];
|
|
4929
|
-
}
|
|
4930
|
-
});
|
|
4931
|
-
});
|
|
4932
|
-
};
|
|
4946
|
+
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
|
|
4933
4947
|
/**
|
|
4934
|
-
*
|
|
4935
|
-
*
|
|
4936
|
-
* @returns
|
|
4948
|
+
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
4949
|
+
* Used to renew an access token using a refresh token against the token endpoint.
|
|
4937
4950
|
*/
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4951
|
+
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
|
|
4952
|
+
/**
|
|
4953
|
+
* acquireTokenSilent API (msal-browser and msal-node).
|
|
4954
|
+
* Used to silently acquire a new access token (from the cache or the network).
|
|
4955
|
+
*/
|
|
4956
|
+
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
|
|
4957
|
+
/**
|
|
4958
|
+
* acquireTokenSilentAsync (msal-browser).
|
|
4959
|
+
* Internal API for acquireTokenSilent.
|
|
4960
|
+
*/
|
|
4961
|
+
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
4962
|
+
/**
|
|
4963
|
+
* acquireTokenPopup (msal-browser).
|
|
4964
|
+
* Used to acquire a new access token interactively through pop ups
|
|
4965
|
+
*/
|
|
4966
|
+
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
|
|
4967
|
+
/**
|
|
4968
|
+
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
4969
|
+
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
4970
|
+
*/
|
|
4971
|
+
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
|
|
4972
|
+
/**
|
|
4973
|
+
* signJwt API in CryptoOpts class (msal-browser).
|
|
4974
|
+
* Used to signed a pop token.
|
|
4975
|
+
*/
|
|
4976
|
+
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
|
|
4977
|
+
/**
|
|
4978
|
+
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
4979
|
+
* Used to read access tokens from the cache.
|
|
4980
|
+
*/
|
|
4981
|
+
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
|
|
4982
|
+
/**
|
|
4983
|
+
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
4984
|
+
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4985
|
+
*/
|
|
4986
|
+
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
|
|
4987
|
+
/**
|
|
4988
|
+
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4989
|
+
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
4990
|
+
*/
|
|
4991
|
+
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
|
|
4992
|
+
/**
|
|
4993
|
+
* ssoSilent API (msal-browser).
|
|
4994
|
+
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
4995
|
+
*/
|
|
4996
|
+
PerformanceEvents["SsoSilent"] = "ssoSilent";
|
|
4997
|
+
/**
|
|
4998
|
+
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
4999
|
+
* Used to load authority metadata for a request.
|
|
5000
|
+
*/
|
|
5001
|
+
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
5002
|
+
/**
|
|
5003
|
+
* acquireToken APIs in msal-browser.
|
|
5004
|
+
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
5005
|
+
*/
|
|
5006
|
+
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
|
|
5007
|
+
/**
|
|
5008
|
+
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
5009
|
+
* Used to acquire a token from Native component when native brokering is enabled.
|
|
5010
|
+
*/
|
|
5011
|
+
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
5012
|
+
/**
|
|
5013
|
+
* Time spent creating default headers for requests to token endpoint
|
|
5014
|
+
*/
|
|
5015
|
+
PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
|
|
5016
|
+
/**
|
|
5017
|
+
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
5018
|
+
*/
|
|
5019
|
+
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
|
|
5020
|
+
/**
|
|
5021
|
+
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
5022
|
+
*/
|
|
5023
|
+
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
5024
|
+
/**
|
|
5025
|
+
* Time taken for token acquisition by broker
|
|
5026
|
+
*/
|
|
5027
|
+
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
5028
|
+
/**
|
|
5029
|
+
* Time spent on the network for refresh token acquisition
|
|
5030
|
+
*/
|
|
5031
|
+
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
5032
|
+
/**
|
|
5033
|
+
* Time taken for acquiring refresh token , records RT size
|
|
5034
|
+
*/
|
|
5035
|
+
PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
|
|
5036
|
+
/**
|
|
5037
|
+
* Time taken for acquiring cached refresh token
|
|
5038
|
+
*/
|
|
5039
|
+
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
5040
|
+
/**
|
|
5041
|
+
* acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
|
|
5042
|
+
*/
|
|
5043
|
+
PerformanceEvents["RefreshTokenClientAcquireTokenByRefreshToken"] = "refreshTokenClientAcquireTokenByRefreshToken";
|
|
5044
|
+
/**
|
|
5045
|
+
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
5046
|
+
*/
|
|
5047
|
+
PerformanceEvents["RefreshTokenClientCreateTokenRequestBody"] = "refreshTokenClientCreateTokenRequestBody";
|
|
5048
|
+
/**
|
|
5049
|
+
* acquireTokenFromCache (msal-browser).
|
|
5050
|
+
* Internal API for acquiring token from cache
|
|
5051
|
+
*/
|
|
5052
|
+
PerformanceEvents["AcquireTokenFromCache"] = "acquireTokenFromCache";
|
|
5053
|
+
/**
|
|
5054
|
+
* acquireTokenBySilentIframe (msal-browser).
|
|
5055
|
+
* Internal API for acquiring token by silent Iframe
|
|
5056
|
+
*/
|
|
5057
|
+
PerformanceEvents["AcquireTokenBySilentIframe"] = "acquireTokenBySilentIframe";
|
|
5058
|
+
/**
|
|
5059
|
+
* Internal API for initializing base request in BaseInteractionClient (msal-browser)
|
|
5060
|
+
*/
|
|
5061
|
+
PerformanceEvents["InitializeBaseRequest"] = "initializeBaseRequest";
|
|
5062
|
+
/**
|
|
5063
|
+
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
5064
|
+
*/
|
|
5065
|
+
PerformanceEvents["InitializeSilentRequest"] = "initializeSilentRequest";
|
|
5066
|
+
/**
|
|
5067
|
+
* Helper function in SilentIframeClient class (msal-browser).
|
|
5068
|
+
*/
|
|
5069
|
+
PerformanceEvents["SilentIframeClientTokenHelper"] = "silentIframeClientTokenHelper";
|
|
5070
|
+
/**
|
|
5071
|
+
* SilentHandler
|
|
5072
|
+
*/
|
|
5073
|
+
PerformanceEvents["SilentHandlerInitiateAuthRequest"] = "silentHandlerInitiateAuthRequest";
|
|
5074
|
+
PerformanceEvents["SilentHandlerMonitorIframeForHash"] = "silentHandlerMonitorIframeForHash";
|
|
5075
|
+
PerformanceEvents["SilentHandlerLoadFrame"] = "silentHandlerLoadFrame";
|
|
5076
|
+
/**
|
|
5077
|
+
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
5078
|
+
*/
|
|
5079
|
+
PerformanceEvents["StandardInteractionClientCreateAuthCodeClient"] = "standardInteractionClientCreateAuthCodeClient";
|
|
5080
|
+
PerformanceEvents["StandardInteractionClientGetClientConfiguration"] = "standardInteractionClientGetClientConfiguration";
|
|
5081
|
+
PerformanceEvents["StandardInteractionClientInitializeAuthorizationRequest"] = "standardInteractionClientInitializeAuthorizationRequest";
|
|
5082
|
+
PerformanceEvents["StandardInteractionClientInitializeAuthorizationCodeRequest"] = "standardInteractionClientInitializeAuthorizationCodeRequest";
|
|
5083
|
+
/**
|
|
5084
|
+
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
5085
|
+
*/
|
|
5086
|
+
PerformanceEvents["GetAuthCodeUrl"] = "getAuthCodeUrl";
|
|
5087
|
+
/**
|
|
5088
|
+
* Functions from InteractionHandler (msal-browser)
|
|
5089
|
+
*/
|
|
5090
|
+
PerformanceEvents["HandleCodeResponseFromServer"] = "handleCodeResponseFromServer";
|
|
5091
|
+
PerformanceEvents["HandleCodeResponseFromHash"] = "handleCodeResponseFromHash";
|
|
5092
|
+
PerformanceEvents["UpdateTokenEndpointAuthority"] = "updateTokenEndpointAuthority";
|
|
5093
|
+
/**
|
|
5094
|
+
* APIs in Authorization Code Client (msal-common)
|
|
5095
|
+
*/
|
|
5096
|
+
PerformanceEvents["AuthClientAcquireToken"] = "authClientAcquireToken";
|
|
5097
|
+
PerformanceEvents["AuthClientExecuteTokenRequest"] = "authClientExecuteTokenRequest";
|
|
5098
|
+
PerformanceEvents["AuthClientCreateTokenRequestBody"] = "authClientCreateTokenRequestBody";
|
|
5099
|
+
PerformanceEvents["AuthClientCreateQueryString"] = "authClientCreateQueryString";
|
|
5100
|
+
/**
|
|
5101
|
+
* Generate functions in PopTokenGenerator (msal-common)
|
|
5102
|
+
*/
|
|
5103
|
+
PerformanceEvents["PopTokenGenerateCnf"] = "popTokenGenerateCnf";
|
|
5104
|
+
PerformanceEvents["PopTokenGenerateKid"] = "popTokenGenerateKid";
|
|
5105
|
+
/**
|
|
5106
|
+
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
5107
|
+
*/
|
|
5108
|
+
PerformanceEvents["HandleServerTokenResponse"] = "handleServerTokenResponse";
|
|
5109
|
+
/**
|
|
5110
|
+
* Authority functions
|
|
5111
|
+
*/
|
|
5112
|
+
PerformanceEvents["AuthorityFactoryCreateDiscoveredInstance"] = "authorityFactoryCreateDiscoveredInstance";
|
|
5113
|
+
PerformanceEvents["AuthorityResolveEndpointsAsync"] = "authorityResolveEndpointsAsync";
|
|
5114
|
+
PerformanceEvents["AuthorityGetCloudDiscoveryMetadataFromNetwork"] = "authorityGetCloudDiscoveryMetadataFromNetwork";
|
|
5115
|
+
PerformanceEvents["AuthorityUpdateCloudDiscoveryMetadata"] = "authorityUpdateCloudDiscoveryMetadata";
|
|
5116
|
+
PerformanceEvents["AuthorityGetEndpointMetadataFromNetwork"] = "authorityGetEndpointMetadataFromNetwork";
|
|
5117
|
+
PerformanceEvents["AuthorityUpdateEndpointMetadata"] = "authorityUpdateEndpointMetadata";
|
|
5118
|
+
PerformanceEvents["AuthorityUpdateMetadataWithRegionalInformation"] = "authorityUpdateMetadataWithRegionalInformation";
|
|
5119
|
+
/**
|
|
5120
|
+
* Region Discovery functions
|
|
5121
|
+
*/
|
|
5122
|
+
PerformanceEvents["RegionDiscoveryDetectRegion"] = "regionDiscoveryDetectRegion";
|
|
5123
|
+
PerformanceEvents["RegionDiscoveryGetRegionFromIMDS"] = "regionDiscoveryGetRegionFromIMDS";
|
|
5124
|
+
PerformanceEvents["RegionDiscoveryGetCurrentVersion"] = "regionDiscoveryGetCurrentVersion";
|
|
5125
|
+
PerformanceEvents["AcquireTokenByCodeAsync"] = "acquireTokenByCodeAsync";
|
|
5126
|
+
PerformanceEvents["GetEndpointMetadataFromNetwork"] = "getEndpointMetadataFromNetwork";
|
|
5127
|
+
PerformanceEvents["GetCloudDiscoveryMetadataFromNetworkMeasurement"] = "getCloudDiscoveryMetadataFromNetworkMeasurement";
|
|
5128
|
+
PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
|
|
5129
|
+
PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
|
|
5130
|
+
PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
|
|
5131
|
+
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5132
|
+
/**
|
|
5133
|
+
* State of the performance event.
|
|
5134
|
+
*
|
|
5135
|
+
* @export
|
|
5136
|
+
* @enum {number}
|
|
5137
|
+
*/
|
|
5138
|
+
var PerformanceEventStatus;
|
|
5139
|
+
(function (PerformanceEventStatus) {
|
|
5140
|
+
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
|
|
5141
|
+
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
|
|
5142
|
+
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
5143
|
+
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5144
|
+
var IntFields = new Set([
|
|
5145
|
+
"accessTokenSize",
|
|
5146
|
+
"durationMs",
|
|
5147
|
+
"idTokenSize",
|
|
5148
|
+
"matsSilentStatus",
|
|
5149
|
+
"matsHttpStatus",
|
|
5150
|
+
"refreshTokenSize",
|
|
5151
|
+
"queuedTimeMs",
|
|
5152
|
+
"startTimeMs",
|
|
5153
|
+
"status",
|
|
5154
|
+
]);
|
|
5155
|
+
|
|
5156
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5157
|
+
|
|
5158
|
+
/*
|
|
5159
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5160
|
+
* Licensed under the MIT License.
|
|
5161
|
+
*/
|
|
5162
|
+
var KeyLocation;
|
|
5163
|
+
(function (KeyLocation) {
|
|
5164
|
+
KeyLocation["SW"] = "sw";
|
|
5165
|
+
KeyLocation["UHW"] = "uhw";
|
|
5166
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
5167
|
+
var PopTokenGenerator = /** @class */ (function () {
|
|
5168
|
+
function PopTokenGenerator(cryptoUtils, performanceClient) {
|
|
5169
|
+
this.cryptoUtils = cryptoUtils;
|
|
5170
|
+
this.performanceClient = performanceClient;
|
|
5171
|
+
}
|
|
5172
|
+
/**
|
|
5173
|
+
* Generates the req_cnf validated at the RP in the POP protocol for SHR parameters
|
|
5174
|
+
* and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash
|
|
5175
|
+
* @param request
|
|
5176
|
+
* @returns
|
|
5177
|
+
*/
|
|
5178
|
+
PopTokenGenerator.prototype.generateCnf = function (request) {
|
|
5179
|
+
var _a, _b;
|
|
5180
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5181
|
+
var reqCnf, reqCnfString, _c;
|
|
5182
|
+
return __generator(this, function (_d) {
|
|
5183
|
+
switch (_d.label) {
|
|
5184
|
+
case 0:
|
|
5185
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5186
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5187
|
+
return [4 /*yield*/, this.generateKid(request)];
|
|
5188
|
+
case 1:
|
|
5189
|
+
reqCnf = _d.sent();
|
|
5190
|
+
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
5191
|
+
_c = {
|
|
5192
|
+
kid: reqCnf.kid,
|
|
5193
|
+
reqCnfString: reqCnfString
|
|
5194
|
+
};
|
|
5195
|
+
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
5196
|
+
case 2: return [2 /*return*/, (_c.reqCnfHash = _d.sent(),
|
|
5197
|
+
_c)];
|
|
5198
|
+
}
|
|
5199
|
+
});
|
|
5200
|
+
});
|
|
5201
|
+
};
|
|
5202
|
+
/**
|
|
5203
|
+
* Generates key_id for a SHR token request
|
|
5204
|
+
* @param request
|
|
5205
|
+
* @returns
|
|
5206
|
+
*/
|
|
5207
|
+
PopTokenGenerator.prototype.generateKid = function (request) {
|
|
5208
|
+
var _a;
|
|
5209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5210
|
+
var kidThumbprint;
|
|
5211
|
+
return __generator(this, function (_b) {
|
|
5212
|
+
switch (_b.label) {
|
|
5213
|
+
case 0:
|
|
5214
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5215
|
+
return [4 /*yield*/, this.cryptoUtils.getPublicKeyThumbprint(request)];
|
|
4944
5216
|
case 1:
|
|
4945
|
-
kidThumbprint =
|
|
5217
|
+
kidThumbprint = _b.sent();
|
|
4946
5218
|
return [2 /*return*/, {
|
|
4947
5219
|
kid: kidThumbprint,
|
|
4948
5220
|
xms_ksl: KeyLocation.SW
|
|
@@ -4990,7 +5262,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4990
5262
|
return PopTokenGenerator;
|
|
4991
5263
|
}());
|
|
4992
5264
|
|
|
4993
|
-
/*! @azure/msal-common
|
|
5265
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4994
5266
|
|
|
4995
5267
|
/*
|
|
4996
5268
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5060,7 +5332,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5060
5332
|
return AppMetadataEntity;
|
|
5061
5333
|
}());
|
|
5062
5334
|
|
|
5063
|
-
/*! @azure/msal-common
|
|
5335
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5064
5336
|
/*
|
|
5065
5337
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5066
5338
|
* Licensed under the MIT License.
|
|
@@ -5096,7 +5368,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5096
5368
|
return TokenCacheContext;
|
|
5097
5369
|
}());
|
|
5098
5370
|
|
|
5099
|
-
/*! @azure/msal-common
|
|
5371
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5100
5372
|
|
|
5101
5373
|
/*
|
|
5102
5374
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5106,13 +5378,14 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5106
5378
|
* Class that handles response parsing.
|
|
5107
5379
|
*/
|
|
5108
5380
|
var ResponseHandler = /** @class */ (function () {
|
|
5109
|
-
function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin) {
|
|
5381
|
+
function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin, performanceClient) {
|
|
5110
5382
|
this.clientId = clientId;
|
|
5111
5383
|
this.cacheStorage = cacheStorage;
|
|
5112
5384
|
this.cryptoObj = cryptoObj;
|
|
5113
5385
|
this.logger = logger;
|
|
5114
5386
|
this.serializableCache = serializableCache;
|
|
5115
5387
|
this.persistencePlugin = persistencePlugin;
|
|
5388
|
+
this.performanceClient = performanceClient;
|
|
5116
5389
|
}
|
|
5117
5390
|
/**
|
|
5118
5391
|
* Function which validates server authorization code response.
|
|
@@ -5130,7 +5403,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5130
5403
|
// Check for error
|
|
5131
5404
|
if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {
|
|
5132
5405
|
if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {
|
|
5133
|
-
throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
|
|
5406
|
+
throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror, serverResponseHash.timestamp || Constants.EMPTY_STRING, serverResponseHash.trace_id || Constants.EMPTY_STRING, serverResponseHash.correlation_id || Constants.EMPTY_STRING, serverResponseHash.claims || Constants.EMPTY_STRING);
|
|
5134
5407
|
}
|
|
5135
5408
|
throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
|
|
5136
5409
|
}
|
|
@@ -5146,7 +5419,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5146
5419
|
// Check for error
|
|
5147
5420
|
if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {
|
|
5148
5421
|
if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
5149
|
-
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);
|
|
5422
|
+
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING);
|
|
5150
5423
|
}
|
|
5151
5424
|
var errString = serverResponse.error_codes + " - [" + serverResponse.timestamp + "]: " + serverResponse.error_description + " - Correlation ID: " + serverResponse.correlation_id + " - Trace ID: " + serverResponse.trace_id;
|
|
5152
5425
|
throw new ServerError(serverResponse.error, errString, serverResponse.suberror);
|
|
@@ -5158,11 +5431,13 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5158
5431
|
* @param authority
|
|
5159
5432
|
*/
|
|
5160
5433
|
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
|
|
5434
|
+
var _a;
|
|
5161
5435
|
return __awaiter(this, void 0, void 0, function () {
|
|
5162
5436
|
var idTokenObj, authTime, requestStateObj, cacheRecord, cacheContext, key, account;
|
|
5163
|
-
return __generator(this, function (
|
|
5164
|
-
switch (
|
|
5437
|
+
return __generator(this, function (_b) {
|
|
5438
|
+
switch (_b.label) {
|
|
5165
5439
|
case 0:
|
|
5440
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
|
|
5166
5441
|
if (serverTokenResponse.id_token) {
|
|
5167
5442
|
idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);
|
|
5168
5443
|
// token nonce check (TODO: Add a warning if no nonce is given?)
|
|
@@ -5188,16 +5463,16 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5188
5463
|
// Add keyId from request to serverTokenResponse if defined
|
|
5189
5464
|
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
|
|
5190
5465
|
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);
|
|
5191
|
-
|
|
5466
|
+
_b.label = 1;
|
|
5192
5467
|
case 1:
|
|
5193
|
-
|
|
5468
|
+
_b.trys.push([1, , 5, 8]);
|
|
5194
5469
|
if (!(this.persistencePlugin && this.serializableCache)) return [3 /*break*/, 3];
|
|
5195
5470
|
this.logger.verbose("Persistence enabled, calling beforeCacheAccess");
|
|
5196
5471
|
cacheContext = new TokenCacheContext(this.serializableCache, true);
|
|
5197
5472
|
return [4 /*yield*/, this.persistencePlugin.beforeCacheAccess(cacheContext)];
|
|
5198
5473
|
case 2:
|
|
5199
|
-
|
|
5200
|
-
|
|
5474
|
+
_b.sent();
|
|
5475
|
+
_b.label = 3;
|
|
5201
5476
|
case 3:
|
|
5202
5477
|
/*
|
|
5203
5478
|
* When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.
|
|
@@ -5215,15 +5490,15 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5215
5490
|
}
|
|
5216
5491
|
return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];
|
|
5217
5492
|
case 4:
|
|
5218
|
-
|
|
5493
|
+
_b.sent();
|
|
5219
5494
|
return [3 /*break*/, 8];
|
|
5220
5495
|
case 5:
|
|
5221
5496
|
if (!(this.persistencePlugin && this.serializableCache && cacheContext)) return [3 /*break*/, 7];
|
|
5222
5497
|
this.logger.verbose("Persistence enabled, calling afterCacheAccess");
|
|
5223
5498
|
return [4 /*yield*/, this.persistencePlugin.afterCacheAccess(cacheContext)];
|
|
5224
5499
|
case 6:
|
|
5225
|
-
|
|
5226
|
-
|
|
5500
|
+
_b.sent();
|
|
5501
|
+
_b.label = 7;
|
|
5227
5502
|
case 7: return [7 /*endfinally*/];
|
|
5228
5503
|
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code, serverRequestId)];
|
|
5229
5504
|
}
|
|
@@ -5376,7 +5651,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5376
5651
|
return ResponseHandler;
|
|
5377
5652
|
}());
|
|
5378
5653
|
|
|
5379
|
-
/*! @azure/msal-common
|
|
5654
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5380
5655
|
|
|
5381
5656
|
/*
|
|
5382
5657
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5404,13 +5679,17 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5404
5679
|
* @param request
|
|
5405
5680
|
*/
|
|
5406
5681
|
AuthorizationCodeClient.prototype.getAuthCodeUrl = function (request) {
|
|
5682
|
+
var _a, _b;
|
|
5407
5683
|
return __awaiter(this, void 0, void 0, function () {
|
|
5408
5684
|
var queryString;
|
|
5409
|
-
return __generator(this, function (
|
|
5410
|
-
switch (
|
|
5411
|
-
case 0:
|
|
5685
|
+
return __generator(this, function (_c) {
|
|
5686
|
+
switch (_c.label) {
|
|
5687
|
+
case 0:
|
|
5688
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.GetAuthCodeUrl, request.correlationId);
|
|
5689
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5690
|
+
return [4 /*yield*/, this.createAuthCodeUrlQueryString(request)];
|
|
5412
5691
|
case 1:
|
|
5413
|
-
queryString =
|
|
5692
|
+
queryString = _c.sent();
|
|
5414
5693
|
return [2 /*return*/, UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString)];
|
|
5415
5694
|
}
|
|
5416
5695
|
});
|
|
@@ -5422,32 +5701,35 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5422
5701
|
* @param request
|
|
5423
5702
|
*/
|
|
5424
5703
|
AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {
|
|
5425
|
-
var _a, _b, _c;
|
|
5704
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5426
5705
|
return __awaiter(this, void 0, void 0, function () {
|
|
5427
5706
|
var atsMeasurement, reqTimestamp, response, requestId, httpVerAuthority, responseHandler;
|
|
5428
5707
|
var _this = this;
|
|
5429
|
-
return __generator(this, function (
|
|
5430
|
-
switch (
|
|
5708
|
+
return __generator(this, function (_g) {
|
|
5709
|
+
switch (_g.label) {
|
|
5431
5710
|
case 0:
|
|
5432
|
-
|
|
5433
|
-
this.logger.info("in acquireToken call in auth-code client");
|
|
5434
|
-
if (!request || StringUtils.isEmpty(request.code)) {
|
|
5711
|
+
if (!request || !request.code) {
|
|
5435
5712
|
throw ClientAuthError.createTokenRequestCannotBeMadeError();
|
|
5436
5713
|
}
|
|
5714
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientAcquireToken, request.correlationId);
|
|
5715
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement("AuthCodeClientAcquireToken", request.correlationId);
|
|
5716
|
+
this.logger.info("in acquireToken call in auth-code client");
|
|
5437
5717
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
5718
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5438
5719
|
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
5439
5720
|
case 1:
|
|
5440
|
-
response =
|
|
5441
|
-
requestId = (
|
|
5442
|
-
httpVerAuthority = (
|
|
5721
|
+
response = _g.sent();
|
|
5722
|
+
requestId = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_REQUEST_ID];
|
|
5723
|
+
httpVerAuthority = (_e = response.headers) === null || _e === void 0 ? void 0 : _e[HeaderNames.X_MS_HTTP_VERSION];
|
|
5443
5724
|
if (httpVerAuthority) {
|
|
5444
5725
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
5445
5726
|
httpVerAuthority: httpVerAuthority
|
|
5446
5727
|
});
|
|
5447
5728
|
}
|
|
5448
|
-
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
5729
|
+
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);
|
|
5449
5730
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5450
5731
|
responseHandler.validateTokenResponse(response.body);
|
|
5732
|
+
(_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
5451
5733
|
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId).then(function (result) {
|
|
5452
5734
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5453
5735
|
success: true
|
|
@@ -5509,26 +5791,19 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5509
5791
|
* @param request
|
|
5510
5792
|
*/
|
|
5511
5793
|
AuthorizationCodeClient.prototype.executeTokenRequest = function (authority, request) {
|
|
5794
|
+
var _a, _b;
|
|
5512
5795
|
return __awaiter(this, void 0, void 0, function () {
|
|
5513
|
-
var
|
|
5514
|
-
return __generator(this, function (
|
|
5515
|
-
switch (
|
|
5796
|
+
var queryParametersString, endpoint, requestBody, ccsCredential, clientInfo, headers, thumbprint;
|
|
5797
|
+
return __generator(this, function (_c) {
|
|
5798
|
+
switch (_c.label) {
|
|
5516
5799
|
case 0:
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
claims: request.claims,
|
|
5522
|
-
authenticationScheme: request.authenticationScheme,
|
|
5523
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
5524
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
5525
|
-
shrClaims: request.shrClaims,
|
|
5526
|
-
sshKid: request.sshKid
|
|
5527
|
-
};
|
|
5800
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5801
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5802
|
+
queryParametersString = this.createTokenQueryParameters(request);
|
|
5803
|
+
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
5528
5804
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
5529
5805
|
case 1:
|
|
5530
|
-
requestBody =
|
|
5531
|
-
queryParameters = this.createTokenQueryParameters(request);
|
|
5806
|
+
requestBody = _c.sent();
|
|
5532
5807
|
ccsCredential = undefined;
|
|
5533
5808
|
if (request.clientInfo) {
|
|
5534
5809
|
try {
|
|
@@ -5543,34 +5818,35 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5543
5818
|
}
|
|
5544
5819
|
}
|
|
5545
5820
|
headers = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);
|
|
5546
|
-
|
|
5821
|
+
thumbprint = {
|
|
5822
|
+
clientId: this.config.authOptions.clientId,
|
|
5823
|
+
authority: authority.canonicalAuthority,
|
|
5824
|
+
scopes: request.scopes,
|
|
5825
|
+
claims: request.claims,
|
|
5826
|
+
authenticationScheme: request.authenticationScheme,
|
|
5827
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
5828
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
5829
|
+
shrClaims: request.shrClaims,
|
|
5830
|
+
sshKid: request.sshKid
|
|
5831
|
+
};
|
|
5547
5832
|
return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
|
|
5548
5833
|
}
|
|
5549
5834
|
});
|
|
5550
5835
|
});
|
|
5551
5836
|
};
|
|
5552
|
-
/**
|
|
5553
|
-
* Creates query string for the /token request
|
|
5554
|
-
* @param request
|
|
5555
|
-
*/
|
|
5556
|
-
AuthorizationCodeClient.prototype.createTokenQueryParameters = function (request) {
|
|
5557
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
5558
|
-
if (request.tokenQueryParameters) {
|
|
5559
|
-
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
5560
|
-
}
|
|
5561
|
-
return parameterBuilder.createQueryString();
|
|
5562
|
-
};
|
|
5563
5837
|
/**
|
|
5564
5838
|
* Generates a map for all the params to be sent to the service
|
|
5565
5839
|
* @param request
|
|
5566
5840
|
*/
|
|
5567
5841
|
AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
|
|
5842
|
+
var _a, _b;
|
|
5568
5843
|
return __awaiter(this, void 0, void 0, function () {
|
|
5569
5844
|
var parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, correlationId, ccsCred, clientInfo, clientInfo;
|
|
5570
|
-
var
|
|
5571
|
-
return __generator(this, function (
|
|
5572
|
-
switch (
|
|
5845
|
+
var _c;
|
|
5846
|
+
return __generator(this, function (_d) {
|
|
5847
|
+
switch (_d.label) {
|
|
5573
5848
|
case 0:
|
|
5849
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5574
5850
|
parameterBuilder = new RequestParameterBuilder();
|
|
5575
5851
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5576
5852
|
/*
|
|
@@ -5611,10 +5887,11 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5611
5887
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
5612
5888
|
parameterBuilder.addClientInfo();
|
|
5613
5889
|
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5614
|
-
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5890
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
5891
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5615
5892
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5616
5893
|
case 1:
|
|
5617
|
-
reqCnfData =
|
|
5894
|
+
reqCnfData = _d.sent();
|
|
5618
5895
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5619
5896
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5620
5897
|
return [3 /*break*/, 3];
|
|
@@ -5627,7 +5904,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5627
5904
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
5628
5905
|
}
|
|
5629
5906
|
}
|
|
5630
|
-
|
|
5907
|
+
_d.label = 3;
|
|
5631
5908
|
case 3:
|
|
5632
5909
|
correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
5633
5910
|
parameterBuilder.addCorrelationId(correlationId);
|
|
@@ -5672,9 +5949,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5672
5949
|
}
|
|
5673
5950
|
// Add hybrid spa parameters if not already provided
|
|
5674
5951
|
if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
|
|
5675
|
-
parameterBuilder.addExtraQueryParameters((
|
|
5676
|
-
|
|
5677
|
-
|
|
5952
|
+
parameterBuilder.addExtraQueryParameters((_c = {},
|
|
5953
|
+
_c[AADServerParamKeys.RETURN_SPA_CODE] = "1",
|
|
5954
|
+
_c));
|
|
5678
5955
|
}
|
|
5679
5956
|
return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5680
5957
|
}
|
|
@@ -5686,11 +5963,13 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5686
5963
|
* @param request
|
|
5687
5964
|
*/
|
|
5688
5965
|
AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
|
|
5966
|
+
var _a;
|
|
5689
5967
|
return __awaiter(this, void 0, void 0, function () {
|
|
5690
5968
|
var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
|
|
5691
|
-
return __generator(this, function (
|
|
5692
|
-
switch (
|
|
5969
|
+
return __generator(this, function (_b) {
|
|
5970
|
+
switch (_b.label) {
|
|
5693
5971
|
case 0:
|
|
5972
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5694
5973
|
parameterBuilder = new RequestParameterBuilder();
|
|
5695
5974
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5696
5975
|
requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);
|
|
@@ -5801,9 +6080,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5801
6080
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5802
6081
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5803
6082
|
case 1:
|
|
5804
|
-
reqCnfData =
|
|
6083
|
+
reqCnfData = _b.sent();
|
|
5805
6084
|
parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
|
|
5806
|
-
|
|
6085
|
+
_b.label = 2;
|
|
5807
6086
|
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5808
6087
|
}
|
|
5809
6088
|
});
|
|
@@ -5850,137 +6129,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5850
6129
|
return AuthorizationCodeClient;
|
|
5851
6130
|
}(BaseClient));
|
|
5852
6131
|
|
|
5853
|
-
/*! @azure/msal-common
|
|
5854
|
-
/*
|
|
5855
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5856
|
-
* Licensed under the MIT License.
|
|
5857
|
-
*/
|
|
5858
|
-
/**
|
|
5859
|
-
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
5860
|
-
*
|
|
5861
|
-
* @export
|
|
5862
|
-
* @enum {number}
|
|
5863
|
-
*/
|
|
5864
|
-
exports.PerformanceEvents = void 0;
|
|
5865
|
-
(function (PerformanceEvents) {
|
|
5866
|
-
/**
|
|
5867
|
-
* acquireTokenByCode API (msal-browser and msal-node).
|
|
5868
|
-
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
5869
|
-
*/
|
|
5870
|
-
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
|
|
5871
|
-
/**
|
|
5872
|
-
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
5873
|
-
* Used to renew an access token using a refresh token against the token endpoint.
|
|
5874
|
-
*/
|
|
5875
|
-
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
|
|
5876
|
-
/**
|
|
5877
|
-
* acquireTokenSilent API (msal-browser and msal-node).
|
|
5878
|
-
* Used to silently acquire a new access token (from the cache or the network).
|
|
5879
|
-
*/
|
|
5880
|
-
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
|
|
5881
|
-
/**
|
|
5882
|
-
* acquireTokenSilentAsync (msal-browser).
|
|
5883
|
-
* Internal API for acquireTokenSilent.
|
|
5884
|
-
*/
|
|
5885
|
-
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
5886
|
-
/**
|
|
5887
|
-
* acquireTokenPopup (msal-browser).
|
|
5888
|
-
* Used to acquire a new access token interactively through pop ups
|
|
5889
|
-
*/
|
|
5890
|
-
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
|
|
5891
|
-
/**
|
|
5892
|
-
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
5893
|
-
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
5894
|
-
*/
|
|
5895
|
-
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
|
|
5896
|
-
/**
|
|
5897
|
-
* signJwt API in CryptoOpts class (msal-browser).
|
|
5898
|
-
* Used to signed a pop token.
|
|
5899
|
-
*/
|
|
5900
|
-
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
|
|
5901
|
-
/**
|
|
5902
|
-
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
5903
|
-
* Used to read access tokens from the cache.
|
|
5904
|
-
*/
|
|
5905
|
-
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
|
|
5906
|
-
/**
|
|
5907
|
-
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
5908
|
-
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
5909
|
-
*/
|
|
5910
|
-
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
|
|
5911
|
-
/**
|
|
5912
|
-
* acquireToken API in SilentRereshClient (msal-browser).
|
|
5913
|
-
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
5914
|
-
*/
|
|
5915
|
-
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
|
|
5916
|
-
/**
|
|
5917
|
-
* ssoSilent API (msal-browser).
|
|
5918
|
-
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
5919
|
-
*/
|
|
5920
|
-
PerformanceEvents["SsoSilent"] = "ssoSilent";
|
|
5921
|
-
/**
|
|
5922
|
-
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
5923
|
-
* Used to load authority metadata for a request.
|
|
5924
|
-
*/
|
|
5925
|
-
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
5926
|
-
/**
|
|
5927
|
-
* acquireToken APIs in msal-browser.
|
|
5928
|
-
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
5929
|
-
*/
|
|
5930
|
-
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
|
|
5931
|
-
/**
|
|
5932
|
-
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
5933
|
-
* Used to acquire a token from Native component when native brokering is enabled.
|
|
5934
|
-
*/
|
|
5935
|
-
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
5936
|
-
/**
|
|
5937
|
-
* Time spent creating default headers for requests to token endpoint
|
|
5938
|
-
*/
|
|
5939
|
-
PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
|
|
5940
|
-
/**
|
|
5941
|
-
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
5942
|
-
*/
|
|
5943
|
-
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
|
|
5944
|
-
/**
|
|
5945
|
-
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
5946
|
-
*/
|
|
5947
|
-
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
5948
|
-
/**
|
|
5949
|
-
* Time taken for token acquisition by broker
|
|
5950
|
-
*/
|
|
5951
|
-
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
5952
|
-
/**
|
|
5953
|
-
* Time spent on the network for refresh token acquisition
|
|
5954
|
-
*/
|
|
5955
|
-
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
5956
|
-
/**
|
|
5957
|
-
* Time taken for acquiring refresh token , records RT size
|
|
5958
|
-
*/
|
|
5959
|
-
PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
|
|
5960
|
-
/**
|
|
5961
|
-
* Time taken for acquiring cached refresh token
|
|
5962
|
-
*/
|
|
5963
|
-
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
5964
|
-
PerformanceEvents["GetEndpointMetadataFromNetwork"] = "getEndpointMetadataFromNetwork";
|
|
5965
|
-
PerformanceEvents["GetCloudDiscoveryMetadataFromNetworkMeasurement"] = "getCloudDiscoveryMetadataFromNetworkMeasurement";
|
|
5966
|
-
PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
|
|
5967
|
-
PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
|
|
5968
|
-
PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
|
|
5969
|
-
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5970
|
-
/**
|
|
5971
|
-
* State of the performance event.
|
|
5972
|
-
*
|
|
5973
|
-
* @export
|
|
5974
|
-
* @enum {number}
|
|
5975
|
-
*/
|
|
5976
|
-
var PerformanceEventStatus;
|
|
5977
|
-
(function (PerformanceEventStatus) {
|
|
5978
|
-
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
|
|
5979
|
-
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
|
|
5980
|
-
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
5981
|
-
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5982
|
-
|
|
5983
|
-
/*! @azure/msal-common v9.0.2 2023-01-10 */
|
|
6132
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5984
6133
|
|
|
5985
6134
|
/*
|
|
5986
6135
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5995,31 +6144,34 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5995
6144
|
return _super.call(this, configuration, performanceClient) || this;
|
|
5996
6145
|
}
|
|
5997
6146
|
RefreshTokenClient.prototype.acquireToken = function (request) {
|
|
5998
|
-
var _a, _b, _c, _d;
|
|
6147
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5999
6148
|
return __awaiter(this, void 0, void 0, function () {
|
|
6000
6149
|
var atsMeasurement, reqTimestamp, response, httpVerToken, requestId, responseHandler;
|
|
6001
6150
|
var _this = this;
|
|
6002
|
-
return __generator(this, function (
|
|
6003
|
-
switch (
|
|
6151
|
+
return __generator(this, function (_h) {
|
|
6152
|
+
switch (_h.label) {
|
|
6004
6153
|
case 0:
|
|
6005
|
-
|
|
6154
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6155
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6006
6156
|
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
6007
6157
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
6158
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6008
6159
|
return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
6009
6160
|
case 1:
|
|
6010
|
-
response =
|
|
6011
|
-
httpVerToken = (
|
|
6161
|
+
response = _h.sent();
|
|
6162
|
+
httpVerToken = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_HTTP_VERSION];
|
|
6012
6163
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6013
|
-
refreshTokenSize: ((
|
|
6164
|
+
refreshTokenSize: ((_e = response.body.refresh_token) === null || _e === void 0 ? void 0 : _e.length) || 0,
|
|
6014
6165
|
});
|
|
6015
6166
|
if (httpVerToken) {
|
|
6016
6167
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6017
6168
|
httpVerToken: httpVerToken,
|
|
6018
6169
|
});
|
|
6019
6170
|
}
|
|
6020
|
-
requestId = (
|
|
6171
|
+
requestId = (_f = response.headers) === null || _f === void 0 ? void 0 : _f[HeaderNames.X_MS_REQUEST_ID];
|
|
6021
6172
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
6022
6173
|
responseHandler.validateTokenResponse(response.body);
|
|
6174
|
+
(_g = this.performanceClient) === null || _g === void 0 ? void 0 : _g.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
6023
6175
|
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
|
|
6024
6176
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
6025
6177
|
success: true
|
|
@@ -6044,13 +6196,15 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6044
6196
|
* @param request
|
|
6045
6197
|
*/
|
|
6046
6198
|
RefreshTokenClient.prototype.acquireTokenByRefreshToken = function (request) {
|
|
6199
|
+
var _a, _b, _c, _d;
|
|
6047
6200
|
return __awaiter(this, void 0, void 0, function () {
|
|
6048
6201
|
var isFOCI, noFamilyRTInCache, clientMismatchErrorWithFamilyRT;
|
|
6049
|
-
return __generator(this, function (
|
|
6202
|
+
return __generator(this, function (_e) {
|
|
6050
6203
|
// Cannot renew token if no request object is given.
|
|
6051
6204
|
if (!request) {
|
|
6052
6205
|
throw ClientConfigurationError.createEmptyTokenRequestError();
|
|
6053
6206
|
}
|
|
6207
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
6054
6208
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
6055
6209
|
if (!request.account) {
|
|
6056
6210
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
@@ -6059,6 +6213,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6059
6213
|
// if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
|
|
6060
6214
|
if (isFOCI) {
|
|
6061
6215
|
try {
|
|
6216
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6062
6217
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, true)];
|
|
6063
6218
|
}
|
|
6064
6219
|
catch (e) {
|
|
@@ -6066,6 +6221,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6066
6221
|
clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;
|
|
6067
6222
|
// if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
|
|
6068
6223
|
if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
|
|
6224
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6069
6225
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];
|
|
6070
6226
|
// throw in all other cases
|
|
6071
6227
|
}
|
|
@@ -6075,6 +6231,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6075
6231
|
}
|
|
6076
6232
|
}
|
|
6077
6233
|
// fall back to application refresh token acquisition
|
|
6234
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6078
6235
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];
|
|
6079
6236
|
});
|
|
6080
6237
|
});
|
|
@@ -6084,11 +6241,12 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6084
6241
|
* @param request
|
|
6085
6242
|
*/
|
|
6086
6243
|
RefreshTokenClient.prototype.acquireTokenWithCachedRefreshToken = function (request, foci) {
|
|
6087
|
-
var _a;
|
|
6244
|
+
var _a, _b, _c;
|
|
6088
6245
|
return __awaiter(this, void 0, void 0, function () {
|
|
6089
6246
|
var atsMeasurement, refreshToken, refreshTokenRequest;
|
|
6090
|
-
return __generator(this, function (
|
|
6091
|
-
|
|
6247
|
+
return __generator(this, function (_d) {
|
|
6248
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6249
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6092
6250
|
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
6093
6251
|
refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);
|
|
6094
6252
|
if (!refreshToken) {
|
|
@@ -6103,6 +6261,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6103
6261
|
credential: request.account.homeAccountId,
|
|
6104
6262
|
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
6105
6263
|
} });
|
|
6264
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6106
6265
|
return [2 /*return*/, this.acquireToken(refreshTokenRequest)];
|
|
6107
6266
|
});
|
|
6108
6267
|
});
|
|
@@ -6113,17 +6272,20 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6113
6272
|
* @param authority
|
|
6114
6273
|
*/
|
|
6115
6274
|
RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
|
|
6116
|
-
var _a;
|
|
6275
|
+
var _a, _b, _c;
|
|
6117
6276
|
return __awaiter(this, void 0, void 0, function () {
|
|
6118
|
-
var acquireTokenMeasurement,
|
|
6119
|
-
return __generator(this, function (
|
|
6120
|
-
switch (
|
|
6277
|
+
var acquireTokenMeasurement, queryParametersString, endpoint, requestBody, headers, thumbprint;
|
|
6278
|
+
return __generator(this, function (_d) {
|
|
6279
|
+
switch (_d.label) {
|
|
6121
6280
|
case 0:
|
|
6122
|
-
|
|
6281
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6282
|
+
acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6283
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6284
|
+
queryParametersString = this.createTokenQueryParameters(request);
|
|
6285
|
+
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
6123
6286
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
6124
6287
|
case 1:
|
|
6125
|
-
requestBody =
|
|
6126
|
-
queryParameters = this.createTokenQueryParameters(request);
|
|
6288
|
+
requestBody = _d.sent();
|
|
6127
6289
|
headers = this.createTokenRequestHeaders(request.ccsCredential);
|
|
6128
6290
|
thumbprint = {
|
|
6129
6291
|
clientId: this.config.authOptions.clientId,
|
|
@@ -6136,7 +6298,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6136
6298
|
shrClaims: request.shrClaims,
|
|
6137
6299
|
sshKid: request.sshKid
|
|
6138
6300
|
};
|
|
6139
|
-
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
|
|
6140
6301
|
return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
|
|
6141
6302
|
.then(function (result) {
|
|
6142
6303
|
acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
|
|
@@ -6154,30 +6315,20 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6154
6315
|
});
|
|
6155
6316
|
});
|
|
6156
6317
|
};
|
|
6157
|
-
/**
|
|
6158
|
-
* Creates query string for the /token request
|
|
6159
|
-
* @param request
|
|
6160
|
-
*/
|
|
6161
|
-
RefreshTokenClient.prototype.createTokenQueryParameters = function (request) {
|
|
6162
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
6163
|
-
if (request.tokenQueryParameters) {
|
|
6164
|
-
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
6165
|
-
}
|
|
6166
|
-
return parameterBuilder.createQueryString();
|
|
6167
|
-
};
|
|
6168
6318
|
/**
|
|
6169
6319
|
* Helper function to create the token request body
|
|
6170
6320
|
* @param request
|
|
6171
6321
|
*/
|
|
6172
6322
|
RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
|
|
6173
|
-
var _a;
|
|
6323
|
+
var _a, _b, _c;
|
|
6174
6324
|
return __awaiter(this, void 0, void 0, function () {
|
|
6175
6325
|
var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
|
|
6176
|
-
return __generator(this, function (
|
|
6177
|
-
switch (
|
|
6326
|
+
return __generator(this, function (_d) {
|
|
6327
|
+
switch (_d.label) {
|
|
6178
6328
|
case 0:
|
|
6329
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6179
6330
|
correlationId = request.correlationId;
|
|
6180
|
-
acquireTokenMeasurement = (
|
|
6331
|
+
acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
|
|
6181
6332
|
parameterBuilder = new RequestParameterBuilder();
|
|
6182
6333
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
6183
6334
|
parameterBuilder.addScopes(request.scopes);
|
|
@@ -6200,10 +6351,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6200
6351
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6201
6352
|
}
|
|
6202
6353
|
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
6203
|
-
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
6354
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
6355
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
6204
6356
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
6205
6357
|
case 1:
|
|
6206
|
-
reqCnfData =
|
|
6358
|
+
reqCnfData = _d.sent();
|
|
6207
6359
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
6208
6360
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
6209
6361
|
return [3 /*break*/, 3];
|
|
@@ -6219,7 +6371,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6219
6371
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
6220
6372
|
}
|
|
6221
6373
|
}
|
|
6222
|
-
|
|
6374
|
+
_d.label = 3;
|
|
6223
6375
|
case 3:
|
|
6224
6376
|
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
6225
6377
|
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
@@ -6251,7 +6403,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6251
6403
|
return RefreshTokenClient;
|
|
6252
6404
|
}(BaseClient));
|
|
6253
6405
|
|
|
6254
|
-
/*! @azure/msal-common
|
|
6406
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6255
6407
|
|
|
6256
6408
|
/*
|
|
6257
6409
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6375,7 +6527,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
6375
6527
|
return SilentFlowClient;
|
|
6376
6528
|
}(BaseClient));
|
|
6377
6529
|
|
|
6378
|
-
/*! @azure/msal-common
|
|
6530
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6379
6531
|
/*
|
|
6380
6532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6381
6533
|
* Licensed under the MIT License.
|
|
@@ -6387,7 +6539,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
6387
6539
|
response.hasOwnProperty("jwks_uri"));
|
|
6388
6540
|
}
|
|
6389
6541
|
|
|
6390
|
-
/*! @azure/msal-common
|
|
6542
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6391
6543
|
/*
|
|
6392
6544
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6393
6545
|
* Licensed under the MIT License.
|
|
@@ -6396,7 +6548,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
|
|
|
6396
6548
|
var EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
6397
6549
|
var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
6398
6550
|
|
|
6399
|
-
/*! @azure/msal-common
|
|
6551
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6400
6552
|
/*
|
|
6401
6553
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6402
6554
|
* Licensed under the MIT License.
|
|
@@ -6410,7 +6562,7 @@ exports.ProtocolMode = void 0;
|
|
|
6410
6562
|
ProtocolMode["OIDC"] = "OIDC";
|
|
6411
6563
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
6412
6564
|
|
|
6413
|
-
/*! @azure/msal-common
|
|
6565
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6414
6566
|
|
|
6415
6567
|
/*
|
|
6416
6568
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6487,7 +6639,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
6487
6639
|
return AuthorityMetadataEntity;
|
|
6488
6640
|
}());
|
|
6489
6641
|
|
|
6490
|
-
/*! @azure/msal-common
|
|
6642
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6491
6643
|
/*
|
|
6492
6644
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6493
6645
|
* Licensed under the MIT License.
|
|
@@ -6497,7 +6649,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
6497
6649
|
response.hasOwnProperty("metadata"));
|
|
6498
6650
|
}
|
|
6499
6651
|
|
|
6500
|
-
/*! @azure/msal-common
|
|
6652
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6501
6653
|
/*
|
|
6502
6654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6503
6655
|
* Licensed under the MIT License.
|
|
@@ -6507,68 +6659,72 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
6507
6659
|
response.hasOwnProperty("error_description"));
|
|
6508
6660
|
}
|
|
6509
6661
|
|
|
6510
|
-
/*! @azure/msal-common
|
|
6662
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6511
6663
|
|
|
6512
6664
|
/*
|
|
6513
6665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6514
6666
|
* Licensed under the MIT License.
|
|
6515
6667
|
*/
|
|
6516
6668
|
var RegionDiscovery = /** @class */ (function () {
|
|
6517
|
-
function RegionDiscovery(networkInterface) {
|
|
6669
|
+
function RegionDiscovery(networkInterface, performanceClient, correlationId) {
|
|
6518
6670
|
this.networkInterface = networkInterface;
|
|
6671
|
+
this.performanceClient = performanceClient;
|
|
6672
|
+
this.correlationId = correlationId;
|
|
6519
6673
|
}
|
|
6520
6674
|
/**
|
|
6521
6675
|
* Detect the region from the application's environment.
|
|
6522
6676
|
*
|
|
6523
6677
|
* @returns Promise<string | null>
|
|
6524
6678
|
*/
|
|
6525
|
-
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata
|
|
6679
|
+
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
|
|
6680
|
+
var _a, _b, _c, _d;
|
|
6526
6681
|
return __awaiter(this, void 0, void 0, function () {
|
|
6527
6682
|
var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
6528
|
-
return __generator(this, function (
|
|
6529
|
-
switch (
|
|
6683
|
+
return __generator(this, function (_e) {
|
|
6684
|
+
switch (_e.label) {
|
|
6530
6685
|
case 0:
|
|
6686
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
6531
6687
|
autodetectedRegionName = environmentRegion;
|
|
6532
6688
|
if (!!autodetectedRegionName) return [3 /*break*/, 8];
|
|
6533
6689
|
options = RegionDiscovery.IMDS_OPTIONS;
|
|
6534
|
-
|
|
6535
|
-
options.proxyUrl = proxyUrl;
|
|
6536
|
-
}
|
|
6537
|
-
_a.label = 1;
|
|
6690
|
+
_e.label = 1;
|
|
6538
6691
|
case 1:
|
|
6539
|
-
|
|
6692
|
+
_e.trys.push([1, 6, , 7]);
|
|
6693
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6540
6694
|
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
|
|
6541
6695
|
case 2:
|
|
6542
|
-
localIMDSVersionResponse =
|
|
6696
|
+
localIMDSVersionResponse = _e.sent();
|
|
6543
6697
|
if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
6544
6698
|
autodetectedRegionName = localIMDSVersionResponse.body;
|
|
6545
6699
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
6546
6700
|
}
|
|
6547
6701
|
if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
|
|
6702
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
6548
6703
|
return [4 /*yield*/, this.getCurrentVersion(options)];
|
|
6549
6704
|
case 3:
|
|
6550
|
-
currentIMDSVersion =
|
|
6705
|
+
currentIMDSVersion = _e.sent();
|
|
6551
6706
|
if (!currentIMDSVersion) {
|
|
6552
6707
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
6553
6708
|
return [2 /*return*/, null];
|
|
6554
6709
|
}
|
|
6710
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6555
6711
|
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
|
|
6556
6712
|
case 4:
|
|
6557
|
-
currentIMDSVersionResponse =
|
|
6713
|
+
currentIMDSVersionResponse = _e.sent();
|
|
6558
6714
|
if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
6559
6715
|
autodetectedRegionName = currentIMDSVersionResponse.body;
|
|
6560
6716
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
6561
6717
|
}
|
|
6562
|
-
|
|
6718
|
+
_e.label = 5;
|
|
6563
6719
|
case 5: return [3 /*break*/, 7];
|
|
6564
6720
|
case 6:
|
|
6565
|
-
|
|
6721
|
+
_e.sent();
|
|
6566
6722
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
6567
6723
|
return [2 /*return*/, null];
|
|
6568
6724
|
case 7: return [3 /*break*/, 9];
|
|
6569
6725
|
case 8:
|
|
6570
6726
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.ENVIRONMENT_VARIABLE;
|
|
6571
|
-
|
|
6727
|
+
_e.label = 9;
|
|
6572
6728
|
case 9:
|
|
6573
6729
|
// If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION
|
|
6574
6730
|
if (!autodetectedRegionName) {
|
|
@@ -6586,8 +6742,10 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6586
6742
|
* @returns Promise<NetworkResponse<string>>
|
|
6587
6743
|
*/
|
|
6588
6744
|
RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
|
|
6745
|
+
var _a;
|
|
6589
6746
|
return __awaiter(this, void 0, void 0, function () {
|
|
6590
|
-
return __generator(this, function (
|
|
6747
|
+
return __generator(this, function (_b) {
|
|
6748
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6591
6749
|
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
|
|
6592
6750
|
});
|
|
6593
6751
|
});
|
|
@@ -6598,24 +6756,28 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6598
6756
|
* @returns Promise<string | null>
|
|
6599
6757
|
*/
|
|
6600
6758
|
RegionDiscovery.prototype.getCurrentVersion = function (options) {
|
|
6759
|
+
var _a;
|
|
6601
6760
|
return __awaiter(this, void 0, void 0, function () {
|
|
6602
6761
|
var response;
|
|
6603
|
-
return __generator(this, function (
|
|
6604
|
-
switch (
|
|
6762
|
+
return __generator(this, function (_b) {
|
|
6763
|
+
switch (_b.label) {
|
|
6605
6764
|
case 0:
|
|
6606
|
-
_a.
|
|
6607
|
-
|
|
6765
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
6766
|
+
_b.label = 1;
|
|
6608
6767
|
case 1:
|
|
6609
|
-
|
|
6768
|
+
_b.trys.push([1, 3, , 4]);
|
|
6769
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
|
|
6770
|
+
case 2:
|
|
6771
|
+
response = _b.sent();
|
|
6610
6772
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
6611
6773
|
if (response.status === ResponseCodes.httpBadRequest && response.body && response.body["newest-versions"] && response.body["newest-versions"].length > 0) {
|
|
6612
6774
|
return [2 /*return*/, response.body["newest-versions"][0]];
|
|
6613
6775
|
}
|
|
6614
6776
|
return [2 /*return*/, null];
|
|
6615
|
-
case
|
|
6616
|
-
|
|
6777
|
+
case 3:
|
|
6778
|
+
_b.sent();
|
|
6617
6779
|
return [2 /*return*/, null];
|
|
6618
|
-
case
|
|
6780
|
+
case 4: return [2 /*return*/];
|
|
6619
6781
|
}
|
|
6620
6782
|
});
|
|
6621
6783
|
});
|
|
@@ -6629,7 +6791,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6629
6791
|
return RegionDiscovery;
|
|
6630
6792
|
}());
|
|
6631
6793
|
|
|
6632
|
-
/*! @azure/msal-common
|
|
6794
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6633
6795
|
|
|
6634
6796
|
/*
|
|
6635
6797
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6640,16 +6802,17 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6640
6802
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
|
6641
6803
|
*/
|
|
6642
6804
|
var Authority = /** @class */ (function () {
|
|
6643
|
-
function Authority(authority, networkInterface, cacheManager, authorityOptions, logger,
|
|
6805
|
+
function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
6644
6806
|
this.canonicalAuthority = authority;
|
|
6645
6807
|
this._canonicalAuthority.validateAsUri();
|
|
6646
6808
|
this.networkInterface = networkInterface;
|
|
6647
6809
|
this.cacheManager = cacheManager;
|
|
6648
6810
|
this.authorityOptions = authorityOptions;
|
|
6649
|
-
this.regionDiscovery = new RegionDiscovery(networkInterface);
|
|
6650
6811
|
this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
|
|
6651
|
-
this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
|
|
6652
6812
|
this.logger = logger;
|
|
6813
|
+
this.performanceClient = performanceClient;
|
|
6814
|
+
this.correlationId = correlationId;
|
|
6815
|
+
this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
|
|
6653
6816
|
}
|
|
6654
6817
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
6655
6818
|
// See above for AuthorityType
|
|
@@ -6886,23 +7049,27 @@ var Authority = /** @class */ (function () {
|
|
|
6886
7049
|
* and the /authorize, /token and logout endpoints.
|
|
6887
7050
|
*/
|
|
6888
7051
|
Authority.prototype.resolveEndpointsAsync = function () {
|
|
7052
|
+
var _a, _b, _c;
|
|
6889
7053
|
return __awaiter(this, void 0, void 0, function () {
|
|
6890
7054
|
var metadataEntity, cloudDiscoverySource, endpointSource, cacheKey;
|
|
6891
|
-
return __generator(this, function (
|
|
6892
|
-
switch (
|
|
7055
|
+
return __generator(this, function (_d) {
|
|
7056
|
+
switch (_d.label) {
|
|
6893
7057
|
case 0:
|
|
7058
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
|
|
6894
7059
|
metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
|
|
6895
7060
|
if (!metadataEntity) {
|
|
6896
7061
|
metadataEntity = new AuthorityMetadataEntity();
|
|
6897
7062
|
metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
|
|
6898
7063
|
}
|
|
7064
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
6899
7065
|
return [4 /*yield*/, this.updateCloudDiscoveryMetadata(metadataEntity)];
|
|
6900
7066
|
case 1:
|
|
6901
|
-
cloudDiscoverySource =
|
|
7067
|
+
cloudDiscoverySource = _d.sent();
|
|
6902
7068
|
this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);
|
|
7069
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
6903
7070
|
return [4 /*yield*/, this.updateEndpointMetadata(metadataEntity)];
|
|
6904
7071
|
case 2:
|
|
6905
|
-
endpointSource =
|
|
7072
|
+
endpointSource = _d.sent();
|
|
6906
7073
|
if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {
|
|
6907
7074
|
// Reset the expiration time unless both values came from a successful cache lookup
|
|
6908
7075
|
metadataEntity.resetExpiresAt();
|
|
@@ -6921,12 +7088,13 @@ var Authority = /** @class */ (function () {
|
|
|
6921
7088
|
* @param metadataEntity
|
|
6922
7089
|
*/
|
|
6923
7090
|
Authority.prototype.updateEndpointMetadata = function (metadataEntity) {
|
|
6924
|
-
var _a, _b;
|
|
7091
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6925
7092
|
return __awaiter(this, void 0, void 0, function () {
|
|
6926
7093
|
var metadata, harcodedMetadata;
|
|
6927
|
-
return __generator(this, function (
|
|
6928
|
-
switch (
|
|
7094
|
+
return __generator(this, function (_g) {
|
|
7095
|
+
switch (_g.label) {
|
|
6929
7096
|
case 0:
|
|
7097
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
6930
7098
|
metadata = this.getEndpointMetadataFromConfig();
|
|
6931
7099
|
if (metadata) {
|
|
6932
7100
|
metadataEntity.updateEndpointMetadata(metadata, false);
|
|
@@ -6937,25 +7105,28 @@ var Authority = /** @class */ (function () {
|
|
|
6937
7105
|
return [2 /*return*/, AuthorityMetadataSource.CACHE];
|
|
6938
7106
|
}
|
|
6939
7107
|
harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
|
|
7108
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
6940
7109
|
return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];
|
|
6941
7110
|
case 1:
|
|
6942
|
-
metadata =
|
|
7111
|
+
metadata = _g.sent();
|
|
6943
7112
|
if (!metadata) return [3 /*break*/, 4];
|
|
6944
|
-
if (!((
|
|
7113
|
+
if (!((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.azureRegion)) return [3 /*break*/, 3];
|
|
7114
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
6945
7115
|
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(metadata)];
|
|
6946
7116
|
case 2:
|
|
6947
|
-
metadata =
|
|
6948
|
-
|
|
7117
|
+
metadata = _g.sent();
|
|
7118
|
+
_g.label = 3;
|
|
6949
7119
|
case 3:
|
|
6950
7120
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
6951
7121
|
return [2 /*return*/, AuthorityMetadataSource.NETWORK];
|
|
6952
7122
|
case 4:
|
|
6953
7123
|
if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];
|
|
6954
|
-
if (!((
|
|
7124
|
+
if (!((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion)) return [3 /*break*/, 6];
|
|
7125
|
+
(_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
6955
7126
|
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(harcodedMetadata)];
|
|
6956
7127
|
case 5:
|
|
6957
|
-
harcodedMetadata =
|
|
6958
|
-
|
|
7128
|
+
harcodedMetadata = _g.sent();
|
|
7129
|
+
_g.label = 6;
|
|
6959
7130
|
case 6:
|
|
6960
7131
|
metadataEntity.updateEndpointMetadata(harcodedMetadata, false);
|
|
6961
7132
|
return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
|
|
@@ -6995,25 +7166,24 @@ var Authority = /** @class */ (function () {
|
|
|
6995
7166
|
* @param hasHardcodedMetadata boolean
|
|
6996
7167
|
*/
|
|
6997
7168
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
7169
|
+
var _a;
|
|
6998
7170
|
return __awaiter(this, void 0, void 0, function () {
|
|
6999
7171
|
var options, response;
|
|
7000
|
-
return __generator(this, function (
|
|
7001
|
-
switch (
|
|
7172
|
+
return __generator(this, function (_b) {
|
|
7173
|
+
switch (_b.label) {
|
|
7002
7174
|
case 0:
|
|
7175
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7003
7176
|
options = {};
|
|
7004
|
-
|
|
7005
|
-
options.proxyUrl = this.proxyUrl;
|
|
7006
|
-
}
|
|
7007
|
-
_a.label = 1;
|
|
7177
|
+
_b.label = 1;
|
|
7008
7178
|
case 1:
|
|
7009
|
-
|
|
7179
|
+
_b.trys.push([1, 3, , 4]);
|
|
7010
7180
|
return [4 /*yield*/, this.networkInterface.
|
|
7011
7181
|
sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
7012
7182
|
case 2:
|
|
7013
|
-
response =
|
|
7183
|
+
response = _b.sent();
|
|
7014
7184
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
7015
7185
|
case 3:
|
|
7016
|
-
|
|
7186
|
+
_b.sent();
|
|
7017
7187
|
return [2 /*return*/, null];
|
|
7018
7188
|
case 4: return [2 /*return*/];
|
|
7019
7189
|
}
|
|
@@ -7033,25 +7203,28 @@ var Authority = /** @class */ (function () {
|
|
|
7033
7203
|
* Update the retrieved metadata with regional information.
|
|
7034
7204
|
*/
|
|
7035
7205
|
Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {
|
|
7036
|
-
var _a, _b, _c, _d, _e;
|
|
7206
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7037
7207
|
return __awaiter(this, void 0, void 0, function () {
|
|
7038
7208
|
var autodetectedRegionName, azureRegion;
|
|
7039
|
-
return __generator(this, function (
|
|
7040
|
-
switch (
|
|
7041
|
-
case 0:
|
|
7209
|
+
return __generator(this, function (_h) {
|
|
7210
|
+
switch (_h.label) {
|
|
7211
|
+
case 0:
|
|
7212
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7213
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7214
|
+
return [4 /*yield*/, this.regionDiscovery.detectRegion((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.environmentRegion, this.regionDiscoveryMetadata)];
|
|
7042
7215
|
case 1:
|
|
7043
|
-
autodetectedRegionName =
|
|
7044
|
-
azureRegion = ((
|
|
7216
|
+
autodetectedRegionName = _h.sent();
|
|
7217
|
+
azureRegion = ((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
7045
7218
|
? autodetectedRegionName
|
|
7046
|
-
: (
|
|
7047
|
-
if (((
|
|
7219
|
+
: (_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion;
|
|
7220
|
+
if (((_f = this.authorityOptions.azureRegionConfiguration) === null || _f === void 0 ? void 0 : _f.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
7048
7221
|
this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
|
|
7049
7222
|
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
|
|
7050
7223
|
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
7051
7224
|
}
|
|
7052
7225
|
else {
|
|
7053
7226
|
if (autodetectedRegionName) {
|
|
7054
|
-
this.regionDiscoveryMetadata.region_outcome = (((
|
|
7227
|
+
this.regionDiscoveryMetadata.region_outcome = (((_g = this.authorityOptions.azureRegionConfiguration) === null || _g === void 0 ? void 0 : _g.azureRegion) === autodetectedRegionName) ?
|
|
7055
7228
|
RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
|
|
7056
7229
|
RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
|
|
7057
7230
|
}
|
|
@@ -7075,11 +7248,13 @@ var Authority = /** @class */ (function () {
|
|
|
7075
7248
|
* @param newMetadata
|
|
7076
7249
|
*/
|
|
7077
7250
|
Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
|
|
7251
|
+
var _a, _b;
|
|
7078
7252
|
return __awaiter(this, void 0, void 0, function () {
|
|
7079
7253
|
var metadata, metadataEntityExpired, harcodedMetadata;
|
|
7080
|
-
return __generator(this, function (
|
|
7081
|
-
switch (
|
|
7254
|
+
return __generator(this, function (_c) {
|
|
7255
|
+
switch (_c.label) {
|
|
7082
7256
|
case 0:
|
|
7257
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7083
7258
|
this.logger.verbose("Attempting to get cloud discovery metadata in the config");
|
|
7084
7259
|
this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
|
|
7085
7260
|
this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
|
|
@@ -7102,9 +7277,10 @@ var Authority = /** @class */ (function () {
|
|
|
7102
7277
|
this.logger.verbose("The metadata entity is expired.");
|
|
7103
7278
|
}
|
|
7104
7279
|
this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
|
|
7280
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7105
7281
|
return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
|
|
7106
7282
|
case 1:
|
|
7107
|
-
metadata =
|
|
7283
|
+
metadata = _c.sent();
|
|
7108
7284
|
if (metadata) {
|
|
7109
7285
|
this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
|
|
7110
7286
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
|
|
@@ -7162,23 +7338,22 @@ var Authority = /** @class */ (function () {
|
|
|
7162
7338
|
* @param hasHardcodedMetadata boolean
|
|
7163
7339
|
*/
|
|
7164
7340
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
7341
|
+
var _a;
|
|
7165
7342
|
return __awaiter(this, void 0, void 0, function () {
|
|
7166
7343
|
var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;
|
|
7167
|
-
return __generator(this, function (
|
|
7168
|
-
switch (
|
|
7344
|
+
return __generator(this, function (_b) {
|
|
7345
|
+
switch (_b.label) {
|
|
7169
7346
|
case 0:
|
|
7347
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7170
7348
|
instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
|
|
7171
7349
|
options = {};
|
|
7172
|
-
if (this.proxyUrl) {
|
|
7173
|
-
options.proxyUrl = this.proxyUrl;
|
|
7174
|
-
}
|
|
7175
7350
|
match = null;
|
|
7176
|
-
|
|
7351
|
+
_b.label = 1;
|
|
7177
7352
|
case 1:
|
|
7178
|
-
|
|
7353
|
+
_b.trys.push([1, 3, , 4]);
|
|
7179
7354
|
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
7180
7355
|
case 2:
|
|
7181
|
-
response =
|
|
7356
|
+
response = _b.sent();
|
|
7182
7357
|
typedResponseBody = void 0;
|
|
7183
7358
|
metadata = void 0;
|
|
7184
7359
|
if (isCloudInstanceDiscoveryResponse(response.body)) {
|
|
@@ -7206,7 +7381,7 @@ var Authority = /** @class */ (function () {
|
|
|
7206
7381
|
match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
|
|
7207
7382
|
return [3 /*break*/, 4];
|
|
7208
7383
|
case 3:
|
|
7209
|
-
error_1 =
|
|
7384
|
+
error_1 = _b.sent();
|
|
7210
7385
|
if (error_1 instanceof AuthError) {
|
|
7211
7386
|
this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: " + error_1.errorCode + "\nError Description: " + error_1.errorMessage);
|
|
7212
7387
|
}
|
|
@@ -7351,7 +7526,7 @@ var Authority = /** @class */ (function () {
|
|
|
7351
7526
|
return Authority;
|
|
7352
7527
|
}());
|
|
7353
7528
|
|
|
7354
|
-
/*! @azure/msal-common
|
|
7529
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7355
7530
|
|
|
7356
7531
|
/*
|
|
7357
7532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7370,16 +7545,18 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7370
7545
|
* @param networkClient
|
|
7371
7546
|
* @param protocolMode
|
|
7372
7547
|
*/
|
|
7373
|
-
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger,
|
|
7548
|
+
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
7374
7549
|
return __awaiter(this, void 0, void 0, function () {
|
|
7375
7550
|
var acquireTokenAuthority, e_1;
|
|
7376
7551
|
return __generator(this, function (_a) {
|
|
7377
7552
|
switch (_a.label) {
|
|
7378
7553
|
case 0:
|
|
7379
|
-
|
|
7554
|
+
performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.addQueueMeasurement(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
|
|
7555
|
+
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
7380
7556
|
_a.label = 1;
|
|
7381
7557
|
case 1:
|
|
7382
7558
|
_a.trys.push([1, 3, , 4]);
|
|
7559
|
+
performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
|
|
7383
7560
|
return [4 /*yield*/, acquireTokenAuthority.resolveEndpointsAsync()];
|
|
7384
7561
|
case 2:
|
|
7385
7562
|
_a.sent();
|
|
@@ -7402,17 +7579,17 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7402
7579
|
* @param networkInterface
|
|
7403
7580
|
* @param protocolMode
|
|
7404
7581
|
*/
|
|
7405
|
-
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger,
|
|
7582
|
+
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
7406
7583
|
// Throw error if authority url is empty
|
|
7407
7584
|
if (StringUtils.isEmpty(authorityUrl)) {
|
|
7408
7585
|
throw ClientConfigurationError.createUrlEmptyError();
|
|
7409
7586
|
}
|
|
7410
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger,
|
|
7587
|
+
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
7411
7588
|
};
|
|
7412
7589
|
return AuthorityFactory;
|
|
7413
7590
|
}());
|
|
7414
7591
|
|
|
7415
|
-
/*! @azure/msal-common
|
|
7592
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7416
7593
|
|
|
7417
7594
|
/*
|
|
7418
7595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7443,7 +7620,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
7443
7620
|
return ServerTelemetryEntity;
|
|
7444
7621
|
}());
|
|
7445
7622
|
|
|
7446
|
-
/*! @azure/msal-common
|
|
7623
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7447
7624
|
|
|
7448
7625
|
/*
|
|
7449
7626
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7471,7 +7648,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
7471
7648
|
return ThrottlingEntity;
|
|
7472
7649
|
}());
|
|
7473
7650
|
|
|
7474
|
-
/*! @azure/msal-common
|
|
7651
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7475
7652
|
|
|
7476
7653
|
/*
|
|
7477
7654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7488,7 +7665,7 @@ var StubbedNetworkModule = {
|
|
|
7488
7665
|
}
|
|
7489
7666
|
};
|
|
7490
7667
|
|
|
7491
|
-
/*! @azure/msal-common
|
|
7668
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7492
7669
|
|
|
7493
7670
|
/*
|
|
7494
7671
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7533,7 +7710,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
|
|
|
7533
7710
|
return JoseHeaderError;
|
|
7534
7711
|
}(AuthError));
|
|
7535
7712
|
|
|
7536
|
-
/*! @azure/msal-common
|
|
7713
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7537
7714
|
|
|
7538
7715
|
/*
|
|
7539
7716
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7573,7 +7750,7 @@ var JoseHeader = /** @class */ (function () {
|
|
|
7573
7750
|
return JoseHeader;
|
|
7574
7751
|
}());
|
|
7575
7752
|
|
|
7576
|
-
/*! @azure/msal-common
|
|
7753
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7577
7754
|
|
|
7578
7755
|
/*
|
|
7579
7756
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7632,7 +7809,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
7632
7809
|
return AuthenticationHeaderParser;
|
|
7633
7810
|
}());
|
|
7634
7811
|
|
|
7635
|
-
/*! @azure/msal-common
|
|
7812
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7636
7813
|
|
|
7637
7814
|
/*
|
|
7638
7815
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7794,7 +7971,7 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7794
7971
|
return ServerTelemetryManager;
|
|
7795
7972
|
}());
|
|
7796
7973
|
|
|
7797
|
-
/*! @azure/msal-common
|
|
7974
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7798
7975
|
|
|
7799
7976
|
/*
|
|
7800
7977
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7823,7 +8000,118 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7823
8000
|
this.eventsByCorrelationId = new Map();
|
|
7824
8001
|
this.staticFieldsByCorrelationId = new Map();
|
|
7825
8002
|
this.measurementsById = new Map();
|
|
8003
|
+
this.queueMeasurements = new Map();
|
|
8004
|
+
this.preQueueTimeByCorrelationId = new Map();
|
|
8005
|
+
this.countersByCorrelationId = new Map();
|
|
7826
8006
|
}
|
|
8007
|
+
/**
|
|
8008
|
+
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
8009
|
+
* Note: this function can be changed to abstract at the next major version bump.
|
|
8010
|
+
*
|
|
8011
|
+
* @param {string} measureName
|
|
8012
|
+
* @param {string} correlationId
|
|
8013
|
+
* @returns {IPerformanceMeasurement}
|
|
8014
|
+
*/
|
|
8015
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8016
|
+
PerformanceClient.prototype.startPerformanceMeasurement = function (measureName, correlationId) {
|
|
8017
|
+
return {};
|
|
8018
|
+
};
|
|
8019
|
+
/**
|
|
8020
|
+
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
8021
|
+
* Note: this incorrectly-named function will be removed at the next major version bump.
|
|
8022
|
+
*
|
|
8023
|
+
* @param {string} measureName
|
|
8024
|
+
* @param {string} correlationId
|
|
8025
|
+
* @returns {IPerformanceMeasurement}
|
|
8026
|
+
*/
|
|
8027
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8028
|
+
PerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
8029
|
+
return {};
|
|
8030
|
+
};
|
|
8031
|
+
/**
|
|
8032
|
+
* Get integral fields.
|
|
8033
|
+
* Override to change the set.
|
|
8034
|
+
*/
|
|
8035
|
+
PerformanceClient.prototype.getIntFields = function () {
|
|
8036
|
+
return IntFields;
|
|
8037
|
+
};
|
|
8038
|
+
/**
|
|
8039
|
+
* Gets map of pre-queue times by correlation Id
|
|
8040
|
+
*
|
|
8041
|
+
* @param {PerformanceEvents} eventName
|
|
8042
|
+
* @param {string} correlationId
|
|
8043
|
+
* @returns {number}
|
|
8044
|
+
*/
|
|
8045
|
+
PerformanceClient.prototype.getPreQueueTime = function (eventName, correlationId) {
|
|
8046
|
+
var preQueueTimesByEvents = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
8047
|
+
if (!preQueueTimesByEvents) {
|
|
8048
|
+
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: " + correlationId + ", unable to add queue measurement");
|
|
8049
|
+
return;
|
|
8050
|
+
}
|
|
8051
|
+
else if (!preQueueTimesByEvents.get(eventName)) {
|
|
8052
|
+
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue time found for " + eventName + ", unable to add queue measurement");
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
return preQueueTimesByEvents.get(eventName);
|
|
8056
|
+
};
|
|
8057
|
+
/**
|
|
8058
|
+
* Calculates the difference between current time and time when function was queued.
|
|
8059
|
+
* Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.
|
|
8060
|
+
*
|
|
8061
|
+
* @param {number} preQueueTime
|
|
8062
|
+
* @param {number} currentTime
|
|
8063
|
+
* @returns {number}
|
|
8064
|
+
*/
|
|
8065
|
+
PerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {
|
|
8066
|
+
if (preQueueTime < 1) {
|
|
8067
|
+
this.logger.trace("PerformanceClient: preQueueTime should be a positive integer and not " + preQueueTime);
|
|
8068
|
+
return 0;
|
|
8069
|
+
}
|
|
8070
|
+
if (currentTime < 1) {
|
|
8071
|
+
this.logger.trace("PerformanceClient: currentTime should be a positive integer and not " + currentTime);
|
|
8072
|
+
return 0;
|
|
8073
|
+
}
|
|
8074
|
+
if (currentTime < preQueueTime) {
|
|
8075
|
+
this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved");
|
|
8076
|
+
return 0;
|
|
8077
|
+
}
|
|
8078
|
+
return currentTime - preQueueTime;
|
|
8079
|
+
};
|
|
8080
|
+
/**
|
|
8081
|
+
* Adds queue measurement time to QueueMeasurements array for given correlation ID.
|
|
8082
|
+
*
|
|
8083
|
+
* @param {PerformanceEvents} name
|
|
8084
|
+
* @param {?string} correlationId
|
|
8085
|
+
* @param {?number} time
|
|
8086
|
+
* @returns
|
|
8087
|
+
*/
|
|
8088
|
+
PerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {
|
|
8089
|
+
if (!correlationId) {
|
|
8090
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: correlationId not provided for " + eventName + ", cannot add queue measurement");
|
|
8091
|
+
return;
|
|
8092
|
+
}
|
|
8093
|
+
if (queueTime === 0) {
|
|
8094
|
+
// Possible for there to be no queue time after calculation
|
|
8095
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: queue time provided for " + eventName + " is " + queueTime);
|
|
8096
|
+
}
|
|
8097
|
+
else if (!queueTime) {
|
|
8098
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: no queue time provided for " + eventName);
|
|
8099
|
+
return;
|
|
8100
|
+
}
|
|
8101
|
+
var queueMeasurement = { eventName: eventName, queueTime: queueTime };
|
|
8102
|
+
// Adds to existing correlation Id if present in queueMeasurements
|
|
8103
|
+
var existingMeasurements = this.queueMeasurements.get(correlationId);
|
|
8104
|
+
if (existingMeasurements) {
|
|
8105
|
+
existingMeasurements.push(queueMeasurement);
|
|
8106
|
+
this.queueMeasurements.set(correlationId, existingMeasurements);
|
|
8107
|
+
}
|
|
8108
|
+
else {
|
|
8109
|
+
// Sets new correlation Id if not present in queueMeasurements
|
|
8110
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: adding correlationId " + correlationId + " to queue measurements");
|
|
8111
|
+
var measurementArray = [queueMeasurement];
|
|
8112
|
+
this.queueMeasurements.set(correlationId, measurementArray);
|
|
8113
|
+
}
|
|
8114
|
+
};
|
|
7827
8115
|
/**
|
|
7828
8116
|
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
7829
8117
|
*
|
|
@@ -7839,9 +8127,19 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7839
8127
|
if (!correlationId) {
|
|
7840
8128
|
this.logger.info("PerformanceClient: No correlation id provided for " + measureName + ", generating", eventCorrelationId);
|
|
7841
8129
|
}
|
|
8130
|
+
// Duplicate code to address spelling error will be removed at the next major version bump.
|
|
7842
8131
|
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
|
|
7843
|
-
var
|
|
7844
|
-
|
|
8132
|
+
var validMeasurement;
|
|
8133
|
+
var performanceMeasuremeant = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);
|
|
8134
|
+
if (performanceMeasuremeant.startMeasurement) {
|
|
8135
|
+
performanceMeasuremeant.startMeasurement();
|
|
8136
|
+
validMeasurement = performanceMeasuremeant;
|
|
8137
|
+
}
|
|
8138
|
+
else {
|
|
8139
|
+
var performanceMeasurement = this.startPerformanceMeasurement(measureName, eventCorrelationId);
|
|
8140
|
+
performanceMeasurement.startMeasurement();
|
|
8141
|
+
validMeasurement = performanceMeasurement;
|
|
8142
|
+
}
|
|
7845
8143
|
var inProgressEvent = {
|
|
7846
8144
|
eventId: this.generateId(),
|
|
7847
8145
|
status: PerformanceEventStatus.InProgress,
|
|
@@ -7860,7 +8158,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7860
8158
|
appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
|
|
7861
8159
|
};
|
|
7862
8160
|
this.addStaticFields(staticFields, eventCorrelationId);
|
|
7863
|
-
this.cacheMeasurement(inProgressEvent,
|
|
8161
|
+
this.cacheMeasurement(inProgressEvent, validMeasurement);
|
|
7864
8162
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
7865
8163
|
return {
|
|
7866
8164
|
endMeasurement: function (event) {
|
|
@@ -7880,7 +8178,10 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7880
8178
|
addStaticFields: function (fields) {
|
|
7881
8179
|
return _this.addStaticFields(fields, inProgressEvent.correlationId);
|
|
7882
8180
|
},
|
|
7883
|
-
|
|
8181
|
+
increment: function (counters) {
|
|
8182
|
+
return _this.increment(counters, inProgressEvent.correlationId);
|
|
8183
|
+
},
|
|
8184
|
+
measurement: validMeasurement,
|
|
7884
8185
|
event: inProgressEvent
|
|
7885
8186
|
};
|
|
7886
8187
|
};
|
|
@@ -7931,6 +8232,26 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7931
8232
|
this.staticFieldsByCorrelationId.set(correlationId, fields);
|
|
7932
8233
|
}
|
|
7933
8234
|
};
|
|
8235
|
+
/**
|
|
8236
|
+
* Increment counters to be emitted when the measurements are flushed
|
|
8237
|
+
* @param counters {Counters}
|
|
8238
|
+
* @param correlationId {string} correlation identifier
|
|
8239
|
+
*/
|
|
8240
|
+
PerformanceClient.prototype.increment = function (counters, correlationId) {
|
|
8241
|
+
var existing = this.countersByCorrelationId.get(correlationId);
|
|
8242
|
+
if (!existing) {
|
|
8243
|
+
this.logger.trace("PerformanceClient: Setting counters");
|
|
8244
|
+
this.countersByCorrelationId.set(correlationId, __assign({}, counters));
|
|
8245
|
+
return;
|
|
8246
|
+
}
|
|
8247
|
+
this.logger.trace("PerformanceClient: Updating counters");
|
|
8248
|
+
for (var counter in counters) {
|
|
8249
|
+
if (!existing.hasOwnProperty(counter)) {
|
|
8250
|
+
existing[counter] = 0;
|
|
8251
|
+
}
|
|
8252
|
+
existing[counter] += counters[counter];
|
|
8253
|
+
}
|
|
8254
|
+
};
|
|
7934
8255
|
/**
|
|
7935
8256
|
* Upserts event into event cache.
|
|
7936
8257
|
* First key is the correlation id, second key is the event id.
|
|
@@ -7970,18 +8291,36 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7970
8291
|
PerformanceClient.prototype.flushMeasurements = function (measureName, correlationId) {
|
|
7971
8292
|
var _this = this;
|
|
7972
8293
|
this.logger.trace("PerformanceClient: Performance measurements flushed for " + measureName, correlationId);
|
|
8294
|
+
/**
|
|
8295
|
+
* Adds all queue time and count measurements for given correlation ID
|
|
8296
|
+
* then deletes queue times for given correlation ID from queueMeasurements map.
|
|
8297
|
+
*/
|
|
8298
|
+
var queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);
|
|
8299
|
+
if (!queueMeasurementForCorrelationId) {
|
|
8300
|
+
this.logger.trace("PerformanceClient: no queue measurements found for for correlationId: " + correlationId);
|
|
8301
|
+
}
|
|
8302
|
+
var totalQueueTime = 0;
|
|
8303
|
+
var totalQueueCount = 0;
|
|
8304
|
+
queueMeasurementForCorrelationId === null || queueMeasurementForCorrelationId === void 0 ? void 0 : queueMeasurementForCorrelationId.forEach(function (measurement) {
|
|
8305
|
+
totalQueueTime += measurement.queueTime;
|
|
8306
|
+
totalQueueCount++;
|
|
8307
|
+
});
|
|
7973
8308
|
var eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);
|
|
8309
|
+
var staticFields = this.staticFieldsByCorrelationId.get(correlationId);
|
|
8310
|
+
var counters = this.countersByCorrelationId.get(correlationId);
|
|
7974
8311
|
if (eventsForCorrelationId) {
|
|
7975
|
-
this.
|
|
8312
|
+
this.discardCache(correlationId);
|
|
7976
8313
|
/*
|
|
7977
8314
|
* Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.
|
|
7978
8315
|
* Incomplete submeasurements are likely an instrumentation bug that should be fixed.
|
|
7979
8316
|
* IE only supports Map.forEach.
|
|
7980
8317
|
*/
|
|
7981
8318
|
var completedEvents_1 = [];
|
|
8319
|
+
var incompleteSubsCount_1 = 0;
|
|
7982
8320
|
eventsForCorrelationId.forEach(function (event) {
|
|
7983
8321
|
if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {
|
|
7984
8322
|
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + event.name + " found for " + measureName, correlationId);
|
|
8323
|
+
incompleteSubsCount_1++;
|
|
7985
8324
|
var completedEvent = _this.endMeasurement(event);
|
|
7986
8325
|
if (completedEvent) {
|
|
7987
8326
|
completedEvents_1.push(completedEvent);
|
|
@@ -8023,8 +8362,8 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8023
8362
|
}
|
|
8024
8363
|
return previous;
|
|
8025
8364
|
}, topLevelEvent);
|
|
8026
|
-
var
|
|
8027
|
-
|
|
8365
|
+
var finalEvent = __assign(__assign(__assign(__assign({}, eventToEmit), staticFields), counters), { queuedTimeMs: totalQueueTime, queuedCount: totalQueueCount, incompleteSubsCount: incompleteSubsCount_1 });
|
|
8366
|
+
this.truncateIntegralFields(finalEvent, this.getIntFields());
|
|
8028
8367
|
this.emitEvents([finalEvent], eventToEmit.correlationId);
|
|
8029
8368
|
}
|
|
8030
8369
|
else {
|
|
@@ -8044,6 +8383,22 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8044
8383
|
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
8045
8384
|
this.eventsByCorrelationId.delete(correlationId);
|
|
8046
8385
|
};
|
|
8386
|
+
/**
|
|
8387
|
+
* Removes cache for a given correlation id.
|
|
8388
|
+
*
|
|
8389
|
+
* @param {string} correlation identifier
|
|
8390
|
+
*/
|
|
8391
|
+
PerformanceClient.prototype.discardCache = function (correlationId) {
|
|
8392
|
+
this.discardMeasurements(correlationId);
|
|
8393
|
+
this.logger.trace("PerformanceClient: Static fields discarded", correlationId);
|
|
8394
|
+
this.staticFieldsByCorrelationId.delete(correlationId);
|
|
8395
|
+
this.logger.trace("PerformanceClient: Counters discarded", correlationId);
|
|
8396
|
+
this.countersByCorrelationId.delete(correlationId);
|
|
8397
|
+
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
8398
|
+
this.queueMeasurements.delete(correlationId);
|
|
8399
|
+
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
8400
|
+
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
8401
|
+
};
|
|
8047
8402
|
/**
|
|
8048
8403
|
* Registers a callback function to receive performance events.
|
|
8049
8404
|
*
|
|
@@ -8086,10 +8441,22 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8086
8441
|
callback.apply(null, [events]);
|
|
8087
8442
|
});
|
|
8088
8443
|
};
|
|
8444
|
+
/**
|
|
8445
|
+
* Enforce truncation of integral fields in performance event.
|
|
8446
|
+
* @param {PerformanceEvent} event performance event to update.
|
|
8447
|
+
* @param {Set<string>} intFields integral fields.
|
|
8448
|
+
*/
|
|
8449
|
+
PerformanceClient.prototype.truncateIntegralFields = function (event, intFields) {
|
|
8450
|
+
intFields.forEach(function (key) {
|
|
8451
|
+
if (key in event && typeof event[key] === "number") {
|
|
8452
|
+
event[key] = Math.floor(event[key]);
|
|
8453
|
+
}
|
|
8454
|
+
});
|
|
8455
|
+
};
|
|
8089
8456
|
return PerformanceClient;
|
|
8090
8457
|
}());
|
|
8091
8458
|
|
|
8092
|
-
/*! @azure/msal-common
|
|
8459
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
8093
8460
|
|
|
8094
8461
|
/*
|
|
8095
8462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8115,9 +8482,24 @@ var StubPerformanceClient = /** @class */ (function (_super) {
|
|
|
8115
8482
|
StubPerformanceClient.prototype.generateId = function () {
|
|
8116
8483
|
return "callback-id";
|
|
8117
8484
|
};
|
|
8485
|
+
StubPerformanceClient.prototype.startPerformanceMeasuremeant = function () {
|
|
8486
|
+
return new StubPerformanceMeasurement();
|
|
8487
|
+
};
|
|
8118
8488
|
StubPerformanceClient.prototype.startPerformanceMeasurement = function () {
|
|
8119
8489
|
return new StubPerformanceMeasurement();
|
|
8120
8490
|
};
|
|
8491
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8492
|
+
StubPerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {
|
|
8493
|
+
return 0;
|
|
8494
|
+
};
|
|
8495
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8496
|
+
StubPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {
|
|
8497
|
+
return;
|
|
8498
|
+
};
|
|
8499
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8500
|
+
StubPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {
|
|
8501
|
+
return;
|
|
8502
|
+
};
|
|
8121
8503
|
return StubPerformanceClient;
|
|
8122
8504
|
}(PerformanceClient));
|
|
8123
8505
|
|
|
@@ -9979,7 +10361,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
|
9979
10361
|
|
|
9980
10362
|
/* eslint-disable header/header */
|
|
9981
10363
|
var name = "@azure/msal-browser";
|
|
9982
|
-
var version = "2.
|
|
10364
|
+
var version = "2.33.0";
|
|
9983
10365
|
|
|
9984
10366
|
/*
|
|
9985
10367
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10450,6 +10832,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10450
10832
|
return __generator$1(this, function (_b) {
|
|
10451
10833
|
switch (_b.label) {
|
|
10452
10834
|
case 0:
|
|
10835
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
10453
10836
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
10454
10837
|
authority = request.authority || this.config.auth.authority;
|
|
10455
10838
|
scopes = __spread(((request && request.scopes) || []));
|
|
@@ -10567,6 +10950,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10567
10950
|
return __generator$1(this, function (_a) {
|
|
10568
10951
|
switch (_a.label) {
|
|
10569
10952
|
case 0:
|
|
10953
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
10570
10954
|
this.logger.verbose("initializeAuthorizationRequest called", request.correlationId);
|
|
10571
10955
|
return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];
|
|
10572
10956
|
case 1:
|
|
@@ -10667,10 +11051,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10667
11051
|
var clientConfig;
|
|
10668
11052
|
return __generator$1(this, function (_a) {
|
|
10669
11053
|
switch (_a.label) {
|
|
10670
|
-
case 0:
|
|
11054
|
+
case 0:
|
|
11055
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
|
11056
|
+
// Create auth module.
|
|
11057
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11058
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
|
|
10671
11059
|
case 1:
|
|
10672
11060
|
clientConfig = _a.sent();
|
|
10673
|
-
return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
|
|
11061
|
+
return [2 /*return*/, new AuthorizationCodeClient(clientConfig, this.performanceClient)];
|
|
10674
11062
|
}
|
|
10675
11063
|
});
|
|
10676
11064
|
});
|
|
@@ -10687,7 +11075,9 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10687
11075
|
return __generator$1(this, function (_a) {
|
|
10688
11076
|
switch (_a.label) {
|
|
10689
11077
|
case 0:
|
|
11078
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
10690
11079
|
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
11080
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10691
11081
|
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
|
|
10692
11082
|
case 1:
|
|
10693
11083
|
discoveredAuthority = _a.sent();
|
|
@@ -10755,6 +11145,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10755
11145
|
return __generator$1(this, function (_b) {
|
|
10756
11146
|
switch (_b.label) {
|
|
10757
11147
|
case 0:
|
|
11148
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10758
11149
|
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
10759
11150
|
getAuthorityMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10760
11151
|
authorityOptions = {
|
|
@@ -10767,7 +11158,8 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10767
11158
|
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
10768
11159
|
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
10769
11160
|
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
|
|
10770
|
-
|
|
11161
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
11162
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
10771
11163
|
.then(function (result) {
|
|
10772
11164
|
getAuthorityMeasurement.endMeasurement({
|
|
10773
11165
|
success: true,
|
|
@@ -10798,12 +11190,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10798
11190
|
return __generator$1(this, function (_b) {
|
|
10799
11191
|
switch (_b.label) {
|
|
10800
11192
|
case 0:
|
|
11193
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
|
10801
11194
|
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
10802
11195
|
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
10803
11196
|
browserState = {
|
|
10804
11197
|
interactionType: interactionType
|
|
10805
11198
|
};
|
|
10806
11199
|
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
11200
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
10807
11201
|
_a = [{}];
|
|
10808
11202
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
10809
11203
|
case 1:
|
|
@@ -10837,11 +11231,12 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10837
11231
|
* Abstract class which defines operations for a browser interaction handling class.
|
|
10838
11232
|
*/
|
|
10839
11233
|
var InteractionHandler = /** @class */ (function () {
|
|
10840
|
-
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger) {
|
|
11234
|
+
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) {
|
|
10841
11235
|
this.authModule = authCodeModule;
|
|
10842
11236
|
this.browserStorage = storageImpl;
|
|
10843
11237
|
this.authCodeRequest = authCodeRequest;
|
|
10844
11238
|
this.logger = logger;
|
|
11239
|
+
this.performanceClient = performanceClient;
|
|
10845
11240
|
}
|
|
10846
11241
|
/**
|
|
10847
11242
|
* Function to handle response parameters from hash.
|
|
@@ -10851,6 +11246,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10851
11246
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10852
11247
|
var stateKey, requestState, authCodeResponse;
|
|
10853
11248
|
return __generator$1(this, function (_a) {
|
|
11249
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);
|
|
10854
11250
|
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
10855
11251
|
// Check that location hash isn't empty.
|
|
10856
11252
|
if (StringUtils.isEmpty(locationHash)) {
|
|
@@ -10873,6 +11269,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10873
11269
|
throw e;
|
|
10874
11270
|
}
|
|
10875
11271
|
}
|
|
11272
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
10876
11273
|
return [2 /*return*/, this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule)];
|
|
10877
11274
|
});
|
|
10878
11275
|
});
|
|
@@ -10892,6 +11289,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10892
11289
|
return __generator$1(this, function (_a) {
|
|
10893
11290
|
switch (_a.label) {
|
|
10894
11291
|
case 0:
|
|
11292
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
10895
11293
|
this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");
|
|
10896
11294
|
stateKey = this.browserStorage.generateStateKey(state);
|
|
10897
11295
|
requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
@@ -10903,6 +11301,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10903
11301
|
// Assign code to request
|
|
10904
11302
|
this.authCodeRequest.code = authCodeResponse.code;
|
|
10905
11303
|
if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];
|
|
11304
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
10906
11305
|
return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];
|
|
10907
11306
|
case 1:
|
|
10908
11307
|
_a.sent();
|
|
@@ -10923,6 +11322,8 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10923
11322
|
this.authCodeRequest.ccsCredential = cachedCcsCred;
|
|
10924
11323
|
}
|
|
10925
11324
|
}
|
|
11325
|
+
// Acquire token with retrieved code.
|
|
11326
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);
|
|
10926
11327
|
return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];
|
|
10927
11328
|
case 3:
|
|
10928
11329
|
tokenResponse = _a.sent();
|
|
@@ -10944,8 +11345,9 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10944
11345
|
return __generator$1(this, function (_a) {
|
|
10945
11346
|
switch (_a.label) {
|
|
10946
11347
|
case 0:
|
|
11348
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
10947
11349
|
cloudInstanceAuthorityUri = "https://" + cloudInstanceHostname + "/" + authority.tenant + "/";
|
|
10948
|
-
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger)];
|
|
11350
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger, this.performanceClient, this.authCodeRequest.correlationId)];
|
|
10949
11351
|
case 1:
|
|
10950
11352
|
cloudInstanceAuthority = _a.sent();
|
|
10951
11353
|
this.authModule.updateAuthority(cloudInstanceAuthority);
|
|
@@ -10980,8 +11382,8 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10980
11382
|
*/
|
|
10981
11383
|
var RedirectHandler = /** @class */ (function (_super) {
|
|
10982
11384
|
__extends$1(RedirectHandler, _super);
|
|
10983
|
-
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto) {
|
|
10984
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
11385
|
+
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto, performanceClient) {
|
|
11386
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;
|
|
10985
11387
|
_this.browserCrypto = browserCrypto;
|
|
10986
11388
|
return _this;
|
|
10987
11389
|
}
|
|
@@ -11299,7 +11701,10 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
11299
11701
|
var clientConfig;
|
|
11300
11702
|
return __generator$1(this, function (_a) {
|
|
11301
11703
|
switch (_a.label) {
|
|
11302
|
-
case 0:
|
|
11704
|
+
case 0:
|
|
11705
|
+
// Create auth module.
|
|
11706
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11707
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
11303
11708
|
case 1:
|
|
11304
11709
|
clientConfig = _a.sent();
|
|
11305
11710
|
return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];
|
|
@@ -11313,6 +11718,8 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
11313
11718
|
return __generator$1(this, function (_b) {
|
|
11314
11719
|
switch (_b.label) {
|
|
11315
11720
|
case 0:
|
|
11721
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
11722
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
11316
11723
|
_a = [__assign$1({}, request)];
|
|
11317
11724
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
11318
11725
|
case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
|
|
@@ -12063,7 +12470,9 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12063
12470
|
var _this = this;
|
|
12064
12471
|
return __generator$1(this, function (_a) {
|
|
12065
12472
|
switch (_a.label) {
|
|
12066
|
-
case 0:
|
|
12473
|
+
case 0:
|
|
12474
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
12475
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
|
|
12067
12476
|
case 1:
|
|
12068
12477
|
validRequest = _a.sent();
|
|
12069
12478
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
@@ -12078,14 +12487,18 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12078
12487
|
_a.label = 2;
|
|
12079
12488
|
case 2:
|
|
12080
12489
|
_a.trys.push([2, 7, , 8]);
|
|
12490
|
+
// Create auth code request and generate PKCE params
|
|
12491
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
12081
12492
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
12082
12493
|
case 3:
|
|
12083
12494
|
authCodeRequest = _a.sent();
|
|
12495
|
+
// Initialize the client
|
|
12496
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
12084
12497
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
12085
12498
|
case 4:
|
|
12086
12499
|
authClient = _a.sent();
|
|
12087
12500
|
this.logger.verbose("Auth code client created");
|
|
12088
|
-
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto);
|
|
12501
|
+
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto, this.performanceClient);
|
|
12089
12502
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, validRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme) }))];
|
|
12090
12503
|
case 5:
|
|
12091
12504
|
navigateUrl = _a.sent();
|
|
@@ -12271,12 +12684,13 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12271
12684
|
if (!currentAuthority) {
|
|
12272
12685
|
throw BrowserAuthError.createNoCachedAuthorityError();
|
|
12273
12686
|
}
|
|
12687
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, cachedRequest.correlationId);
|
|
12274
12688
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, currentAuthority)];
|
|
12275
12689
|
case 1:
|
|
12276
12690
|
authClient = _a.sent();
|
|
12277
12691
|
this.logger.verbose("Auth code client created");
|
|
12278
12692
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
|
12279
|
-
interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto);
|
|
12693
|
+
interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto, this.performanceClient);
|
|
12280
12694
|
return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
12281
12695
|
case 2: return [2 /*return*/, _a.sent()];
|
|
12282
12696
|
}
|
|
@@ -12311,6 +12725,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12311
12725
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
12312
12726
|
noHistory: false
|
|
12313
12727
|
};
|
|
12728
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);
|
|
12314
12729
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority)];
|
|
12315
12730
|
case 3:
|
|
12316
12731
|
authClient = _a.sent();
|
|
@@ -12458,6 +12873,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12458
12873
|
case 0:
|
|
12459
12874
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
12460
12875
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
|
|
12876
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
12461
12877
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
|
|
12462
12878
|
case 1:
|
|
12463
12879
|
validRequest = _a.sent();
|
|
@@ -12465,9 +12881,13 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12465
12881
|
_a.label = 2;
|
|
12466
12882
|
case 2:
|
|
12467
12883
|
_a.trys.push([2, 8, , 9]);
|
|
12884
|
+
// Create auth code request and generate PKCE params
|
|
12885
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
12468
12886
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
12469
12887
|
case 3:
|
|
12470
12888
|
authCodeRequest = _a.sent();
|
|
12889
|
+
// Initialize the client
|
|
12890
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
12471
12891
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
12472
12892
|
case 4:
|
|
12473
12893
|
authClient = _a.sent();
|
|
@@ -12480,7 +12900,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12480
12900
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, validRequest), { nativeBroker: isNativeBroker }))];
|
|
12481
12901
|
case 5:
|
|
12482
12902
|
navigateUrl = _a.sent();
|
|
12483
|
-
interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
|
|
12903
|
+
interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
|
12484
12904
|
popupParameters = {
|
|
12485
12905
|
popup: popup,
|
|
12486
12906
|
popupName: popupName,
|
|
@@ -12561,6 +12981,8 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12561
12981
|
case 2:
|
|
12562
12982
|
// Clear cache on logout
|
|
12563
12983
|
_a.sent();
|
|
12984
|
+
// Initialize the client
|
|
12985
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);
|
|
12564
12986
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
|
|
12565
12987
|
case 3:
|
|
12566
12988
|
authClient = _a.sent();
|
|
@@ -12989,8 +13411,8 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12989
13411
|
*/
|
|
12990
13412
|
var SilentHandler = /** @class */ (function (_super) {
|
|
12991
13413
|
__extends$1(SilentHandler, _super);
|
|
12992
|
-
function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions) {
|
|
12993
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
13414
|
+
function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions, performanceClient) {
|
|
13415
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;
|
|
12994
13416
|
_this.navigateFrameWait = systemOptions.navigateFrameWait;
|
|
12995
13417
|
_this.pollIntervalMilliseconds = systemOptions.pollIntervalMilliseconds;
|
|
12996
13418
|
return _this;
|
|
@@ -13002,24 +13424,20 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
13002
13424
|
*/
|
|
13003
13425
|
SilentHandler.prototype.initiateAuthRequest = function (requestUrl) {
|
|
13004
13426
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
switch (_b.label) {
|
|
13427
|
+
return __generator$1(this, function (_a) {
|
|
13428
|
+
switch (_a.label) {
|
|
13008
13429
|
case 0:
|
|
13430
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerInitiateAuthRequest, this.authCodeRequest.correlationId);
|
|
13009
13431
|
if (StringUtils.isEmpty(requestUrl)) {
|
|
13010
13432
|
// Throw error if request URL is empty.
|
|
13011
13433
|
this.logger.info("Navigate url is empty");
|
|
13012
13434
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
13013
13435
|
}
|
|
13014
13436
|
if (!this.navigateFrameWait) return [3 /*break*/, 2];
|
|
13437
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
13015
13438
|
return [4 /*yield*/, this.loadFrame(requestUrl)];
|
|
13016
|
-
case 1:
|
|
13017
|
-
|
|
13018
|
-
return [3 /*break*/, 3];
|
|
13019
|
-
case 2:
|
|
13020
|
-
_a = this.loadFrameSync(requestUrl);
|
|
13021
|
-
_b.label = 3;
|
|
13022
|
-
case 3: return [2 /*return*/, _a];
|
|
13439
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
13440
|
+
case 2: return [2 /*return*/, this.loadFrameSync(requestUrl)];
|
|
13023
13441
|
}
|
|
13024
13442
|
});
|
|
13025
13443
|
});
|
|
@@ -13031,6 +13449,7 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
13031
13449
|
*/
|
|
13032
13450
|
SilentHandler.prototype.monitorIframeForHash = function (iframe, timeout) {
|
|
13033
13451
|
var _this = this;
|
|
13452
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerMonitorIframeForHash, this.authCodeRequest.correlationId);
|
|
13034
13453
|
return new Promise(function (resolve, reject) {
|
|
13035
13454
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
13036
13455
|
_this.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower (" + timeout + "ms) than the default (" + DEFAULT_IFRAME_TIMEOUT_MS + "ms). This may result in timeouts.");
|
|
@@ -13079,11 +13498,12 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
13079
13498
|
* @ignore
|
|
13080
13499
|
*/
|
|
13081
13500
|
SilentHandler.prototype.loadFrame = function (urlNavigate) {
|
|
13501
|
+
var _this = this;
|
|
13502
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
13082
13503
|
/*
|
|
13083
13504
|
* This trick overcomes iframe navigation in IE
|
|
13084
13505
|
* IE does not load the page consistently in iframe
|
|
13085
13506
|
*/
|
|
13086
|
-
var _this = this;
|
|
13087
13507
|
return new Promise(function (resolve, reject) {
|
|
13088
13508
|
var frameHandle = _this.createHiddenIframe();
|
|
13089
13509
|
setTimeout(function () {
|
|
@@ -13158,6 +13578,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13158
13578
|
return __generator$1(this, function (_a) {
|
|
13159
13579
|
switch (_a.label) {
|
|
13160
13580
|
case 0:
|
|
13581
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
13161
13582
|
this.logger.verbose("acquireTokenByIframe called");
|
|
13162
13583
|
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
13163
13584
|
// Check that we have some SSO data
|
|
@@ -13171,6 +13592,8 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13171
13592
|
});
|
|
13172
13593
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
13173
13594
|
}
|
|
13595
|
+
// Create silent request
|
|
13596
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13174
13597
|
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: request.prompt || PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
13175
13598
|
case 1:
|
|
13176
13599
|
silentRequest = _a.sent();
|
|
@@ -13179,10 +13602,13 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13179
13602
|
_a.label = 2;
|
|
13180
13603
|
case 2:
|
|
13181
13604
|
_a.trys.push([2, 5, , 6]);
|
|
13605
|
+
// Initialize the client
|
|
13606
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13182
13607
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
13183
13608
|
case 3:
|
|
13184
13609
|
authClient = _a.sent();
|
|
13185
13610
|
this.logger.verbose("Auth code client created");
|
|
13611
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
13186
13612
|
return [4 /*yield*/, this.silentTokenHelper(authClient, silentRequest).then(function (result) {
|
|
13187
13613
|
acquireTokenMeasurement.endMeasurement({
|
|
13188
13614
|
success: true,
|
|
@@ -13229,16 +13655,26 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13229
13655
|
var _this = this;
|
|
13230
13656
|
return __generator$1(this, function (_a) {
|
|
13231
13657
|
switch (_a.label) {
|
|
13232
|
-
case 0:
|
|
13658
|
+
case 0:
|
|
13659
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);
|
|
13660
|
+
// Create auth code request and generate PKCE params
|
|
13661
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, silentRequest.correlationId);
|
|
13662
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
|
|
13233
13663
|
case 1:
|
|
13234
13664
|
authCodeRequest = _a.sent();
|
|
13665
|
+
// Create authorize request url
|
|
13666
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.GetAuthCodeUrl, silentRequest.correlationId);
|
|
13235
13667
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, silentRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme) }))];
|
|
13236
13668
|
case 2:
|
|
13237
13669
|
navigateUrl = _a.sent();
|
|
13238
|
-
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
|
|
13670
|
+
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
13671
|
+
// Get the frame handle for the silent request
|
|
13672
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerInitiateAuthRequest, silentRequest.correlationId);
|
|
13239
13673
|
return [4 /*yield*/, silentHandler.initiateAuthRequest(navigateUrl)];
|
|
13240
13674
|
case 3:
|
|
13241
13675
|
msalFrame = _a.sent();
|
|
13676
|
+
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
13677
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerMonitorIframeForHash, silentRequest.correlationId);
|
|
13242
13678
|
return [4 /*yield*/, silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout)];
|
|
13243
13679
|
case 4:
|
|
13244
13680
|
hash = _a.sent();
|
|
@@ -13256,6 +13692,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13256
13692
|
})];
|
|
13257
13693
|
}
|
|
13258
13694
|
// Handle response from hash string
|
|
13695
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.HandleCodeResponseFromHash, silentRequest.correlationId);
|
|
13259
13696
|
return [2 /*return*/, silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
13260
13697
|
}
|
|
13261
13698
|
});
|
|
@@ -13284,6 +13721,8 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13284
13721
|
return __generator$1(this, function (_b) {
|
|
13285
13722
|
switch (_b.label) {
|
|
13286
13723
|
case 0:
|
|
13724
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
13725
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
13287
13726
|
_a = [__assign$1({}, request)];
|
|
13288
13727
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
13289
13728
|
case 1:
|
|
@@ -13295,6 +13734,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13295
13734
|
refreshTokenClient = _b.sent();
|
|
13296
13735
|
this.logger.verbose("Refresh token client created");
|
|
13297
13736
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
13737
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
13298
13738
|
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)
|
|
13299
13739
|
.then(function (result) {
|
|
13300
13740
|
acquireTokenMeasurement.endMeasurement({
|
|
@@ -13337,7 +13777,10 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13337
13777
|
var clientConfig;
|
|
13338
13778
|
return __generator$1(this, function (_a) {
|
|
13339
13779
|
switch (_a.label) {
|
|
13340
|
-
case 0:
|
|
13780
|
+
case 0:
|
|
13781
|
+
// Create auth module.
|
|
13782
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
13783
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
13341
13784
|
case 1:
|
|
13342
13785
|
clientConfig = _a.sent();
|
|
13343
13786
|
return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];
|
|
@@ -14919,88 +15362,248 @@ var CryptoOps = /** @class */ (function () {
|
|
|
14919
15362
|
});
|
|
14920
15363
|
};
|
|
14921
15364
|
/**
|
|
14922
|
-
* Removes all cryptographic keys from IndexedDB storage
|
|
15365
|
+
* Removes all cryptographic keys from IndexedDB storage
|
|
15366
|
+
*/
|
|
15367
|
+
CryptoOps.prototype.clearKeystore = function () {
|
|
15368
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15369
|
+
return __generator$1(this, function (_a) {
|
|
15370
|
+
switch (_a.label) {
|
|
15371
|
+
case 0: return [4 /*yield*/, this.cache.clear()];
|
|
15372
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
15373
|
+
}
|
|
15374
|
+
});
|
|
15375
|
+
});
|
|
15376
|
+
};
|
|
15377
|
+
/**
|
|
15378
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
15379
|
+
* @param payload
|
|
15380
|
+
* @param kid
|
|
15381
|
+
*/
|
|
15382
|
+
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
15383
|
+
var _a;
|
|
15384
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15385
|
+
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, encodedKeyIdThumbprint, shrHeader, encodedShrHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
|
|
15386
|
+
return __generator$1(this, function (_b) {
|
|
15387
|
+
switch (_b.label) {
|
|
15388
|
+
case 0:
|
|
15389
|
+
signJwtMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
15390
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
|
|
15391
|
+
case 1:
|
|
15392
|
+
cachedKeyPair = _b.sent();
|
|
15393
|
+
if (!cachedKeyPair) {
|
|
15394
|
+
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
15395
|
+
}
|
|
15396
|
+
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
15397
|
+
case 2:
|
|
15398
|
+
publicKeyJwk = _b.sent();
|
|
15399
|
+
publicKeyJwkString = BrowserStringUtils.getSortedObjectString(publicKeyJwk);
|
|
15400
|
+
encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));
|
|
15401
|
+
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
15402
|
+
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
15403
|
+
// Generate payload
|
|
15404
|
+
payload.cnf = {
|
|
15405
|
+
jwk: JSON.parse(publicKeyJwkString)
|
|
15406
|
+
};
|
|
15407
|
+
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
15408
|
+
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
15409
|
+
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
15410
|
+
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
15411
|
+
case 3:
|
|
15412
|
+
signatureBuffer = _b.sent();
|
|
15413
|
+
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
15414
|
+
signedJwt = tokenString + "." + encodedSignature;
|
|
15415
|
+
if (signJwtMeasurement) {
|
|
15416
|
+
signJwtMeasurement.endMeasurement({
|
|
15417
|
+
success: true
|
|
15418
|
+
});
|
|
15419
|
+
}
|
|
15420
|
+
return [2 /*return*/, signedJwt];
|
|
15421
|
+
}
|
|
15422
|
+
});
|
|
15423
|
+
});
|
|
15424
|
+
};
|
|
15425
|
+
/**
|
|
15426
|
+
* Returns the SHA-256 hash of an input string
|
|
15427
|
+
* @param plainText
|
|
15428
|
+
*/
|
|
15429
|
+
CryptoOps.prototype.hashString = function (plainText) {
|
|
15430
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15431
|
+
var hashBuffer, hashBytes;
|
|
15432
|
+
return __generator$1(this, function (_a) {
|
|
15433
|
+
switch (_a.label) {
|
|
15434
|
+
case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];
|
|
15435
|
+
case 1:
|
|
15436
|
+
hashBuffer = _a.sent();
|
|
15437
|
+
hashBytes = new Uint8Array(hashBuffer);
|
|
15438
|
+
return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];
|
|
15439
|
+
}
|
|
15440
|
+
});
|
|
15441
|
+
});
|
|
15442
|
+
};
|
|
15443
|
+
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
15444
|
+
CryptoOps.EXTRACTABLE = true;
|
|
15445
|
+
return CryptoOps;
|
|
15446
|
+
}());
|
|
15447
|
+
|
|
15448
|
+
/*
|
|
15449
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15450
|
+
* Licensed under the MIT License.
|
|
15451
|
+
*/
|
|
15452
|
+
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
15453
|
+
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
15454
|
+
this.correlationId = correlationId;
|
|
15455
|
+
this.measureName = "msal.measure." + name + "." + this.correlationId;
|
|
15456
|
+
this.startMark = "msal.start." + name + "." + this.correlationId;
|
|
15457
|
+
this.endMark = "msal.end." + name + "." + this.correlationId;
|
|
15458
|
+
}
|
|
15459
|
+
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
15460
|
+
return typeof window !== "undefined" &&
|
|
15461
|
+
typeof window.performance !== "undefined" &&
|
|
15462
|
+
typeof window.performance.mark === "function" &&
|
|
15463
|
+
typeof window.performance.measure === "function" &&
|
|
15464
|
+
typeof window.performance.clearMarks === "function" &&
|
|
15465
|
+
typeof window.performance.clearMeasures === "function" &&
|
|
15466
|
+
typeof window.performance.getEntriesByName === "function";
|
|
15467
|
+
};
|
|
15468
|
+
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
15469
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15470
|
+
try {
|
|
15471
|
+
window.performance.mark(this.startMark);
|
|
15472
|
+
}
|
|
15473
|
+
catch (e) {
|
|
15474
|
+
// Silently catch
|
|
15475
|
+
}
|
|
15476
|
+
}
|
|
15477
|
+
};
|
|
15478
|
+
BrowserPerformanceMeasurement.prototype.endMeasurement = function () {
|
|
15479
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15480
|
+
try {
|
|
15481
|
+
window.performance.mark(this.endMark);
|
|
15482
|
+
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
15483
|
+
}
|
|
15484
|
+
catch (e) {
|
|
15485
|
+
// Silently catch
|
|
15486
|
+
}
|
|
15487
|
+
}
|
|
15488
|
+
};
|
|
15489
|
+
BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
15490
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15491
|
+
try {
|
|
15492
|
+
var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
15493
|
+
if (entriesForMeasurement.length > 0) {
|
|
15494
|
+
var durationMs = entriesForMeasurement[0].duration;
|
|
15495
|
+
window.performance.clearMeasures(this.measureName);
|
|
15496
|
+
window.performance.clearMarks(this.startMark);
|
|
15497
|
+
window.performance.clearMarks(this.endMark);
|
|
15498
|
+
return durationMs;
|
|
15499
|
+
}
|
|
15500
|
+
}
|
|
15501
|
+
catch (e) {
|
|
15502
|
+
// Silently catch and return null
|
|
15503
|
+
}
|
|
15504
|
+
}
|
|
15505
|
+
return null;
|
|
15506
|
+
};
|
|
15507
|
+
return BrowserPerformanceMeasurement;
|
|
15508
|
+
}());
|
|
15509
|
+
|
|
15510
|
+
/*
|
|
15511
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15512
|
+
* Licensed under the MIT License.
|
|
15513
|
+
*/
|
|
15514
|
+
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
15515
|
+
__extends$1(BrowserPerformanceClient, _super);
|
|
15516
|
+
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {
|
|
15517
|
+
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
15518
|
+
_this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);
|
|
15519
|
+
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
15520
|
+
return _this;
|
|
15521
|
+
}
|
|
15522
|
+
BrowserPerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
15523
|
+
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
15524
|
+
};
|
|
15525
|
+
BrowserPerformanceClient.prototype.generateId = function () {
|
|
15526
|
+
return this.guidGenerator.generateGuid();
|
|
15527
|
+
};
|
|
15528
|
+
BrowserPerformanceClient.prototype.getPageVisibility = function () {
|
|
15529
|
+
var _a;
|
|
15530
|
+
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
15531
|
+
};
|
|
15532
|
+
BrowserPerformanceClient.prototype.supportsBrowserPerformanceNow = function () {
|
|
15533
|
+
return typeof window !== "undefined" &&
|
|
15534
|
+
typeof window.performance !== "undefined" &&
|
|
15535
|
+
typeof window.performance.now === "function";
|
|
15536
|
+
};
|
|
15537
|
+
/**
|
|
15538
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
15539
|
+
* Also captures browser page visibilityState.
|
|
15540
|
+
*
|
|
15541
|
+
* @param {PerformanceEvents} measureName
|
|
15542
|
+
* @param {?string} [correlationId]
|
|
15543
|
+
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
14923
15544
|
*/
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
}
|
|
14931
|
-
});
|
|
14932
|
-
});
|
|
15545
|
+
BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
15546
|
+
var _this = this;
|
|
15547
|
+
// Capture page visibilityState and then invoke start/end measurement
|
|
15548
|
+
var startPageVisibility = this.getPageVisibility();
|
|
15549
|
+
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
15550
|
+
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
15551
|
+
return inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
15552
|
+
} });
|
|
14933
15553
|
};
|
|
14934
15554
|
/**
|
|
14935
|
-
*
|
|
14936
|
-
* @param
|
|
14937
|
-
* @param
|
|
15555
|
+
* Adds pre-queue time to preQueueTimeByCorrelationId map.
|
|
15556
|
+
* @param {PerformanceEvents} eventName
|
|
15557
|
+
* @param {?string} correlationId
|
|
15558
|
+
* @returns
|
|
14938
15559
|
*/
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
14959
|
-
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
14960
|
-
// Generate payload
|
|
14961
|
-
payload.cnf = {
|
|
14962
|
-
jwk: JSON.parse(publicKeyJwkString)
|
|
14963
|
-
};
|
|
14964
|
-
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
14965
|
-
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
14966
|
-
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
14967
|
-
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
14968
|
-
case 3:
|
|
14969
|
-
signatureBuffer = _b.sent();
|
|
14970
|
-
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
14971
|
-
signedJwt = tokenString + "." + encodedSignature;
|
|
14972
|
-
if (signJwtMeasurement) {
|
|
14973
|
-
signJwtMeasurement.endMeasurement({
|
|
14974
|
-
success: true
|
|
14975
|
-
});
|
|
14976
|
-
}
|
|
14977
|
-
return [2 /*return*/, signedJwt];
|
|
14978
|
-
}
|
|
14979
|
-
});
|
|
14980
|
-
});
|
|
15560
|
+
BrowserPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {
|
|
15561
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
15562
|
+
this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for " + eventName);
|
|
15563
|
+
return;
|
|
15564
|
+
}
|
|
15565
|
+
if (!correlationId) {
|
|
15566
|
+
this.logger.trace("BrowserPerformanceClient: correlationId for " + eventName + " not provided, unable to set telemetry queue time");
|
|
15567
|
+
return;
|
|
15568
|
+
}
|
|
15569
|
+
var preQueueTimesByEvents = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
15570
|
+
if (preQueueTimesByEvents) {
|
|
15571
|
+
preQueueTimesByEvents.set(eventName, window.performance.now());
|
|
15572
|
+
this.preQueueTimeByCorrelationId.set(correlationId, preQueueTimesByEvents);
|
|
15573
|
+
}
|
|
15574
|
+
else {
|
|
15575
|
+
var preQueueTimes = new Map();
|
|
15576
|
+
preQueueTimes.set(eventName, window.performance.now());
|
|
15577
|
+
this.preQueueTimeByCorrelationId.set(correlationId, preQueueTimes);
|
|
15578
|
+
}
|
|
14981
15579
|
};
|
|
14982
15580
|
/**
|
|
14983
|
-
*
|
|
14984
|
-
*
|
|
15581
|
+
* Calculates and adds queue time measurement for given performance event.
|
|
15582
|
+
*
|
|
15583
|
+
* @param {PerformanceEvents} name
|
|
15584
|
+
* @param {?string} correlationId
|
|
15585
|
+
* @param {?number} preQueueTime
|
|
15586
|
+
* @returns
|
|
14985
15587
|
*/
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
return
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
}
|
|
15588
|
+
BrowserPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId) {
|
|
15589
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
15590
|
+
this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to add queue measurement for " + eventName);
|
|
15591
|
+
return;
|
|
15592
|
+
}
|
|
15593
|
+
if (!correlationId) {
|
|
15594
|
+
this.logger.trace("BrowserPerformanceClient: correlationId for " + eventName + " not provided, unable to add queue measurement");
|
|
15595
|
+
return;
|
|
15596
|
+
}
|
|
15597
|
+
var preQueueTime = _super.prototype.getPreQueueTime.call(this, eventName, correlationId);
|
|
15598
|
+
if (!preQueueTime) {
|
|
15599
|
+
return;
|
|
15600
|
+
}
|
|
15601
|
+
var currentTime = window.performance.now();
|
|
15602
|
+
var queueTime = _super.prototype.calculateQueuedTime.call(this, preQueueTime, currentTime);
|
|
15603
|
+
return _super.prototype.addQueueMeasurement.call(this, eventName, correlationId, queueTime);
|
|
14999
15604
|
};
|
|
15000
|
-
|
|
15001
|
-
|
|
15002
|
-
return CryptoOps;
|
|
15003
|
-
}());
|
|
15605
|
+
return BrowserPerformanceClient;
|
|
15606
|
+
}(PerformanceClient));
|
|
15004
15607
|
|
|
15005
15608
|
/*
|
|
15006
15609
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -15022,7 +15625,9 @@ var internals = /*#__PURE__*/Object.freeze({
|
|
|
15022
15625
|
BrowserConstants: BrowserConstants,
|
|
15023
15626
|
get TemporaryCacheKeys () { return TemporaryCacheKeys; },
|
|
15024
15627
|
CryptoOps: CryptoOps,
|
|
15025
|
-
NativeAuthError: NativeAuthError
|
|
15628
|
+
NativeAuthError: NativeAuthError,
|
|
15629
|
+
BrowserPerformanceClient: BrowserPerformanceClient,
|
|
15630
|
+
BrowserPerformanceMeasurement: BrowserPerformanceMeasurement
|
|
15026
15631
|
});
|
|
15027
15632
|
|
|
15028
15633
|
/*
|
|
@@ -15285,6 +15890,8 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15285
15890
|
if (!request.code) {
|
|
15286
15891
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
15287
15892
|
}
|
|
15893
|
+
// Create silent request
|
|
15894
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
15288
15895
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
15289
15896
|
case 1:
|
|
15290
15897
|
silentRequest = _a.sent();
|
|
@@ -15294,12 +15901,14 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15294
15901
|
case 2:
|
|
15295
15902
|
_a.trys.push([2, 4, , 5]);
|
|
15296
15903
|
authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
|
|
15904
|
+
// Initialize the client
|
|
15905
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, request.correlationId);
|
|
15297
15906
|
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
|
|
15298
15907
|
case 3:
|
|
15299
15908
|
clientConfig = _a.sent();
|
|
15300
15909
|
authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
15301
15910
|
this.logger.verbose("Auth code client created");
|
|
15302
|
-
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
|
|
15911
|
+
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
15303
15912
|
// Handle auth code parameters from request
|
|
15304
15913
|
return [2 /*return*/, silentHandler.handleCodeResponseFromServer({
|
|
15305
15914
|
code: request.code,
|
|
@@ -15330,110 +15939,6 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15330
15939
|
return SilentAuthCodeClient;
|
|
15331
15940
|
}(StandardInteractionClient));
|
|
15332
15941
|
|
|
15333
|
-
/*
|
|
15334
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15335
|
-
* Licensed under the MIT License.
|
|
15336
|
-
*/
|
|
15337
|
-
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
15338
|
-
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
15339
|
-
this.correlationId = correlationId;
|
|
15340
|
-
this.measureName = "msal.measure." + name + "." + this.correlationId;
|
|
15341
|
-
this.startMark = "msal.start." + name + "." + this.correlationId;
|
|
15342
|
-
this.endMark = "msal.end." + name + "." + this.correlationId;
|
|
15343
|
-
}
|
|
15344
|
-
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
15345
|
-
return typeof window !== "undefined" &&
|
|
15346
|
-
typeof window.performance !== "undefined" &&
|
|
15347
|
-
typeof window.performance.mark === "function" &&
|
|
15348
|
-
typeof window.performance.measure === "function" &&
|
|
15349
|
-
typeof window.performance.clearMarks === "function" &&
|
|
15350
|
-
typeof window.performance.clearMeasures === "function" &&
|
|
15351
|
-
typeof window.performance.getEntriesByName === "function";
|
|
15352
|
-
};
|
|
15353
|
-
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
15354
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15355
|
-
try {
|
|
15356
|
-
window.performance.mark(this.startMark);
|
|
15357
|
-
}
|
|
15358
|
-
catch (e) {
|
|
15359
|
-
// Silently catch
|
|
15360
|
-
}
|
|
15361
|
-
}
|
|
15362
|
-
};
|
|
15363
|
-
BrowserPerformanceMeasurement.prototype.endMeasurement = function () {
|
|
15364
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15365
|
-
try {
|
|
15366
|
-
window.performance.mark(this.endMark);
|
|
15367
|
-
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
15368
|
-
}
|
|
15369
|
-
catch (e) {
|
|
15370
|
-
// Silently catch
|
|
15371
|
-
}
|
|
15372
|
-
}
|
|
15373
|
-
};
|
|
15374
|
-
BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
15375
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15376
|
-
try {
|
|
15377
|
-
var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
15378
|
-
if (entriesForMeasurement.length > 0) {
|
|
15379
|
-
var durationMs = entriesForMeasurement[0].duration;
|
|
15380
|
-
window.performance.clearMeasures(this.measureName);
|
|
15381
|
-
window.performance.clearMarks(this.startMark);
|
|
15382
|
-
window.performance.clearMarks(this.endMark);
|
|
15383
|
-
return durationMs;
|
|
15384
|
-
}
|
|
15385
|
-
}
|
|
15386
|
-
catch (e) {
|
|
15387
|
-
// Silently catch and return null
|
|
15388
|
-
}
|
|
15389
|
-
}
|
|
15390
|
-
return null;
|
|
15391
|
-
};
|
|
15392
|
-
return BrowserPerformanceMeasurement;
|
|
15393
|
-
}());
|
|
15394
|
-
|
|
15395
|
-
/*
|
|
15396
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15397
|
-
* Licensed under the MIT License.
|
|
15398
|
-
*/
|
|
15399
|
-
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
15400
|
-
__extends$1(BrowserPerformanceClient, _super);
|
|
15401
|
-
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {
|
|
15402
|
-
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
15403
|
-
_this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);
|
|
15404
|
-
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
15405
|
-
return _this;
|
|
15406
|
-
}
|
|
15407
|
-
BrowserPerformanceClient.prototype.startPerformanceMeasurement = function (measureName, correlationId) {
|
|
15408
|
-
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
15409
|
-
};
|
|
15410
|
-
BrowserPerformanceClient.prototype.generateId = function () {
|
|
15411
|
-
return this.guidGenerator.generateGuid();
|
|
15412
|
-
};
|
|
15413
|
-
BrowserPerformanceClient.prototype.getPageVisibility = function () {
|
|
15414
|
-
var _a;
|
|
15415
|
-
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
15416
|
-
};
|
|
15417
|
-
/**
|
|
15418
|
-
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
15419
|
-
* Also captures browser page visibilityState.
|
|
15420
|
-
*
|
|
15421
|
-
* @param {PerformanceEvents} measureName
|
|
15422
|
-
* @param {?string} [correlationId]
|
|
15423
|
-
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
15424
|
-
*/
|
|
15425
|
-
BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
15426
|
-
var _this = this;
|
|
15427
|
-
// Capture page visibilityState and then invoke start/end measurement
|
|
15428
|
-
var startPageVisibility = this.getPageVisibility();
|
|
15429
|
-
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
15430
|
-
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
15431
|
-
return inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
15432
|
-
} });
|
|
15433
|
-
};
|
|
15434
|
-
return BrowserPerformanceClient;
|
|
15435
|
-
}(PerformanceClient));
|
|
15436
|
-
|
|
15437
15942
|
/*
|
|
15438
15943
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15439
15944
|
* Licensed under the MIT License.
|
|
@@ -15500,6 +16005,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15500
16005
|
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
15501
16006
|
// Initialize the token cache
|
|
15502
16007
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
16008
|
+
// Register listener functions
|
|
16009
|
+
this.trackPageVisibilityWithMeasurement = this.trackPageVisibilityWithMeasurement.bind(this);
|
|
15503
16010
|
}
|
|
15504
16011
|
/**
|
|
15505
16012
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
@@ -15766,6 +16273,16 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15766
16273
|
return Promise.reject(e);
|
|
15767
16274
|
});
|
|
15768
16275
|
};
|
|
16276
|
+
ClientApplication.prototype.trackPageVisibilityWithMeasurement = function () {
|
|
16277
|
+
var measurement = this.ssoSilentMeasurement || this.acquireTokenByCodeAsyncMeasurement;
|
|
16278
|
+
if (!measurement) {
|
|
16279
|
+
return;
|
|
16280
|
+
}
|
|
16281
|
+
this.logger.info("Perf: Visibility change detected in ", measurement.event.name);
|
|
16282
|
+
measurement.increment({
|
|
16283
|
+
visibilityChangeCount: 1,
|
|
16284
|
+
});
|
|
16285
|
+
};
|
|
15769
16286
|
// #endregion
|
|
15770
16287
|
// #region Silent Flow
|
|
15771
16288
|
/**
|
|
@@ -15784,16 +16301,21 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15784
16301
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
15785
16302
|
*/
|
|
15786
16303
|
ClientApplication.prototype.ssoSilent = function (request) {
|
|
16304
|
+
var _a;
|
|
15787
16305
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15788
|
-
var correlationId, validRequest,
|
|
16306
|
+
var correlationId, validRequest, result, silentIframeClient;
|
|
15789
16307
|
var _this = this;
|
|
15790
|
-
return __generator$1(this, function (
|
|
16308
|
+
return __generator$1(this, function (_b) {
|
|
15791
16309
|
correlationId = this.getRequestCorrelationId(request);
|
|
15792
16310
|
validRequest = __assign$1(__assign$1({}, request), {
|
|
15793
16311
|
// will be PromptValue.NONE or PromptValue.NO_SESSION
|
|
15794
16312
|
prompt: request.prompt, correlationId: correlationId });
|
|
15795
16313
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15796
|
-
ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
16314
|
+
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
16315
|
+
(_a = this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
16316
|
+
visibilityChangeCount: 0
|
|
16317
|
+
});
|
|
16318
|
+
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
15797
16319
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
15798
16320
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
15799
16321
|
if (this.canUseNative(validRequest)) {
|
|
@@ -15812,27 +16334,31 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15812
16334
|
result = silentIframeClient.acquireToken(validRequest);
|
|
15813
16335
|
}
|
|
15814
16336
|
return [2 /*return*/, result.then(function (response) {
|
|
16337
|
+
var _a, _b, _c;
|
|
15815
16338
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
15816
|
-
ssoSilentMeasurement.addStaticFields({
|
|
16339
|
+
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.addStaticFields({
|
|
15817
16340
|
accessTokenSize: response.accessToken.length,
|
|
15818
16341
|
idTokenSize: response.idToken.length
|
|
15819
16342
|
});
|
|
15820
|
-
ssoSilentMeasurement.endMeasurement({
|
|
16343
|
+
(_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.endMeasurement({
|
|
15821
16344
|
success: true,
|
|
15822
16345
|
isNativeBroker: response.fromNativeBroker,
|
|
15823
16346
|
requestId: response.requestId
|
|
15824
16347
|
});
|
|
15825
|
-
ssoSilentMeasurement.flushMeasurement();
|
|
16348
|
+
(_c = _this.ssoSilentMeasurement) === null || _c === void 0 ? void 0 : _c.flushMeasurement();
|
|
15826
16349
|
return response;
|
|
15827
16350
|
}).catch(function (e) {
|
|
16351
|
+
var _a, _b;
|
|
15828
16352
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15829
|
-
ssoSilentMeasurement.endMeasurement({
|
|
16353
|
+
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
15830
16354
|
errorCode: e.errorCode,
|
|
15831
16355
|
subErrorCode: e.subError,
|
|
15832
16356
|
success: false
|
|
15833
16357
|
});
|
|
15834
|
-
ssoSilentMeasurement.flushMeasurement();
|
|
16358
|
+
(_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.flushMeasurement();
|
|
15835
16359
|
throw e;
|
|
16360
|
+
}).finally(function () {
|
|
16361
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibilityWithMeasurement);
|
|
15836
16362
|
})];
|
|
15837
16363
|
});
|
|
15838
16364
|
});
|
|
@@ -15938,16 +16464,42 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15938
16464
|
* @returns Result of the operation to redeem the authorization code
|
|
15939
16465
|
*/
|
|
15940
16466
|
ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {
|
|
16467
|
+
var _a;
|
|
15941
16468
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15942
16469
|
var silentAuthCodeClient, silentTokenResult;
|
|
15943
|
-
|
|
15944
|
-
|
|
16470
|
+
var _this = this;
|
|
16471
|
+
return __generator$1(this, function (_b) {
|
|
16472
|
+
switch (_b.label) {
|
|
15945
16473
|
case 0:
|
|
15946
16474
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
16475
|
+
this.acquireTokenByCodeAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenByCodeAsync, request.correlationId);
|
|
16476
|
+
(_a = this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
16477
|
+
visibilityChangeCount: 0
|
|
16478
|
+
});
|
|
16479
|
+
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
15947
16480
|
silentAuthCodeClient = this.createSilentAuthCodeClient(request.correlationId);
|
|
15948
|
-
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)
|
|
16481
|
+
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request).then(function (response) {
|
|
16482
|
+
var _a;
|
|
16483
|
+
(_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16484
|
+
success: true,
|
|
16485
|
+
fromCache: response.fromCache,
|
|
16486
|
+
isNativeBroker: response.fromNativeBroker,
|
|
16487
|
+
requestId: response.requestId
|
|
16488
|
+
});
|
|
16489
|
+
return response;
|
|
16490
|
+
}).catch(function (tokenRenewalError) {
|
|
16491
|
+
var _a;
|
|
16492
|
+
(_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16493
|
+
errorCode: tokenRenewalError.errorCode,
|
|
16494
|
+
subErrorCode: tokenRenewalError.subError,
|
|
16495
|
+
success: false
|
|
16496
|
+
});
|
|
16497
|
+
throw tokenRenewalError;
|
|
16498
|
+
}).finally(function () {
|
|
16499
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibilityWithMeasurement);
|
|
16500
|
+
})];
|
|
15949
16501
|
case 1:
|
|
15950
|
-
silentTokenResult =
|
|
16502
|
+
silentTokenResult = _b.sent();
|
|
15951
16503
|
return [2 /*return*/, silentTokenResult];
|
|
15952
16504
|
}
|
|
15953
16505
|
});
|
|
@@ -15963,6 +16515,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15963
16515
|
ClientApplication.prototype.acquireTokenFromCache = function (silentCacheClient, commonRequest, silentRequest) {
|
|
15964
16516
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15965
16517
|
return __generator$1(this, function (_a) {
|
|
16518
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
15966
16519
|
switch (silentRequest.cacheLookupPolicy) {
|
|
15967
16520
|
case exports.CacheLookupPolicy.Default:
|
|
15968
16521
|
case exports.CacheLookupPolicy.AccessToken:
|
|
@@ -15985,12 +16538,14 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15985
16538
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15986
16539
|
var silentRefreshClient;
|
|
15987
16540
|
return __generator$1(this, function (_a) {
|
|
16541
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenByRefreshToken, commonRequest.correlationId);
|
|
15988
16542
|
switch (silentRequest.cacheLookupPolicy) {
|
|
15989
16543
|
case exports.CacheLookupPolicy.Default:
|
|
15990
16544
|
case exports.CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
15991
16545
|
case exports.CacheLookupPolicy.RefreshToken:
|
|
15992
16546
|
case exports.CacheLookupPolicy.RefreshTokenAndNetwork:
|
|
15993
16547
|
silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
|
|
16548
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentRefreshClientAcquireToken, commonRequest.correlationId);
|
|
15994
16549
|
return [2 /*return*/, silentRefreshClient.acquireToken(commonRequest)];
|
|
15995
16550
|
default:
|
|
15996
16551
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -16008,7 +16563,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
16008
16563
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
16009
16564
|
var silentIframeClient;
|
|
16010
16565
|
return __generator$1(this, function (_a) {
|
|
16566
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenBySilentIframe, request.correlationId);
|
|
16011
16567
|
silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
16568
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
16012
16569
|
return [2 /*return*/, silentIframeClient.acquireToken(request)];
|
|
16013
16570
|
});
|
|
16014
16571
|
});
|
|
@@ -16426,7 +16983,10 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16426
16983
|
*/
|
|
16427
16984
|
function PublicClientApplication(configuration) {
|
|
16428
16985
|
var _this = _super.call(this, configuration) || this;
|
|
16986
|
+
_this.astsAsyncMeasurement = undefined;
|
|
16429
16987
|
_this.activeSilentTokenRequests = new Map();
|
|
16988
|
+
// Register listener functions
|
|
16989
|
+
_this.trackPageVisibility = _this.trackPageVisibility.bind(_this);
|
|
16430
16990
|
return _this;
|
|
16431
16991
|
}
|
|
16432
16992
|
/**
|
|
@@ -16498,6 +17058,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16498
17058
|
cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
16499
17059
|
if (typeof cachedResponse === "undefined") {
|
|
16500
17060
|
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
17061
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenSilentAsync, correlationId);
|
|
16501
17062
|
response = this.acquireTokenSilentAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }), account)
|
|
16502
17063
|
.then(function (result) {
|
|
16503
17064
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
@@ -16540,6 +17101,15 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16540
17101
|
});
|
|
16541
17102
|
});
|
|
16542
17103
|
};
|
|
17104
|
+
PublicClientApplication.prototype.trackPageVisibility = function () {
|
|
17105
|
+
if (!this.astsAsyncMeasurement) {
|
|
17106
|
+
return;
|
|
17107
|
+
}
|
|
17108
|
+
this.logger.info("Perf: Visibility change detected");
|
|
17109
|
+
this.astsAsyncMeasurement.increment({
|
|
17110
|
+
visibilityChangeCount: 1,
|
|
17111
|
+
});
|
|
17112
|
+
};
|
|
16543
17113
|
/**
|
|
16544
17114
|
* Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.
|
|
16545
17115
|
* @param {@link (SilentRequest:type)}
|
|
@@ -16547,14 +17117,20 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16547
17117
|
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
|
|
16548
17118
|
*/
|
|
16549
17119
|
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
|
|
17120
|
+
var _a;
|
|
16550
17121
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
16551
|
-
var
|
|
17122
|
+
var result, silentRequest, silentCacheClient, silentRequest_1, requestWithCLP_1;
|
|
16552
17123
|
var _this = this;
|
|
16553
|
-
return __generator$1(this, function (
|
|
16554
|
-
switch (
|
|
17124
|
+
return __generator$1(this, function (_b) {
|
|
17125
|
+
switch (_b.label) {
|
|
16555
17126
|
case 0:
|
|
17127
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
16556
17128
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
16557
|
-
|
|
17129
|
+
this.astsAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17130
|
+
(_a = this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
17131
|
+
visibilityChangeCount: 0
|
|
17132
|
+
});
|
|
17133
|
+
document.addEventListener("visibilitychange", this.trackPageVisibility);
|
|
16558
17134
|
if (!(NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) && account.nativeAccountId)) return [3 /*break*/, 1];
|
|
16559
17135
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
16560
17136
|
silentRequest = __assign$1(__assign$1({}, request), { account: account });
|
|
@@ -16564,7 +17140,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16564
17140
|
// If native token acquisition fails for availability reasons fallback to web flow
|
|
16565
17141
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
16566
17142
|
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
16567
|
-
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
17143
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
16568
17144
|
silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
16569
17145
|
return [2 /*return*/, silentIframeClient.acquireToken(request)];
|
|
16570
17146
|
}
|
|
@@ -16575,12 +17151,14 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16575
17151
|
case 1:
|
|
16576
17152
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16577
17153
|
silentCacheClient = this.createSilentCacheClient(request.correlationId);
|
|
17154
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
16578
17155
|
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
16579
17156
|
case 2:
|
|
16580
|
-
silentRequest_1 =
|
|
17157
|
+
silentRequest_1 = _b.sent();
|
|
16581
17158
|
requestWithCLP_1 = __assign$1(__assign$1({}, request), {
|
|
16582
17159
|
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
|
|
16583
17160
|
cacheLookupPolicy: request.cacheLookupPolicy || exports.CacheLookupPolicy.Default });
|
|
17161
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenFromCache, silentRequest_1.correlationId);
|
|
16584
17162
|
result = this.acquireTokenFromCache(silentCacheClient, silentRequest_1, requestWithCLP_1).catch(function (cacheError) {
|
|
16585
17163
|
if (requestWithCLP_1.cacheLookupPolicy === exports.CacheLookupPolicy.AccessToken) {
|
|
16586
17164
|
throw cacheError;
|
|
@@ -16588,6 +17166,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16588
17166
|
// block the reload if it occurred inside a hidden iframe
|
|
16589
17167
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
16590
17168
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest_1);
|
|
17169
|
+
_this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenByRefreshToken, silentRequest_1.correlationId);
|
|
16591
17170
|
return _this.acquireTokenByRefreshToken(silentRequest_1, requestWithCLP_1).catch(function (refreshTokenError) {
|
|
16592
17171
|
var isServerError = refreshTokenError instanceof ServerError;
|
|
16593
17172
|
var isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;
|
|
@@ -16601,13 +17180,15 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16601
17180
|
throw refreshTokenError;
|
|
16602
17181
|
}
|
|
16603
17182
|
_this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
|
|
17183
|
+
_this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenBySilentIframe, silentRequest_1.correlationId);
|
|
16604
17184
|
return _this.acquireTokenBySilentIframe(silentRequest_1);
|
|
16605
17185
|
});
|
|
16606
17186
|
});
|
|
16607
|
-
|
|
17187
|
+
_b.label = 3;
|
|
16608
17188
|
case 3: return [2 /*return*/, result.then(function (response) {
|
|
17189
|
+
var _a;
|
|
16609
17190
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
16610
|
-
|
|
17191
|
+
(_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16611
17192
|
success: true,
|
|
16612
17193
|
fromCache: response.fromCache,
|
|
16613
17194
|
isNativeBroker: response.fromNativeBroker,
|
|
@@ -16615,13 +17196,16 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16615
17196
|
});
|
|
16616
17197
|
return response;
|
|
16617
17198
|
}).catch(function (tokenRenewalError) {
|
|
17199
|
+
var _a;
|
|
16618
17200
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
16619
|
-
|
|
17201
|
+
(_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16620
17202
|
errorCode: tokenRenewalError.errorCode,
|
|
16621
17203
|
subErrorCode: tokenRenewalError.subError,
|
|
16622
17204
|
success: false
|
|
16623
17205
|
});
|
|
16624
17206
|
throw tokenRenewalError;
|
|
17207
|
+
}).finally(function () {
|
|
17208
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibility);
|
|
16625
17209
|
})];
|
|
16626
17210
|
}
|
|
16627
17211
|
});
|