@azure/msal-browser 2.32.1 → 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 +39 -11
- 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.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +8 -7
- package/dist/cache/BrowserCacheManager.js.map +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.d.ts.map +1 -1
- package/dist/config/Configuration.js +6 -3
- package/dist/config/Configuration.js.map +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 +1519 -886
- 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/NativeInteractionClient.js.map +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 +27 -14
- 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 +4 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +5 -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 +17 -0
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +57 -1
- 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 +1519 -886
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +43 -44
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.33.0 2023-02-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -117,7 +117,7 @@ function __spread() {
|
|
|
117
117
|
return ar;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/*! @azure/msal-common
|
|
120
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
121
121
|
/*! *****************************************************************************
|
|
122
122
|
Copyright (c) Microsoft Corporation.
|
|
123
123
|
|
|
@@ -204,7 +204,7 @@ function __spreadArrays() {
|
|
|
204
204
|
return r;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
/*! @azure/msal-common
|
|
207
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
208
208
|
|
|
209
209
|
/*
|
|
210
210
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -280,6 +280,7 @@ var HeaderNames;
|
|
|
280
280
|
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
|
|
281
281
|
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
|
|
282
282
|
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
|
|
283
|
+
HeaderNames["X_MS_HTTP_VERSION"] = "x-ms-httpver";
|
|
283
284
|
})(HeaderNames || (HeaderNames = {}));
|
|
284
285
|
/**
|
|
285
286
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
@@ -587,7 +588,7 @@ var JsonTypes;
|
|
|
587
588
|
JsonTypes["Jwk"] = "JWK";
|
|
588
589
|
})(JsonTypes || (JsonTypes = {}));
|
|
589
590
|
|
|
590
|
-
/*! @azure/msal-common
|
|
591
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
591
592
|
|
|
592
593
|
/*
|
|
593
594
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -643,7 +644,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
643
644
|
return AuthError;
|
|
644
645
|
}(Error));
|
|
645
646
|
|
|
646
|
-
/*! @azure/msal-common
|
|
647
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
647
648
|
|
|
648
649
|
/*
|
|
649
650
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -718,7 +719,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
718
719
|
}
|
|
719
720
|
};
|
|
720
721
|
|
|
721
|
-
/*! @azure/msal-common
|
|
722
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
722
723
|
|
|
723
724
|
/*
|
|
724
725
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1213,7 +1214,7 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1213
1214
|
return ClientAuthError;
|
|
1214
1215
|
}(AuthError));
|
|
1215
1216
|
|
|
1216
|
-
/*! @azure/msal-common
|
|
1217
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1217
1218
|
|
|
1218
1219
|
/*
|
|
1219
1220
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1338,7 +1339,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1338
1339
|
return StringUtils;
|
|
1339
1340
|
}());
|
|
1340
1341
|
|
|
1341
|
-
/*! @azure/msal-common
|
|
1342
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1342
1343
|
|
|
1343
1344
|
/*
|
|
1344
1345
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1365,13 +1366,23 @@ var Logger = /** @class */ (function () {
|
|
|
1365
1366
|
var defaultLoggerCallback = function () {
|
|
1366
1367
|
return;
|
|
1367
1368
|
};
|
|
1368
|
-
|
|
1369
|
-
this.
|
|
1370
|
-
this.
|
|
1371
|
-
this.
|
|
1369
|
+
var setLoggerOptions = loggerOptions || Logger.createDefaultLoggerOptions();
|
|
1370
|
+
this.localCallback = setLoggerOptions.loggerCallback || defaultLoggerCallback;
|
|
1371
|
+
this.piiLoggingEnabled = setLoggerOptions.piiLoggingEnabled || false;
|
|
1372
|
+
this.level = typeof (setLoggerOptions.logLevel) === "number" ? setLoggerOptions.logLevel : exports.LogLevel.Info;
|
|
1373
|
+
this.correlationId = setLoggerOptions.correlationId || Constants.EMPTY_STRING;
|
|
1372
1374
|
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
1373
1375
|
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
1374
1376
|
}
|
|
1377
|
+
Logger.createDefaultLoggerOptions = function () {
|
|
1378
|
+
return {
|
|
1379
|
+
loggerCallback: function () {
|
|
1380
|
+
// allow users to not set loggerCallback
|
|
1381
|
+
},
|
|
1382
|
+
piiLoggingEnabled: false,
|
|
1383
|
+
logLevel: exports.LogLevel.Info
|
|
1384
|
+
};
|
|
1385
|
+
};
|
|
1375
1386
|
/**
|
|
1376
1387
|
* Create new Logger with existing configurations.
|
|
1377
1388
|
*/
|
|
@@ -1518,12 +1529,12 @@ var Logger = /** @class */ (function () {
|
|
|
1518
1529
|
return Logger;
|
|
1519
1530
|
}());
|
|
1520
1531
|
|
|
1521
|
-
/*! @azure/msal-common
|
|
1532
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1522
1533
|
/* eslint-disable header/header */
|
|
1523
1534
|
var name$1 = "@azure/msal-common";
|
|
1524
|
-
var version$1 = "
|
|
1535
|
+
var version$1 = "10.0.0";
|
|
1525
1536
|
|
|
1526
|
-
/*! @azure/msal-common
|
|
1537
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1527
1538
|
/*
|
|
1528
1539
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1529
1540
|
* Licensed under the MIT License.
|
|
@@ -1544,7 +1555,7 @@ exports.AzureCloudInstance = void 0;
|
|
|
1544
1555
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1545
1556
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1546
1557
|
|
|
1547
|
-
/*! @azure/msal-common
|
|
1558
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1548
1559
|
|
|
1549
1560
|
/*
|
|
1550
1561
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1575,6 +1586,25 @@ exports.AzureCloudInstance = void 0;
|
|
|
1575
1586
|
var CredentialEntity = /** @class */ (function () {
|
|
1576
1587
|
function CredentialEntity() {
|
|
1577
1588
|
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Initializes a map with credential {CredentialType} regular expressions.
|
|
1591
|
+
*/
|
|
1592
|
+
CredentialEntity._initRegex = function () {
|
|
1593
|
+
var separator = Separators.CACHE_KEY_SEPARATOR;
|
|
1594
|
+
CredentialEntity.credentialRegexMap = new Map();
|
|
1595
|
+
for (var _i = 0, _a = Object.keys(CredentialType); _i < _a.length; _i++) {
|
|
1596
|
+
var credKey = _a[_i];
|
|
1597
|
+
var credVal = CredentialType[credKey].toLowerCase();
|
|
1598
|
+
try {
|
|
1599
|
+
// Verify credential type is preceded by a valid host name (environment) using lookbehind
|
|
1600
|
+
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("(?<=" + separator + CredentialEntity.credentialDomainRegex + ")" + separator + credVal + separator));
|
|
1601
|
+
}
|
|
1602
|
+
catch (err) {
|
|
1603
|
+
// Lookbehind is not supported (Safari or older versions of IE) - removing it
|
|
1604
|
+
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("" + separator + CredentialEntity.credentialDomainRegex + separator + credVal + separator));
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1578
1608
|
/**
|
|
1579
1609
|
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
1580
1610
|
*/
|
|
@@ -1621,19 +1651,12 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1621
1651
|
* @param key
|
|
1622
1652
|
*/
|
|
1623
1653
|
CredentialEntity.getCredentialType = function (key) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
if (
|
|
1628
|
-
return CredentialType
|
|
1654
|
+
var _a;
|
|
1655
|
+
for (var _i = 0, _b = Object.keys(CredentialType); _i < _b.length; _i++) {
|
|
1656
|
+
var credKey = _b[_i];
|
|
1657
|
+
if ((_a = this.credentialRegexMap.get(CredentialType[credKey])) === null || _a === void 0 ? void 0 : _a.test(key.toLowerCase())) {
|
|
1658
|
+
return CredentialType[credKey];
|
|
1629
1659
|
}
|
|
1630
|
-
return CredentialType.ACCESS_TOKEN;
|
|
1631
|
-
}
|
|
1632
|
-
else if (key.indexOf(CredentialType.ID_TOKEN.toLowerCase()) !== -1) {
|
|
1633
|
-
return CredentialType.ID_TOKEN;
|
|
1634
|
-
}
|
|
1635
|
-
else if (key.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) !== -1) {
|
|
1636
|
-
return CredentialType.REFRESH_TOKEN;
|
|
1637
1660
|
}
|
|
1638
1661
|
return Constants.NOT_DEFINED;
|
|
1639
1662
|
};
|
|
@@ -1700,10 +1723,13 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1700
1723
|
*/
|
|
1701
1724
|
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
1702
1725
|
};
|
|
1726
|
+
// Match host names like "login.microsoftonline.com", "https://accounts.google.com:4000", https://localhost:5000, etc.
|
|
1727
|
+
CredentialEntity.credentialDomainRegex = "(https?:\\/\\/)?((([\\w-]+\\.)*([\\w-]{1,63})(\\.(\\w{2,63})))|(localhost))(\\:[0-9]{4,5})?";
|
|
1703
1728
|
return CredentialEntity;
|
|
1704
|
-
}());
|
|
1729
|
+
}());
|
|
1730
|
+
CredentialEntity._initRegex();
|
|
1705
1731
|
|
|
1706
|
-
/*! @azure/msal-common
|
|
1732
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1707
1733
|
|
|
1708
1734
|
/*
|
|
1709
1735
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1958,7 +1984,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1958
1984
|
return ClientConfigurationError;
|
|
1959
1985
|
}(ClientAuthError));
|
|
1960
1986
|
|
|
1961
|
-
/*! @azure/msal-common
|
|
1987
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
1962
1988
|
|
|
1963
1989
|
/*
|
|
1964
1990
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2142,7 +2168,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2142
2168
|
return ScopeSet;
|
|
2143
2169
|
}());
|
|
2144
2170
|
|
|
2145
|
-
/*! @azure/msal-common
|
|
2171
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2146
2172
|
|
|
2147
2173
|
/*
|
|
2148
2174
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2180,7 +2206,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2180
2206
|
};
|
|
2181
2207
|
}
|
|
2182
2208
|
|
|
2183
|
-
/*! @azure/msal-common
|
|
2209
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2184
2210
|
/*
|
|
2185
2211
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2186
2212
|
* Licensed under the MIT License.
|
|
@@ -2195,7 +2221,7 @@ var AuthorityType;
|
|
|
2195
2221
|
AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
|
|
2196
2222
|
})(AuthorityType || (AuthorityType = {}));
|
|
2197
2223
|
|
|
2198
|
-
/*! @azure/msal-common
|
|
2224
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2199
2225
|
|
|
2200
2226
|
/*
|
|
2201
2227
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2434,7 +2460,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2434
2460
|
return AccountEntity;
|
|
2435
2461
|
}());
|
|
2436
2462
|
|
|
2437
|
-
/*! @azure/msal-common
|
|
2463
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2438
2464
|
|
|
2439
2465
|
/*
|
|
2440
2466
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2486,7 +2512,7 @@ var AuthToken = /** @class */ (function () {
|
|
|
2486
2512
|
return AuthToken;
|
|
2487
2513
|
}());
|
|
2488
2514
|
|
|
2489
|
-
/*! @azure/msal-common
|
|
2515
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
2490
2516
|
|
|
2491
2517
|
/*
|
|
2492
2518
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3365,7 +3391,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3365
3391
|
return DefaultStorageClass;
|
|
3366
3392
|
}(CacheManager));
|
|
3367
3393
|
|
|
3368
|
-
/*! @azure/msal-common
|
|
3394
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3369
3395
|
|
|
3370
3396
|
/*
|
|
3371
3397
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3375,8 +3401,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3375
3401
|
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3376
3402
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3377
3403
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3378
|
-
preventCorsPreflight: false
|
|
3379
|
-
proxyUrl: Constants.EMPTY_STRING
|
|
3404
|
+
preventCorsPreflight: false
|
|
3380
3405
|
};
|
|
3381
3406
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3382
3407
|
loggerCallback: function () {
|
|
@@ -3459,7 +3484,7 @@ function buildAuthOptions(authOptions) {
|
|
|
3459
3484
|
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
|
|
3460
3485
|
}
|
|
3461
3486
|
|
|
3462
|
-
/*! @azure/msal-common
|
|
3487
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3463
3488
|
|
|
3464
3489
|
/*
|
|
3465
3490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3479,7 +3504,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3479
3504
|
return ServerError;
|
|
3480
3505
|
}(AuthError));
|
|
3481
3506
|
|
|
3482
|
-
/*! @azure/msal-common
|
|
3507
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3483
3508
|
|
|
3484
3509
|
/*
|
|
3485
3510
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3575,7 +3600,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3575
3600
|
return ThrottlingUtils;
|
|
3576
3601
|
}());
|
|
3577
3602
|
|
|
3578
|
-
/*! @azure/msal-common
|
|
3603
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3579
3604
|
|
|
3580
3605
|
/*
|
|
3581
3606
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3624,7 +3649,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3624
3649
|
return NetworkManager;
|
|
3625
3650
|
}());
|
|
3626
3651
|
|
|
3627
|
-
/*! @azure/msal-common
|
|
3652
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3628
3653
|
/*
|
|
3629
3654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3630
3655
|
* Licensed under the MIT License.
|
|
@@ -3635,98 +3660,7 @@ var CcsCredentialType;
|
|
|
3635
3660
|
CcsCredentialType["UPN"] = "UPN";
|
|
3636
3661
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3637
3662
|
|
|
3638
|
-
/*! @azure/msal-common
|
|
3639
|
-
|
|
3640
|
-
/*
|
|
3641
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3642
|
-
* Licensed under the MIT License.
|
|
3643
|
-
*/
|
|
3644
|
-
/**
|
|
3645
|
-
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
|
|
3646
|
-
*/
|
|
3647
|
-
var BaseClient = /** @class */ (function () {
|
|
3648
|
-
function BaseClient(configuration, performanceClient) {
|
|
3649
|
-
// Set the configuration
|
|
3650
|
-
this.config = buildClientConfiguration(configuration);
|
|
3651
|
-
// Initialize the logger
|
|
3652
|
-
this.logger = new Logger(this.config.loggerOptions, name$1, version$1);
|
|
3653
|
-
// Initialize crypto
|
|
3654
|
-
this.cryptoUtils = this.config.cryptoInterface;
|
|
3655
|
-
// Initialize storage interface
|
|
3656
|
-
this.cacheManager = this.config.storageInterface;
|
|
3657
|
-
// Set the network interface
|
|
3658
|
-
this.networkClient = this.config.networkInterface;
|
|
3659
|
-
// Set the NetworkManager
|
|
3660
|
-
this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);
|
|
3661
|
-
// Set TelemetryManager
|
|
3662
|
-
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
3663
|
-
// set Authority
|
|
3664
|
-
this.authority = this.config.authOptions.authority;
|
|
3665
|
-
// set performance telemetry client
|
|
3666
|
-
this.performanceClient = performanceClient;
|
|
3667
|
-
}
|
|
3668
|
-
/**
|
|
3669
|
-
* Creates default headers for requests to token endpoint
|
|
3670
|
-
*/
|
|
3671
|
-
BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {
|
|
3672
|
-
var headers = {};
|
|
3673
|
-
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
3674
|
-
if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
|
|
3675
|
-
switch (ccsCred.type) {
|
|
3676
|
-
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
3677
|
-
try {
|
|
3678
|
-
var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
|
|
3679
|
-
headers[HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
|
|
3680
|
-
}
|
|
3681
|
-
catch (e) {
|
|
3682
|
-
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
3683
|
-
}
|
|
3684
|
-
break;
|
|
3685
|
-
case CcsCredentialType.UPN:
|
|
3686
|
-
headers[HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
|
|
3687
|
-
break;
|
|
3688
|
-
}
|
|
3689
|
-
}
|
|
3690
|
-
return headers;
|
|
3691
|
-
};
|
|
3692
|
-
/**
|
|
3693
|
-
* Http post to token endpoint
|
|
3694
|
-
* @param tokenEndpoint
|
|
3695
|
-
* @param queryString
|
|
3696
|
-
* @param headers
|
|
3697
|
-
* @param thumbprint
|
|
3698
|
-
*/
|
|
3699
|
-
BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {
|
|
3700
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3701
|
-
var response;
|
|
3702
|
-
return __generator(this, function (_a) {
|
|
3703
|
-
switch (_a.label) {
|
|
3704
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
|
|
3705
|
-
case 1:
|
|
3706
|
-
response = _a.sent();
|
|
3707
|
-
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
3708
|
-
// Telemetry data successfully logged by server, clear Telemetry cache
|
|
3709
|
-
this.config.serverTelemetryManager.clearTelemetryCache();
|
|
3710
|
-
}
|
|
3711
|
-
return [2 /*return*/, response];
|
|
3712
|
-
}
|
|
3713
|
-
});
|
|
3714
|
-
});
|
|
3715
|
-
};
|
|
3716
|
-
/**
|
|
3717
|
-
* Updates the authority object of the client. Endpoint discovery must be completed.
|
|
3718
|
-
* @param updatedAuthority
|
|
3719
|
-
*/
|
|
3720
|
-
BaseClient.prototype.updateAuthority = function (updatedAuthority) {
|
|
3721
|
-
if (!updatedAuthority.discoveryComplete()) {
|
|
3722
|
-
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");
|
|
3723
|
-
}
|
|
3724
|
-
this.authority = updatedAuthority;
|
|
3725
|
-
};
|
|
3726
|
-
return BaseClient;
|
|
3727
|
-
}());
|
|
3728
|
-
|
|
3729
|
-
/*! @azure/msal-common v9.0.1 2022-12-07 */
|
|
3663
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3730
3664
|
|
|
3731
3665
|
/*
|
|
3732
3666
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3794,7 +3728,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3794
3728
|
}
|
|
3795
3729
|
};
|
|
3796
3730
|
/**
|
|
3797
|
-
* Removes unnecessary
|
|
3731
|
+
* Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
|
|
3798
3732
|
* @param request
|
|
3799
3733
|
*/
|
|
3800
3734
|
RequestValidator.sanitizeEQParams = function (eQParams, queryParams) {
|
|
@@ -3807,12 +3741,17 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3807
3741
|
delete eQParams[key];
|
|
3808
3742
|
}
|
|
3809
3743
|
});
|
|
3810
|
-
|
|
3744
|
+
// remove empty string parameters
|
|
3745
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3746
|
+
return Object.fromEntries(Object.entries(eQParams).filter(function (_a) {
|
|
3747
|
+
var value = _a[1];
|
|
3748
|
+
return value !== "";
|
|
3749
|
+
}));
|
|
3811
3750
|
};
|
|
3812
3751
|
return RequestValidator;
|
|
3813
3752
|
}());
|
|
3814
3753
|
|
|
3815
|
-
/*! @azure/msal-common
|
|
3754
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
3816
3755
|
|
|
3817
3756
|
/*
|
|
3818
3757
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4089,13 +4028,13 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4089
4028
|
};
|
|
4090
4029
|
/**
|
|
4091
4030
|
* add extraQueryParams
|
|
4092
|
-
* @param
|
|
4031
|
+
* @param eQParams
|
|
4093
4032
|
*/
|
|
4094
|
-
RequestParameterBuilder.prototype.addExtraQueryParameters = function (
|
|
4033
|
+
RequestParameterBuilder.prototype.addExtraQueryParameters = function (eQParams) {
|
|
4095
4034
|
var _this = this;
|
|
4096
|
-
RequestValidator.sanitizeEQParams(
|
|
4097
|
-
Object.keys(
|
|
4098
|
-
_this.parameters.set(key,
|
|
4035
|
+
var sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);
|
|
4036
|
+
Object.keys(sanitizedEQParams).forEach(function (key) {
|
|
4037
|
+
_this.parameters.set(key, eQParams[key]);
|
|
4099
4038
|
});
|
|
4100
4039
|
};
|
|
4101
4040
|
RequestParameterBuilder.prototype.addClientCapabilitiesToClaims = function (claims, clientCapabilities) {
|
|
@@ -4190,7 +4129,109 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4190
4129
|
return RequestParameterBuilder;
|
|
4191
4130
|
}());
|
|
4192
4131
|
|
|
4193
|
-
/*! @azure/msal-common
|
|
4132
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4133
|
+
|
|
4134
|
+
/*
|
|
4135
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4136
|
+
* Licensed under the MIT License.
|
|
4137
|
+
*/
|
|
4138
|
+
/**
|
|
4139
|
+
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
|
|
4140
|
+
*/
|
|
4141
|
+
var BaseClient = /** @class */ (function () {
|
|
4142
|
+
function BaseClient(configuration, performanceClient) {
|
|
4143
|
+
// Set the configuration
|
|
4144
|
+
this.config = buildClientConfiguration(configuration);
|
|
4145
|
+
// Initialize the logger
|
|
4146
|
+
this.logger = new Logger(this.config.loggerOptions, name$1, version$1);
|
|
4147
|
+
// Initialize crypto
|
|
4148
|
+
this.cryptoUtils = this.config.cryptoInterface;
|
|
4149
|
+
// Initialize storage interface
|
|
4150
|
+
this.cacheManager = this.config.storageInterface;
|
|
4151
|
+
// Set the network interface
|
|
4152
|
+
this.networkClient = this.config.networkInterface;
|
|
4153
|
+
// Set the NetworkManager
|
|
4154
|
+
this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);
|
|
4155
|
+
// Set TelemetryManager
|
|
4156
|
+
this.serverTelemetryManager = this.config.serverTelemetryManager;
|
|
4157
|
+
// set Authority
|
|
4158
|
+
this.authority = this.config.authOptions.authority;
|
|
4159
|
+
// set performance telemetry client
|
|
4160
|
+
this.performanceClient = performanceClient;
|
|
4161
|
+
}
|
|
4162
|
+
/**
|
|
4163
|
+
* Creates default headers for requests to token endpoint
|
|
4164
|
+
*/
|
|
4165
|
+
BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {
|
|
4166
|
+
var headers = {};
|
|
4167
|
+
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
4168
|
+
if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
|
|
4169
|
+
switch (ccsCred.type) {
|
|
4170
|
+
case CcsCredentialType.HOME_ACCOUNT_ID:
|
|
4171
|
+
try {
|
|
4172
|
+
var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
|
|
4173
|
+
headers[HeaderNames.CCS_HEADER] = "Oid:" + clientInfo.uid + "@" + clientInfo.utid;
|
|
4174
|
+
}
|
|
4175
|
+
catch (e) {
|
|
4176
|
+
this.logger.verbose("Could not parse home account ID for CCS Header: " + e);
|
|
4177
|
+
}
|
|
4178
|
+
break;
|
|
4179
|
+
case CcsCredentialType.UPN:
|
|
4180
|
+
headers[HeaderNames.CCS_HEADER] = "UPN: " + ccsCred.credential;
|
|
4181
|
+
break;
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
return headers;
|
|
4185
|
+
};
|
|
4186
|
+
/**
|
|
4187
|
+
* Http post to token endpoint
|
|
4188
|
+
* @param tokenEndpoint
|
|
4189
|
+
* @param queryString
|
|
4190
|
+
* @param headers
|
|
4191
|
+
* @param thumbprint
|
|
4192
|
+
*/
|
|
4193
|
+
BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {
|
|
4194
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4195
|
+
var response;
|
|
4196
|
+
return __generator(this, function (_a) {
|
|
4197
|
+
switch (_a.label) {
|
|
4198
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
|
|
4199
|
+
case 1:
|
|
4200
|
+
response = _a.sent();
|
|
4201
|
+
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
4202
|
+
// Telemetry data successfully logged by server, clear Telemetry cache
|
|
4203
|
+
this.config.serverTelemetryManager.clearTelemetryCache();
|
|
4204
|
+
}
|
|
4205
|
+
return [2 /*return*/, response];
|
|
4206
|
+
}
|
|
4207
|
+
});
|
|
4208
|
+
});
|
|
4209
|
+
};
|
|
4210
|
+
/**
|
|
4211
|
+
* Updates the authority object of the client. Endpoint discovery must be completed.
|
|
4212
|
+
* @param updatedAuthority
|
|
4213
|
+
*/
|
|
4214
|
+
BaseClient.prototype.updateAuthority = function (updatedAuthority) {
|
|
4215
|
+
if (!updatedAuthority.discoveryComplete()) {
|
|
4216
|
+
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Updated authority has not completed endpoint discovery.");
|
|
4217
|
+
}
|
|
4218
|
+
this.authority = updatedAuthority;
|
|
4219
|
+
};
|
|
4220
|
+
/**
|
|
4221
|
+
* Creates query string for the /token request
|
|
4222
|
+
* @param request
|
|
4223
|
+
*/
|
|
4224
|
+
BaseClient.prototype.createTokenQueryParameters = function (request) {
|
|
4225
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
4226
|
+
if (request.tokenQueryParameters) {
|
|
4227
|
+
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
4228
|
+
}
|
|
4229
|
+
return parameterBuilder.createQueryString();
|
|
4230
|
+
};
|
|
4231
|
+
return BaseClient;
|
|
4232
|
+
}());
|
|
4233
|
+
|
|
4234
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4194
4235
|
|
|
4195
4236
|
/*
|
|
4196
4237
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4254,7 +4295,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4254
4295
|
return IdTokenEntity;
|
|
4255
4296
|
}(CredentialEntity));
|
|
4256
4297
|
|
|
4257
|
-
/*! @azure/msal-common
|
|
4298
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4258
4299
|
/*
|
|
4259
4300
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4260
4301
|
* Licensed under the MIT License.
|
|
@@ -4304,7 +4345,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4304
4345
|
return TimeUtils;
|
|
4305
4346
|
}());
|
|
4306
4347
|
|
|
4307
|
-
/*! @azure/msal-common
|
|
4348
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4308
4349
|
|
|
4309
4350
|
/*
|
|
4310
4351
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4418,7 +4459,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4418
4459
|
return AccessTokenEntity;
|
|
4419
4460
|
}(CredentialEntity));
|
|
4420
4461
|
|
|
4421
|
-
/*! @azure/msal-common
|
|
4462
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4422
4463
|
|
|
4423
4464
|
/*
|
|
4424
4465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4485,7 +4526,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4485
4526
|
return RefreshTokenEntity;
|
|
4486
4527
|
}(CredentialEntity));
|
|
4487
4528
|
|
|
4488
|
-
/*! @azure/msal-common
|
|
4529
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4489
4530
|
|
|
4490
4531
|
/*
|
|
4491
4532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4524,10 +4565,14 @@ var InteractionRequiredAuthErrorMessage = {
|
|
|
4524
4565
|
*/
|
|
4525
4566
|
var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
4526
4567
|
__extends(InteractionRequiredAuthError, _super);
|
|
4527
|
-
function InteractionRequiredAuthError(errorCode, errorMessage, subError) {
|
|
4568
|
+
function InteractionRequiredAuthError(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims) {
|
|
4528
4569
|
var _this = _super.call(this, errorCode, errorMessage, subError) || this;
|
|
4529
|
-
_this.name = "InteractionRequiredAuthError";
|
|
4530
4570
|
Object.setPrototypeOf(_this, InteractionRequiredAuthError.prototype);
|
|
4571
|
+
_this.timestamp = timestamp || Constants.EMPTY_STRING;
|
|
4572
|
+
_this.traceId = traceId || Constants.EMPTY_STRING;
|
|
4573
|
+
_this.correlationId = correlationId || Constants.EMPTY_STRING;
|
|
4574
|
+
_this.claims = claims || Constants.EMPTY_STRING;
|
|
4575
|
+
_this.name = "InteractionRequiredAuthError";
|
|
4531
4576
|
return _this;
|
|
4532
4577
|
}
|
|
4533
4578
|
/**
|
|
@@ -4560,7 +4605,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4560
4605
|
return InteractionRequiredAuthError;
|
|
4561
4606
|
}(AuthError));
|
|
4562
4607
|
|
|
4563
|
-
/*! @azure/msal-common
|
|
4608
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4564
4609
|
/*
|
|
4565
4610
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4566
4611
|
* Licensed under the MIT License.
|
|
@@ -4576,7 +4621,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4576
4621
|
return CacheRecord;
|
|
4577
4622
|
}());
|
|
4578
4623
|
|
|
4579
|
-
/*! @azure/msal-common
|
|
4624
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4580
4625
|
|
|
4581
4626
|
/*
|
|
4582
4627
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4647,7 +4692,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4647
4692
|
return ProtocolUtils;
|
|
4648
4693
|
}());
|
|
4649
4694
|
|
|
4650
|
-
/*! @azure/msal-common
|
|
4695
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4651
4696
|
|
|
4652
4697
|
/*
|
|
4653
4698
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4881,60 +4926,295 @@ var UrlString = /** @class */ (function () {
|
|
|
4881
4926
|
return UrlString;
|
|
4882
4927
|
}());
|
|
4883
4928
|
|
|
4884
|
-
/*! @azure/msal-common
|
|
4885
|
-
|
|
4929
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4886
4930
|
/*
|
|
4887
4931
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4888
4932
|
* Licensed under the MIT License.
|
|
4889
4933
|
*/
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
}
|
|
4934
|
+
/**
|
|
4935
|
+
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
4936
|
+
*
|
|
4937
|
+
* @export
|
|
4938
|
+
* @enum {number}
|
|
4939
|
+
*/
|
|
4940
|
+
exports.PerformanceEvents = void 0;
|
|
4941
|
+
(function (PerformanceEvents) {
|
|
4899
4942
|
/**
|
|
4900
|
-
*
|
|
4901
|
-
*
|
|
4902
|
-
* @param request
|
|
4903
|
-
* @returns
|
|
4943
|
+
* acquireTokenByCode API (msal-browser and msal-node).
|
|
4944
|
+
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
4904
4945
|
*/
|
|
4905
|
-
|
|
4906
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4907
|
-
var reqCnf, reqCnfString, _a;
|
|
4908
|
-
return __generator(this, function (_b) {
|
|
4909
|
-
switch (_b.label) {
|
|
4910
|
-
case 0: return [4 /*yield*/, this.generateKid(request)];
|
|
4911
|
-
case 1:
|
|
4912
|
-
reqCnf = _b.sent();
|
|
4913
|
-
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
4914
|
-
_a = {
|
|
4915
|
-
kid: reqCnf.kid,
|
|
4916
|
-
reqCnfString: reqCnfString
|
|
4917
|
-
};
|
|
4918
|
-
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
4919
|
-
case 2: return [2 /*return*/, (_a.reqCnfHash = _b.sent(),
|
|
4920
|
-
_a)];
|
|
4921
|
-
}
|
|
4922
|
-
});
|
|
4923
|
-
});
|
|
4924
|
-
};
|
|
4946
|
+
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
|
|
4925
4947
|
/**
|
|
4926
|
-
*
|
|
4927
|
-
*
|
|
4928
|
-
* @returns
|
|
4948
|
+
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
4949
|
+
* Used to renew an access token using a refresh token against the token endpoint.
|
|
4929
4950
|
*/
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4951
|
+
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
|
|
4952
|
+
/**
|
|
4953
|
+
* acquireTokenSilent API (msal-browser and msal-node).
|
|
4954
|
+
* Used to silently acquire a new access token (from the cache or the network).
|
|
4955
|
+
*/
|
|
4956
|
+
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
|
|
4957
|
+
/**
|
|
4958
|
+
* acquireTokenSilentAsync (msal-browser).
|
|
4959
|
+
* Internal API for acquireTokenSilent.
|
|
4960
|
+
*/
|
|
4961
|
+
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
4962
|
+
/**
|
|
4963
|
+
* acquireTokenPopup (msal-browser).
|
|
4964
|
+
* Used to acquire a new access token interactively through pop ups
|
|
4965
|
+
*/
|
|
4966
|
+
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
|
|
4967
|
+
/**
|
|
4968
|
+
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
4969
|
+
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
4970
|
+
*/
|
|
4971
|
+
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
|
|
4972
|
+
/**
|
|
4973
|
+
* signJwt API in CryptoOpts class (msal-browser).
|
|
4974
|
+
* Used to signed a pop token.
|
|
4975
|
+
*/
|
|
4976
|
+
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
|
|
4977
|
+
/**
|
|
4978
|
+
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
4979
|
+
* Used to read access tokens from the cache.
|
|
4980
|
+
*/
|
|
4981
|
+
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
|
|
4982
|
+
/**
|
|
4983
|
+
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
4984
|
+
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4985
|
+
*/
|
|
4986
|
+
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
|
|
4987
|
+
/**
|
|
4988
|
+
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4989
|
+
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
4990
|
+
*/
|
|
4991
|
+
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
|
|
4992
|
+
/**
|
|
4993
|
+
* ssoSilent API (msal-browser).
|
|
4994
|
+
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
4995
|
+
*/
|
|
4996
|
+
PerformanceEvents["SsoSilent"] = "ssoSilent";
|
|
4997
|
+
/**
|
|
4998
|
+
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
4999
|
+
* Used to load authority metadata for a request.
|
|
5000
|
+
*/
|
|
5001
|
+
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
5002
|
+
/**
|
|
5003
|
+
* acquireToken APIs in msal-browser.
|
|
5004
|
+
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
5005
|
+
*/
|
|
5006
|
+
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
|
|
5007
|
+
/**
|
|
5008
|
+
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
5009
|
+
* Used to acquire a token from Native component when native brokering is enabled.
|
|
5010
|
+
*/
|
|
5011
|
+
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
5012
|
+
/**
|
|
5013
|
+
* Time spent creating default headers for requests to token endpoint
|
|
5014
|
+
*/
|
|
5015
|
+
PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
|
|
5016
|
+
/**
|
|
5017
|
+
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
5018
|
+
*/
|
|
5019
|
+
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
|
|
5020
|
+
/**
|
|
5021
|
+
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
5022
|
+
*/
|
|
5023
|
+
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
5024
|
+
/**
|
|
5025
|
+
* Time taken for token acquisition by broker
|
|
5026
|
+
*/
|
|
5027
|
+
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
5028
|
+
/**
|
|
5029
|
+
* Time spent on the network for refresh token acquisition
|
|
5030
|
+
*/
|
|
5031
|
+
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
5032
|
+
/**
|
|
5033
|
+
* Time taken for acquiring refresh token , records RT size
|
|
5034
|
+
*/
|
|
5035
|
+
PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
|
|
5036
|
+
/**
|
|
5037
|
+
* Time taken for acquiring cached refresh token
|
|
5038
|
+
*/
|
|
5039
|
+
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
5040
|
+
/**
|
|
5041
|
+
* acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
|
|
5042
|
+
*/
|
|
5043
|
+
PerformanceEvents["RefreshTokenClientAcquireTokenByRefreshToken"] = "refreshTokenClientAcquireTokenByRefreshToken";
|
|
5044
|
+
/**
|
|
5045
|
+
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
5046
|
+
*/
|
|
5047
|
+
PerformanceEvents["RefreshTokenClientCreateTokenRequestBody"] = "refreshTokenClientCreateTokenRequestBody";
|
|
5048
|
+
/**
|
|
5049
|
+
* acquireTokenFromCache (msal-browser).
|
|
5050
|
+
* Internal API for acquiring token from cache
|
|
5051
|
+
*/
|
|
5052
|
+
PerformanceEvents["AcquireTokenFromCache"] = "acquireTokenFromCache";
|
|
5053
|
+
/**
|
|
5054
|
+
* acquireTokenBySilentIframe (msal-browser).
|
|
5055
|
+
* Internal API for acquiring token by silent Iframe
|
|
5056
|
+
*/
|
|
5057
|
+
PerformanceEvents["AcquireTokenBySilentIframe"] = "acquireTokenBySilentIframe";
|
|
5058
|
+
/**
|
|
5059
|
+
* Internal API for initializing base request in BaseInteractionClient (msal-browser)
|
|
5060
|
+
*/
|
|
5061
|
+
PerformanceEvents["InitializeBaseRequest"] = "initializeBaseRequest";
|
|
5062
|
+
/**
|
|
5063
|
+
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
5064
|
+
*/
|
|
5065
|
+
PerformanceEvents["InitializeSilentRequest"] = "initializeSilentRequest";
|
|
5066
|
+
/**
|
|
5067
|
+
* Helper function in SilentIframeClient class (msal-browser).
|
|
5068
|
+
*/
|
|
5069
|
+
PerformanceEvents["SilentIframeClientTokenHelper"] = "silentIframeClientTokenHelper";
|
|
5070
|
+
/**
|
|
5071
|
+
* SilentHandler
|
|
5072
|
+
*/
|
|
5073
|
+
PerformanceEvents["SilentHandlerInitiateAuthRequest"] = "silentHandlerInitiateAuthRequest";
|
|
5074
|
+
PerformanceEvents["SilentHandlerMonitorIframeForHash"] = "silentHandlerMonitorIframeForHash";
|
|
5075
|
+
PerformanceEvents["SilentHandlerLoadFrame"] = "silentHandlerLoadFrame";
|
|
5076
|
+
/**
|
|
5077
|
+
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
5078
|
+
*/
|
|
5079
|
+
PerformanceEvents["StandardInteractionClientCreateAuthCodeClient"] = "standardInteractionClientCreateAuthCodeClient";
|
|
5080
|
+
PerformanceEvents["StandardInteractionClientGetClientConfiguration"] = "standardInteractionClientGetClientConfiguration";
|
|
5081
|
+
PerformanceEvents["StandardInteractionClientInitializeAuthorizationRequest"] = "standardInteractionClientInitializeAuthorizationRequest";
|
|
5082
|
+
PerformanceEvents["StandardInteractionClientInitializeAuthorizationCodeRequest"] = "standardInteractionClientInitializeAuthorizationCodeRequest";
|
|
5083
|
+
/**
|
|
5084
|
+
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
5085
|
+
*/
|
|
5086
|
+
PerformanceEvents["GetAuthCodeUrl"] = "getAuthCodeUrl";
|
|
5087
|
+
/**
|
|
5088
|
+
* Functions from InteractionHandler (msal-browser)
|
|
5089
|
+
*/
|
|
5090
|
+
PerformanceEvents["HandleCodeResponseFromServer"] = "handleCodeResponseFromServer";
|
|
5091
|
+
PerformanceEvents["HandleCodeResponseFromHash"] = "handleCodeResponseFromHash";
|
|
5092
|
+
PerformanceEvents["UpdateTokenEndpointAuthority"] = "updateTokenEndpointAuthority";
|
|
5093
|
+
/**
|
|
5094
|
+
* APIs in Authorization Code Client (msal-common)
|
|
5095
|
+
*/
|
|
5096
|
+
PerformanceEvents["AuthClientAcquireToken"] = "authClientAcquireToken";
|
|
5097
|
+
PerformanceEvents["AuthClientExecuteTokenRequest"] = "authClientExecuteTokenRequest";
|
|
5098
|
+
PerformanceEvents["AuthClientCreateTokenRequestBody"] = "authClientCreateTokenRequestBody";
|
|
5099
|
+
PerformanceEvents["AuthClientCreateQueryString"] = "authClientCreateQueryString";
|
|
5100
|
+
/**
|
|
5101
|
+
* Generate functions in PopTokenGenerator (msal-common)
|
|
5102
|
+
*/
|
|
5103
|
+
PerformanceEvents["PopTokenGenerateCnf"] = "popTokenGenerateCnf";
|
|
5104
|
+
PerformanceEvents["PopTokenGenerateKid"] = "popTokenGenerateKid";
|
|
5105
|
+
/**
|
|
5106
|
+
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
5107
|
+
*/
|
|
5108
|
+
PerformanceEvents["HandleServerTokenResponse"] = "handleServerTokenResponse";
|
|
5109
|
+
/**
|
|
5110
|
+
* Authority functions
|
|
5111
|
+
*/
|
|
5112
|
+
PerformanceEvents["AuthorityFactoryCreateDiscoveredInstance"] = "authorityFactoryCreateDiscoveredInstance";
|
|
5113
|
+
PerformanceEvents["AuthorityResolveEndpointsAsync"] = "authorityResolveEndpointsAsync";
|
|
5114
|
+
PerformanceEvents["AuthorityGetCloudDiscoveryMetadataFromNetwork"] = "authorityGetCloudDiscoveryMetadataFromNetwork";
|
|
5115
|
+
PerformanceEvents["AuthorityUpdateCloudDiscoveryMetadata"] = "authorityUpdateCloudDiscoveryMetadata";
|
|
5116
|
+
PerformanceEvents["AuthorityGetEndpointMetadataFromNetwork"] = "authorityGetEndpointMetadataFromNetwork";
|
|
5117
|
+
PerformanceEvents["AuthorityUpdateEndpointMetadata"] = "authorityUpdateEndpointMetadata";
|
|
5118
|
+
PerformanceEvents["AuthorityUpdateMetadataWithRegionalInformation"] = "authorityUpdateMetadataWithRegionalInformation";
|
|
5119
|
+
/**
|
|
5120
|
+
* Region Discovery functions
|
|
5121
|
+
*/
|
|
5122
|
+
PerformanceEvents["RegionDiscoveryDetectRegion"] = "regionDiscoveryDetectRegion";
|
|
5123
|
+
PerformanceEvents["RegionDiscoveryGetRegionFromIMDS"] = "regionDiscoveryGetRegionFromIMDS";
|
|
5124
|
+
PerformanceEvents["RegionDiscoveryGetCurrentVersion"] = "regionDiscoveryGetCurrentVersion";
|
|
5125
|
+
PerformanceEvents["AcquireTokenByCodeAsync"] = "acquireTokenByCodeAsync";
|
|
5126
|
+
PerformanceEvents["GetEndpointMetadataFromNetwork"] = "getEndpointMetadataFromNetwork";
|
|
5127
|
+
PerformanceEvents["GetCloudDiscoveryMetadataFromNetworkMeasurement"] = "getCloudDiscoveryMetadataFromNetworkMeasurement";
|
|
5128
|
+
PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
|
|
5129
|
+
PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
|
|
5130
|
+
PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
|
|
5131
|
+
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5132
|
+
/**
|
|
5133
|
+
* State of the performance event.
|
|
5134
|
+
*
|
|
5135
|
+
* @export
|
|
5136
|
+
* @enum {number}
|
|
5137
|
+
*/
|
|
5138
|
+
var PerformanceEventStatus;
|
|
5139
|
+
(function (PerformanceEventStatus) {
|
|
5140
|
+
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
|
|
5141
|
+
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
|
|
5142
|
+
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
5143
|
+
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5144
|
+
var IntFields = new Set([
|
|
5145
|
+
"accessTokenSize",
|
|
5146
|
+
"durationMs",
|
|
5147
|
+
"idTokenSize",
|
|
5148
|
+
"matsSilentStatus",
|
|
5149
|
+
"matsHttpStatus",
|
|
5150
|
+
"refreshTokenSize",
|
|
5151
|
+
"queuedTimeMs",
|
|
5152
|
+
"startTimeMs",
|
|
5153
|
+
"status",
|
|
5154
|
+
]);
|
|
5155
|
+
|
|
5156
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5157
|
+
|
|
5158
|
+
/*
|
|
5159
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5160
|
+
* Licensed under the MIT License.
|
|
5161
|
+
*/
|
|
5162
|
+
var KeyLocation;
|
|
5163
|
+
(function (KeyLocation) {
|
|
5164
|
+
KeyLocation["SW"] = "sw";
|
|
5165
|
+
KeyLocation["UHW"] = "uhw";
|
|
5166
|
+
})(KeyLocation || (KeyLocation = {}));
|
|
5167
|
+
var PopTokenGenerator = /** @class */ (function () {
|
|
5168
|
+
function PopTokenGenerator(cryptoUtils, performanceClient) {
|
|
5169
|
+
this.cryptoUtils = cryptoUtils;
|
|
5170
|
+
this.performanceClient = performanceClient;
|
|
5171
|
+
}
|
|
5172
|
+
/**
|
|
5173
|
+
* Generates the req_cnf validated at the RP in the POP protocol for SHR parameters
|
|
5174
|
+
* and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash
|
|
5175
|
+
* @param request
|
|
5176
|
+
* @returns
|
|
5177
|
+
*/
|
|
5178
|
+
PopTokenGenerator.prototype.generateCnf = function (request) {
|
|
5179
|
+
var _a, _b;
|
|
5180
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5181
|
+
var reqCnf, reqCnfString, _c;
|
|
5182
|
+
return __generator(this, function (_d) {
|
|
5183
|
+
switch (_d.label) {
|
|
5184
|
+
case 0:
|
|
5185
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5186
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5187
|
+
return [4 /*yield*/, this.generateKid(request)];
|
|
4936
5188
|
case 1:
|
|
4937
|
-
|
|
5189
|
+
reqCnf = _d.sent();
|
|
5190
|
+
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
5191
|
+
_c = {
|
|
5192
|
+
kid: reqCnf.kid,
|
|
5193
|
+
reqCnfString: reqCnfString
|
|
5194
|
+
};
|
|
5195
|
+
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
5196
|
+
case 2: return [2 /*return*/, (_c.reqCnfHash = _d.sent(),
|
|
5197
|
+
_c)];
|
|
5198
|
+
}
|
|
5199
|
+
});
|
|
5200
|
+
});
|
|
5201
|
+
};
|
|
5202
|
+
/**
|
|
5203
|
+
* Generates key_id for a SHR token request
|
|
5204
|
+
* @param request
|
|
5205
|
+
* @returns
|
|
5206
|
+
*/
|
|
5207
|
+
PopTokenGenerator.prototype.generateKid = function (request) {
|
|
5208
|
+
var _a;
|
|
5209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5210
|
+
var kidThumbprint;
|
|
5211
|
+
return __generator(this, function (_b) {
|
|
5212
|
+
switch (_b.label) {
|
|
5213
|
+
case 0:
|
|
5214
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5215
|
+
return [4 /*yield*/, this.cryptoUtils.getPublicKeyThumbprint(request)];
|
|
5216
|
+
case 1:
|
|
5217
|
+
kidThumbprint = _b.sent();
|
|
4938
5218
|
return [2 /*return*/, {
|
|
4939
5219
|
kid: kidThumbprint,
|
|
4940
5220
|
xms_ksl: KeyLocation.SW
|
|
@@ -4982,7 +5262,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4982
5262
|
return PopTokenGenerator;
|
|
4983
5263
|
}());
|
|
4984
5264
|
|
|
4985
|
-
/*! @azure/msal-common
|
|
5265
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
4986
5266
|
|
|
4987
5267
|
/*
|
|
4988
5268
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5052,7 +5332,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5052
5332
|
return AppMetadataEntity;
|
|
5053
5333
|
}());
|
|
5054
5334
|
|
|
5055
|
-
/*! @azure/msal-common
|
|
5335
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5056
5336
|
/*
|
|
5057
5337
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5058
5338
|
* Licensed under the MIT License.
|
|
@@ -5088,7 +5368,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5088
5368
|
return TokenCacheContext;
|
|
5089
5369
|
}());
|
|
5090
5370
|
|
|
5091
|
-
/*! @azure/msal-common
|
|
5371
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5092
5372
|
|
|
5093
5373
|
/*
|
|
5094
5374
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5098,13 +5378,14 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5098
5378
|
* Class that handles response parsing.
|
|
5099
5379
|
*/
|
|
5100
5380
|
var ResponseHandler = /** @class */ (function () {
|
|
5101
|
-
function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin) {
|
|
5381
|
+
function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin, performanceClient) {
|
|
5102
5382
|
this.clientId = clientId;
|
|
5103
5383
|
this.cacheStorage = cacheStorage;
|
|
5104
5384
|
this.cryptoObj = cryptoObj;
|
|
5105
5385
|
this.logger = logger;
|
|
5106
5386
|
this.serializableCache = serializableCache;
|
|
5107
5387
|
this.persistencePlugin = persistencePlugin;
|
|
5388
|
+
this.performanceClient = performanceClient;
|
|
5108
5389
|
}
|
|
5109
5390
|
/**
|
|
5110
5391
|
* Function which validates server authorization code response.
|
|
@@ -5122,7 +5403,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5122
5403
|
// Check for error
|
|
5123
5404
|
if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {
|
|
5124
5405
|
if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {
|
|
5125
|
-
throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
|
|
5406
|
+
throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror, serverResponseHash.timestamp || Constants.EMPTY_STRING, serverResponseHash.trace_id || Constants.EMPTY_STRING, serverResponseHash.correlation_id || Constants.EMPTY_STRING, serverResponseHash.claims || Constants.EMPTY_STRING);
|
|
5126
5407
|
}
|
|
5127
5408
|
throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);
|
|
5128
5409
|
}
|
|
@@ -5138,7 +5419,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5138
5419
|
// Check for error
|
|
5139
5420
|
if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {
|
|
5140
5421
|
if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
5141
|
-
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);
|
|
5422
|
+
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING);
|
|
5142
5423
|
}
|
|
5143
5424
|
var errString = serverResponse.error_codes + " - [" + serverResponse.timestamp + "]: " + serverResponse.error_description + " - Correlation ID: " + serverResponse.correlation_id + " - Trace ID: " + serverResponse.trace_id;
|
|
5144
5425
|
throw new ServerError(serverResponse.error, errString, serverResponse.suberror);
|
|
@@ -5150,11 +5431,13 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5150
5431
|
* @param authority
|
|
5151
5432
|
*/
|
|
5152
5433
|
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
|
|
5434
|
+
var _a;
|
|
5153
5435
|
return __awaiter(this, void 0, void 0, function () {
|
|
5154
5436
|
var idTokenObj, authTime, requestStateObj, cacheRecord, cacheContext, key, account;
|
|
5155
|
-
return __generator(this, function (
|
|
5156
|
-
switch (
|
|
5437
|
+
return __generator(this, function (_b) {
|
|
5438
|
+
switch (_b.label) {
|
|
5157
5439
|
case 0:
|
|
5440
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
|
|
5158
5441
|
if (serverTokenResponse.id_token) {
|
|
5159
5442
|
idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);
|
|
5160
5443
|
// token nonce check (TODO: Add a warning if no nonce is given?)
|
|
@@ -5180,16 +5463,16 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5180
5463
|
// Add keyId from request to serverTokenResponse if defined
|
|
5181
5464
|
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
|
|
5182
5465
|
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);
|
|
5183
|
-
|
|
5466
|
+
_b.label = 1;
|
|
5184
5467
|
case 1:
|
|
5185
|
-
|
|
5468
|
+
_b.trys.push([1, , 5, 8]);
|
|
5186
5469
|
if (!(this.persistencePlugin && this.serializableCache)) return [3 /*break*/, 3];
|
|
5187
5470
|
this.logger.verbose("Persistence enabled, calling beforeCacheAccess");
|
|
5188
5471
|
cacheContext = new TokenCacheContext(this.serializableCache, true);
|
|
5189
5472
|
return [4 /*yield*/, this.persistencePlugin.beforeCacheAccess(cacheContext)];
|
|
5190
5473
|
case 2:
|
|
5191
|
-
|
|
5192
|
-
|
|
5474
|
+
_b.sent();
|
|
5475
|
+
_b.label = 3;
|
|
5193
5476
|
case 3:
|
|
5194
5477
|
/*
|
|
5195
5478
|
* When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.
|
|
@@ -5207,15 +5490,15 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5207
5490
|
}
|
|
5208
5491
|
return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];
|
|
5209
5492
|
case 4:
|
|
5210
|
-
|
|
5493
|
+
_b.sent();
|
|
5211
5494
|
return [3 /*break*/, 8];
|
|
5212
5495
|
case 5:
|
|
5213
5496
|
if (!(this.persistencePlugin && this.serializableCache && cacheContext)) return [3 /*break*/, 7];
|
|
5214
5497
|
this.logger.verbose("Persistence enabled, calling afterCacheAccess");
|
|
5215
5498
|
return [4 /*yield*/, this.persistencePlugin.afterCacheAccess(cacheContext)];
|
|
5216
5499
|
case 6:
|
|
5217
|
-
|
|
5218
|
-
|
|
5500
|
+
_b.sent();
|
|
5501
|
+
_b.label = 7;
|
|
5219
5502
|
case 7: return [7 /*endfinally*/];
|
|
5220
5503
|
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code, serverRequestId)];
|
|
5221
5504
|
}
|
|
@@ -5359,7 +5642,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5359
5642
|
cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
|
|
5360
5643
|
msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
|
|
5361
5644
|
code: code,
|
|
5362
|
-
fromNativeBroker: false
|
|
5645
|
+
fromNativeBroker: false,
|
|
5363
5646
|
}];
|
|
5364
5647
|
}
|
|
5365
5648
|
});
|
|
@@ -5368,7 +5651,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5368
5651
|
return ResponseHandler;
|
|
5369
5652
|
}());
|
|
5370
5653
|
|
|
5371
|
-
/*! @azure/msal-common
|
|
5654
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5372
5655
|
|
|
5373
5656
|
/*
|
|
5374
5657
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5379,8 +5662,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5379
5662
|
*/
|
|
5380
5663
|
var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
5381
5664
|
__extends(AuthorizationCodeClient, _super);
|
|
5382
|
-
function AuthorizationCodeClient(configuration) {
|
|
5383
|
-
var _this = _super.call(this, configuration) || this;
|
|
5665
|
+
function AuthorizationCodeClient(configuration, performanceClient) {
|
|
5666
|
+
var _this = _super.call(this, configuration, performanceClient) || this;
|
|
5384
5667
|
// Flag to indicate if client is for hybrid spa auth code redemption
|
|
5385
5668
|
_this.includeRedirectUri = true;
|
|
5386
5669
|
return _this;
|
|
@@ -5396,13 +5679,17 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5396
5679
|
* @param request
|
|
5397
5680
|
*/
|
|
5398
5681
|
AuthorizationCodeClient.prototype.getAuthCodeUrl = function (request) {
|
|
5682
|
+
var _a, _b;
|
|
5399
5683
|
return __awaiter(this, void 0, void 0, function () {
|
|
5400
5684
|
var queryString;
|
|
5401
|
-
return __generator(this, function (
|
|
5402
|
-
switch (
|
|
5403
|
-
case 0:
|
|
5685
|
+
return __generator(this, function (_c) {
|
|
5686
|
+
switch (_c.label) {
|
|
5687
|
+
case 0:
|
|
5688
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.GetAuthCodeUrl, request.correlationId);
|
|
5689
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5690
|
+
return [4 /*yield*/, this.createAuthCodeUrlQueryString(request)];
|
|
5404
5691
|
case 1:
|
|
5405
|
-
queryString =
|
|
5692
|
+
queryString = _c.sent();
|
|
5406
5693
|
return [2 /*return*/, UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString)];
|
|
5407
5694
|
}
|
|
5408
5695
|
});
|
|
@@ -5414,26 +5701,50 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5414
5701
|
* @param request
|
|
5415
5702
|
*/
|
|
5416
5703
|
AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {
|
|
5417
|
-
var _a;
|
|
5704
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5418
5705
|
return __awaiter(this, void 0, void 0, function () {
|
|
5419
|
-
var reqTimestamp, response, requestId, responseHandler;
|
|
5420
|
-
|
|
5421
|
-
|
|
5706
|
+
var atsMeasurement, reqTimestamp, response, requestId, httpVerAuthority, responseHandler;
|
|
5707
|
+
var _this = this;
|
|
5708
|
+
return __generator(this, function (_g) {
|
|
5709
|
+
switch (_g.label) {
|
|
5422
5710
|
case 0:
|
|
5423
|
-
|
|
5424
|
-
if (!request || StringUtils.isEmpty(request.code)) {
|
|
5711
|
+
if (!request || !request.code) {
|
|
5425
5712
|
throw ClientAuthError.createTokenRequestCannotBeMadeError();
|
|
5426
5713
|
}
|
|
5714
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientAcquireToken, request.correlationId);
|
|
5715
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement("AuthCodeClientAcquireToken", request.correlationId);
|
|
5716
|
+
this.logger.info("in acquireToken call in auth-code client");
|
|
5427
5717
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
5718
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5428
5719
|
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
5429
5720
|
case 1:
|
|
5430
|
-
response =
|
|
5431
|
-
requestId = (
|
|
5432
|
-
|
|
5721
|
+
response = _g.sent();
|
|
5722
|
+
requestId = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_REQUEST_ID];
|
|
5723
|
+
httpVerAuthority = (_e = response.headers) === null || _e === void 0 ? void 0 : _e[HeaderNames.X_MS_HTTP_VERSION];
|
|
5724
|
+
if (httpVerAuthority) {
|
|
5725
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
5726
|
+
httpVerAuthority: httpVerAuthority
|
|
5727
|
+
});
|
|
5728
|
+
}
|
|
5729
|
+
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);
|
|
5433
5730
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5434
5731
|
responseHandler.validateTokenResponse(response.body);
|
|
5435
|
-
|
|
5436
|
-
|
|
5732
|
+
(_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
5733
|
+
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId).then(function (result) {
|
|
5734
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5735
|
+
success: true
|
|
5736
|
+
});
|
|
5737
|
+
return result;
|
|
5738
|
+
})
|
|
5739
|
+
.catch(function (error) {
|
|
5740
|
+
_this.logger.verbose("Error in fetching token in ACC", request.correlationId);
|
|
5741
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5742
|
+
errorCode: error.errorCode,
|
|
5743
|
+
subErrorCode: error.subError,
|
|
5744
|
+
success: false
|
|
5745
|
+
});
|
|
5746
|
+
throw error;
|
|
5747
|
+
})];
|
|
5437
5748
|
}
|
|
5438
5749
|
});
|
|
5439
5750
|
});
|
|
@@ -5480,26 +5791,19 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5480
5791
|
* @param request
|
|
5481
5792
|
*/
|
|
5482
5793
|
AuthorizationCodeClient.prototype.executeTokenRequest = function (authority, request) {
|
|
5794
|
+
var _a, _b;
|
|
5483
5795
|
return __awaiter(this, void 0, void 0, function () {
|
|
5484
|
-
var
|
|
5485
|
-
return __generator(this, function (
|
|
5486
|
-
switch (
|
|
5796
|
+
var queryParametersString, endpoint, requestBody, ccsCredential, clientInfo, headers, thumbprint;
|
|
5797
|
+
return __generator(this, function (_c) {
|
|
5798
|
+
switch (_c.label) {
|
|
5487
5799
|
case 0:
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
claims: request.claims,
|
|
5493
|
-
authenticationScheme: request.authenticationScheme,
|
|
5494
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
5495
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
5496
|
-
shrClaims: request.shrClaims,
|
|
5497
|
-
sshKid: request.sshKid
|
|
5498
|
-
};
|
|
5800
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5801
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5802
|
+
queryParametersString = this.createTokenQueryParameters(request);
|
|
5803
|
+
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
5499
5804
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
5500
5805
|
case 1:
|
|
5501
|
-
requestBody =
|
|
5502
|
-
queryParameters = this.createTokenQueryParameters(request);
|
|
5806
|
+
requestBody = _c.sent();
|
|
5503
5807
|
ccsCredential = undefined;
|
|
5504
5808
|
if (request.clientInfo) {
|
|
5505
5809
|
try {
|
|
@@ -5514,34 +5818,35 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5514
5818
|
}
|
|
5515
5819
|
}
|
|
5516
5820
|
headers = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);
|
|
5517
|
-
|
|
5821
|
+
thumbprint = {
|
|
5822
|
+
clientId: this.config.authOptions.clientId,
|
|
5823
|
+
authority: authority.canonicalAuthority,
|
|
5824
|
+
scopes: request.scopes,
|
|
5825
|
+
claims: request.claims,
|
|
5826
|
+
authenticationScheme: request.authenticationScheme,
|
|
5827
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
5828
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
5829
|
+
shrClaims: request.shrClaims,
|
|
5830
|
+
sshKid: request.sshKid
|
|
5831
|
+
};
|
|
5518
5832
|
return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];
|
|
5519
5833
|
}
|
|
5520
5834
|
});
|
|
5521
5835
|
});
|
|
5522
5836
|
};
|
|
5523
|
-
/**
|
|
5524
|
-
* Creates query string for the /token request
|
|
5525
|
-
* @param request
|
|
5526
|
-
*/
|
|
5527
|
-
AuthorizationCodeClient.prototype.createTokenQueryParameters = function (request) {
|
|
5528
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
5529
|
-
if (request.tokenQueryParameters) {
|
|
5530
|
-
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
5531
|
-
}
|
|
5532
|
-
return parameterBuilder.createQueryString();
|
|
5533
|
-
};
|
|
5534
5837
|
/**
|
|
5535
5838
|
* Generates a map for all the params to be sent to the service
|
|
5536
5839
|
* @param request
|
|
5537
5840
|
*/
|
|
5538
5841
|
AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
|
|
5842
|
+
var _a, _b;
|
|
5539
5843
|
return __awaiter(this, void 0, void 0, function () {
|
|
5540
5844
|
var parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, correlationId, ccsCred, clientInfo, clientInfo;
|
|
5541
|
-
var
|
|
5542
|
-
return __generator(this, function (
|
|
5543
|
-
switch (
|
|
5845
|
+
var _c;
|
|
5846
|
+
return __generator(this, function (_d) {
|
|
5847
|
+
switch (_d.label) {
|
|
5544
5848
|
case 0:
|
|
5849
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5545
5850
|
parameterBuilder = new RequestParameterBuilder();
|
|
5546
5851
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5547
5852
|
/*
|
|
@@ -5582,10 +5887,11 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5582
5887
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
5583
5888
|
parameterBuilder.addClientInfo();
|
|
5584
5889
|
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5585
|
-
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5890
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
5891
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5586
5892
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5587
5893
|
case 1:
|
|
5588
|
-
reqCnfData =
|
|
5894
|
+
reqCnfData = _d.sent();
|
|
5589
5895
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5590
5896
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5591
5897
|
return [3 /*break*/, 3];
|
|
@@ -5598,7 +5904,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5598
5904
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
5599
5905
|
}
|
|
5600
5906
|
}
|
|
5601
|
-
|
|
5907
|
+
_d.label = 3;
|
|
5602
5908
|
case 3:
|
|
5603
5909
|
correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();
|
|
5604
5910
|
parameterBuilder.addCorrelationId(correlationId);
|
|
@@ -5643,9 +5949,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5643
5949
|
}
|
|
5644
5950
|
// Add hybrid spa parameters if not already provided
|
|
5645
5951
|
if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
|
|
5646
|
-
parameterBuilder.addExtraQueryParameters((
|
|
5647
|
-
|
|
5648
|
-
|
|
5952
|
+
parameterBuilder.addExtraQueryParameters((_c = {},
|
|
5953
|
+
_c[AADServerParamKeys.RETURN_SPA_CODE] = "1",
|
|
5954
|
+
_c));
|
|
5649
5955
|
}
|
|
5650
5956
|
return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5651
5957
|
}
|
|
@@ -5657,11 +5963,13 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5657
5963
|
* @param request
|
|
5658
5964
|
*/
|
|
5659
5965
|
AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
|
|
5966
|
+
var _a;
|
|
5660
5967
|
return __awaiter(this, void 0, void 0, function () {
|
|
5661
5968
|
var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
|
|
5662
|
-
return __generator(this, function (
|
|
5663
|
-
switch (
|
|
5969
|
+
return __generator(this, function (_b) {
|
|
5970
|
+
switch (_b.label) {
|
|
5664
5971
|
case 0:
|
|
5972
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5665
5973
|
parameterBuilder = new RequestParameterBuilder();
|
|
5666
5974
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5667
5975
|
requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);
|
|
@@ -5733,220 +6041,95 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5733
6041
|
}
|
|
5734
6042
|
else if (request.account.username) {
|
|
5735
6043
|
// Fallback to account username if provided
|
|
5736
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
5737
|
-
parameterBuilder.addLoginHint(request.account.username);
|
|
5738
|
-
try {
|
|
5739
|
-
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
5740
|
-
parameterBuilder.addCcsOid(clientInfo);
|
|
5741
|
-
}
|
|
5742
|
-
catch (e) {
|
|
5743
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
5744
|
-
}
|
|
5745
|
-
}
|
|
5746
|
-
}
|
|
5747
|
-
else if (request.loginHint) {
|
|
5748
|
-
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
5749
|
-
parameterBuilder.addLoginHint(request.loginHint);
|
|
5750
|
-
parameterBuilder.addCcsUpn(request.loginHint);
|
|
5751
|
-
}
|
|
5752
|
-
}
|
|
5753
|
-
else {
|
|
5754
|
-
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
5755
|
-
}
|
|
5756
|
-
if (request.nonce) {
|
|
5757
|
-
parameterBuilder.addNonce(request.nonce);
|
|
5758
|
-
}
|
|
5759
|
-
if (request.state) {
|
|
5760
|
-
parameterBuilder.addState(request.state);
|
|
5761
|
-
}
|
|
5762
|
-
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
5763
|
-
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
5764
|
-
}
|
|
5765
|
-
if (request.extraQueryParameters) {
|
|
5766
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5767
|
-
}
|
|
5768
|
-
if (!request.nativeBroker) return [3 /*break*/, 2];
|
|
5769
|
-
// signal ests that this is a WAM call
|
|
5770
|
-
parameterBuilder.addNativeBroker();
|
|
5771
|
-
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5772
|
-
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5773
|
-
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5774
|
-
case 1:
|
|
5775
|
-
reqCnfData =
|
|
5776
|
-
parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
|
|
5777
|
-
|
|
5778
|
-
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5779
|
-
}
|
|
5780
|
-
});
|
|
5781
|
-
});
|
|
5782
|
-
};
|
|
5783
|
-
/**
|
|
5784
|
-
* This API validates the `EndSessionRequest` and creates a URL
|
|
5785
|
-
* @param request
|
|
5786
|
-
*/
|
|
5787
|
-
AuthorizationCodeClient.prototype.createLogoutUrlQueryString = function (request) {
|
|
5788
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
5789
|
-
if (request.postLogoutRedirectUri) {
|
|
5790
|
-
parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);
|
|
5791
|
-
}
|
|
5792
|
-
if (request.correlationId) {
|
|
5793
|
-
parameterBuilder.addCorrelationId(request.correlationId);
|
|
5794
|
-
}
|
|
5795
|
-
if (request.idTokenHint) {
|
|
5796
|
-
parameterBuilder.addIdTokenHint(request.idTokenHint);
|
|
5797
|
-
}
|
|
5798
|
-
if (request.state) {
|
|
5799
|
-
parameterBuilder.addState(request.state);
|
|
5800
|
-
}
|
|
5801
|
-
if (request.logoutHint) {
|
|
5802
|
-
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
5803
|
-
}
|
|
5804
|
-
if (request.extraQueryParameters) {
|
|
5805
|
-
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5806
|
-
}
|
|
5807
|
-
return parameterBuilder.createQueryString();
|
|
5808
|
-
};
|
|
5809
|
-
/**
|
|
5810
|
-
* Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.
|
|
5811
|
-
* @param account
|
|
5812
|
-
*/
|
|
5813
|
-
AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
|
|
5814
|
-
var _a;
|
|
5815
|
-
return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
|
|
5816
|
-
};
|
|
5817
|
-
AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
|
|
5818
|
-
var _a;
|
|
5819
|
-
return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
|
|
5820
|
-
};
|
|
5821
|
-
return AuthorizationCodeClient;
|
|
5822
|
-
}(BaseClient));
|
|
5823
|
-
|
|
5824
|
-
/*! @azure/msal-common v9.0.1 2022-12-07 */
|
|
5825
|
-
/*
|
|
5826
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5827
|
-
* Licensed under the MIT License.
|
|
5828
|
-
*/
|
|
5829
|
-
/**
|
|
5830
|
-
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
5831
|
-
*
|
|
5832
|
-
* @export
|
|
5833
|
-
* @enum {number}
|
|
5834
|
-
*/
|
|
5835
|
-
exports.PerformanceEvents = void 0;
|
|
5836
|
-
(function (PerformanceEvents) {
|
|
5837
|
-
/**
|
|
5838
|
-
* acquireTokenByCode API (msal-browser and msal-node).
|
|
5839
|
-
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
5840
|
-
*/
|
|
5841
|
-
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
|
|
5842
|
-
/**
|
|
5843
|
-
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
5844
|
-
* Used to renew an access token using a refresh token against the token endpoint.
|
|
5845
|
-
*/
|
|
5846
|
-
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
|
|
5847
|
-
/**
|
|
5848
|
-
* acquireTokenSilent API (msal-browser and msal-node).
|
|
5849
|
-
* Used to silently acquire a new access token (from the cache or the network).
|
|
5850
|
-
*/
|
|
5851
|
-
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
|
|
5852
|
-
/**
|
|
5853
|
-
* acquireTokenSilentAsync (msal-browser).
|
|
5854
|
-
* Internal API for acquireTokenSilent.
|
|
5855
|
-
*/
|
|
5856
|
-
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
5857
|
-
/**
|
|
5858
|
-
* acquireTokenPopup (msal-browser).
|
|
5859
|
-
* Used to acquire a new access token interactively through pop ups
|
|
5860
|
-
*/
|
|
5861
|
-
PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
|
|
5862
|
-
/**
|
|
5863
|
-
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
5864
|
-
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
5865
|
-
*/
|
|
5866
|
-
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
|
|
5867
|
-
/**
|
|
5868
|
-
* signJwt API in CryptoOpts class (msal-browser).
|
|
5869
|
-
* Used to signed a pop token.
|
|
5870
|
-
*/
|
|
5871
|
-
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
|
|
5872
|
-
/**
|
|
5873
|
-
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
5874
|
-
* Used to read access tokens from the cache.
|
|
5875
|
-
*/
|
|
5876
|
-
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
|
|
5877
|
-
/**
|
|
5878
|
-
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
5879
|
-
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
5880
|
-
*/
|
|
5881
|
-
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
|
|
5882
|
-
/**
|
|
5883
|
-
* acquireToken API in SilentRereshClient (msal-browser).
|
|
5884
|
-
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
5885
|
-
*/
|
|
5886
|
-
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
|
|
5887
|
-
/**
|
|
5888
|
-
* ssoSilent API (msal-browser).
|
|
5889
|
-
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
5890
|
-
*/
|
|
5891
|
-
PerformanceEvents["SsoSilent"] = "ssoSilent";
|
|
5892
|
-
/**
|
|
5893
|
-
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
5894
|
-
* Used to load authority metadata for a request.
|
|
5895
|
-
*/
|
|
5896
|
-
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
5897
|
-
/**
|
|
5898
|
-
* acquireToken APIs in msal-browser.
|
|
5899
|
-
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
5900
|
-
*/
|
|
5901
|
-
PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
|
|
5902
|
-
/**
|
|
5903
|
-
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
5904
|
-
* Used to acquire a token from Native component when native brokering is enabled.
|
|
5905
|
-
*/
|
|
5906
|
-
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
5907
|
-
/**
|
|
5908
|
-
* Time spent creating default headers for requests to token endpoint
|
|
5909
|
-
*/
|
|
5910
|
-
PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
|
|
5911
|
-
/**
|
|
5912
|
-
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
5913
|
-
*/
|
|
5914
|
-
PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
|
|
5915
|
-
/**
|
|
5916
|
-
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
5917
|
-
*/
|
|
5918
|
-
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
5919
|
-
/**
|
|
5920
|
-
* Time taken for token acquisition by broker
|
|
5921
|
-
*/
|
|
5922
|
-
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
5923
|
-
/**
|
|
5924
|
-
* Time spent on the network for refresh token acquisition
|
|
5925
|
-
*/
|
|
5926
|
-
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
6044
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account");
|
|
6045
|
+
parameterBuilder.addLoginHint(request.account.username);
|
|
6046
|
+
try {
|
|
6047
|
+
clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);
|
|
6048
|
+
parameterBuilder.addCcsOid(clientInfo);
|
|
6049
|
+
}
|
|
6050
|
+
catch (e) {
|
|
6051
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header");
|
|
6052
|
+
}
|
|
6053
|
+
}
|
|
6054
|
+
}
|
|
6055
|
+
else if (request.loginHint) {
|
|
6056
|
+
this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request");
|
|
6057
|
+
parameterBuilder.addLoginHint(request.loginHint);
|
|
6058
|
+
parameterBuilder.addCcsUpn(request.loginHint);
|
|
6059
|
+
}
|
|
6060
|
+
}
|
|
6061
|
+
else {
|
|
6062
|
+
this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");
|
|
6063
|
+
}
|
|
6064
|
+
if (request.nonce) {
|
|
6065
|
+
parameterBuilder.addNonce(request.nonce);
|
|
6066
|
+
}
|
|
6067
|
+
if (request.state) {
|
|
6068
|
+
parameterBuilder.addState(request.state);
|
|
6069
|
+
}
|
|
6070
|
+
if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
6071
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
6072
|
+
}
|
|
6073
|
+
if (request.extraQueryParameters) {
|
|
6074
|
+
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
6075
|
+
}
|
|
6076
|
+
if (!request.nativeBroker) return [3 /*break*/, 2];
|
|
6077
|
+
// signal ests that this is a WAM call
|
|
6078
|
+
parameterBuilder.addNativeBroker();
|
|
6079
|
+
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
6080
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
6081
|
+
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
6082
|
+
case 1:
|
|
6083
|
+
reqCnfData = _b.sent();
|
|
6084
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
|
|
6085
|
+
_b.label = 2;
|
|
6086
|
+
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
6087
|
+
}
|
|
6088
|
+
});
|
|
6089
|
+
});
|
|
6090
|
+
};
|
|
5927
6091
|
/**
|
|
5928
|
-
*
|
|
6092
|
+
* This API validates the `EndSessionRequest` and creates a URL
|
|
6093
|
+
* @param request
|
|
5929
6094
|
*/
|
|
5930
|
-
|
|
6095
|
+
AuthorizationCodeClient.prototype.createLogoutUrlQueryString = function (request) {
|
|
6096
|
+
var parameterBuilder = new RequestParameterBuilder();
|
|
6097
|
+
if (request.postLogoutRedirectUri) {
|
|
6098
|
+
parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);
|
|
6099
|
+
}
|
|
6100
|
+
if (request.correlationId) {
|
|
6101
|
+
parameterBuilder.addCorrelationId(request.correlationId);
|
|
6102
|
+
}
|
|
6103
|
+
if (request.idTokenHint) {
|
|
6104
|
+
parameterBuilder.addIdTokenHint(request.idTokenHint);
|
|
6105
|
+
}
|
|
6106
|
+
if (request.state) {
|
|
6107
|
+
parameterBuilder.addState(request.state);
|
|
6108
|
+
}
|
|
6109
|
+
if (request.logoutHint) {
|
|
6110
|
+
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
6111
|
+
}
|
|
6112
|
+
if (request.extraQueryParameters) {
|
|
6113
|
+
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
6114
|
+
}
|
|
6115
|
+
return parameterBuilder.createQueryString();
|
|
6116
|
+
};
|
|
5931
6117
|
/**
|
|
5932
|
-
*
|
|
6118
|
+
* Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.
|
|
6119
|
+
* @param account
|
|
5933
6120
|
*/
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
(
|
|
5944
|
-
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
|
|
5945
|
-
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
|
|
5946
|
-
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
5947
|
-
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
6121
|
+
AuthorizationCodeClient.prototype.extractAccountSid = function (account) {
|
|
6122
|
+
var _a;
|
|
6123
|
+
return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;
|
|
6124
|
+
};
|
|
6125
|
+
AuthorizationCodeClient.prototype.extractLoginHint = function (account) {
|
|
6126
|
+
var _a;
|
|
6127
|
+
return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;
|
|
6128
|
+
};
|
|
6129
|
+
return AuthorizationCodeClient;
|
|
6130
|
+
}(BaseClient));
|
|
5948
6131
|
|
|
5949
|
-
/*! @azure/msal-common
|
|
6132
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
5950
6133
|
|
|
5951
6134
|
/*
|
|
5952
6135
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5961,25 +6144,34 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5961
6144
|
return _super.call(this, configuration, performanceClient) || this;
|
|
5962
6145
|
}
|
|
5963
6146
|
RefreshTokenClient.prototype.acquireToken = function (request) {
|
|
5964
|
-
var _a, _b, _c;
|
|
6147
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5965
6148
|
return __awaiter(this, void 0, void 0, function () {
|
|
5966
|
-
var atsMeasurement, reqTimestamp, response, requestId, responseHandler;
|
|
6149
|
+
var atsMeasurement, reqTimestamp, response, httpVerToken, requestId, responseHandler;
|
|
5967
6150
|
var _this = this;
|
|
5968
|
-
return __generator(this, function (
|
|
5969
|
-
switch (
|
|
6151
|
+
return __generator(this, function (_h) {
|
|
6152
|
+
switch (_h.label) {
|
|
5970
6153
|
case 0:
|
|
5971
|
-
|
|
6154
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6155
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5972
6156
|
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
5973
6157
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
6158
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
5974
6159
|
return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
5975
6160
|
case 1:
|
|
5976
|
-
response =
|
|
6161
|
+
response = _h.sent();
|
|
6162
|
+
httpVerToken = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_HTTP_VERSION];
|
|
5977
6163
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
5978
|
-
refreshTokenSize: ((
|
|
6164
|
+
refreshTokenSize: ((_e = response.body.refresh_token) === null || _e === void 0 ? void 0 : _e.length) || 0,
|
|
5979
6165
|
});
|
|
5980
|
-
|
|
6166
|
+
if (httpVerToken) {
|
|
6167
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6168
|
+
httpVerToken: httpVerToken,
|
|
6169
|
+
});
|
|
6170
|
+
}
|
|
6171
|
+
requestId = (_f = response.headers) === null || _f === void 0 ? void 0 : _f[HeaderNames.X_MS_REQUEST_ID];
|
|
5981
6172
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
5982
6173
|
responseHandler.validateTokenResponse(response.body);
|
|
6174
|
+
(_g = this.performanceClient) === null || _g === void 0 ? void 0 : _g.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
5983
6175
|
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
|
|
5984
6176
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5985
6177
|
success: true
|
|
@@ -6004,13 +6196,15 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6004
6196
|
* @param request
|
|
6005
6197
|
*/
|
|
6006
6198
|
RefreshTokenClient.prototype.acquireTokenByRefreshToken = function (request) {
|
|
6199
|
+
var _a, _b, _c, _d;
|
|
6007
6200
|
return __awaiter(this, void 0, void 0, function () {
|
|
6008
6201
|
var isFOCI, noFamilyRTInCache, clientMismatchErrorWithFamilyRT;
|
|
6009
|
-
return __generator(this, function (
|
|
6202
|
+
return __generator(this, function (_e) {
|
|
6010
6203
|
// Cannot renew token if no request object is given.
|
|
6011
6204
|
if (!request) {
|
|
6012
6205
|
throw ClientConfigurationError.createEmptyTokenRequestError();
|
|
6013
6206
|
}
|
|
6207
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
6014
6208
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
6015
6209
|
if (!request.account) {
|
|
6016
6210
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
@@ -6019,6 +6213,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6019
6213
|
// if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
|
|
6020
6214
|
if (isFOCI) {
|
|
6021
6215
|
try {
|
|
6216
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6022
6217
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, true)];
|
|
6023
6218
|
}
|
|
6024
6219
|
catch (e) {
|
|
@@ -6026,6 +6221,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6026
6221
|
clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;
|
|
6027
6222
|
// if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
|
|
6028
6223
|
if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
|
|
6224
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6029
6225
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];
|
|
6030
6226
|
// throw in all other cases
|
|
6031
6227
|
}
|
|
@@ -6035,6 +6231,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6035
6231
|
}
|
|
6036
6232
|
}
|
|
6037
6233
|
// fall back to application refresh token acquisition
|
|
6234
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6038
6235
|
return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];
|
|
6039
6236
|
});
|
|
6040
6237
|
});
|
|
@@ -6044,11 +6241,12 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6044
6241
|
* @param request
|
|
6045
6242
|
*/
|
|
6046
6243
|
RefreshTokenClient.prototype.acquireTokenWithCachedRefreshToken = function (request, foci) {
|
|
6047
|
-
var _a;
|
|
6244
|
+
var _a, _b, _c;
|
|
6048
6245
|
return __awaiter(this, void 0, void 0, function () {
|
|
6049
6246
|
var atsMeasurement, refreshToken, refreshTokenRequest;
|
|
6050
|
-
return __generator(this, function (
|
|
6051
|
-
|
|
6247
|
+
return __generator(this, function (_d) {
|
|
6248
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6249
|
+
atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6052
6250
|
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
6053
6251
|
refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);
|
|
6054
6252
|
if (!refreshToken) {
|
|
@@ -6063,6 +6261,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6063
6261
|
credential: request.account.homeAccountId,
|
|
6064
6262
|
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
6065
6263
|
} });
|
|
6264
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6066
6265
|
return [2 /*return*/, this.acquireToken(refreshTokenRequest)];
|
|
6067
6266
|
});
|
|
6068
6267
|
});
|
|
@@ -6073,17 +6272,20 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6073
6272
|
* @param authority
|
|
6074
6273
|
*/
|
|
6075
6274
|
RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {
|
|
6076
|
-
var _a;
|
|
6275
|
+
var _a, _b, _c;
|
|
6077
6276
|
return __awaiter(this, void 0, void 0, function () {
|
|
6078
|
-
var acquireTokenMeasurement,
|
|
6079
|
-
return __generator(this, function (
|
|
6080
|
-
switch (
|
|
6277
|
+
var acquireTokenMeasurement, queryParametersString, endpoint, requestBody, headers, thumbprint;
|
|
6278
|
+
return __generator(this, function (_d) {
|
|
6279
|
+
switch (_d.label) {
|
|
6081
6280
|
case 0:
|
|
6082
|
-
|
|
6281
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6282
|
+
acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6283
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6284
|
+
queryParametersString = this.createTokenQueryParameters(request);
|
|
6285
|
+
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
6083
6286
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
6084
6287
|
case 1:
|
|
6085
|
-
requestBody =
|
|
6086
|
-
queryParameters = this.createTokenQueryParameters(request);
|
|
6288
|
+
requestBody = _d.sent();
|
|
6087
6289
|
headers = this.createTokenRequestHeaders(request.ccsCredential);
|
|
6088
6290
|
thumbprint = {
|
|
6089
6291
|
clientId: this.config.authOptions.clientId,
|
|
@@ -6096,7 +6298,6 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6096
6298
|
shrClaims: request.shrClaims,
|
|
6097
6299
|
sshKid: request.sshKid
|
|
6098
6300
|
};
|
|
6099
|
-
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
|
|
6100
6301
|
return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)
|
|
6101
6302
|
.then(function (result) {
|
|
6102
6303
|
acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({
|
|
@@ -6114,30 +6315,20 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6114
6315
|
});
|
|
6115
6316
|
});
|
|
6116
6317
|
};
|
|
6117
|
-
/**
|
|
6118
|
-
* Creates query string for the /token request
|
|
6119
|
-
* @param request
|
|
6120
|
-
*/
|
|
6121
|
-
RefreshTokenClient.prototype.createTokenQueryParameters = function (request) {
|
|
6122
|
-
var parameterBuilder = new RequestParameterBuilder();
|
|
6123
|
-
if (request.tokenQueryParameters) {
|
|
6124
|
-
parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);
|
|
6125
|
-
}
|
|
6126
|
-
return parameterBuilder.createQueryString();
|
|
6127
|
-
};
|
|
6128
6318
|
/**
|
|
6129
6319
|
* Helper function to create the token request body
|
|
6130
6320
|
* @param request
|
|
6131
6321
|
*/
|
|
6132
6322
|
RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
|
|
6133
|
-
var _a;
|
|
6323
|
+
var _a, _b, _c;
|
|
6134
6324
|
return __awaiter(this, void 0, void 0, function () {
|
|
6135
6325
|
var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
|
|
6136
|
-
return __generator(this, function (
|
|
6137
|
-
switch (
|
|
6326
|
+
return __generator(this, function (_d) {
|
|
6327
|
+
switch (_d.label) {
|
|
6138
6328
|
case 0:
|
|
6329
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6139
6330
|
correlationId = request.correlationId;
|
|
6140
|
-
acquireTokenMeasurement = (
|
|
6331
|
+
acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
|
|
6141
6332
|
parameterBuilder = new RequestParameterBuilder();
|
|
6142
6333
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
6143
6334
|
parameterBuilder.addScopes(request.scopes);
|
|
@@ -6160,10 +6351,11 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6160
6351
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6161
6352
|
}
|
|
6162
6353
|
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
6163
|
-
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
6354
|
+
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
6355
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
6164
6356
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
6165
6357
|
case 1:
|
|
6166
|
-
reqCnfData =
|
|
6358
|
+
reqCnfData = _d.sent();
|
|
6167
6359
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
6168
6360
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
6169
6361
|
return [3 /*break*/, 3];
|
|
@@ -6179,7 +6371,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6179
6371
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
6180
6372
|
}
|
|
6181
6373
|
}
|
|
6182
|
-
|
|
6374
|
+
_d.label = 3;
|
|
6183
6375
|
case 3:
|
|
6184
6376
|
if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {
|
|
6185
6377
|
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
@@ -6211,7 +6403,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6211
6403
|
return RefreshTokenClient;
|
|
6212
6404
|
}(BaseClient));
|
|
6213
6405
|
|
|
6214
|
-
/*! @azure/msal-common
|
|
6406
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6215
6407
|
|
|
6216
6408
|
/*
|
|
6217
6409
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6335,7 +6527,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
6335
6527
|
return SilentFlowClient;
|
|
6336
6528
|
}(BaseClient));
|
|
6337
6529
|
|
|
6338
|
-
/*! @azure/msal-common
|
|
6530
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6339
6531
|
/*
|
|
6340
6532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6341
6533
|
* Licensed under the MIT License.
|
|
@@ -6347,7 +6539,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
6347
6539
|
response.hasOwnProperty("jwks_uri"));
|
|
6348
6540
|
}
|
|
6349
6541
|
|
|
6350
|
-
/*! @azure/msal-common
|
|
6542
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6351
6543
|
/*
|
|
6352
6544
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6353
6545
|
* Licensed under the MIT License.
|
|
@@ -6356,7 +6548,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
|
|
|
6356
6548
|
var EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
6357
6549
|
var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
6358
6550
|
|
|
6359
|
-
/*! @azure/msal-common
|
|
6551
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6360
6552
|
/*
|
|
6361
6553
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6362
6554
|
* Licensed under the MIT License.
|
|
@@ -6370,7 +6562,7 @@ exports.ProtocolMode = void 0;
|
|
|
6370
6562
|
ProtocolMode["OIDC"] = "OIDC";
|
|
6371
6563
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
6372
6564
|
|
|
6373
|
-
/*! @azure/msal-common
|
|
6565
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6374
6566
|
|
|
6375
6567
|
/*
|
|
6376
6568
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6447,7 +6639,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
6447
6639
|
return AuthorityMetadataEntity;
|
|
6448
6640
|
}());
|
|
6449
6641
|
|
|
6450
|
-
/*! @azure/msal-common
|
|
6642
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6451
6643
|
/*
|
|
6452
6644
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6453
6645
|
* Licensed under the MIT License.
|
|
@@ -6457,7 +6649,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
6457
6649
|
response.hasOwnProperty("metadata"));
|
|
6458
6650
|
}
|
|
6459
6651
|
|
|
6460
|
-
/*! @azure/msal-common
|
|
6652
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6461
6653
|
/*
|
|
6462
6654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6463
6655
|
* Licensed under the MIT License.
|
|
@@ -6467,68 +6659,72 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
6467
6659
|
response.hasOwnProperty("error_description"));
|
|
6468
6660
|
}
|
|
6469
6661
|
|
|
6470
|
-
/*! @azure/msal-common
|
|
6662
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6471
6663
|
|
|
6472
6664
|
/*
|
|
6473
6665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6474
6666
|
* Licensed under the MIT License.
|
|
6475
6667
|
*/
|
|
6476
6668
|
var RegionDiscovery = /** @class */ (function () {
|
|
6477
|
-
function RegionDiscovery(networkInterface) {
|
|
6669
|
+
function RegionDiscovery(networkInterface, performanceClient, correlationId) {
|
|
6478
6670
|
this.networkInterface = networkInterface;
|
|
6671
|
+
this.performanceClient = performanceClient;
|
|
6672
|
+
this.correlationId = correlationId;
|
|
6479
6673
|
}
|
|
6480
6674
|
/**
|
|
6481
6675
|
* Detect the region from the application's environment.
|
|
6482
6676
|
*
|
|
6483
6677
|
* @returns Promise<string | null>
|
|
6484
6678
|
*/
|
|
6485
|
-
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata
|
|
6679
|
+
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
|
|
6680
|
+
var _a, _b, _c, _d;
|
|
6486
6681
|
return __awaiter(this, void 0, void 0, function () {
|
|
6487
6682
|
var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
6488
|
-
return __generator(this, function (
|
|
6489
|
-
switch (
|
|
6683
|
+
return __generator(this, function (_e) {
|
|
6684
|
+
switch (_e.label) {
|
|
6490
6685
|
case 0:
|
|
6686
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
6491
6687
|
autodetectedRegionName = environmentRegion;
|
|
6492
6688
|
if (!!autodetectedRegionName) return [3 /*break*/, 8];
|
|
6493
6689
|
options = RegionDiscovery.IMDS_OPTIONS;
|
|
6494
|
-
|
|
6495
|
-
options.proxyUrl = proxyUrl;
|
|
6496
|
-
}
|
|
6497
|
-
_a.label = 1;
|
|
6690
|
+
_e.label = 1;
|
|
6498
6691
|
case 1:
|
|
6499
|
-
|
|
6692
|
+
_e.trys.push([1, 6, , 7]);
|
|
6693
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6500
6694
|
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
|
|
6501
6695
|
case 2:
|
|
6502
|
-
localIMDSVersionResponse =
|
|
6696
|
+
localIMDSVersionResponse = _e.sent();
|
|
6503
6697
|
if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
6504
6698
|
autodetectedRegionName = localIMDSVersionResponse.body;
|
|
6505
6699
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
6506
6700
|
}
|
|
6507
6701
|
if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
|
|
6702
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
6508
6703
|
return [4 /*yield*/, this.getCurrentVersion(options)];
|
|
6509
6704
|
case 3:
|
|
6510
|
-
currentIMDSVersion =
|
|
6705
|
+
currentIMDSVersion = _e.sent();
|
|
6511
6706
|
if (!currentIMDSVersion) {
|
|
6512
6707
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
6513
6708
|
return [2 /*return*/, null];
|
|
6514
6709
|
}
|
|
6710
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6515
6711
|
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
|
|
6516
6712
|
case 4:
|
|
6517
|
-
currentIMDSVersionResponse =
|
|
6713
|
+
currentIMDSVersionResponse = _e.sent();
|
|
6518
6714
|
if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
6519
6715
|
autodetectedRegionName = currentIMDSVersionResponse.body;
|
|
6520
6716
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
6521
6717
|
}
|
|
6522
|
-
|
|
6718
|
+
_e.label = 5;
|
|
6523
6719
|
case 5: return [3 /*break*/, 7];
|
|
6524
6720
|
case 6:
|
|
6525
|
-
|
|
6721
|
+
_e.sent();
|
|
6526
6722
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
6527
6723
|
return [2 /*return*/, null];
|
|
6528
6724
|
case 7: return [3 /*break*/, 9];
|
|
6529
6725
|
case 8:
|
|
6530
6726
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.ENVIRONMENT_VARIABLE;
|
|
6531
|
-
|
|
6727
|
+
_e.label = 9;
|
|
6532
6728
|
case 9:
|
|
6533
6729
|
// If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION
|
|
6534
6730
|
if (!autodetectedRegionName) {
|
|
@@ -6546,8 +6742,10 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6546
6742
|
* @returns Promise<NetworkResponse<string>>
|
|
6547
6743
|
*/
|
|
6548
6744
|
RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
|
|
6745
|
+
var _a;
|
|
6549
6746
|
return __awaiter(this, void 0, void 0, function () {
|
|
6550
|
-
return __generator(this, function (
|
|
6747
|
+
return __generator(this, function (_b) {
|
|
6748
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
6551
6749
|
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
|
|
6552
6750
|
});
|
|
6553
6751
|
});
|
|
@@ -6558,24 +6756,28 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6558
6756
|
* @returns Promise<string | null>
|
|
6559
6757
|
*/
|
|
6560
6758
|
RegionDiscovery.prototype.getCurrentVersion = function (options) {
|
|
6759
|
+
var _a;
|
|
6561
6760
|
return __awaiter(this, void 0, void 0, function () {
|
|
6562
6761
|
var response;
|
|
6563
|
-
return __generator(this, function (
|
|
6564
|
-
switch (
|
|
6762
|
+
return __generator(this, function (_b) {
|
|
6763
|
+
switch (_b.label) {
|
|
6565
6764
|
case 0:
|
|
6566
|
-
_a.
|
|
6567
|
-
|
|
6765
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
6766
|
+
_b.label = 1;
|
|
6568
6767
|
case 1:
|
|
6569
|
-
|
|
6768
|
+
_b.trys.push([1, 3, , 4]);
|
|
6769
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
|
|
6770
|
+
case 2:
|
|
6771
|
+
response = _b.sent();
|
|
6570
6772
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
6571
6773
|
if (response.status === ResponseCodes.httpBadRequest && response.body && response.body["newest-versions"] && response.body["newest-versions"].length > 0) {
|
|
6572
6774
|
return [2 /*return*/, response.body["newest-versions"][0]];
|
|
6573
6775
|
}
|
|
6574
6776
|
return [2 /*return*/, null];
|
|
6575
|
-
case
|
|
6576
|
-
|
|
6777
|
+
case 3:
|
|
6778
|
+
_b.sent();
|
|
6577
6779
|
return [2 /*return*/, null];
|
|
6578
|
-
case
|
|
6780
|
+
case 4: return [2 /*return*/];
|
|
6579
6781
|
}
|
|
6580
6782
|
});
|
|
6581
6783
|
});
|
|
@@ -6589,7 +6791,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6589
6791
|
return RegionDiscovery;
|
|
6590
6792
|
}());
|
|
6591
6793
|
|
|
6592
|
-
/*! @azure/msal-common
|
|
6794
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
6593
6795
|
|
|
6594
6796
|
/*
|
|
6595
6797
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6600,16 +6802,17 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6600
6802
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
|
6601
6803
|
*/
|
|
6602
6804
|
var Authority = /** @class */ (function () {
|
|
6603
|
-
function Authority(authority, networkInterface, cacheManager, authorityOptions, logger,
|
|
6805
|
+
function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
6604
6806
|
this.canonicalAuthority = authority;
|
|
6605
6807
|
this._canonicalAuthority.validateAsUri();
|
|
6606
6808
|
this.networkInterface = networkInterface;
|
|
6607
6809
|
this.cacheManager = cacheManager;
|
|
6608
6810
|
this.authorityOptions = authorityOptions;
|
|
6609
|
-
this.regionDiscovery = new RegionDiscovery(networkInterface);
|
|
6610
6811
|
this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
|
|
6611
|
-
this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
|
|
6612
6812
|
this.logger = logger;
|
|
6813
|
+
this.performanceClient = performanceClient;
|
|
6814
|
+
this.correlationId = correlationId;
|
|
6815
|
+
this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
|
|
6613
6816
|
}
|
|
6614
6817
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
6615
6818
|
// See above for AuthorityType
|
|
@@ -6846,23 +7049,27 @@ var Authority = /** @class */ (function () {
|
|
|
6846
7049
|
* and the /authorize, /token and logout endpoints.
|
|
6847
7050
|
*/
|
|
6848
7051
|
Authority.prototype.resolveEndpointsAsync = function () {
|
|
7052
|
+
var _a, _b, _c;
|
|
6849
7053
|
return __awaiter(this, void 0, void 0, function () {
|
|
6850
7054
|
var metadataEntity, cloudDiscoverySource, endpointSource, cacheKey;
|
|
6851
|
-
return __generator(this, function (
|
|
6852
|
-
switch (
|
|
7055
|
+
return __generator(this, function (_d) {
|
|
7056
|
+
switch (_d.label) {
|
|
6853
7057
|
case 0:
|
|
7058
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
|
|
6854
7059
|
metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
|
|
6855
7060
|
if (!metadataEntity) {
|
|
6856
7061
|
metadataEntity = new AuthorityMetadataEntity();
|
|
6857
7062
|
metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
|
|
6858
7063
|
}
|
|
7064
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
6859
7065
|
return [4 /*yield*/, this.updateCloudDiscoveryMetadata(metadataEntity)];
|
|
6860
7066
|
case 1:
|
|
6861
|
-
cloudDiscoverySource =
|
|
7067
|
+
cloudDiscoverySource = _d.sent();
|
|
6862
7068
|
this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);
|
|
7069
|
+
(_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
6863
7070
|
return [4 /*yield*/, this.updateEndpointMetadata(metadataEntity)];
|
|
6864
7071
|
case 2:
|
|
6865
|
-
endpointSource =
|
|
7072
|
+
endpointSource = _d.sent();
|
|
6866
7073
|
if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {
|
|
6867
7074
|
// Reset the expiration time unless both values came from a successful cache lookup
|
|
6868
7075
|
metadataEntity.resetExpiresAt();
|
|
@@ -6881,12 +7088,13 @@ var Authority = /** @class */ (function () {
|
|
|
6881
7088
|
* @param metadataEntity
|
|
6882
7089
|
*/
|
|
6883
7090
|
Authority.prototype.updateEndpointMetadata = function (metadataEntity) {
|
|
6884
|
-
var _a, _b;
|
|
7091
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6885
7092
|
return __awaiter(this, void 0, void 0, function () {
|
|
6886
7093
|
var metadata, harcodedMetadata;
|
|
6887
|
-
return __generator(this, function (
|
|
6888
|
-
switch (
|
|
7094
|
+
return __generator(this, function (_g) {
|
|
7095
|
+
switch (_g.label) {
|
|
6889
7096
|
case 0:
|
|
7097
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
6890
7098
|
metadata = this.getEndpointMetadataFromConfig();
|
|
6891
7099
|
if (metadata) {
|
|
6892
7100
|
metadataEntity.updateEndpointMetadata(metadata, false);
|
|
@@ -6897,25 +7105,28 @@ var Authority = /** @class */ (function () {
|
|
|
6897
7105
|
return [2 /*return*/, AuthorityMetadataSource.CACHE];
|
|
6898
7106
|
}
|
|
6899
7107
|
harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
|
|
7108
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
6900
7109
|
return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];
|
|
6901
7110
|
case 1:
|
|
6902
|
-
metadata =
|
|
7111
|
+
metadata = _g.sent();
|
|
6903
7112
|
if (!metadata) return [3 /*break*/, 4];
|
|
6904
|
-
if (!((
|
|
7113
|
+
if (!((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.azureRegion)) return [3 /*break*/, 3];
|
|
7114
|
+
(_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
6905
7115
|
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(metadata)];
|
|
6906
7116
|
case 2:
|
|
6907
|
-
metadata =
|
|
6908
|
-
|
|
7117
|
+
metadata = _g.sent();
|
|
7118
|
+
_g.label = 3;
|
|
6909
7119
|
case 3:
|
|
6910
7120
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
6911
7121
|
return [2 /*return*/, AuthorityMetadataSource.NETWORK];
|
|
6912
7122
|
case 4:
|
|
6913
7123
|
if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];
|
|
6914
|
-
if (!((
|
|
7124
|
+
if (!((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion)) return [3 /*break*/, 6];
|
|
7125
|
+
(_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
6915
7126
|
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(harcodedMetadata)];
|
|
6916
7127
|
case 5:
|
|
6917
|
-
harcodedMetadata =
|
|
6918
|
-
|
|
7128
|
+
harcodedMetadata = _g.sent();
|
|
7129
|
+
_g.label = 6;
|
|
6919
7130
|
case 6:
|
|
6920
7131
|
metadataEntity.updateEndpointMetadata(harcodedMetadata, false);
|
|
6921
7132
|
return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
|
|
@@ -6955,25 +7166,24 @@ var Authority = /** @class */ (function () {
|
|
|
6955
7166
|
* @param hasHardcodedMetadata boolean
|
|
6956
7167
|
*/
|
|
6957
7168
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
7169
|
+
var _a;
|
|
6958
7170
|
return __awaiter(this, void 0, void 0, function () {
|
|
6959
7171
|
var options, response;
|
|
6960
|
-
return __generator(this, function (
|
|
6961
|
-
switch (
|
|
7172
|
+
return __generator(this, function (_b) {
|
|
7173
|
+
switch (_b.label) {
|
|
6962
7174
|
case 0:
|
|
7175
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
6963
7176
|
options = {};
|
|
6964
|
-
|
|
6965
|
-
options.proxyUrl = this.proxyUrl;
|
|
6966
|
-
}
|
|
6967
|
-
_a.label = 1;
|
|
7177
|
+
_b.label = 1;
|
|
6968
7178
|
case 1:
|
|
6969
|
-
|
|
7179
|
+
_b.trys.push([1, 3, , 4]);
|
|
6970
7180
|
return [4 /*yield*/, this.networkInterface.
|
|
6971
7181
|
sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
6972
7182
|
case 2:
|
|
6973
|
-
response =
|
|
7183
|
+
response = _b.sent();
|
|
6974
7184
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
6975
7185
|
case 3:
|
|
6976
|
-
|
|
7186
|
+
_b.sent();
|
|
6977
7187
|
return [2 /*return*/, null];
|
|
6978
7188
|
case 4: return [2 /*return*/];
|
|
6979
7189
|
}
|
|
@@ -6993,25 +7203,28 @@ var Authority = /** @class */ (function () {
|
|
|
6993
7203
|
* Update the retrieved metadata with regional information.
|
|
6994
7204
|
*/
|
|
6995
7205
|
Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {
|
|
6996
|
-
var _a, _b, _c, _d, _e;
|
|
7206
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6997
7207
|
return __awaiter(this, void 0, void 0, function () {
|
|
6998
7208
|
var autodetectedRegionName, azureRegion;
|
|
6999
|
-
return __generator(this, function (
|
|
7000
|
-
switch (
|
|
7001
|
-
case 0:
|
|
7209
|
+
return __generator(this, function (_h) {
|
|
7210
|
+
switch (_h.label) {
|
|
7211
|
+
case 0:
|
|
7212
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7213
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7214
|
+
return [4 /*yield*/, this.regionDiscovery.detectRegion((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.environmentRegion, this.regionDiscoveryMetadata)];
|
|
7002
7215
|
case 1:
|
|
7003
|
-
autodetectedRegionName =
|
|
7004
|
-
azureRegion = ((
|
|
7216
|
+
autodetectedRegionName = _h.sent();
|
|
7217
|
+
azureRegion = ((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
7005
7218
|
? autodetectedRegionName
|
|
7006
|
-
: (
|
|
7007
|
-
if (((
|
|
7219
|
+
: (_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion;
|
|
7220
|
+
if (((_f = this.authorityOptions.azureRegionConfiguration) === null || _f === void 0 ? void 0 : _f.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
7008
7221
|
this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
|
|
7009
7222
|
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
|
|
7010
7223
|
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
7011
7224
|
}
|
|
7012
7225
|
else {
|
|
7013
7226
|
if (autodetectedRegionName) {
|
|
7014
|
-
this.regionDiscoveryMetadata.region_outcome = (((
|
|
7227
|
+
this.regionDiscoveryMetadata.region_outcome = (((_g = this.authorityOptions.azureRegionConfiguration) === null || _g === void 0 ? void 0 : _g.azureRegion) === autodetectedRegionName) ?
|
|
7015
7228
|
RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
|
|
7016
7229
|
RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
|
|
7017
7230
|
}
|
|
@@ -7035,11 +7248,13 @@ var Authority = /** @class */ (function () {
|
|
|
7035
7248
|
* @param newMetadata
|
|
7036
7249
|
*/
|
|
7037
7250
|
Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
|
|
7251
|
+
var _a, _b;
|
|
7038
7252
|
return __awaiter(this, void 0, void 0, function () {
|
|
7039
7253
|
var metadata, metadataEntityExpired, harcodedMetadata;
|
|
7040
|
-
return __generator(this, function (
|
|
7041
|
-
switch (
|
|
7254
|
+
return __generator(this, function (_c) {
|
|
7255
|
+
switch (_c.label) {
|
|
7042
7256
|
case 0:
|
|
7257
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7043
7258
|
this.logger.verbose("Attempting to get cloud discovery metadata in the config");
|
|
7044
7259
|
this.logger.verbosePii("Known Authorities: " + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));
|
|
7045
7260
|
this.logger.verbosePii("Authority Metadata: " + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));
|
|
@@ -7062,9 +7277,10 @@ var Authority = /** @class */ (function () {
|
|
|
7062
7277
|
this.logger.verbose("The metadata entity is expired.");
|
|
7063
7278
|
}
|
|
7064
7279
|
this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
|
|
7280
|
+
(_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7065
7281
|
return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
|
|
7066
7282
|
case 1:
|
|
7067
|
-
metadata =
|
|
7283
|
+
metadata = _c.sent();
|
|
7068
7284
|
if (metadata) {
|
|
7069
7285
|
this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
|
|
7070
7286
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
|
|
@@ -7122,23 +7338,22 @@ var Authority = /** @class */ (function () {
|
|
|
7122
7338
|
* @param hasHardcodedMetadata boolean
|
|
7123
7339
|
*/
|
|
7124
7340
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
7341
|
+
var _a;
|
|
7125
7342
|
return __awaiter(this, void 0, void 0, function () {
|
|
7126
7343
|
var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;
|
|
7127
|
-
return __generator(this, function (
|
|
7128
|
-
switch (
|
|
7344
|
+
return __generator(this, function (_b) {
|
|
7345
|
+
switch (_b.label) {
|
|
7129
7346
|
case 0:
|
|
7347
|
+
(_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7130
7348
|
instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
|
|
7131
7349
|
options = {};
|
|
7132
|
-
if (this.proxyUrl) {
|
|
7133
|
-
options.proxyUrl = this.proxyUrl;
|
|
7134
|
-
}
|
|
7135
7350
|
match = null;
|
|
7136
|
-
|
|
7351
|
+
_b.label = 1;
|
|
7137
7352
|
case 1:
|
|
7138
|
-
|
|
7353
|
+
_b.trys.push([1, 3, , 4]);
|
|
7139
7354
|
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
7140
7355
|
case 2:
|
|
7141
|
-
response =
|
|
7356
|
+
response = _b.sent();
|
|
7142
7357
|
typedResponseBody = void 0;
|
|
7143
7358
|
metadata = void 0;
|
|
7144
7359
|
if (isCloudInstanceDiscoveryResponse(response.body)) {
|
|
@@ -7166,7 +7381,7 @@ var Authority = /** @class */ (function () {
|
|
|
7166
7381
|
match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
|
|
7167
7382
|
return [3 /*break*/, 4];
|
|
7168
7383
|
case 3:
|
|
7169
|
-
error_1 =
|
|
7384
|
+
error_1 = _b.sent();
|
|
7170
7385
|
if (error_1 instanceof AuthError) {
|
|
7171
7386
|
this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: " + error_1.errorCode + "\nError Description: " + error_1.errorMessage);
|
|
7172
7387
|
}
|
|
@@ -7311,7 +7526,7 @@ var Authority = /** @class */ (function () {
|
|
|
7311
7526
|
return Authority;
|
|
7312
7527
|
}());
|
|
7313
7528
|
|
|
7314
|
-
/*! @azure/msal-common
|
|
7529
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7315
7530
|
|
|
7316
7531
|
/*
|
|
7317
7532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7330,16 +7545,18 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7330
7545
|
* @param networkClient
|
|
7331
7546
|
* @param protocolMode
|
|
7332
7547
|
*/
|
|
7333
|
-
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger,
|
|
7548
|
+
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
7334
7549
|
return __awaiter(this, void 0, void 0, function () {
|
|
7335
7550
|
var acquireTokenAuthority, e_1;
|
|
7336
7551
|
return __generator(this, function (_a) {
|
|
7337
7552
|
switch (_a.label) {
|
|
7338
7553
|
case 0:
|
|
7339
|
-
|
|
7554
|
+
performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.addQueueMeasurement(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
|
|
7555
|
+
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
7340
7556
|
_a.label = 1;
|
|
7341
7557
|
case 1:
|
|
7342
7558
|
_a.trys.push([1, 3, , 4]);
|
|
7559
|
+
performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
|
|
7343
7560
|
return [4 /*yield*/, acquireTokenAuthority.resolveEndpointsAsync()];
|
|
7344
7561
|
case 2:
|
|
7345
7562
|
_a.sent();
|
|
@@ -7362,17 +7579,17 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7362
7579
|
* @param networkInterface
|
|
7363
7580
|
* @param protocolMode
|
|
7364
7581
|
*/
|
|
7365
|
-
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger,
|
|
7582
|
+
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
7366
7583
|
// Throw error if authority url is empty
|
|
7367
7584
|
if (StringUtils.isEmpty(authorityUrl)) {
|
|
7368
7585
|
throw ClientConfigurationError.createUrlEmptyError();
|
|
7369
7586
|
}
|
|
7370
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger,
|
|
7587
|
+
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
7371
7588
|
};
|
|
7372
7589
|
return AuthorityFactory;
|
|
7373
7590
|
}());
|
|
7374
7591
|
|
|
7375
|
-
/*! @azure/msal-common
|
|
7592
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7376
7593
|
|
|
7377
7594
|
/*
|
|
7378
7595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7403,7 +7620,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
7403
7620
|
return ServerTelemetryEntity;
|
|
7404
7621
|
}());
|
|
7405
7622
|
|
|
7406
|
-
/*! @azure/msal-common
|
|
7623
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7407
7624
|
|
|
7408
7625
|
/*
|
|
7409
7626
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7431,7 +7648,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
7431
7648
|
return ThrottlingEntity;
|
|
7432
7649
|
}());
|
|
7433
7650
|
|
|
7434
|
-
/*! @azure/msal-common
|
|
7651
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7435
7652
|
|
|
7436
7653
|
/*
|
|
7437
7654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7448,7 +7665,7 @@ var StubbedNetworkModule = {
|
|
|
7448
7665
|
}
|
|
7449
7666
|
};
|
|
7450
7667
|
|
|
7451
|
-
/*! @azure/msal-common
|
|
7668
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7452
7669
|
|
|
7453
7670
|
/*
|
|
7454
7671
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7493,7 +7710,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
|
|
|
7493
7710
|
return JoseHeaderError;
|
|
7494
7711
|
}(AuthError));
|
|
7495
7712
|
|
|
7496
|
-
/*! @azure/msal-common
|
|
7713
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7497
7714
|
|
|
7498
7715
|
/*
|
|
7499
7716
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7533,7 +7750,7 @@ var JoseHeader = /** @class */ (function () {
|
|
|
7533
7750
|
return JoseHeader;
|
|
7534
7751
|
}());
|
|
7535
7752
|
|
|
7536
|
-
/*! @azure/msal-common
|
|
7753
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7537
7754
|
|
|
7538
7755
|
/*
|
|
7539
7756
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7592,7 +7809,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
7592
7809
|
return AuthenticationHeaderParser;
|
|
7593
7810
|
}());
|
|
7594
7811
|
|
|
7595
|
-
/*! @azure/msal-common
|
|
7812
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7596
7813
|
|
|
7597
7814
|
/*
|
|
7598
7815
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7754,7 +7971,7 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7754
7971
|
return ServerTelemetryManager;
|
|
7755
7972
|
}());
|
|
7756
7973
|
|
|
7757
|
-
/*! @azure/msal-common
|
|
7974
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
7758
7975
|
|
|
7759
7976
|
/*
|
|
7760
7977
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7783,7 +8000,118 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7783
8000
|
this.eventsByCorrelationId = new Map();
|
|
7784
8001
|
this.staticFieldsByCorrelationId = new Map();
|
|
7785
8002
|
this.measurementsById = new Map();
|
|
8003
|
+
this.queueMeasurements = new Map();
|
|
8004
|
+
this.preQueueTimeByCorrelationId = new Map();
|
|
8005
|
+
this.countersByCorrelationId = new Map();
|
|
7786
8006
|
}
|
|
8007
|
+
/**
|
|
8008
|
+
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
8009
|
+
* Note: this function can be changed to abstract at the next major version bump.
|
|
8010
|
+
*
|
|
8011
|
+
* @param {string} measureName
|
|
8012
|
+
* @param {string} correlationId
|
|
8013
|
+
* @returns {IPerformanceMeasurement}
|
|
8014
|
+
*/
|
|
8015
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8016
|
+
PerformanceClient.prototype.startPerformanceMeasurement = function (measureName, correlationId) {
|
|
8017
|
+
return {};
|
|
8018
|
+
};
|
|
8019
|
+
/**
|
|
8020
|
+
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
8021
|
+
* Note: this incorrectly-named function will be removed at the next major version bump.
|
|
8022
|
+
*
|
|
8023
|
+
* @param {string} measureName
|
|
8024
|
+
* @param {string} correlationId
|
|
8025
|
+
* @returns {IPerformanceMeasurement}
|
|
8026
|
+
*/
|
|
8027
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8028
|
+
PerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
8029
|
+
return {};
|
|
8030
|
+
};
|
|
8031
|
+
/**
|
|
8032
|
+
* Get integral fields.
|
|
8033
|
+
* Override to change the set.
|
|
8034
|
+
*/
|
|
8035
|
+
PerformanceClient.prototype.getIntFields = function () {
|
|
8036
|
+
return IntFields;
|
|
8037
|
+
};
|
|
8038
|
+
/**
|
|
8039
|
+
* Gets map of pre-queue times by correlation Id
|
|
8040
|
+
*
|
|
8041
|
+
* @param {PerformanceEvents} eventName
|
|
8042
|
+
* @param {string} correlationId
|
|
8043
|
+
* @returns {number}
|
|
8044
|
+
*/
|
|
8045
|
+
PerformanceClient.prototype.getPreQueueTime = function (eventName, correlationId) {
|
|
8046
|
+
var preQueueTimesByEvents = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
8047
|
+
if (!preQueueTimesByEvents) {
|
|
8048
|
+
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: " + correlationId + ", unable to add queue measurement");
|
|
8049
|
+
return;
|
|
8050
|
+
}
|
|
8051
|
+
else if (!preQueueTimesByEvents.get(eventName)) {
|
|
8052
|
+
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue time found for " + eventName + ", unable to add queue measurement");
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
return preQueueTimesByEvents.get(eventName);
|
|
8056
|
+
};
|
|
8057
|
+
/**
|
|
8058
|
+
* Calculates the difference between current time and time when function was queued.
|
|
8059
|
+
* Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.
|
|
8060
|
+
*
|
|
8061
|
+
* @param {number} preQueueTime
|
|
8062
|
+
* @param {number} currentTime
|
|
8063
|
+
* @returns {number}
|
|
8064
|
+
*/
|
|
8065
|
+
PerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {
|
|
8066
|
+
if (preQueueTime < 1) {
|
|
8067
|
+
this.logger.trace("PerformanceClient: preQueueTime should be a positive integer and not " + preQueueTime);
|
|
8068
|
+
return 0;
|
|
8069
|
+
}
|
|
8070
|
+
if (currentTime < 1) {
|
|
8071
|
+
this.logger.trace("PerformanceClient: currentTime should be a positive integer and not " + currentTime);
|
|
8072
|
+
return 0;
|
|
8073
|
+
}
|
|
8074
|
+
if (currentTime < preQueueTime) {
|
|
8075
|
+
this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved");
|
|
8076
|
+
return 0;
|
|
8077
|
+
}
|
|
8078
|
+
return currentTime - preQueueTime;
|
|
8079
|
+
};
|
|
8080
|
+
/**
|
|
8081
|
+
* Adds queue measurement time to QueueMeasurements array for given correlation ID.
|
|
8082
|
+
*
|
|
8083
|
+
* @param {PerformanceEvents} name
|
|
8084
|
+
* @param {?string} correlationId
|
|
8085
|
+
* @param {?number} time
|
|
8086
|
+
* @returns
|
|
8087
|
+
*/
|
|
8088
|
+
PerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {
|
|
8089
|
+
if (!correlationId) {
|
|
8090
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: correlationId not provided for " + eventName + ", cannot add queue measurement");
|
|
8091
|
+
return;
|
|
8092
|
+
}
|
|
8093
|
+
if (queueTime === 0) {
|
|
8094
|
+
// Possible for there to be no queue time after calculation
|
|
8095
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: queue time provided for " + eventName + " is " + queueTime);
|
|
8096
|
+
}
|
|
8097
|
+
else if (!queueTime) {
|
|
8098
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: no queue time provided for " + eventName);
|
|
8099
|
+
return;
|
|
8100
|
+
}
|
|
8101
|
+
var queueMeasurement = { eventName: eventName, queueTime: queueTime };
|
|
8102
|
+
// Adds to existing correlation Id if present in queueMeasurements
|
|
8103
|
+
var existingMeasurements = this.queueMeasurements.get(correlationId);
|
|
8104
|
+
if (existingMeasurements) {
|
|
8105
|
+
existingMeasurements.push(queueMeasurement);
|
|
8106
|
+
this.queueMeasurements.set(correlationId, existingMeasurements);
|
|
8107
|
+
}
|
|
8108
|
+
else {
|
|
8109
|
+
// Sets new correlation Id if not present in queueMeasurements
|
|
8110
|
+
this.logger.trace("PerformanceClient.addQueueMeasurement: adding correlationId " + correlationId + " to queue measurements");
|
|
8111
|
+
var measurementArray = [queueMeasurement];
|
|
8112
|
+
this.queueMeasurements.set(correlationId, measurementArray);
|
|
8113
|
+
}
|
|
8114
|
+
};
|
|
7787
8115
|
/**
|
|
7788
8116
|
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
7789
8117
|
*
|
|
@@ -7799,9 +8127,19 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7799
8127
|
if (!correlationId) {
|
|
7800
8128
|
this.logger.info("PerformanceClient: No correlation id provided for " + measureName + ", generating", eventCorrelationId);
|
|
7801
8129
|
}
|
|
8130
|
+
// Duplicate code to address spelling error will be removed at the next major version bump.
|
|
7802
8131
|
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
|
|
7803
|
-
var
|
|
7804
|
-
|
|
8132
|
+
var validMeasurement;
|
|
8133
|
+
var performanceMeasuremeant = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);
|
|
8134
|
+
if (performanceMeasuremeant.startMeasurement) {
|
|
8135
|
+
performanceMeasuremeant.startMeasurement();
|
|
8136
|
+
validMeasurement = performanceMeasuremeant;
|
|
8137
|
+
}
|
|
8138
|
+
else {
|
|
8139
|
+
var performanceMeasurement = this.startPerformanceMeasurement(measureName, eventCorrelationId);
|
|
8140
|
+
performanceMeasurement.startMeasurement();
|
|
8141
|
+
validMeasurement = performanceMeasurement;
|
|
8142
|
+
}
|
|
7805
8143
|
var inProgressEvent = {
|
|
7806
8144
|
eventId: this.generateId(),
|
|
7807
8145
|
status: PerformanceEventStatus.InProgress,
|
|
@@ -7820,7 +8158,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7820
8158
|
appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
|
|
7821
8159
|
};
|
|
7822
8160
|
this.addStaticFields(staticFields, eventCorrelationId);
|
|
7823
|
-
this.cacheMeasurement(inProgressEvent,
|
|
8161
|
+
this.cacheMeasurement(inProgressEvent, validMeasurement);
|
|
7824
8162
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
7825
8163
|
return {
|
|
7826
8164
|
endMeasurement: function (event) {
|
|
@@ -7840,7 +8178,10 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7840
8178
|
addStaticFields: function (fields) {
|
|
7841
8179
|
return _this.addStaticFields(fields, inProgressEvent.correlationId);
|
|
7842
8180
|
},
|
|
7843
|
-
|
|
8181
|
+
increment: function (counters) {
|
|
8182
|
+
return _this.increment(counters, inProgressEvent.correlationId);
|
|
8183
|
+
},
|
|
8184
|
+
measurement: validMeasurement,
|
|
7844
8185
|
event: inProgressEvent
|
|
7845
8186
|
};
|
|
7846
8187
|
};
|
|
@@ -7891,6 +8232,26 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7891
8232
|
this.staticFieldsByCorrelationId.set(correlationId, fields);
|
|
7892
8233
|
}
|
|
7893
8234
|
};
|
|
8235
|
+
/**
|
|
8236
|
+
* Increment counters to be emitted when the measurements are flushed
|
|
8237
|
+
* @param counters {Counters}
|
|
8238
|
+
* @param correlationId {string} correlation identifier
|
|
8239
|
+
*/
|
|
8240
|
+
PerformanceClient.prototype.increment = function (counters, correlationId) {
|
|
8241
|
+
var existing = this.countersByCorrelationId.get(correlationId);
|
|
8242
|
+
if (!existing) {
|
|
8243
|
+
this.logger.trace("PerformanceClient: Setting counters");
|
|
8244
|
+
this.countersByCorrelationId.set(correlationId, __assign({}, counters));
|
|
8245
|
+
return;
|
|
8246
|
+
}
|
|
8247
|
+
this.logger.trace("PerformanceClient: Updating counters");
|
|
8248
|
+
for (var counter in counters) {
|
|
8249
|
+
if (!existing.hasOwnProperty(counter)) {
|
|
8250
|
+
existing[counter] = 0;
|
|
8251
|
+
}
|
|
8252
|
+
existing[counter] += counters[counter];
|
|
8253
|
+
}
|
|
8254
|
+
};
|
|
7894
8255
|
/**
|
|
7895
8256
|
* Upserts event into event cache.
|
|
7896
8257
|
* First key is the correlation id, second key is the event id.
|
|
@@ -7930,18 +8291,36 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7930
8291
|
PerformanceClient.prototype.flushMeasurements = function (measureName, correlationId) {
|
|
7931
8292
|
var _this = this;
|
|
7932
8293
|
this.logger.trace("PerformanceClient: Performance measurements flushed for " + measureName, correlationId);
|
|
8294
|
+
/**
|
|
8295
|
+
* Adds all queue time and count measurements for given correlation ID
|
|
8296
|
+
* then deletes queue times for given correlation ID from queueMeasurements map.
|
|
8297
|
+
*/
|
|
8298
|
+
var queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);
|
|
8299
|
+
if (!queueMeasurementForCorrelationId) {
|
|
8300
|
+
this.logger.trace("PerformanceClient: no queue measurements found for for correlationId: " + correlationId);
|
|
8301
|
+
}
|
|
8302
|
+
var totalQueueTime = 0;
|
|
8303
|
+
var totalQueueCount = 0;
|
|
8304
|
+
queueMeasurementForCorrelationId === null || queueMeasurementForCorrelationId === void 0 ? void 0 : queueMeasurementForCorrelationId.forEach(function (measurement) {
|
|
8305
|
+
totalQueueTime += measurement.queueTime;
|
|
8306
|
+
totalQueueCount++;
|
|
8307
|
+
});
|
|
7933
8308
|
var eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);
|
|
8309
|
+
var staticFields = this.staticFieldsByCorrelationId.get(correlationId);
|
|
8310
|
+
var counters = this.countersByCorrelationId.get(correlationId);
|
|
7934
8311
|
if (eventsForCorrelationId) {
|
|
7935
|
-
this.
|
|
8312
|
+
this.discardCache(correlationId);
|
|
7936
8313
|
/*
|
|
7937
8314
|
* Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.
|
|
7938
8315
|
* Incomplete submeasurements are likely an instrumentation bug that should be fixed.
|
|
7939
8316
|
* IE only supports Map.forEach.
|
|
7940
8317
|
*/
|
|
7941
8318
|
var completedEvents_1 = [];
|
|
8319
|
+
var incompleteSubsCount_1 = 0;
|
|
7942
8320
|
eventsForCorrelationId.forEach(function (event) {
|
|
7943
8321
|
if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {
|
|
7944
8322
|
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + event.name + " found for " + measureName, correlationId);
|
|
8323
|
+
incompleteSubsCount_1++;
|
|
7945
8324
|
var completedEvent = _this.endMeasurement(event);
|
|
7946
8325
|
if (completedEvent) {
|
|
7947
8326
|
completedEvents_1.push(completedEvent);
|
|
@@ -7983,8 +8362,8 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7983
8362
|
}
|
|
7984
8363
|
return previous;
|
|
7985
8364
|
}, topLevelEvent);
|
|
7986
|
-
var
|
|
7987
|
-
|
|
8365
|
+
var finalEvent = __assign(__assign(__assign(__assign({}, eventToEmit), staticFields), counters), { queuedTimeMs: totalQueueTime, queuedCount: totalQueueCount, incompleteSubsCount: incompleteSubsCount_1 });
|
|
8366
|
+
this.truncateIntegralFields(finalEvent, this.getIntFields());
|
|
7988
8367
|
this.emitEvents([finalEvent], eventToEmit.correlationId);
|
|
7989
8368
|
}
|
|
7990
8369
|
else {
|
|
@@ -8004,6 +8383,22 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8004
8383
|
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
8005
8384
|
this.eventsByCorrelationId.delete(correlationId);
|
|
8006
8385
|
};
|
|
8386
|
+
/**
|
|
8387
|
+
* Removes cache for a given correlation id.
|
|
8388
|
+
*
|
|
8389
|
+
* @param {string} correlation identifier
|
|
8390
|
+
*/
|
|
8391
|
+
PerformanceClient.prototype.discardCache = function (correlationId) {
|
|
8392
|
+
this.discardMeasurements(correlationId);
|
|
8393
|
+
this.logger.trace("PerformanceClient: Static fields discarded", correlationId);
|
|
8394
|
+
this.staticFieldsByCorrelationId.delete(correlationId);
|
|
8395
|
+
this.logger.trace("PerformanceClient: Counters discarded", correlationId);
|
|
8396
|
+
this.countersByCorrelationId.delete(correlationId);
|
|
8397
|
+
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
8398
|
+
this.queueMeasurements.delete(correlationId);
|
|
8399
|
+
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
8400
|
+
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
8401
|
+
};
|
|
8007
8402
|
/**
|
|
8008
8403
|
* Registers a callback function to receive performance events.
|
|
8009
8404
|
*
|
|
@@ -8046,10 +8441,22 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8046
8441
|
callback.apply(null, [events]);
|
|
8047
8442
|
});
|
|
8048
8443
|
};
|
|
8444
|
+
/**
|
|
8445
|
+
* Enforce truncation of integral fields in performance event.
|
|
8446
|
+
* @param {PerformanceEvent} event performance event to update.
|
|
8447
|
+
* @param {Set<string>} intFields integral fields.
|
|
8448
|
+
*/
|
|
8449
|
+
PerformanceClient.prototype.truncateIntegralFields = function (event, intFields) {
|
|
8450
|
+
intFields.forEach(function (key) {
|
|
8451
|
+
if (key in event && typeof event[key] === "number") {
|
|
8452
|
+
event[key] = Math.floor(event[key]);
|
|
8453
|
+
}
|
|
8454
|
+
});
|
|
8455
|
+
};
|
|
8049
8456
|
return PerformanceClient;
|
|
8050
8457
|
}());
|
|
8051
8458
|
|
|
8052
|
-
/*! @azure/msal-common
|
|
8459
|
+
/*! @azure/msal-common v10.0.0 2023-02-06 */
|
|
8053
8460
|
|
|
8054
8461
|
/*
|
|
8055
8462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8078,6 +8485,21 @@ var StubPerformanceClient = /** @class */ (function (_super) {
|
|
|
8078
8485
|
StubPerformanceClient.prototype.startPerformanceMeasuremeant = function () {
|
|
8079
8486
|
return new StubPerformanceMeasurement();
|
|
8080
8487
|
};
|
|
8488
|
+
StubPerformanceClient.prototype.startPerformanceMeasurement = function () {
|
|
8489
|
+
return new StubPerformanceMeasurement();
|
|
8490
|
+
};
|
|
8491
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8492
|
+
StubPerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {
|
|
8493
|
+
return 0;
|
|
8494
|
+
};
|
|
8495
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8496
|
+
StubPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {
|
|
8497
|
+
return;
|
|
8498
|
+
};
|
|
8499
|
+
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
8500
|
+
StubPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {
|
|
8501
|
+
return;
|
|
8502
|
+
};
|
|
8081
8503
|
return StubPerformanceClient;
|
|
8082
8504
|
}(PerformanceClient));
|
|
8083
8505
|
|
|
@@ -9321,17 +9743,17 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9321
9743
|
var activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
|
|
9322
9744
|
if (!activeAccountValueFilters) {
|
|
9323
9745
|
// if new active account cache type isn't found, it's an old version, so look for that instead
|
|
9324
|
-
this.logger.trace("No active account filters cache schema found, looking for legacy schema");
|
|
9746
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");
|
|
9325
9747
|
var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
|
|
9326
9748
|
var activeAccountValueLocal = this.getItem(activeAccountKeyLocal);
|
|
9327
9749
|
if (!activeAccountValueLocal) {
|
|
9328
|
-
this.logger.trace("No active account found");
|
|
9750
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
|
|
9329
9751
|
return null;
|
|
9330
9752
|
}
|
|
9331
9753
|
var activeAccount = this.getAccountInfoByFilter({ localAccountId: activeAccountValueLocal })[0] || null;
|
|
9332
9754
|
if (activeAccount) {
|
|
9333
|
-
this.logger.trace("Legacy active account cache schema found");
|
|
9334
|
-
this.logger.trace("Adding active account filters cache schema");
|
|
9755
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found");
|
|
9756
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema");
|
|
9335
9757
|
this.setActiveAccount(activeAccount);
|
|
9336
9758
|
return activeAccount;
|
|
9337
9759
|
}
|
|
@@ -9339,13 +9761,13 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9339
9761
|
}
|
|
9340
9762
|
var activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);
|
|
9341
9763
|
if (activeAccountValueObj) {
|
|
9342
|
-
this.logger.trace("Active account filters schema found");
|
|
9764
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found");
|
|
9343
9765
|
return this.getAccountInfoByFilter({
|
|
9344
9766
|
homeAccountId: activeAccountValueObj.homeAccountId,
|
|
9345
9767
|
localAccountId: activeAccountValueObj.localAccountId
|
|
9346
9768
|
})[0] || null;
|
|
9347
9769
|
}
|
|
9348
|
-
this.logger.trace("No active account found");
|
|
9770
|
+
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
|
|
9349
9771
|
return null;
|
|
9350
9772
|
};
|
|
9351
9773
|
/**
|
|
@@ -9376,6 +9798,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9376
9798
|
*/
|
|
9377
9799
|
BrowserCacheManager.prototype.getAccountInfoByFilter = function (accountFilter) {
|
|
9378
9800
|
var allAccounts = this.getAllAccounts();
|
|
9801
|
+
this.logger.trace("BrowserCacheManager.getAccountInfoByFilter: total " + allAccounts.length + " accounts found");
|
|
9379
9802
|
return allAccounts.filter(function (accountObj) {
|
|
9380
9803
|
if (accountFilter.username && accountFilter.username.toLowerCase() !== accountObj.username.toLowerCase()) {
|
|
9381
9804
|
return false;
|
|
@@ -9938,7 +10361,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
|
9938
10361
|
|
|
9939
10362
|
/* eslint-disable header/header */
|
|
9940
10363
|
var name = "@azure/msal-browser";
|
|
9941
|
-
var version = "2.
|
|
10364
|
+
var version = "2.33.0";
|
|
9942
10365
|
|
|
9943
10366
|
/*
|
|
9944
10367
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10409,6 +10832,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10409
10832
|
return __generator$1(this, function (_b) {
|
|
10410
10833
|
switch (_b.label) {
|
|
10411
10834
|
case 0:
|
|
10835
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
10412
10836
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
10413
10837
|
authority = request.authority || this.config.auth.authority;
|
|
10414
10838
|
scopes = __spread(((request && request.scopes) || []));
|
|
@@ -10526,6 +10950,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10526
10950
|
return __generator$1(this, function (_a) {
|
|
10527
10951
|
switch (_a.label) {
|
|
10528
10952
|
case 0:
|
|
10953
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
10529
10954
|
this.logger.verbose("initializeAuthorizationRequest called", request.correlationId);
|
|
10530
10955
|
return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];
|
|
10531
10956
|
case 1:
|
|
@@ -10626,10 +11051,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10626
11051
|
var clientConfig;
|
|
10627
11052
|
return __generator$1(this, function (_a) {
|
|
10628
11053
|
switch (_a.label) {
|
|
10629
|
-
case 0:
|
|
11054
|
+
case 0:
|
|
11055
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
|
11056
|
+
// Create auth module.
|
|
11057
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11058
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
|
|
10630
11059
|
case 1:
|
|
10631
11060
|
clientConfig = _a.sent();
|
|
10632
|
-
return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
|
|
11061
|
+
return [2 /*return*/, new AuthorizationCodeClient(clientConfig, this.performanceClient)];
|
|
10633
11062
|
}
|
|
10634
11063
|
});
|
|
10635
11064
|
});
|
|
@@ -10642,14 +11071,17 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10642
11071
|
*/
|
|
10643
11072
|
StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
10644
11073
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10645
|
-
var discoveredAuthority;
|
|
11074
|
+
var discoveredAuthority, logger;
|
|
10646
11075
|
return __generator$1(this, function (_a) {
|
|
10647
11076
|
switch (_a.label) {
|
|
10648
11077
|
case 0:
|
|
11078
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
10649
11079
|
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
11080
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10650
11081
|
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
|
|
10651
11082
|
case 1:
|
|
10652
11083
|
discoveredAuthority = _a.sent();
|
|
11084
|
+
logger = this.config.system.loggerOptions;
|
|
10653
11085
|
return [2 /*return*/, {
|
|
10654
11086
|
authOptions: {
|
|
10655
11087
|
clientId: this.config.auth.clientId,
|
|
@@ -10661,9 +11093,9 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10661
11093
|
preventCorsPreflight: true
|
|
10662
11094
|
},
|
|
10663
11095
|
loggerOptions: {
|
|
10664
|
-
loggerCallback:
|
|
10665
|
-
piiLoggingEnabled:
|
|
10666
|
-
logLevel:
|
|
11096
|
+
loggerCallback: logger.loggerCallback,
|
|
11097
|
+
piiLoggingEnabled: logger.piiLoggingEnabled,
|
|
11098
|
+
logLevel: logger.logLevel,
|
|
10667
11099
|
correlationId: this.correlationId
|
|
10668
11100
|
},
|
|
10669
11101
|
cryptoInterface: this.browserCrypto,
|
|
@@ -10707,13 +11139,15 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10707
11139
|
* @param requestCorrelationId
|
|
10708
11140
|
*/
|
|
10709
11141
|
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
|
|
11142
|
+
var _a;
|
|
10710
11143
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10711
11144
|
var getAuthorityMeasurement, authorityOptions, userAuthority, builtAuthority;
|
|
10712
|
-
return __generator$1(this, function (
|
|
10713
|
-
switch (
|
|
11145
|
+
return __generator$1(this, function (_b) {
|
|
11146
|
+
switch (_b.label) {
|
|
10714
11147
|
case 0:
|
|
11148
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10715
11149
|
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
10716
|
-
getAuthorityMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11150
|
+
getAuthorityMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10717
11151
|
authorityOptions = {
|
|
10718
11152
|
protocolMode: this.config.auth.protocolMode,
|
|
10719
11153
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
@@ -10724,10 +11158,11 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10724
11158
|
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
10725
11159
|
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
10726
11160
|
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
|
|
10727
|
-
|
|
11161
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
11162
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
10728
11163
|
.then(function (result) {
|
|
10729
11164
|
getAuthorityMeasurement.endMeasurement({
|
|
10730
|
-
success: true
|
|
11165
|
+
success: true,
|
|
10731
11166
|
});
|
|
10732
11167
|
return result;
|
|
10733
11168
|
})
|
|
@@ -10739,7 +11174,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10739
11174
|
});
|
|
10740
11175
|
throw error;
|
|
10741
11176
|
})];
|
|
10742
|
-
case 1: return [2 /*return*/,
|
|
11177
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
10743
11178
|
}
|
|
10744
11179
|
});
|
|
10745
11180
|
});
|
|
@@ -10755,12 +11190,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10755
11190
|
return __generator$1(this, function (_b) {
|
|
10756
11191
|
switch (_b.label) {
|
|
10757
11192
|
case 0:
|
|
11193
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
|
10758
11194
|
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
10759
11195
|
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
10760
11196
|
browserState = {
|
|
10761
11197
|
interactionType: interactionType
|
|
10762
11198
|
};
|
|
10763
11199
|
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
11200
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
10764
11201
|
_a = [{}];
|
|
10765
11202
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
10766
11203
|
case 1:
|
|
@@ -10794,11 +11231,12 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10794
11231
|
* Abstract class which defines operations for a browser interaction handling class.
|
|
10795
11232
|
*/
|
|
10796
11233
|
var InteractionHandler = /** @class */ (function () {
|
|
10797
|
-
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger) {
|
|
11234
|
+
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) {
|
|
10798
11235
|
this.authModule = authCodeModule;
|
|
10799
11236
|
this.browserStorage = storageImpl;
|
|
10800
11237
|
this.authCodeRequest = authCodeRequest;
|
|
10801
11238
|
this.logger = logger;
|
|
11239
|
+
this.performanceClient = performanceClient;
|
|
10802
11240
|
}
|
|
10803
11241
|
/**
|
|
10804
11242
|
* Function to handle response parameters from hash.
|
|
@@ -10808,6 +11246,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10808
11246
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10809
11247
|
var stateKey, requestState, authCodeResponse;
|
|
10810
11248
|
return __generator$1(this, function (_a) {
|
|
11249
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);
|
|
10811
11250
|
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
10812
11251
|
// Check that location hash isn't empty.
|
|
10813
11252
|
if (StringUtils.isEmpty(locationHash)) {
|
|
@@ -10830,6 +11269,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10830
11269
|
throw e;
|
|
10831
11270
|
}
|
|
10832
11271
|
}
|
|
11272
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
10833
11273
|
return [2 /*return*/, this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule)];
|
|
10834
11274
|
});
|
|
10835
11275
|
});
|
|
@@ -10849,6 +11289,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10849
11289
|
return __generator$1(this, function (_a) {
|
|
10850
11290
|
switch (_a.label) {
|
|
10851
11291
|
case 0:
|
|
11292
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
10852
11293
|
this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");
|
|
10853
11294
|
stateKey = this.browserStorage.generateStateKey(state);
|
|
10854
11295
|
requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
@@ -10860,6 +11301,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10860
11301
|
// Assign code to request
|
|
10861
11302
|
this.authCodeRequest.code = authCodeResponse.code;
|
|
10862
11303
|
if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];
|
|
11304
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
10863
11305
|
return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];
|
|
10864
11306
|
case 1:
|
|
10865
11307
|
_a.sent();
|
|
@@ -10880,6 +11322,8 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10880
11322
|
this.authCodeRequest.ccsCredential = cachedCcsCred;
|
|
10881
11323
|
}
|
|
10882
11324
|
}
|
|
11325
|
+
// Acquire token with retrieved code.
|
|
11326
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);
|
|
10883
11327
|
return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];
|
|
10884
11328
|
case 3:
|
|
10885
11329
|
tokenResponse = _a.sent();
|
|
@@ -10901,8 +11345,9 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10901
11345
|
return __generator$1(this, function (_a) {
|
|
10902
11346
|
switch (_a.label) {
|
|
10903
11347
|
case 0:
|
|
11348
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
10904
11349
|
cloudInstanceAuthorityUri = "https://" + cloudInstanceHostname + "/" + authority.tenant + "/";
|
|
10905
|
-
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger)];
|
|
11350
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger, this.performanceClient, this.authCodeRequest.correlationId)];
|
|
10906
11351
|
case 1:
|
|
10907
11352
|
cloudInstanceAuthority = _a.sent();
|
|
10908
11353
|
this.authModule.updateAuthority(cloudInstanceAuthority);
|
|
@@ -10937,8 +11382,8 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10937
11382
|
*/
|
|
10938
11383
|
var RedirectHandler = /** @class */ (function (_super) {
|
|
10939
11384
|
__extends$1(RedirectHandler, _super);
|
|
10940
|
-
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto) {
|
|
10941
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
11385
|
+
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto, performanceClient) {
|
|
11386
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;
|
|
10942
11387
|
_this.browserCrypto = browserCrypto;
|
|
10943
11388
|
return _this;
|
|
10944
11389
|
}
|
|
@@ -11256,7 +11701,10 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
11256
11701
|
var clientConfig;
|
|
11257
11702
|
return __generator$1(this, function (_a) {
|
|
11258
11703
|
switch (_a.label) {
|
|
11259
|
-
case 0:
|
|
11704
|
+
case 0:
|
|
11705
|
+
// Create auth module.
|
|
11706
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11707
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
11260
11708
|
case 1:
|
|
11261
11709
|
clientConfig = _a.sent();
|
|
11262
11710
|
return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];
|
|
@@ -11270,6 +11718,8 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
11270
11718
|
return __generator$1(this, function (_b) {
|
|
11271
11719
|
switch (_b.label) {
|
|
11272
11720
|
case 0:
|
|
11721
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
11722
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
11273
11723
|
_a = [__assign$1({}, request)];
|
|
11274
11724
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
11275
11725
|
case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
|
|
@@ -12020,7 +12470,9 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12020
12470
|
var _this = this;
|
|
12021
12471
|
return __generator$1(this, function (_a) {
|
|
12022
12472
|
switch (_a.label) {
|
|
12023
|
-
case 0:
|
|
12473
|
+
case 0:
|
|
12474
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
12475
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
|
|
12024
12476
|
case 1:
|
|
12025
12477
|
validRequest = _a.sent();
|
|
12026
12478
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
@@ -12035,14 +12487,18 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12035
12487
|
_a.label = 2;
|
|
12036
12488
|
case 2:
|
|
12037
12489
|
_a.trys.push([2, 7, , 8]);
|
|
12490
|
+
// Create auth code request and generate PKCE params
|
|
12491
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
12038
12492
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
12039
12493
|
case 3:
|
|
12040
12494
|
authCodeRequest = _a.sent();
|
|
12495
|
+
// Initialize the client
|
|
12496
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
12041
12497
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
12042
12498
|
case 4:
|
|
12043
12499
|
authClient = _a.sent();
|
|
12044
12500
|
this.logger.verbose("Auth code client created");
|
|
12045
|
-
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto);
|
|
12501
|
+
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto, this.performanceClient);
|
|
12046
12502
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, validRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme) }))];
|
|
12047
12503
|
case 5:
|
|
12048
12504
|
navigateUrl = _a.sent();
|
|
@@ -12228,12 +12684,13 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12228
12684
|
if (!currentAuthority) {
|
|
12229
12685
|
throw BrowserAuthError.createNoCachedAuthorityError();
|
|
12230
12686
|
}
|
|
12687
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, cachedRequest.correlationId);
|
|
12231
12688
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, currentAuthority)];
|
|
12232
12689
|
case 1:
|
|
12233
12690
|
authClient = _a.sent();
|
|
12234
12691
|
this.logger.verbose("Auth code client created");
|
|
12235
12692
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
|
12236
|
-
interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto);
|
|
12693
|
+
interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto, this.performanceClient);
|
|
12237
12694
|
return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
12238
12695
|
case 2: return [2 /*return*/, _a.sent()];
|
|
12239
12696
|
}
|
|
@@ -12268,6 +12725,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
12268
12725
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
12269
12726
|
noHistory: false
|
|
12270
12727
|
};
|
|
12728
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);
|
|
12271
12729
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority)];
|
|
12272
12730
|
case 3:
|
|
12273
12731
|
authClient = _a.sent();
|
|
@@ -12415,6 +12873,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12415
12873
|
case 0:
|
|
12416
12874
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
12417
12875
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
|
|
12876
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
12418
12877
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
|
|
12419
12878
|
case 1:
|
|
12420
12879
|
validRequest = _a.sent();
|
|
@@ -12422,9 +12881,13 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12422
12881
|
_a.label = 2;
|
|
12423
12882
|
case 2:
|
|
12424
12883
|
_a.trys.push([2, 8, , 9]);
|
|
12884
|
+
// Create auth code request and generate PKCE params
|
|
12885
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
12425
12886
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
12426
12887
|
case 3:
|
|
12427
12888
|
authCodeRequest = _a.sent();
|
|
12889
|
+
// Initialize the client
|
|
12890
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
12428
12891
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
12429
12892
|
case 4:
|
|
12430
12893
|
authClient = _a.sent();
|
|
@@ -12437,7 +12900,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12437
12900
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, validRequest), { nativeBroker: isNativeBroker }))];
|
|
12438
12901
|
case 5:
|
|
12439
12902
|
navigateUrl = _a.sent();
|
|
12440
|
-
interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
|
|
12903
|
+
interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
|
12441
12904
|
popupParameters = {
|
|
12442
12905
|
popup: popup,
|
|
12443
12906
|
popupName: popupName,
|
|
@@ -12518,6 +12981,8 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
12518
12981
|
case 2:
|
|
12519
12982
|
// Clear cache on logout
|
|
12520
12983
|
_a.sent();
|
|
12984
|
+
// Initialize the client
|
|
12985
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);
|
|
12521
12986
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
|
|
12522
12987
|
case 3:
|
|
12523
12988
|
authClient = _a.sent();
|
|
@@ -12911,7 +13376,9 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12911
13376
|
// Default logger options for browser
|
|
12912
13377
|
var DEFAULT_LOGGER_OPTIONS = {
|
|
12913
13378
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
12914
|
-
loggerCallback: function () {
|
|
13379
|
+
loggerCallback: function () {
|
|
13380
|
+
// allow users to not set logger call back
|
|
13381
|
+
},
|
|
12915
13382
|
logLevel: exports.LogLevel.Info,
|
|
12916
13383
|
piiLoggingEnabled: false
|
|
12917
13384
|
};
|
|
@@ -12922,6 +13389,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12922
13389
|
useMsrCrypto: false,
|
|
12923
13390
|
entropy: undefined
|
|
12924
13391
|
} });
|
|
13392
|
+
var providedSystemOptions = __assign$1(__assign$1({}, userInputSystem), { loggerOptions: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loggerOptions) || DEFAULT_LOGGER_OPTIONS });
|
|
12925
13393
|
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
12926
13394
|
application: {
|
|
12927
13395
|
appName: Constants.EMPTY_STRING,
|
|
@@ -12931,7 +13399,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12931
13399
|
var overlayedConfig = {
|
|
12932
13400
|
auth: __assign$1(__assign$1({}, DEFAULT_AUTH_OPTIONS), userInputAuth),
|
|
12933
13401
|
cache: __assign$1(__assign$1({}, DEFAULT_CACHE_OPTIONS), userInputCache),
|
|
12934
|
-
system: __assign$1(__assign$1({}, DEFAULT_BROWSER_SYSTEM_OPTIONS),
|
|
13402
|
+
system: __assign$1(__assign$1({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), providedSystemOptions),
|
|
12935
13403
|
telemetry: __assign$1(__assign$1({}, DEFAULT_TELEMETRY_OPTIONS), userInputTelemetry)
|
|
12936
13404
|
};
|
|
12937
13405
|
return overlayedConfig;
|
|
@@ -12943,8 +13411,8 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12943
13411
|
*/
|
|
12944
13412
|
var SilentHandler = /** @class */ (function (_super) {
|
|
12945
13413
|
__extends$1(SilentHandler, _super);
|
|
12946
|
-
function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions) {
|
|
12947
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
13414
|
+
function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions, performanceClient) {
|
|
13415
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;
|
|
12948
13416
|
_this.navigateFrameWait = systemOptions.navigateFrameWait;
|
|
12949
13417
|
_this.pollIntervalMilliseconds = systemOptions.pollIntervalMilliseconds;
|
|
12950
13418
|
return _this;
|
|
@@ -12956,24 +13424,20 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12956
13424
|
*/
|
|
12957
13425
|
SilentHandler.prototype.initiateAuthRequest = function (requestUrl) {
|
|
12958
13426
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
switch (_b.label) {
|
|
13427
|
+
return __generator$1(this, function (_a) {
|
|
13428
|
+
switch (_a.label) {
|
|
12962
13429
|
case 0:
|
|
13430
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerInitiateAuthRequest, this.authCodeRequest.correlationId);
|
|
12963
13431
|
if (StringUtils.isEmpty(requestUrl)) {
|
|
12964
13432
|
// Throw error if request URL is empty.
|
|
12965
13433
|
this.logger.info("Navigate url is empty");
|
|
12966
13434
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
12967
13435
|
}
|
|
12968
13436
|
if (!this.navigateFrameWait) return [3 /*break*/, 2];
|
|
13437
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
12969
13438
|
return [4 /*yield*/, this.loadFrame(requestUrl)];
|
|
12970
|
-
case 1:
|
|
12971
|
-
|
|
12972
|
-
return [3 /*break*/, 3];
|
|
12973
|
-
case 2:
|
|
12974
|
-
_a = this.loadFrameSync(requestUrl);
|
|
12975
|
-
_b.label = 3;
|
|
12976
|
-
case 3: return [2 /*return*/, _a];
|
|
13439
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
13440
|
+
case 2: return [2 /*return*/, this.loadFrameSync(requestUrl)];
|
|
12977
13441
|
}
|
|
12978
13442
|
});
|
|
12979
13443
|
});
|
|
@@ -12985,6 +13449,7 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12985
13449
|
*/
|
|
12986
13450
|
SilentHandler.prototype.monitorIframeForHash = function (iframe, timeout) {
|
|
12987
13451
|
var _this = this;
|
|
13452
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerMonitorIframeForHash, this.authCodeRequest.correlationId);
|
|
12988
13453
|
return new Promise(function (resolve, reject) {
|
|
12989
13454
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
12990
13455
|
_this.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower (" + timeout + "ms) than the default (" + DEFAULT_IFRAME_TIMEOUT_MS + "ms). This may result in timeouts.");
|
|
@@ -13033,11 +13498,12 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
13033
13498
|
* @ignore
|
|
13034
13499
|
*/
|
|
13035
13500
|
SilentHandler.prototype.loadFrame = function (urlNavigate) {
|
|
13501
|
+
var _this = this;
|
|
13502
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
13036
13503
|
/*
|
|
13037
13504
|
* This trick overcomes iframe navigation in IE
|
|
13038
13505
|
* IE does not load the page consistently in iframe
|
|
13039
13506
|
*/
|
|
13040
|
-
var _this = this;
|
|
13041
13507
|
return new Promise(function (resolve, reject) {
|
|
13042
13508
|
var frameHandle = _this.createHiddenIframe();
|
|
13043
13509
|
setTimeout(function () {
|
|
@@ -13112,6 +13578,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13112
13578
|
return __generator$1(this, function (_a) {
|
|
13113
13579
|
switch (_a.label) {
|
|
13114
13580
|
case 0:
|
|
13581
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
13115
13582
|
this.logger.verbose("acquireTokenByIframe called");
|
|
13116
13583
|
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
13117
13584
|
// Check that we have some SSO data
|
|
@@ -13125,6 +13592,8 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13125
13592
|
});
|
|
13126
13593
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
13127
13594
|
}
|
|
13595
|
+
// Create silent request
|
|
13596
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13128
13597
|
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: request.prompt || PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
13129
13598
|
case 1:
|
|
13130
13599
|
silentRequest = _a.sent();
|
|
@@ -13133,10 +13602,13 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13133
13602
|
_a.label = 2;
|
|
13134
13603
|
case 2:
|
|
13135
13604
|
_a.trys.push([2, 5, , 6]);
|
|
13605
|
+
// Initialize the client
|
|
13606
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13136
13607
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
13137
13608
|
case 3:
|
|
13138
13609
|
authClient = _a.sent();
|
|
13139
13610
|
this.logger.verbose("Auth code client created");
|
|
13611
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
13140
13612
|
return [4 /*yield*/, this.silentTokenHelper(authClient, silentRequest).then(function (result) {
|
|
13141
13613
|
acquireTokenMeasurement.endMeasurement({
|
|
13142
13614
|
success: true,
|
|
@@ -13183,16 +13655,26 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13183
13655
|
var _this = this;
|
|
13184
13656
|
return __generator$1(this, function (_a) {
|
|
13185
13657
|
switch (_a.label) {
|
|
13186
|
-
case 0:
|
|
13658
|
+
case 0:
|
|
13659
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);
|
|
13660
|
+
// Create auth code request and generate PKCE params
|
|
13661
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, silentRequest.correlationId);
|
|
13662
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
|
|
13187
13663
|
case 1:
|
|
13188
13664
|
authCodeRequest = _a.sent();
|
|
13665
|
+
// Create authorize request url
|
|
13666
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.GetAuthCodeUrl, silentRequest.correlationId);
|
|
13189
13667
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, silentRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme) }))];
|
|
13190
13668
|
case 2:
|
|
13191
13669
|
navigateUrl = _a.sent();
|
|
13192
|
-
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
|
|
13670
|
+
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
13671
|
+
// Get the frame handle for the silent request
|
|
13672
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerInitiateAuthRequest, silentRequest.correlationId);
|
|
13193
13673
|
return [4 /*yield*/, silentHandler.initiateAuthRequest(navigateUrl)];
|
|
13194
13674
|
case 3:
|
|
13195
13675
|
msalFrame = _a.sent();
|
|
13676
|
+
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
13677
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentHandlerMonitorIframeForHash, silentRequest.correlationId);
|
|
13196
13678
|
return [4 /*yield*/, silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout)];
|
|
13197
13679
|
case 4:
|
|
13198
13680
|
hash = _a.sent();
|
|
@@ -13210,6 +13692,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
13210
13692
|
})];
|
|
13211
13693
|
}
|
|
13212
13694
|
// Handle response from hash string
|
|
13695
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.HandleCodeResponseFromHash, silentRequest.correlationId);
|
|
13213
13696
|
return [2 /*return*/, silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
13214
13697
|
}
|
|
13215
13698
|
});
|
|
@@ -13238,6 +13721,8 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13238
13721
|
return __generator$1(this, function (_b) {
|
|
13239
13722
|
switch (_b.label) {
|
|
13240
13723
|
case 0:
|
|
13724
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
13725
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
13241
13726
|
_a = [__assign$1({}, request)];
|
|
13242
13727
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
13243
13728
|
case 1:
|
|
@@ -13249,6 +13734,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13249
13734
|
refreshTokenClient = _b.sent();
|
|
13250
13735
|
this.logger.verbose("Refresh token client created");
|
|
13251
13736
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
13737
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
13252
13738
|
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)
|
|
13253
13739
|
.then(function (result) {
|
|
13254
13740
|
acquireTokenMeasurement.endMeasurement({
|
|
@@ -13291,7 +13777,10 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
13291
13777
|
var clientConfig;
|
|
13292
13778
|
return __generator$1(this, function (_a) {
|
|
13293
13779
|
switch (_a.label) {
|
|
13294
|
-
case 0:
|
|
13780
|
+
case 0:
|
|
13781
|
+
// Create auth module.
|
|
13782
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
13783
|
+
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
13295
13784
|
case 1:
|
|
13296
13785
|
clientConfig = _a.sent();
|
|
13297
13786
|
return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];
|
|
@@ -13422,27 +13911,6 @@ var EventHandler = /** @class */ (function () {
|
|
|
13422
13911
|
return EventHandler;
|
|
13423
13912
|
}());
|
|
13424
13913
|
|
|
13425
|
-
/*
|
|
13426
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13427
|
-
* Licensed under the MIT License.
|
|
13428
|
-
*/
|
|
13429
|
-
|
|
13430
|
-
var internals = /*#__PURE__*/Object.freeze({
|
|
13431
|
-
__proto__: null,
|
|
13432
|
-
BrowserCacheManager: BrowserCacheManager,
|
|
13433
|
-
StandardInteractionClient: StandardInteractionClient,
|
|
13434
|
-
RedirectClient: RedirectClient,
|
|
13435
|
-
PopupClient: PopupClient,
|
|
13436
|
-
SilentIframeClient: SilentIframeClient,
|
|
13437
|
-
SilentCacheClient: SilentCacheClient,
|
|
13438
|
-
SilentRefreshClient: SilentRefreshClient,
|
|
13439
|
-
RedirectHandler: RedirectHandler,
|
|
13440
|
-
EventHandler: EventHandler,
|
|
13441
|
-
NativeMessageHandler: NativeMessageHandler,
|
|
13442
|
-
BrowserConstants: BrowserConstants,
|
|
13443
|
-
get TemporaryCacheKeys () { return TemporaryCacheKeys; }
|
|
13444
|
-
});
|
|
13445
|
-
|
|
13446
13914
|
/*
|
|
13447
13915
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13448
13916
|
* Licensed under the MIT License.
|
|
@@ -14896,86 +15364,271 @@ var CryptoOps = /** @class */ (function () {
|
|
|
14896
15364
|
/**
|
|
14897
15365
|
* Removes all cryptographic keys from IndexedDB storage
|
|
14898
15366
|
*/
|
|
14899
|
-
CryptoOps.prototype.clearKeystore = function () {
|
|
14900
|
-
return __awaiter$1(this, void 0, void 0, function () {
|
|
14901
|
-
return __generator$1(this, function (_a) {
|
|
14902
|
-
switch (_a.label) {
|
|
14903
|
-
case 0: return [4 /*yield*/, this.cache.clear()];
|
|
14904
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
14905
|
-
}
|
|
14906
|
-
});
|
|
14907
|
-
});
|
|
15367
|
+
CryptoOps.prototype.clearKeystore = function () {
|
|
15368
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15369
|
+
return __generator$1(this, function (_a) {
|
|
15370
|
+
switch (_a.label) {
|
|
15371
|
+
case 0: return [4 /*yield*/, this.cache.clear()];
|
|
15372
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
15373
|
+
}
|
|
15374
|
+
});
|
|
15375
|
+
});
|
|
15376
|
+
};
|
|
15377
|
+
/**
|
|
15378
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
15379
|
+
* @param payload
|
|
15380
|
+
* @param kid
|
|
15381
|
+
*/
|
|
15382
|
+
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
15383
|
+
var _a;
|
|
15384
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15385
|
+
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, encodedKeyIdThumbprint, shrHeader, encodedShrHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
|
|
15386
|
+
return __generator$1(this, function (_b) {
|
|
15387
|
+
switch (_b.label) {
|
|
15388
|
+
case 0:
|
|
15389
|
+
signJwtMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
15390
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
|
|
15391
|
+
case 1:
|
|
15392
|
+
cachedKeyPair = _b.sent();
|
|
15393
|
+
if (!cachedKeyPair) {
|
|
15394
|
+
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
15395
|
+
}
|
|
15396
|
+
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
15397
|
+
case 2:
|
|
15398
|
+
publicKeyJwk = _b.sent();
|
|
15399
|
+
publicKeyJwkString = BrowserStringUtils.getSortedObjectString(publicKeyJwk);
|
|
15400
|
+
encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));
|
|
15401
|
+
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
15402
|
+
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
15403
|
+
// Generate payload
|
|
15404
|
+
payload.cnf = {
|
|
15405
|
+
jwk: JSON.parse(publicKeyJwkString)
|
|
15406
|
+
};
|
|
15407
|
+
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
15408
|
+
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
15409
|
+
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
15410
|
+
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
15411
|
+
case 3:
|
|
15412
|
+
signatureBuffer = _b.sent();
|
|
15413
|
+
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
15414
|
+
signedJwt = tokenString + "." + encodedSignature;
|
|
15415
|
+
if (signJwtMeasurement) {
|
|
15416
|
+
signJwtMeasurement.endMeasurement({
|
|
15417
|
+
success: true
|
|
15418
|
+
});
|
|
15419
|
+
}
|
|
15420
|
+
return [2 /*return*/, signedJwt];
|
|
15421
|
+
}
|
|
15422
|
+
});
|
|
15423
|
+
});
|
|
15424
|
+
};
|
|
15425
|
+
/**
|
|
15426
|
+
* Returns the SHA-256 hash of an input string
|
|
15427
|
+
* @param plainText
|
|
15428
|
+
*/
|
|
15429
|
+
CryptoOps.prototype.hashString = function (plainText) {
|
|
15430
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15431
|
+
var hashBuffer, hashBytes;
|
|
15432
|
+
return __generator$1(this, function (_a) {
|
|
15433
|
+
switch (_a.label) {
|
|
15434
|
+
case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];
|
|
15435
|
+
case 1:
|
|
15436
|
+
hashBuffer = _a.sent();
|
|
15437
|
+
hashBytes = new Uint8Array(hashBuffer);
|
|
15438
|
+
return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];
|
|
15439
|
+
}
|
|
15440
|
+
});
|
|
15441
|
+
});
|
|
15442
|
+
};
|
|
15443
|
+
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
15444
|
+
CryptoOps.EXTRACTABLE = true;
|
|
15445
|
+
return CryptoOps;
|
|
15446
|
+
}());
|
|
15447
|
+
|
|
15448
|
+
/*
|
|
15449
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15450
|
+
* Licensed under the MIT License.
|
|
15451
|
+
*/
|
|
15452
|
+
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
15453
|
+
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
15454
|
+
this.correlationId = correlationId;
|
|
15455
|
+
this.measureName = "msal.measure." + name + "." + this.correlationId;
|
|
15456
|
+
this.startMark = "msal.start." + name + "." + this.correlationId;
|
|
15457
|
+
this.endMark = "msal.end." + name + "." + this.correlationId;
|
|
15458
|
+
}
|
|
15459
|
+
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
15460
|
+
return typeof window !== "undefined" &&
|
|
15461
|
+
typeof window.performance !== "undefined" &&
|
|
15462
|
+
typeof window.performance.mark === "function" &&
|
|
15463
|
+
typeof window.performance.measure === "function" &&
|
|
15464
|
+
typeof window.performance.clearMarks === "function" &&
|
|
15465
|
+
typeof window.performance.clearMeasures === "function" &&
|
|
15466
|
+
typeof window.performance.getEntriesByName === "function";
|
|
15467
|
+
};
|
|
15468
|
+
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
15469
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15470
|
+
try {
|
|
15471
|
+
window.performance.mark(this.startMark);
|
|
15472
|
+
}
|
|
15473
|
+
catch (e) {
|
|
15474
|
+
// Silently catch
|
|
15475
|
+
}
|
|
15476
|
+
}
|
|
15477
|
+
};
|
|
15478
|
+
BrowserPerformanceMeasurement.prototype.endMeasurement = function () {
|
|
15479
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15480
|
+
try {
|
|
15481
|
+
window.performance.mark(this.endMark);
|
|
15482
|
+
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
15483
|
+
}
|
|
15484
|
+
catch (e) {
|
|
15485
|
+
// Silently catch
|
|
15486
|
+
}
|
|
15487
|
+
}
|
|
15488
|
+
};
|
|
15489
|
+
BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
15490
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15491
|
+
try {
|
|
15492
|
+
var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
15493
|
+
if (entriesForMeasurement.length > 0) {
|
|
15494
|
+
var durationMs = entriesForMeasurement[0].duration;
|
|
15495
|
+
window.performance.clearMeasures(this.measureName);
|
|
15496
|
+
window.performance.clearMarks(this.startMark);
|
|
15497
|
+
window.performance.clearMarks(this.endMark);
|
|
15498
|
+
return durationMs;
|
|
15499
|
+
}
|
|
15500
|
+
}
|
|
15501
|
+
catch (e) {
|
|
15502
|
+
// Silently catch and return null
|
|
15503
|
+
}
|
|
15504
|
+
}
|
|
15505
|
+
return null;
|
|
15506
|
+
};
|
|
15507
|
+
return BrowserPerformanceMeasurement;
|
|
15508
|
+
}());
|
|
15509
|
+
|
|
15510
|
+
/*
|
|
15511
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15512
|
+
* Licensed under the MIT License.
|
|
15513
|
+
*/
|
|
15514
|
+
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
15515
|
+
__extends$1(BrowserPerformanceClient, _super);
|
|
15516
|
+
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {
|
|
15517
|
+
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
15518
|
+
_this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);
|
|
15519
|
+
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
15520
|
+
return _this;
|
|
15521
|
+
}
|
|
15522
|
+
BrowserPerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
15523
|
+
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
15524
|
+
};
|
|
15525
|
+
BrowserPerformanceClient.prototype.generateId = function () {
|
|
15526
|
+
return this.guidGenerator.generateGuid();
|
|
15527
|
+
};
|
|
15528
|
+
BrowserPerformanceClient.prototype.getPageVisibility = function () {
|
|
15529
|
+
var _a;
|
|
15530
|
+
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
15531
|
+
};
|
|
15532
|
+
BrowserPerformanceClient.prototype.supportsBrowserPerformanceNow = function () {
|
|
15533
|
+
return typeof window !== "undefined" &&
|
|
15534
|
+
typeof window.performance !== "undefined" &&
|
|
15535
|
+
typeof window.performance.now === "function";
|
|
15536
|
+
};
|
|
15537
|
+
/**
|
|
15538
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
15539
|
+
* Also captures browser page visibilityState.
|
|
15540
|
+
*
|
|
15541
|
+
* @param {PerformanceEvents} measureName
|
|
15542
|
+
* @param {?string} [correlationId]
|
|
15543
|
+
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
15544
|
+
*/
|
|
15545
|
+
BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
15546
|
+
var _this = this;
|
|
15547
|
+
// Capture page visibilityState and then invoke start/end measurement
|
|
15548
|
+
var startPageVisibility = this.getPageVisibility();
|
|
15549
|
+
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
15550
|
+
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
15551
|
+
return inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
15552
|
+
} });
|
|
14908
15553
|
};
|
|
14909
15554
|
/**
|
|
14910
|
-
*
|
|
14911
|
-
* @param
|
|
14912
|
-
* @param
|
|
15555
|
+
* Adds pre-queue time to preQueueTimeByCorrelationId map.
|
|
15556
|
+
* @param {PerformanceEvents} eventName
|
|
15557
|
+
* @param {?string} correlationId
|
|
15558
|
+
* @returns
|
|
14913
15559
|
*/
|
|
14914
|
-
|
|
14915
|
-
|
|
14916
|
-
|
|
14917
|
-
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14933
|
-
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
14934
|
-
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
14935
|
-
// Generate payload
|
|
14936
|
-
payload.cnf = {
|
|
14937
|
-
jwk: JSON.parse(publicKeyJwkString)
|
|
14938
|
-
};
|
|
14939
|
-
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
14940
|
-
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
14941
|
-
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
14942
|
-
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
14943
|
-
case 3:
|
|
14944
|
-
signatureBuffer = _b.sent();
|
|
14945
|
-
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
14946
|
-
signedJwt = tokenString + "." + encodedSignature;
|
|
14947
|
-
if (signJwtMeasurement) {
|
|
14948
|
-
signJwtMeasurement.endMeasurement({
|
|
14949
|
-
success: true
|
|
14950
|
-
});
|
|
14951
|
-
}
|
|
14952
|
-
return [2 /*return*/, signedJwt];
|
|
14953
|
-
}
|
|
14954
|
-
});
|
|
14955
|
-
});
|
|
15560
|
+
BrowserPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {
|
|
15561
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
15562
|
+
this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for " + eventName);
|
|
15563
|
+
return;
|
|
15564
|
+
}
|
|
15565
|
+
if (!correlationId) {
|
|
15566
|
+
this.logger.trace("BrowserPerformanceClient: correlationId for " + eventName + " not provided, unable to set telemetry queue time");
|
|
15567
|
+
return;
|
|
15568
|
+
}
|
|
15569
|
+
var preQueueTimesByEvents = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
15570
|
+
if (preQueueTimesByEvents) {
|
|
15571
|
+
preQueueTimesByEvents.set(eventName, window.performance.now());
|
|
15572
|
+
this.preQueueTimeByCorrelationId.set(correlationId, preQueueTimesByEvents);
|
|
15573
|
+
}
|
|
15574
|
+
else {
|
|
15575
|
+
var preQueueTimes = new Map();
|
|
15576
|
+
preQueueTimes.set(eventName, window.performance.now());
|
|
15577
|
+
this.preQueueTimeByCorrelationId.set(correlationId, preQueueTimes);
|
|
15578
|
+
}
|
|
14956
15579
|
};
|
|
14957
15580
|
/**
|
|
14958
|
-
*
|
|
14959
|
-
*
|
|
15581
|
+
* Calculates and adds queue time measurement for given performance event.
|
|
15582
|
+
*
|
|
15583
|
+
* @param {PerformanceEvents} name
|
|
15584
|
+
* @param {?string} correlationId
|
|
15585
|
+
* @param {?number} preQueueTime
|
|
15586
|
+
* @returns
|
|
14960
15587
|
*/
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
return
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
}
|
|
15588
|
+
BrowserPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId) {
|
|
15589
|
+
if (!this.supportsBrowserPerformanceNow()) {
|
|
15590
|
+
this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to add queue measurement for " + eventName);
|
|
15591
|
+
return;
|
|
15592
|
+
}
|
|
15593
|
+
if (!correlationId) {
|
|
15594
|
+
this.logger.trace("BrowserPerformanceClient: correlationId for " + eventName + " not provided, unable to add queue measurement");
|
|
15595
|
+
return;
|
|
15596
|
+
}
|
|
15597
|
+
var preQueueTime = _super.prototype.getPreQueueTime.call(this, eventName, correlationId);
|
|
15598
|
+
if (!preQueueTime) {
|
|
15599
|
+
return;
|
|
15600
|
+
}
|
|
15601
|
+
var currentTime = window.performance.now();
|
|
15602
|
+
var queueTime = _super.prototype.calculateQueuedTime.call(this, preQueueTime, currentTime);
|
|
15603
|
+
return _super.prototype.addQueueMeasurement.call(this, eventName, correlationId, queueTime);
|
|
14974
15604
|
};
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
15605
|
+
return BrowserPerformanceClient;
|
|
15606
|
+
}(PerformanceClient));
|
|
15607
|
+
|
|
15608
|
+
/*
|
|
15609
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15610
|
+
* Licensed under the MIT License.
|
|
15611
|
+
*/
|
|
15612
|
+
|
|
15613
|
+
var internals = /*#__PURE__*/Object.freeze({
|
|
15614
|
+
__proto__: null,
|
|
15615
|
+
BrowserCacheManager: BrowserCacheManager,
|
|
15616
|
+
StandardInteractionClient: StandardInteractionClient,
|
|
15617
|
+
RedirectClient: RedirectClient,
|
|
15618
|
+
PopupClient: PopupClient,
|
|
15619
|
+
SilentIframeClient: SilentIframeClient,
|
|
15620
|
+
SilentCacheClient: SilentCacheClient,
|
|
15621
|
+
SilentRefreshClient: SilentRefreshClient,
|
|
15622
|
+
RedirectHandler: RedirectHandler,
|
|
15623
|
+
EventHandler: EventHandler,
|
|
15624
|
+
NativeMessageHandler: NativeMessageHandler,
|
|
15625
|
+
BrowserConstants: BrowserConstants,
|
|
15626
|
+
get TemporaryCacheKeys () { return TemporaryCacheKeys; },
|
|
15627
|
+
CryptoOps: CryptoOps,
|
|
15628
|
+
NativeAuthError: NativeAuthError,
|
|
15629
|
+
BrowserPerformanceClient: BrowserPerformanceClient,
|
|
15630
|
+
BrowserPerformanceMeasurement: BrowserPerformanceMeasurement
|
|
15631
|
+
});
|
|
14979
15632
|
|
|
14980
15633
|
/*
|
|
14981
15634
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -15237,6 +15890,8 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15237
15890
|
if (!request.code) {
|
|
15238
15891
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
15239
15892
|
}
|
|
15893
|
+
// Create silent request
|
|
15894
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
15240
15895
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
15241
15896
|
case 1:
|
|
15242
15897
|
silentRequest = _a.sent();
|
|
@@ -15246,12 +15901,14 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15246
15901
|
case 2:
|
|
15247
15902
|
_a.trys.push([2, 4, , 5]);
|
|
15248
15903
|
authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
|
|
15904
|
+
// Initialize the client
|
|
15905
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.StandardInteractionClientGetClientConfiguration, request.correlationId);
|
|
15249
15906
|
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
|
|
15250
15907
|
case 3:
|
|
15251
15908
|
clientConfig = _a.sent();
|
|
15252
15909
|
authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
15253
15910
|
this.logger.verbose("Auth code client created");
|
|
15254
|
-
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system);
|
|
15911
|
+
silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
15255
15912
|
// Handle auth code parameters from request
|
|
15256
15913
|
return [2 /*return*/, silentHandler.handleCodeResponseFromServer({
|
|
15257
15914
|
code: request.code,
|
|
@@ -15282,110 +15939,6 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
15282
15939
|
return SilentAuthCodeClient;
|
|
15283
15940
|
}(StandardInteractionClient));
|
|
15284
15941
|
|
|
15285
|
-
/*
|
|
15286
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15287
|
-
* Licensed under the MIT License.
|
|
15288
|
-
*/
|
|
15289
|
-
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
15290
|
-
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
15291
|
-
this.correlationId = correlationId;
|
|
15292
|
-
this.measureName = "msal.measure." + name + "." + this.correlationId;
|
|
15293
|
-
this.startMark = "msal.start." + name + "." + this.correlationId;
|
|
15294
|
-
this.endMark = "msal.end." + name + "." + this.correlationId;
|
|
15295
|
-
}
|
|
15296
|
-
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
15297
|
-
return typeof window !== "undefined" &&
|
|
15298
|
-
typeof window.performance !== "undefined" &&
|
|
15299
|
-
typeof window.performance.mark === "function" &&
|
|
15300
|
-
typeof window.performance.measure === "function" &&
|
|
15301
|
-
typeof window.performance.clearMarks === "function" &&
|
|
15302
|
-
typeof window.performance.clearMeasures === "function" &&
|
|
15303
|
-
typeof window.performance.getEntriesByName === "function";
|
|
15304
|
-
};
|
|
15305
|
-
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
15306
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15307
|
-
try {
|
|
15308
|
-
window.performance.mark(this.startMark);
|
|
15309
|
-
}
|
|
15310
|
-
catch (e) {
|
|
15311
|
-
// Silently catch
|
|
15312
|
-
}
|
|
15313
|
-
}
|
|
15314
|
-
};
|
|
15315
|
-
BrowserPerformanceMeasurement.prototype.endMeasurement = function () {
|
|
15316
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15317
|
-
try {
|
|
15318
|
-
window.performance.mark(this.endMark);
|
|
15319
|
-
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
15320
|
-
}
|
|
15321
|
-
catch (e) {
|
|
15322
|
-
// Silently catch
|
|
15323
|
-
}
|
|
15324
|
-
}
|
|
15325
|
-
};
|
|
15326
|
-
BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
15327
|
-
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15328
|
-
try {
|
|
15329
|
-
var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
15330
|
-
if (entriesForMeasurement.length > 0) {
|
|
15331
|
-
var durationMs = entriesForMeasurement[0].duration;
|
|
15332
|
-
window.performance.clearMeasures(this.measureName);
|
|
15333
|
-
window.performance.clearMarks(this.startMark);
|
|
15334
|
-
window.performance.clearMarks(this.endMark);
|
|
15335
|
-
return durationMs;
|
|
15336
|
-
}
|
|
15337
|
-
}
|
|
15338
|
-
catch (e) {
|
|
15339
|
-
// Silently catch and return null
|
|
15340
|
-
}
|
|
15341
|
-
}
|
|
15342
|
-
return null;
|
|
15343
|
-
};
|
|
15344
|
-
return BrowserPerformanceMeasurement;
|
|
15345
|
-
}());
|
|
15346
|
-
|
|
15347
|
-
/*
|
|
15348
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15349
|
-
* Licensed under the MIT License.
|
|
15350
|
-
*/
|
|
15351
|
-
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
15352
|
-
__extends$1(BrowserPerformanceClient, _super);
|
|
15353
|
-
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {
|
|
15354
|
-
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
15355
|
-
_this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);
|
|
15356
|
-
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
15357
|
-
return _this;
|
|
15358
|
-
}
|
|
15359
|
-
BrowserPerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
15360
|
-
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
15361
|
-
};
|
|
15362
|
-
BrowserPerformanceClient.prototype.generateId = function () {
|
|
15363
|
-
return this.guidGenerator.generateGuid();
|
|
15364
|
-
};
|
|
15365
|
-
BrowserPerformanceClient.prototype.getPageVisibility = function () {
|
|
15366
|
-
var _a;
|
|
15367
|
-
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
15368
|
-
};
|
|
15369
|
-
/**
|
|
15370
|
-
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
15371
|
-
* Also captures browser page visibilityState.
|
|
15372
|
-
*
|
|
15373
|
-
* @param {PerformanceEvents} measureName
|
|
15374
|
-
* @param {?string} [correlationId]
|
|
15375
|
-
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
15376
|
-
*/
|
|
15377
|
-
BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
15378
|
-
var _this = this;
|
|
15379
|
-
// Capture page visibilityState and then invoke start/end measurement
|
|
15380
|
-
var startPageVisibility = this.getPageVisibility();
|
|
15381
|
-
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
15382
|
-
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
15383
|
-
return inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
15384
|
-
} });
|
|
15385
|
-
};
|
|
15386
|
-
return BrowserPerformanceClient;
|
|
15387
|
-
}(PerformanceClient));
|
|
15388
|
-
|
|
15389
15942
|
/*
|
|
15390
15943
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15391
15944
|
* Licensed under the MIT License.
|
|
@@ -15452,6 +16005,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15452
16005
|
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
15453
16006
|
// Initialize the token cache
|
|
15454
16007
|
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
|
|
16008
|
+
// Register listener functions
|
|
16009
|
+
this.trackPageVisibilityWithMeasurement = this.trackPageVisibilityWithMeasurement.bind(this);
|
|
15455
16010
|
}
|
|
15456
16011
|
/**
|
|
15457
16012
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
@@ -15718,6 +16273,16 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15718
16273
|
return Promise.reject(e);
|
|
15719
16274
|
});
|
|
15720
16275
|
};
|
|
16276
|
+
ClientApplication.prototype.trackPageVisibilityWithMeasurement = function () {
|
|
16277
|
+
var measurement = this.ssoSilentMeasurement || this.acquireTokenByCodeAsyncMeasurement;
|
|
16278
|
+
if (!measurement) {
|
|
16279
|
+
return;
|
|
16280
|
+
}
|
|
16281
|
+
this.logger.info("Perf: Visibility change detected in ", measurement.event.name);
|
|
16282
|
+
measurement.increment({
|
|
16283
|
+
visibilityChangeCount: 1,
|
|
16284
|
+
});
|
|
16285
|
+
};
|
|
15721
16286
|
// #endregion
|
|
15722
16287
|
// #region Silent Flow
|
|
15723
16288
|
/**
|
|
@@ -15736,16 +16301,21 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15736
16301
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
15737
16302
|
*/
|
|
15738
16303
|
ClientApplication.prototype.ssoSilent = function (request) {
|
|
16304
|
+
var _a;
|
|
15739
16305
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15740
|
-
var correlationId, validRequest,
|
|
16306
|
+
var correlationId, validRequest, result, silentIframeClient;
|
|
15741
16307
|
var _this = this;
|
|
15742
|
-
return __generator$1(this, function (
|
|
16308
|
+
return __generator$1(this, function (_b) {
|
|
15743
16309
|
correlationId = this.getRequestCorrelationId(request);
|
|
15744
16310
|
validRequest = __assign$1(__assign$1({}, request), {
|
|
15745
16311
|
// will be PromptValue.NONE or PromptValue.NO_SESSION
|
|
15746
16312
|
prompt: request.prompt, correlationId: correlationId });
|
|
15747
16313
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15748
|
-
ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
16314
|
+
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
16315
|
+
(_a = this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
16316
|
+
visibilityChangeCount: 0
|
|
16317
|
+
});
|
|
16318
|
+
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
15749
16319
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
15750
16320
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
15751
16321
|
if (this.canUseNative(validRequest)) {
|
|
@@ -15764,27 +16334,31 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15764
16334
|
result = silentIframeClient.acquireToken(validRequest);
|
|
15765
16335
|
}
|
|
15766
16336
|
return [2 /*return*/, result.then(function (response) {
|
|
16337
|
+
var _a, _b, _c;
|
|
15767
16338
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
15768
|
-
ssoSilentMeasurement.addStaticFields({
|
|
16339
|
+
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.addStaticFields({
|
|
15769
16340
|
accessTokenSize: response.accessToken.length,
|
|
15770
16341
|
idTokenSize: response.idToken.length
|
|
15771
16342
|
});
|
|
15772
|
-
ssoSilentMeasurement.endMeasurement({
|
|
16343
|
+
(_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.endMeasurement({
|
|
15773
16344
|
success: true,
|
|
15774
16345
|
isNativeBroker: response.fromNativeBroker,
|
|
15775
16346
|
requestId: response.requestId
|
|
15776
16347
|
});
|
|
15777
|
-
ssoSilentMeasurement.flushMeasurement();
|
|
16348
|
+
(_c = _this.ssoSilentMeasurement) === null || _c === void 0 ? void 0 : _c.flushMeasurement();
|
|
15778
16349
|
return response;
|
|
15779
16350
|
}).catch(function (e) {
|
|
16351
|
+
var _a, _b;
|
|
15780
16352
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
15781
|
-
ssoSilentMeasurement.endMeasurement({
|
|
16353
|
+
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
15782
16354
|
errorCode: e.errorCode,
|
|
15783
16355
|
subErrorCode: e.subError,
|
|
15784
16356
|
success: false
|
|
15785
16357
|
});
|
|
15786
|
-
ssoSilentMeasurement.flushMeasurement();
|
|
16358
|
+
(_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.flushMeasurement();
|
|
15787
16359
|
throw e;
|
|
16360
|
+
}).finally(function () {
|
|
16361
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibilityWithMeasurement);
|
|
15788
16362
|
})];
|
|
15789
16363
|
});
|
|
15790
16364
|
});
|
|
@@ -15890,16 +16464,42 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15890
16464
|
* @returns Result of the operation to redeem the authorization code
|
|
15891
16465
|
*/
|
|
15892
16466
|
ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {
|
|
16467
|
+
var _a;
|
|
15893
16468
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15894
16469
|
var silentAuthCodeClient, silentTokenResult;
|
|
15895
|
-
|
|
15896
|
-
|
|
16470
|
+
var _this = this;
|
|
16471
|
+
return __generator$1(this, function (_b) {
|
|
16472
|
+
switch (_b.label) {
|
|
15897
16473
|
case 0:
|
|
15898
16474
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
16475
|
+
this.acquireTokenByCodeAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenByCodeAsync, request.correlationId);
|
|
16476
|
+
(_a = this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
16477
|
+
visibilityChangeCount: 0
|
|
16478
|
+
});
|
|
16479
|
+
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
15899
16480
|
silentAuthCodeClient = this.createSilentAuthCodeClient(request.correlationId);
|
|
15900
|
-
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)
|
|
16481
|
+
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request).then(function (response) {
|
|
16482
|
+
var _a;
|
|
16483
|
+
(_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16484
|
+
success: true,
|
|
16485
|
+
fromCache: response.fromCache,
|
|
16486
|
+
isNativeBroker: response.fromNativeBroker,
|
|
16487
|
+
requestId: response.requestId
|
|
16488
|
+
});
|
|
16489
|
+
return response;
|
|
16490
|
+
}).catch(function (tokenRenewalError) {
|
|
16491
|
+
var _a;
|
|
16492
|
+
(_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16493
|
+
errorCode: tokenRenewalError.errorCode,
|
|
16494
|
+
subErrorCode: tokenRenewalError.subError,
|
|
16495
|
+
success: false
|
|
16496
|
+
});
|
|
16497
|
+
throw tokenRenewalError;
|
|
16498
|
+
}).finally(function () {
|
|
16499
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibilityWithMeasurement);
|
|
16500
|
+
})];
|
|
15901
16501
|
case 1:
|
|
15902
|
-
silentTokenResult =
|
|
16502
|
+
silentTokenResult = _b.sent();
|
|
15903
16503
|
return [2 /*return*/, silentTokenResult];
|
|
15904
16504
|
}
|
|
15905
16505
|
});
|
|
@@ -15915,6 +16515,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15915
16515
|
ClientApplication.prototype.acquireTokenFromCache = function (silentCacheClient, commonRequest, silentRequest) {
|
|
15916
16516
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15917
16517
|
return __generator$1(this, function (_a) {
|
|
16518
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
15918
16519
|
switch (silentRequest.cacheLookupPolicy) {
|
|
15919
16520
|
case exports.CacheLookupPolicy.Default:
|
|
15920
16521
|
case exports.CacheLookupPolicy.AccessToken:
|
|
@@ -15937,12 +16538,14 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15937
16538
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15938
16539
|
var silentRefreshClient;
|
|
15939
16540
|
return __generator$1(this, function (_a) {
|
|
16541
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenByRefreshToken, commonRequest.correlationId);
|
|
15940
16542
|
switch (silentRequest.cacheLookupPolicy) {
|
|
15941
16543
|
case exports.CacheLookupPolicy.Default:
|
|
15942
16544
|
case exports.CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
15943
16545
|
case exports.CacheLookupPolicy.RefreshToken:
|
|
15944
16546
|
case exports.CacheLookupPolicy.RefreshTokenAndNetwork:
|
|
15945
16547
|
silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
|
|
16548
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentRefreshClientAcquireToken, commonRequest.correlationId);
|
|
15946
16549
|
return [2 /*return*/, silentRefreshClient.acquireToken(commonRequest)];
|
|
15947
16550
|
default:
|
|
15948
16551
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -15960,7 +16563,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15960
16563
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15961
16564
|
var silentIframeClient;
|
|
15962
16565
|
return __generator$1(this, function (_a) {
|
|
16566
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenBySilentIframe, request.correlationId);
|
|
15963
16567
|
silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
16568
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
15964
16569
|
return [2 /*return*/, silentIframeClient.acquireToken(request)];
|
|
15965
16570
|
});
|
|
15966
16571
|
});
|
|
@@ -16378,7 +16983,10 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16378
16983
|
*/
|
|
16379
16984
|
function PublicClientApplication(configuration) {
|
|
16380
16985
|
var _this = _super.call(this, configuration) || this;
|
|
16986
|
+
_this.astsAsyncMeasurement = undefined;
|
|
16381
16987
|
_this.activeSilentTokenRequests = new Map();
|
|
16988
|
+
// Register listener functions
|
|
16989
|
+
_this.trackPageVisibility = _this.trackPageVisibility.bind(_this);
|
|
16382
16990
|
return _this;
|
|
16383
16991
|
}
|
|
16384
16992
|
/**
|
|
@@ -16450,6 +17058,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16450
17058
|
cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
16451
17059
|
if (typeof cachedResponse === "undefined") {
|
|
16452
17060
|
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
17061
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenSilentAsync, correlationId);
|
|
16453
17062
|
response = this.acquireTokenSilentAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }), account)
|
|
16454
17063
|
.then(function (result) {
|
|
16455
17064
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
@@ -16461,7 +17070,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16461
17070
|
success: true,
|
|
16462
17071
|
fromCache: result.fromCache,
|
|
16463
17072
|
isNativeBroker: result.fromNativeBroker,
|
|
16464
|
-
|
|
17073
|
+
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
17074
|
+
requestId: result.requestId,
|
|
16465
17075
|
});
|
|
16466
17076
|
atsMeasurement.flushMeasurement();
|
|
16467
17077
|
return result;
|
|
@@ -16491,6 +17101,15 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16491
17101
|
});
|
|
16492
17102
|
});
|
|
16493
17103
|
};
|
|
17104
|
+
PublicClientApplication.prototype.trackPageVisibility = function () {
|
|
17105
|
+
if (!this.astsAsyncMeasurement) {
|
|
17106
|
+
return;
|
|
17107
|
+
}
|
|
17108
|
+
this.logger.info("Perf: Visibility change detected");
|
|
17109
|
+
this.astsAsyncMeasurement.increment({
|
|
17110
|
+
visibilityChangeCount: 1,
|
|
17111
|
+
});
|
|
17112
|
+
};
|
|
16494
17113
|
/**
|
|
16495
17114
|
* Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.
|
|
16496
17115
|
* @param {@link (SilentRequest:type)}
|
|
@@ -16498,14 +17117,20 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16498
17117
|
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
|
|
16499
17118
|
*/
|
|
16500
17119
|
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
|
|
17120
|
+
var _a;
|
|
16501
17121
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
16502
|
-
var
|
|
17122
|
+
var result, silentRequest, silentCacheClient, silentRequest_1, requestWithCLP_1;
|
|
16503
17123
|
var _this = this;
|
|
16504
|
-
return __generator$1(this, function (
|
|
16505
|
-
switch (
|
|
17124
|
+
return __generator$1(this, function (_b) {
|
|
17125
|
+
switch (_b.label) {
|
|
16506
17126
|
case 0:
|
|
17127
|
+
this.performanceClient.addQueueMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
16507
17128
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
16508
|
-
astsAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17129
|
+
this.astsAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17130
|
+
(_a = this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({
|
|
17131
|
+
visibilityChangeCount: 0
|
|
17132
|
+
});
|
|
17133
|
+
document.addEventListener("visibilitychange", this.trackPageVisibility);
|
|
16509
17134
|
if (!(NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) && account.nativeAccountId)) return [3 /*break*/, 1];
|
|
16510
17135
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
|
|
16511
17136
|
silentRequest = __assign$1(__assign$1({}, request), { account: account });
|
|
@@ -16515,7 +17140,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16515
17140
|
// If native token acquisition fails for availability reasons fallback to web flow
|
|
16516
17141
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
16517
17142
|
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
16518
|
-
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
17143
|
+
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
|
|
16519
17144
|
silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
16520
17145
|
return [2 /*return*/, silentIframeClient.acquireToken(request)];
|
|
16521
17146
|
}
|
|
@@ -16526,12 +17151,14 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16526
17151
|
case 1:
|
|
16527
17152
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
16528
17153
|
silentCacheClient = this.createSilentCacheClient(request.correlationId);
|
|
17154
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
16529
17155
|
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
16530
17156
|
case 2:
|
|
16531
|
-
silentRequest_1 =
|
|
17157
|
+
silentRequest_1 = _b.sent();
|
|
16532
17158
|
requestWithCLP_1 = __assign$1(__assign$1({}, request), {
|
|
16533
17159
|
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
|
|
16534
17160
|
cacheLookupPolicy: request.cacheLookupPolicy || exports.CacheLookupPolicy.Default });
|
|
17161
|
+
this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenFromCache, silentRequest_1.correlationId);
|
|
16535
17162
|
result = this.acquireTokenFromCache(silentCacheClient, silentRequest_1, requestWithCLP_1).catch(function (cacheError) {
|
|
16536
17163
|
if (requestWithCLP_1.cacheLookupPolicy === exports.CacheLookupPolicy.AccessToken) {
|
|
16537
17164
|
throw cacheError;
|
|
@@ -16539,6 +17166,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16539
17166
|
// block the reload if it occurred inside a hidden iframe
|
|
16540
17167
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
16541
17168
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest_1);
|
|
17169
|
+
_this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenByRefreshToken, silentRequest_1.correlationId);
|
|
16542
17170
|
return _this.acquireTokenByRefreshToken(silentRequest_1, requestWithCLP_1).catch(function (refreshTokenError) {
|
|
16543
17171
|
var isServerError = refreshTokenError instanceof ServerError;
|
|
16544
17172
|
var isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;
|
|
@@ -16552,13 +17180,15 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16552
17180
|
throw refreshTokenError;
|
|
16553
17181
|
}
|
|
16554
17182
|
_this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
|
|
17183
|
+
_this.performanceClient.setPreQueueTime(exports.PerformanceEvents.AcquireTokenBySilentIframe, silentRequest_1.correlationId);
|
|
16555
17184
|
return _this.acquireTokenBySilentIframe(silentRequest_1);
|
|
16556
17185
|
});
|
|
16557
17186
|
});
|
|
16558
|
-
|
|
17187
|
+
_b.label = 3;
|
|
16559
17188
|
case 3: return [2 /*return*/, result.then(function (response) {
|
|
17189
|
+
var _a;
|
|
16560
17190
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
16561
|
-
astsAsyncMeasurement.endMeasurement({
|
|
17191
|
+
(_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16562
17192
|
success: true,
|
|
16563
17193
|
fromCache: response.fromCache,
|
|
16564
17194
|
isNativeBroker: response.fromNativeBroker,
|
|
@@ -16566,13 +17196,16 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16566
17196
|
});
|
|
16567
17197
|
return response;
|
|
16568
17198
|
}).catch(function (tokenRenewalError) {
|
|
17199
|
+
var _a;
|
|
16569
17200
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
16570
|
-
astsAsyncMeasurement.endMeasurement({
|
|
17201
|
+
(_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16571
17202
|
errorCode: tokenRenewalError.errorCode,
|
|
16572
17203
|
subErrorCode: tokenRenewalError.subError,
|
|
16573
17204
|
success: false
|
|
16574
17205
|
});
|
|
16575
17206
|
throw tokenRenewalError;
|
|
17207
|
+
}).finally(function () {
|
|
17208
|
+
document.removeEventListener("visibilitychange", _this.trackPageVisibility);
|
|
16576
17209
|
})];
|
|
16577
17210
|
}
|
|
16578
17211
|
});
|