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