@azure/msal-browser 2.22.1 → 2.23.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 +24 -1
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +137 -36
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.d.ts +3 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +7 -1
- package/dist/app/IPublicClientApplication.js.map +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +51 -15
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +3 -2
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +17 -6
- package/dist/cache/AsyncMemoryStorage.js.map +1 -1
- package/dist/cache/BrowserCacheManager.js +7 -7
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/DatabaseStorage.d.ts +5 -0
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.js +65 -13
- package/dist/cache/DatabaseStorage.js.map +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.d.ts +14 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +16 -9
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +7 -6
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +12 -3
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +71 -36
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts +3 -2
- package/dist/crypto/GuidGenerator.d.ts.map +1 -1
- package/dist/crypto/GuidGenerator.js +4 -3
- package/dist/crypto/GuidGenerator.js.map +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.js +3 -2
- package/dist/encode/Base64Decode.js.map +1 -1
- package/dist/encode/Base64Encode.d.ts.map +1 -1
- package/dist/encode/Base64Encode.js +5 -4
- package/dist/encode/Base64Encode.js.map +1 -1
- package/dist/error/BrowserAuthError.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.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 +1071 -258
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +3 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +4 -3
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +3 -3
- 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 +4 -4
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +2 -2
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +5 -5
- 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 +11 -3
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +2 -2
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +21 -7
- 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 +16 -4
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +2 -2
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +30 -16
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/PopupHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.js +3 -2
- package/dist/network/FetchClient.js.map +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/telemetry/BrowserPerformanceClient.d.ts +19 -0
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.js +52 -0
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +13 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.js +66 -0
- package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -0
- package/dist/utils/BrowserConstants.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
- package/dist/utils/BrowserStringUtils.js +4 -2
- package/dist/utils/BrowserStringUtils.js.map +1 -1
- package/dist/utils/BrowserUtils.js +2 -2
- package/dist/utils/BrowserUtils.js.map +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/dist/utils/PopupUtils.js +1 -1
- package/lib/msal-browser.js +1071 -258
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +41 -36
- 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.23.0 2022-04-04 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -105,7 +105,7 @@ function __spread() {
|
|
|
105
105
|
return ar;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
/*! @azure/msal-common v6.
|
|
108
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
109
109
|
/*! *****************************************************************************
|
|
110
110
|
Copyright (c) Microsoft Corporation.
|
|
111
111
|
|
|
@@ -192,7 +192,7 @@ function __spreadArrays() {
|
|
|
192
192
|
return r;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
/*! @azure/msal-common v6.
|
|
195
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
196
196
|
|
|
197
197
|
/*
|
|
198
198
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -317,6 +317,8 @@ var AADServerParamKeys;
|
|
|
317
317
|
AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
|
|
318
318
|
AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
|
|
319
319
|
AADServerParamKeys["X_MS_LIB_CAPABILITY"] = "x-ms-lib-capability";
|
|
320
|
+
AADServerParamKeys["X_APP_NAME"] = "x-app-name";
|
|
321
|
+
AADServerParamKeys["X_APP_VER"] = "x-app-ver";
|
|
320
322
|
AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
|
|
321
323
|
AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
|
|
322
324
|
AADServerParamKeys["DEVICE_CODE"] = "device_code";
|
|
@@ -556,7 +558,7 @@ var CacheOutcome;
|
|
|
556
558
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
557
559
|
})(CacheOutcome || (CacheOutcome = {}));
|
|
558
560
|
|
|
559
|
-
/*! @azure/msal-common v6.
|
|
561
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
560
562
|
|
|
561
563
|
/*
|
|
562
564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -582,8 +584,8 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
582
584
|
_this = _super.call(this, errorString) || this;
|
|
583
585
|
Object.setPrototypeOf(_this, AuthError.prototype);
|
|
584
586
|
_this.errorCode = errorCode || Constants.EMPTY_STRING;
|
|
585
|
-
_this.errorMessage = errorMessage ||
|
|
586
|
-
_this.subError = suberror ||
|
|
587
|
+
_this.errorMessage = errorMessage || Constants.EMPTY_STRING;
|
|
588
|
+
_this.subError = suberror || Constants.EMPTY_STRING;
|
|
587
589
|
_this.name = "AuthError";
|
|
588
590
|
return _this;
|
|
589
591
|
}
|
|
@@ -600,7 +602,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
600
602
|
return AuthError;
|
|
601
603
|
}(Error));
|
|
602
604
|
|
|
603
|
-
/*! @azure/msal-common v6.
|
|
605
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
604
606
|
|
|
605
607
|
/*
|
|
606
608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -675,7 +677,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
675
677
|
}
|
|
676
678
|
};
|
|
677
679
|
|
|
678
|
-
/*! @azure/msal-common v6.
|
|
680
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
679
681
|
|
|
680
682
|
/*
|
|
681
683
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1137,7 +1139,7 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1137
1139
|
return ClientAuthError;
|
|
1138
1140
|
}(AuthError));
|
|
1139
1141
|
|
|
1140
|
-
/*! @azure/msal-common v6.
|
|
1142
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1141
1143
|
|
|
1142
1144
|
/*
|
|
1143
1145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1262,7 +1264,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1262
1264
|
return StringUtils;
|
|
1263
1265
|
}());
|
|
1264
1266
|
|
|
1265
|
-
/*! @azure/msal-common v6.
|
|
1267
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1266
1268
|
|
|
1267
1269
|
/*
|
|
1268
1270
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1292,7 +1294,7 @@ var Logger = /** @class */ (function () {
|
|
|
1292
1294
|
this.localCallback = loggerOptions.loggerCallback || defaultLoggerCallback;
|
|
1293
1295
|
this.piiLoggingEnabled = loggerOptions.piiLoggingEnabled || false;
|
|
1294
1296
|
this.level = typeof (loggerOptions.logLevel) === "number" ? loggerOptions.logLevel : exports.LogLevel.Info;
|
|
1295
|
-
this.correlationId = loggerOptions.correlationId ||
|
|
1297
|
+
this.correlationId = loggerOptions.correlationId || Constants.EMPTY_STRING;
|
|
1296
1298
|
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
1297
1299
|
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
1298
1300
|
}
|
|
@@ -1322,7 +1324,7 @@ var Logger = /** @class */ (function () {
|
|
|
1322
1324
|
logHeader = "[" + timestamp + "]";
|
|
1323
1325
|
}
|
|
1324
1326
|
var log = logHeader + " : " + this.packageName + "@" + this.packageVersion + " : " + exports.LogLevel[options.logLevel] + " - " + logMessage;
|
|
1325
|
-
// debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? "-Pii":
|
|
1327
|
+
// debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? "-Pii": Constants.EMPTY_STRING}${options.context ? `:${options.context}` : Constants.EMPTY_STRING}`)(logMessage);
|
|
1326
1328
|
this.executeCallback(options.logLevel, log, options.containsPii || false);
|
|
1327
1329
|
};
|
|
1328
1330
|
/**
|
|
@@ -1340,7 +1342,7 @@ var Logger = /** @class */ (function () {
|
|
|
1340
1342
|
this.logMessage(message, {
|
|
1341
1343
|
logLevel: exports.LogLevel.Error,
|
|
1342
1344
|
containsPii: false,
|
|
1343
|
-
correlationId: correlationId ||
|
|
1345
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1344
1346
|
});
|
|
1345
1347
|
};
|
|
1346
1348
|
/**
|
|
@@ -1350,7 +1352,7 @@ var Logger = /** @class */ (function () {
|
|
|
1350
1352
|
this.logMessage(message, {
|
|
1351
1353
|
logLevel: exports.LogLevel.Error,
|
|
1352
1354
|
containsPii: true,
|
|
1353
|
-
correlationId: correlationId ||
|
|
1355
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1354
1356
|
});
|
|
1355
1357
|
};
|
|
1356
1358
|
/**
|
|
@@ -1360,7 +1362,7 @@ var Logger = /** @class */ (function () {
|
|
|
1360
1362
|
this.logMessage(message, {
|
|
1361
1363
|
logLevel: exports.LogLevel.Warning,
|
|
1362
1364
|
containsPii: false,
|
|
1363
|
-
correlationId: correlationId ||
|
|
1365
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1364
1366
|
});
|
|
1365
1367
|
};
|
|
1366
1368
|
/**
|
|
@@ -1370,7 +1372,7 @@ var Logger = /** @class */ (function () {
|
|
|
1370
1372
|
this.logMessage(message, {
|
|
1371
1373
|
logLevel: exports.LogLevel.Warning,
|
|
1372
1374
|
containsPii: true,
|
|
1373
|
-
correlationId: correlationId ||
|
|
1375
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1374
1376
|
});
|
|
1375
1377
|
};
|
|
1376
1378
|
/**
|
|
@@ -1380,7 +1382,7 @@ var Logger = /** @class */ (function () {
|
|
|
1380
1382
|
this.logMessage(message, {
|
|
1381
1383
|
logLevel: exports.LogLevel.Info,
|
|
1382
1384
|
containsPii: false,
|
|
1383
|
-
correlationId: correlationId ||
|
|
1385
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1384
1386
|
});
|
|
1385
1387
|
};
|
|
1386
1388
|
/**
|
|
@@ -1390,7 +1392,7 @@ var Logger = /** @class */ (function () {
|
|
|
1390
1392
|
this.logMessage(message, {
|
|
1391
1393
|
logLevel: exports.LogLevel.Info,
|
|
1392
1394
|
containsPii: true,
|
|
1393
|
-
correlationId: correlationId ||
|
|
1395
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1394
1396
|
});
|
|
1395
1397
|
};
|
|
1396
1398
|
/**
|
|
@@ -1400,7 +1402,7 @@ var Logger = /** @class */ (function () {
|
|
|
1400
1402
|
this.logMessage(message, {
|
|
1401
1403
|
logLevel: exports.LogLevel.Verbose,
|
|
1402
1404
|
containsPii: false,
|
|
1403
|
-
correlationId: correlationId ||
|
|
1405
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1404
1406
|
});
|
|
1405
1407
|
};
|
|
1406
1408
|
/**
|
|
@@ -1410,7 +1412,7 @@ var Logger = /** @class */ (function () {
|
|
|
1410
1412
|
this.logMessage(message, {
|
|
1411
1413
|
logLevel: exports.LogLevel.Verbose,
|
|
1412
1414
|
containsPii: true,
|
|
1413
|
-
correlationId: correlationId ||
|
|
1415
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1414
1416
|
});
|
|
1415
1417
|
};
|
|
1416
1418
|
/**
|
|
@@ -1420,7 +1422,7 @@ var Logger = /** @class */ (function () {
|
|
|
1420
1422
|
this.logMessage(message, {
|
|
1421
1423
|
logLevel: exports.LogLevel.Trace,
|
|
1422
1424
|
containsPii: false,
|
|
1423
|
-
correlationId: correlationId ||
|
|
1425
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1424
1426
|
});
|
|
1425
1427
|
};
|
|
1426
1428
|
/**
|
|
@@ -1430,7 +1432,7 @@ var Logger = /** @class */ (function () {
|
|
|
1430
1432
|
this.logMessage(message, {
|
|
1431
1433
|
logLevel: exports.LogLevel.Trace,
|
|
1432
1434
|
containsPii: true,
|
|
1433
|
-
correlationId: correlationId ||
|
|
1435
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1434
1436
|
});
|
|
1435
1437
|
};
|
|
1436
1438
|
/**
|
|
@@ -1442,12 +1444,12 @@ var Logger = /** @class */ (function () {
|
|
|
1442
1444
|
return Logger;
|
|
1443
1445
|
}());
|
|
1444
1446
|
|
|
1445
|
-
/*! @azure/msal-common v6.
|
|
1447
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1446
1448
|
/* eslint-disable header/header */
|
|
1447
1449
|
var name$1 = "@azure/msal-common";
|
|
1448
|
-
var version$1 = "6.
|
|
1450
|
+
var version$1 = "6.2.0";
|
|
1449
1451
|
|
|
1450
|
-
/*! @azure/msal-common v6.
|
|
1452
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1451
1453
|
/*
|
|
1452
1454
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1453
1455
|
* Licensed under the MIT License.
|
|
@@ -1458,6 +1460,8 @@ exports.AzureCloudInstance = void 0;
|
|
|
1458
1460
|
AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
|
|
1459
1461
|
// Microsoft Azure public cloud
|
|
1460
1462
|
AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
|
|
1463
|
+
// Microsoft PPE
|
|
1464
|
+
AzureCloudInstance["AzurePpe"] = "https://login.windows-ppe.net";
|
|
1461
1465
|
// Microsoft Chinese national cloud
|
|
1462
1466
|
AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
|
|
1463
1467
|
// Microsoft German national cloud ("Black Forest")
|
|
@@ -1466,7 +1470,7 @@ exports.AzureCloudInstance = void 0;
|
|
|
1466
1470
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1467
1471
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1468
1472
|
|
|
1469
|
-
/*! @azure/msal-common v6.
|
|
1473
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1470
1474
|
|
|
1471
1475
|
/*
|
|
1472
1476
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1596,7 +1600,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1596
1600
|
var credentialId = [
|
|
1597
1601
|
credentialType,
|
|
1598
1602
|
clientOrFamilyId,
|
|
1599
|
-
realm ||
|
|
1603
|
+
realm || Constants.EMPTY_STRING,
|
|
1600
1604
|
];
|
|
1601
1605
|
return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1602
1606
|
};
|
|
@@ -1604,13 +1608,13 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1604
1608
|
* Generate target key component as per schema: <target>
|
|
1605
1609
|
*/
|
|
1606
1610
|
CredentialEntity.generateTargetForCacheKey = function (scopes) {
|
|
1607
|
-
return (scopes ||
|
|
1611
|
+
return (scopes || Constants.EMPTY_STRING).toLowerCase();
|
|
1608
1612
|
};
|
|
1609
1613
|
/**
|
|
1610
1614
|
* Generate requested claims key component as per schema: <requestedClaims>
|
|
1611
1615
|
*/
|
|
1612
1616
|
CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
|
|
1613
|
-
return (requestedClaimsHash ||
|
|
1617
|
+
return (requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();
|
|
1614
1618
|
};
|
|
1615
1619
|
/**
|
|
1616
1620
|
* Generate scheme key componenet as per schema: <scheme>
|
|
@@ -1620,12 +1624,12 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1620
1624
|
* PoP Tokens and SSH certs include scheme in cache key
|
|
1621
1625
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
1622
1626
|
*/
|
|
1623
|
-
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() :
|
|
1627
|
+
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
1624
1628
|
};
|
|
1625
1629
|
return CredentialEntity;
|
|
1626
1630
|
}());
|
|
1627
1631
|
|
|
1628
|
-
/*! @azure/msal-common v6.
|
|
1632
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1629
1633
|
|
|
1630
1634
|
/*
|
|
1631
1635
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1880,7 +1884,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1880
1884
|
return ClientConfigurationError;
|
|
1881
1885
|
}(ClientAuthError));
|
|
1882
1886
|
|
|
1883
|
-
/*! @azure/msal-common v6.
|
|
1887
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1884
1888
|
|
|
1885
1889
|
/*
|
|
1886
1890
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1909,7 +1913,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
1909
1913
|
* @param scopesRequired
|
|
1910
1914
|
*/
|
|
1911
1915
|
ScopeSet.fromString = function (inputScopeString) {
|
|
1912
|
-
var scopeString = inputScopeString ||
|
|
1916
|
+
var scopeString = inputScopeString || Constants.EMPTY_STRING;
|
|
1913
1917
|
var inputScopes = scopeString.split(" ");
|
|
1914
1918
|
return new ScopeSet(inputScopes);
|
|
1915
1919
|
};
|
|
@@ -2053,7 +2057,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2053
2057
|
var scopeArr = this.asArray();
|
|
2054
2058
|
return scopeArr.join(" ");
|
|
2055
2059
|
}
|
|
2056
|
-
return
|
|
2060
|
+
return Constants.EMPTY_STRING;
|
|
2057
2061
|
};
|
|
2058
2062
|
/**
|
|
2059
2063
|
* Prints scopes into a space-delimited lower-case string (used for caching)
|
|
@@ -2064,7 +2068,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2064
2068
|
return ScopeSet;
|
|
2065
2069
|
}());
|
|
2066
2070
|
|
|
2067
|
-
/*! @azure/msal-common v6.
|
|
2071
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2068
2072
|
|
|
2069
2073
|
/*
|
|
2070
2074
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2102,7 +2106,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2102
2106
|
};
|
|
2103
2107
|
}
|
|
2104
2108
|
|
|
2105
|
-
/*! @azure/msal-common v6.
|
|
2109
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2106
2110
|
/*
|
|
2107
2111
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2108
2112
|
* Licensed under the MIT License.
|
|
@@ -2116,7 +2120,7 @@ var AuthorityType;
|
|
|
2116
2120
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2117
2121
|
})(AuthorityType || (AuthorityType = {}));
|
|
2118
2122
|
|
|
2119
|
-
/*! @azure/msal-common v6.
|
|
2123
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2120
2124
|
|
|
2121
2125
|
/*
|
|
2122
2126
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2206,8 +2210,8 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2206
2210
|
AccountEntity.generateAccountCacheKey = function (accountInterface) {
|
|
2207
2211
|
var accountKey = [
|
|
2208
2212
|
accountInterface.homeAccountId,
|
|
2209
|
-
accountInterface.environment ||
|
|
2210
|
-
accountInterface.tenantId ||
|
|
2213
|
+
accountInterface.environment || Constants.EMPTY_STRING,
|
|
2214
|
+
accountInterface.tenantId || Constants.EMPTY_STRING,
|
|
2211
2215
|
];
|
|
2212
2216
|
return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
2213
2217
|
};
|
|
@@ -2230,17 +2234,17 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2230
2234
|
}
|
|
2231
2235
|
account.environment = env;
|
|
2232
2236
|
// non AAD scenarios can have empty realm
|
|
2233
|
-
account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) ||
|
|
2237
|
+
account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || Constants.EMPTY_STRING;
|
|
2234
2238
|
account.oboAssertion = oboAssertion;
|
|
2235
2239
|
if (idToken) {
|
|
2236
2240
|
account.idTokenClaims = idToken.claims;
|
|
2237
2241
|
// How do you account for MSA CID here?
|
|
2238
|
-
account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) ||
|
|
2242
|
+
account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) || Constants.EMPTY_STRING;
|
|
2239
2243
|
/*
|
|
2240
2244
|
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array. In most cases it will contain a single email.
|
|
2241
2245
|
* This field should not be relied upon if a custom policy is configured to return more than 1 email.
|
|
2242
2246
|
*/
|
|
2243
|
-
account.username = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username) || (((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] :
|
|
2247
|
+
account.username = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username) || (((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] : Constants.EMPTY_STRING);
|
|
2244
2248
|
account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;
|
|
2245
2249
|
}
|
|
2246
2250
|
account.cloudGraphHostName = cloudGraphHostName;
|
|
@@ -2258,7 +2262,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2258
2262
|
account.authorityType = (authority && authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
2259
2263
|
account.homeAccountId = homeAccountId;
|
|
2260
2264
|
// non AAD scenarios can have empty realm
|
|
2261
|
-
account.realm =
|
|
2265
|
+
account.realm = Constants.EMPTY_STRING;
|
|
2262
2266
|
account.oboAssertion = oboAssertion;
|
|
2263
2267
|
var env = environment || authority && authority.getPreferredCache();
|
|
2264
2268
|
if (!env) {
|
|
@@ -2266,10 +2270,10 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2266
2270
|
}
|
|
2267
2271
|
if (idToken) {
|
|
2268
2272
|
// How do you account for MSA CID here?
|
|
2269
|
-
account.localAccountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.oid) || ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.sub) ||
|
|
2273
|
+
account.localAccountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.oid) || ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.sub) || Constants.EMPTY_STRING;
|
|
2270
2274
|
// upn claim for most ADFS scenarios
|
|
2271
|
-
account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) ||
|
|
2272
|
-
account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) ||
|
|
2275
|
+
account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) || Constants.EMPTY_STRING;
|
|
2276
|
+
account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) || Constants.EMPTY_STRING;
|
|
2273
2277
|
account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;
|
|
2274
2278
|
}
|
|
2275
2279
|
account.environment = env;
|
|
@@ -2350,7 +2354,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2350
2354
|
return AccountEntity;
|
|
2351
2355
|
}());
|
|
2352
2356
|
|
|
2353
|
-
/*! @azure/msal-common v6.
|
|
2357
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2354
2358
|
|
|
2355
2359
|
/*
|
|
2356
2360
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2388,7 +2392,7 @@ var AuthToken = /** @class */ (function () {
|
|
|
2388
2392
|
return AuthToken;
|
|
2389
2393
|
}());
|
|
2390
2394
|
|
|
2391
|
-
/*! @azure/msal-common v6.
|
|
2395
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2392
2396
|
|
|
2393
2397
|
/*
|
|
2394
2398
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2510,7 +2514,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2510
2514
|
* @param realm
|
|
2511
2515
|
*/
|
|
2512
2516
|
CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {
|
|
2513
|
-
return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId :
|
|
2517
|
+
return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING, accountFilter ? accountFilter.environment : Constants.EMPTY_STRING, accountFilter ? accountFilter.realm : Constants.EMPTY_STRING);
|
|
2514
2518
|
};
|
|
2515
2519
|
/**
|
|
2516
2520
|
* retrieve accounts matching all provided filters; if no filter is set, get all accounts
|
|
@@ -3230,7 +3234,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3230
3234
|
return DefaultStorageClass;
|
|
3231
3235
|
}(CacheManager));
|
|
3232
3236
|
|
|
3233
|
-
/*! @azure/msal-common v6.
|
|
3237
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3234
3238
|
|
|
3235
3239
|
/*
|
|
3236
3240
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3241,7 +3245,7 @@ var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
|
3241
3245
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3242
3246
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3243
3247
|
preventCorsPreflight: false,
|
|
3244
|
-
proxyUrl:
|
|
3248
|
+
proxyUrl: Constants.EMPTY_STRING
|
|
3245
3249
|
};
|
|
3246
3250
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3247
3251
|
loggerCallback: function () {
|
|
@@ -3249,7 +3253,7 @@ var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
|
3249
3253
|
},
|
|
3250
3254
|
piiLoggingEnabled: false,
|
|
3251
3255
|
logLevel: exports.LogLevel.Info,
|
|
3252
|
-
correlationId:
|
|
3256
|
+
correlationId: Constants.EMPTY_STRING
|
|
3253
3257
|
};
|
|
3254
3258
|
var DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
3255
3259
|
sendGetRequestAsync: function () {
|
|
@@ -3274,17 +3278,23 @@ var DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
|
3274
3278
|
var DEFAULT_LIBRARY_INFO = {
|
|
3275
3279
|
sku: Constants.SKU,
|
|
3276
3280
|
version: version$1,
|
|
3277
|
-
cpu:
|
|
3278
|
-
os:
|
|
3281
|
+
cpu: Constants.EMPTY_STRING,
|
|
3282
|
+
os: Constants.EMPTY_STRING
|
|
3279
3283
|
};
|
|
3280
3284
|
var DEFAULT_CLIENT_CREDENTIALS = {
|
|
3281
|
-
clientSecret:
|
|
3285
|
+
clientSecret: Constants.EMPTY_STRING,
|
|
3282
3286
|
clientAssertion: undefined
|
|
3283
3287
|
};
|
|
3284
3288
|
var DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3285
3289
|
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
3286
3290
|
tenant: "" + Constants.DEFAULT_COMMON_TENANT
|
|
3287
3291
|
};
|
|
3292
|
+
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
3293
|
+
application: {
|
|
3294
|
+
appName: "",
|
|
3295
|
+
appVersion: ""
|
|
3296
|
+
}
|
|
3297
|
+
};
|
|
3288
3298
|
/**
|
|
3289
3299
|
* Function that sets the default options when not explicitly configured from app developer
|
|
3290
3300
|
*
|
|
@@ -3293,7 +3303,7 @@ var DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
|
3293
3303
|
* @returns Configuration
|
|
3294
3304
|
*/
|
|
3295
3305
|
function buildClientConfiguration(_a) {
|
|
3296
|
-
var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;
|
|
3306
|
+
var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, telemetry = _a.telemetry, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;
|
|
3297
3307
|
var loggerOptions = __assign(__assign({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption);
|
|
3298
3308
|
return {
|
|
3299
3309
|
authOptions: buildAuthOptions(userAuthOptions),
|
|
@@ -3304,6 +3314,7 @@ function buildClientConfiguration(_a) {
|
|
|
3304
3314
|
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
3305
3315
|
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
3306
3316
|
libraryInfo: __assign(__assign({}, DEFAULT_LIBRARY_INFO), libraryInfo),
|
|
3317
|
+
telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), telemetry),
|
|
3307
3318
|
serverTelemetryManager: serverTelemetryManager || null,
|
|
3308
3319
|
persistencePlugin: persistencePlugin || null,
|
|
3309
3320
|
serializableCache: serializableCache || null
|
|
@@ -3317,7 +3328,7 @@ function buildAuthOptions(authOptions) {
|
|
|
3317
3328
|
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
|
|
3318
3329
|
}
|
|
3319
3330
|
|
|
3320
|
-
/*! @azure/msal-common v6.
|
|
3331
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3321
3332
|
|
|
3322
3333
|
/*
|
|
3323
3334
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3337,7 +3348,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3337
3348
|
return ServerError;
|
|
3338
3349
|
}(AuthError));
|
|
3339
3350
|
|
|
3340
|
-
/*! @azure/msal-common v6.
|
|
3351
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3341
3352
|
|
|
3342
3353
|
/*
|
|
3343
3354
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3433,7 +3444,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3433
3444
|
return ThrottlingUtils;
|
|
3434
3445
|
}());
|
|
3435
3446
|
|
|
3436
|
-
/*! @azure/msal-common v6.
|
|
3447
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3437
3448
|
|
|
3438
3449
|
/*
|
|
3439
3450
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3482,7 +3493,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3482
3493
|
return NetworkManager;
|
|
3483
3494
|
}());
|
|
3484
3495
|
|
|
3485
|
-
/*! @azure/msal-common v6.
|
|
3496
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3486
3497
|
/*
|
|
3487
3498
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3488
3499
|
* Licensed under the MIT License.
|
|
@@ -3493,7 +3504,7 @@ var CcsCredentialType;
|
|
|
3493
3504
|
CcsCredentialType["UPN"] = "UPN";
|
|
3494
3505
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3495
3506
|
|
|
3496
|
-
/*! @azure/msal-common v6.
|
|
3507
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3497
3508
|
|
|
3498
3509
|
/*
|
|
3499
3510
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3582,7 +3593,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3582
3593
|
return BaseClient;
|
|
3583
3594
|
}());
|
|
3584
3595
|
|
|
3585
|
-
/*! @azure/msal-common v6.
|
|
3596
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3586
3597
|
|
|
3587
3598
|
/*
|
|
3588
3599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3668,7 +3679,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3668
3679
|
return RequestValidator;
|
|
3669
3680
|
}());
|
|
3670
3681
|
|
|
3671
|
-
/*! @azure/msal-common v6.
|
|
3682
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3672
3683
|
|
|
3673
3684
|
/*
|
|
3674
3685
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3791,8 +3802,24 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3791
3802
|
// Telemetry Info
|
|
3792
3803
|
this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
|
|
3793
3804
|
this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
|
|
3794
|
-
|
|
3795
|
-
|
|
3805
|
+
if (libraryInfo.os) {
|
|
3806
|
+
this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);
|
|
3807
|
+
}
|
|
3808
|
+
if (libraryInfo.cpu) {
|
|
3809
|
+
this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);
|
|
3810
|
+
}
|
|
3811
|
+
};
|
|
3812
|
+
/**
|
|
3813
|
+
* Add client telemetry parameters
|
|
3814
|
+
* @param appTelemetry
|
|
3815
|
+
*/
|
|
3816
|
+
RequestParameterBuilder.prototype.addApplicationTelemetry = function (appTelemetry) {
|
|
3817
|
+
if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appName) {
|
|
3818
|
+
this.parameters.set(AADServerParamKeys.X_APP_NAME, appTelemetry.appName);
|
|
3819
|
+
}
|
|
3820
|
+
if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appVersion) {
|
|
3821
|
+
this.parameters.set(AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);
|
|
3822
|
+
}
|
|
3796
3823
|
};
|
|
3797
3824
|
/**
|
|
3798
3825
|
* add prompt
|
|
@@ -4014,7 +4041,7 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4014
4041
|
return RequestParameterBuilder;
|
|
4015
4042
|
}());
|
|
4016
4043
|
|
|
4017
|
-
/*! @azure/msal-common v6.
|
|
4044
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4018
4045
|
|
|
4019
4046
|
/*
|
|
4020
4047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4079,7 +4106,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4079
4106
|
return IdTokenEntity;
|
|
4080
4107
|
}(CredentialEntity));
|
|
4081
4108
|
|
|
4082
|
-
/*! @azure/msal-common v6.
|
|
4109
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4083
4110
|
/*
|
|
4084
4111
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4085
4112
|
* Licensed under the MIT License.
|
|
@@ -4129,7 +4156,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4129
4156
|
return TimeUtils;
|
|
4130
4157
|
}());
|
|
4131
4158
|
|
|
4132
|
-
/*! @azure/msal-common v6.
|
|
4159
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4133
4160
|
|
|
4134
4161
|
/*
|
|
4135
4162
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4243,7 +4270,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4243
4270
|
return AccessTokenEntity;
|
|
4244
4271
|
}(CredentialEntity));
|
|
4245
4272
|
|
|
4246
|
-
/*! @azure/msal-common v6.
|
|
4273
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4247
4274
|
|
|
4248
4275
|
/*
|
|
4249
4276
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4310,7 +4337,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4310
4337
|
return RefreshTokenEntity;
|
|
4311
4338
|
}(CredentialEntity));
|
|
4312
4339
|
|
|
4313
|
-
/*! @azure/msal-common v6.
|
|
4340
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4314
4341
|
|
|
4315
4342
|
/*
|
|
4316
4343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4374,7 +4401,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4374
4401
|
return InteractionRequiredAuthError;
|
|
4375
4402
|
}(AuthError));
|
|
4376
4403
|
|
|
4377
|
-
/*! @azure/msal-common v6.
|
|
4404
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4378
4405
|
/*
|
|
4379
4406
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4380
4407
|
* Licensed under the MIT License.
|
|
@@ -4390,7 +4417,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4390
4417
|
return CacheRecord;
|
|
4391
4418
|
}());
|
|
4392
4419
|
|
|
4393
|
-
/*! @azure/msal-common v6.
|
|
4420
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4394
4421
|
|
|
4395
4422
|
/*
|
|
4396
4423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4446,11 +4473,11 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4446
4473
|
// Split the state between library state and user passed state and decode them separately
|
|
4447
4474
|
var splitState = state.split(Constants.RESOURCE_DELIM);
|
|
4448
4475
|
var libraryState = splitState[0];
|
|
4449
|
-
var userState = splitState.length > 1 ? splitState.slice(1).join(Constants.RESOURCE_DELIM) :
|
|
4476
|
+
var userState = splitState.length > 1 ? splitState.slice(1).join(Constants.RESOURCE_DELIM) : Constants.EMPTY_STRING;
|
|
4450
4477
|
var libraryStateString = cryptoObj.base64Decode(libraryState);
|
|
4451
4478
|
var libraryStateObj = JSON.parse(libraryStateString);
|
|
4452
4479
|
return {
|
|
4453
|
-
userRequestState: !StringUtils.isEmpty(userState) ? userState :
|
|
4480
|
+
userRequestState: !StringUtils.isEmpty(userState) ? userState : Constants.EMPTY_STRING,
|
|
4454
4481
|
libraryState: libraryStateObj
|
|
4455
4482
|
};
|
|
4456
4483
|
}
|
|
@@ -4461,7 +4488,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4461
4488
|
return ProtocolUtils;
|
|
4462
4489
|
}());
|
|
4463
4490
|
|
|
4464
|
-
/*! @azure/msal-common v6.
|
|
4491
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4465
4492
|
|
|
4466
4493
|
/*
|
|
4467
4494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4622,7 +4649,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4622
4649
|
else if (hashIndex1 > -1) {
|
|
4623
4650
|
return hashString.substring(hashIndex1 + 1);
|
|
4624
4651
|
}
|
|
4625
|
-
return
|
|
4652
|
+
return Constants.EMPTY_STRING;
|
|
4626
4653
|
};
|
|
4627
4654
|
UrlString.constructAuthorityUriFromObject = function (urlObject) {
|
|
4628
4655
|
return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
|
|
@@ -4662,7 +4689,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4662
4689
|
return UrlString;
|
|
4663
4690
|
}());
|
|
4664
4691
|
|
|
4665
|
-
/*! @azure/msal-common v6.
|
|
4692
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4666
4693
|
|
|
4667
4694
|
/*
|
|
4668
4695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4728,7 +4755,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4728
4755
|
resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims, shrNonce = request.shrNonce;
|
|
4729
4756
|
resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;
|
|
4730
4757
|
resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();
|
|
4731
|
-
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims), kid)];
|
|
4758
|
+
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims), kid, request.correlationId)];
|
|
4732
4759
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4733
4760
|
}
|
|
4734
4761
|
});
|
|
@@ -4737,7 +4764,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4737
4764
|
return PopTokenGenerator;
|
|
4738
4765
|
}());
|
|
4739
4766
|
|
|
4740
|
-
/*! @azure/msal-common v6.
|
|
4767
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4741
4768
|
|
|
4742
4769
|
/*
|
|
4743
4770
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4807,7 +4834,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4807
4834
|
return AppMetadataEntity;
|
|
4808
4835
|
}());
|
|
4809
4836
|
|
|
4810
|
-
/*! @azure/msal-common v6.
|
|
4837
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4811
4838
|
/*
|
|
4812
4839
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4813
4840
|
* Licensed under the MIT License.
|
|
@@ -4843,7 +4870,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4843
4870
|
return TokenCacheContext;
|
|
4844
4871
|
}());
|
|
4845
4872
|
|
|
4846
|
-
/*! @azure/msal-common v6.
|
|
4873
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4847
4874
|
|
|
4848
4875
|
/*
|
|
4849
4876
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5024,8 +5051,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5024
5051
|
*/
|
|
5025
5052
|
ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, oboAssertion, authCodePayload) {
|
|
5026
5053
|
var authorityType = authority.authorityType;
|
|
5027
|
-
var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name :
|
|
5028
|
-
var msGraphhost = authCodePayload ? authCodePayload.msgraph_host :
|
|
5054
|
+
var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;
|
|
5055
|
+
var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;
|
|
5029
5056
|
// ADFS does not require client_info in the response
|
|
5030
5057
|
if (authorityType === AuthorityType.Adfs) {
|
|
5031
5058
|
this.logger.verbose("Authority type is ADFS, creating ADFS account");
|
|
@@ -5056,7 +5083,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5056
5083
|
return __generator(this, function (_d) {
|
|
5057
5084
|
switch (_d.label) {
|
|
5058
5085
|
case 0:
|
|
5059
|
-
accessToken =
|
|
5086
|
+
accessToken = Constants.EMPTY_STRING;
|
|
5060
5087
|
responseScopes = [];
|
|
5061
5088
|
expiresOn = null;
|
|
5062
5089
|
familyId = Constants.EMPTY_STRING;
|
|
@@ -5108,7 +5135,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5108
5135
|
return ResponseHandler;
|
|
5109
5136
|
}());
|
|
5110
5137
|
|
|
5111
|
-
/*! @azure/msal-common v6.
|
|
5138
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5112
5139
|
|
|
5113
5140
|
/*
|
|
5114
5141
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5296,6 +5323,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5296
5323
|
parameterBuilder.addAuthorizationCode(request.code);
|
|
5297
5324
|
// Add library metadata
|
|
5298
5325
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5326
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5299
5327
|
parameterBuilder.addThrottling();
|
|
5300
5328
|
if (this.serverTelemetryManager) {
|
|
5301
5329
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
@@ -5404,6 +5432,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5404
5432
|
parameterBuilder.addResponseTypeCode();
|
|
5405
5433
|
// add library info parameters
|
|
5406
5434
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5435
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5407
5436
|
// add client_info=1
|
|
5408
5437
|
parameterBuilder.addClientInfo();
|
|
5409
5438
|
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
@@ -5519,7 +5548,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5519
5548
|
return AuthorizationCodeClient;
|
|
5520
5549
|
}(BaseClient));
|
|
5521
5550
|
|
|
5522
|
-
/*! @azure/msal-common v6.
|
|
5551
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5523
5552
|
|
|
5524
5553
|
/*
|
|
5525
5554
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5670,6 +5699,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5670
5699
|
parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);
|
|
5671
5700
|
parameterBuilder.addClientInfo();
|
|
5672
5701
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5702
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5673
5703
|
parameterBuilder.addThrottling();
|
|
5674
5704
|
if (this.serverTelemetryManager) {
|
|
5675
5705
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
@@ -5730,7 +5760,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5730
5760
|
return RefreshTokenClient;
|
|
5731
5761
|
}(BaseClient));
|
|
5732
5762
|
|
|
5733
|
-
/*! @azure/msal-common v6.
|
|
5763
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5734
5764
|
|
|
5735
5765
|
/*
|
|
5736
5766
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5846,7 +5876,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
5846
5876
|
return SilentFlowClient;
|
|
5847
5877
|
}(BaseClient));
|
|
5848
5878
|
|
|
5849
|
-
/*! @azure/msal-common v6.
|
|
5879
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5850
5880
|
/*
|
|
5851
5881
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5852
5882
|
* Licensed under the MIT License.
|
|
@@ -5857,7 +5887,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
5857
5887
|
response.hasOwnProperty("issuer"));
|
|
5858
5888
|
}
|
|
5859
5889
|
|
|
5860
|
-
/*! @azure/msal-common v6.
|
|
5890
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5861
5891
|
/*
|
|
5862
5892
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5863
5893
|
* Licensed under the MIT License.
|
|
@@ -5871,7 +5901,7 @@ exports.ProtocolMode = void 0;
|
|
|
5871
5901
|
ProtocolMode["OIDC"] = "OIDC";
|
|
5872
5902
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
5873
5903
|
|
|
5874
|
-
/*! @azure/msal-common v6.
|
|
5904
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5875
5905
|
|
|
5876
5906
|
/*
|
|
5877
5907
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5946,7 +5976,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
5946
5976
|
return AuthorityMetadataEntity;
|
|
5947
5977
|
}());
|
|
5948
5978
|
|
|
5949
|
-
/*! @azure/msal-common v6.
|
|
5979
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5950
5980
|
/*
|
|
5951
5981
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5952
5982
|
* Licensed under the MIT License.
|
|
@@ -5956,7 +5986,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
5956
5986
|
response.hasOwnProperty("metadata"));
|
|
5957
5987
|
}
|
|
5958
5988
|
|
|
5959
|
-
/*! @azure/msal-common v6.
|
|
5989
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5960
5990
|
|
|
5961
5991
|
/*
|
|
5962
5992
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6078,7 +6108,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6078
6108
|
return RegionDiscovery;
|
|
6079
6109
|
}());
|
|
6080
6110
|
|
|
6081
|
-
/*! @azure/msal-common v6.
|
|
6111
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6082
6112
|
|
|
6083
6113
|
/*
|
|
6084
6114
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6668,7 +6698,7 @@ var Authority = /** @class */ (function () {
|
|
|
6668
6698
|
return Authority;
|
|
6669
6699
|
}());
|
|
6670
6700
|
|
|
6671
|
-
/*! @azure/msal-common v6.
|
|
6701
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6672
6702
|
|
|
6673
6703
|
/*
|
|
6674
6704
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6729,7 +6759,7 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
6729
6759
|
return AuthorityFactory;
|
|
6730
6760
|
}());
|
|
6731
6761
|
|
|
6732
|
-
/*! @azure/msal-common v6.
|
|
6762
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6733
6763
|
|
|
6734
6764
|
/*
|
|
6735
6765
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6760,7 +6790,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
6760
6790
|
return ServerTelemetryEntity;
|
|
6761
6791
|
}());
|
|
6762
6792
|
|
|
6763
|
-
/*! @azure/msal-common v6.
|
|
6793
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6764
6794
|
|
|
6765
6795
|
/*
|
|
6766
6796
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6788,7 +6818,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
6788
6818
|
return ThrottlingEntity;
|
|
6789
6819
|
}());
|
|
6790
6820
|
|
|
6791
|
-
/*! @azure/msal-common v6.
|
|
6821
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6792
6822
|
|
|
6793
6823
|
/*
|
|
6794
6824
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6805,7 +6835,7 @@ var StubbedNetworkModule = {
|
|
|
6805
6835
|
}
|
|
6806
6836
|
};
|
|
6807
6837
|
|
|
6808
|
-
/*! @azure/msal-common v6.
|
|
6838
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6809
6839
|
|
|
6810
6840
|
/*
|
|
6811
6841
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6857,14 +6887,14 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
6857
6887
|
challenges.forEach(function (challenge) {
|
|
6858
6888
|
var _a = challenge.split("="), key = _a[0], value = _a[1];
|
|
6859
6889
|
// Remove escaped quotation marks (', ") from challenge string to keep only the challenge value
|
|
6860
|
-
challengeMap[key] = unescape(value.replace(/['"]+/g,
|
|
6890
|
+
challengeMap[key] = unescape(value.replace(/['"]+/g, Constants.EMPTY_STRING));
|
|
6861
6891
|
});
|
|
6862
6892
|
return challengeMap;
|
|
6863
6893
|
};
|
|
6864
6894
|
return AuthenticationHeaderParser;
|
|
6865
6895
|
}());
|
|
6866
6896
|
|
|
6867
|
-
/*! @azure/msal-common v6.
|
|
6897
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6868
6898
|
|
|
6869
6899
|
/*
|
|
6870
6900
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7001,9 +7031,9 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7001
7031
|
*/
|
|
7002
7032
|
ServerTelemetryManager.prototype.getRegionDiscoveryFields = function () {
|
|
7003
7033
|
var regionDiscoveryFields = [];
|
|
7004
|
-
regionDiscoveryFields.push(this.regionUsed ||
|
|
7005
|
-
regionDiscoveryFields.push(this.regionSource ||
|
|
7006
|
-
regionDiscoveryFields.push(this.regionOutcome ||
|
|
7034
|
+
regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);
|
|
7035
|
+
regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);
|
|
7036
|
+
regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);
|
|
7007
7037
|
return regionDiscoveryFields.join(",");
|
|
7008
7038
|
};
|
|
7009
7039
|
/**
|
|
@@ -7026,6 +7056,390 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7026
7056
|
return ServerTelemetryManager;
|
|
7027
7057
|
}());
|
|
7028
7058
|
|
|
7059
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
7060
|
+
/*
|
|
7061
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7062
|
+
* Licensed under the MIT License.
|
|
7063
|
+
*/
|
|
7064
|
+
/**
|
|
7065
|
+
* Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
|
|
7066
|
+
*
|
|
7067
|
+
* @export
|
|
7068
|
+
* @enum {number}
|
|
7069
|
+
*/
|
|
7070
|
+
exports.PerformanceEvents = void 0;
|
|
7071
|
+
(function (PerformanceEvents) {
|
|
7072
|
+
/**
|
|
7073
|
+
* acquireTokenByCode API (msal-browser and msal-node).
|
|
7074
|
+
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
7075
|
+
*/
|
|
7076
|
+
PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
|
|
7077
|
+
/**
|
|
7078
|
+
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
7079
|
+
* Used to renew an access token using a refresh token against the token endpoint.
|
|
7080
|
+
*/
|
|
7081
|
+
PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
|
|
7082
|
+
/**
|
|
7083
|
+
* acquireTokenSilent API (msal-browser and msal-node).
|
|
7084
|
+
* Used to silently acquire a new access token (from the cache or the network).
|
|
7085
|
+
*/
|
|
7086
|
+
PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
|
|
7087
|
+
/**
|
|
7088
|
+
* acquireTokenSilentAsync (msal-browser).
|
|
7089
|
+
* Internal API for acquireTokenSilent.
|
|
7090
|
+
*/
|
|
7091
|
+
PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
|
|
7092
|
+
/**
|
|
7093
|
+
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
7094
|
+
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
7095
|
+
*/
|
|
7096
|
+
PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
|
|
7097
|
+
/**
|
|
7098
|
+
* signJwt API in CryptoOpts class (msal-browser).
|
|
7099
|
+
* Used to signed a pop token.
|
|
7100
|
+
*/
|
|
7101
|
+
PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
|
|
7102
|
+
/**
|
|
7103
|
+
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
7104
|
+
* Used to read access tokens from the cache.
|
|
7105
|
+
*/
|
|
7106
|
+
PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
|
|
7107
|
+
/**
|
|
7108
|
+
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
7109
|
+
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
7110
|
+
*/
|
|
7111
|
+
PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
|
|
7112
|
+
/**
|
|
7113
|
+
* acquireToken API in SilentRereshClient (msal-browser).
|
|
7114
|
+
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
7115
|
+
*/
|
|
7116
|
+
PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
|
|
7117
|
+
/**
|
|
7118
|
+
* ssoSilent API (msal-browser).
|
|
7119
|
+
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
7120
|
+
*/
|
|
7121
|
+
PerformanceEvents["SsoSilent"] = "ssoSilent";
|
|
7122
|
+
/**
|
|
7123
|
+
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
7124
|
+
* Used to load authority metadata for a request.
|
|
7125
|
+
*/
|
|
7126
|
+
PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
|
|
7127
|
+
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
7128
|
+
/**
|
|
7129
|
+
* State of the performance event.
|
|
7130
|
+
*
|
|
7131
|
+
* @export
|
|
7132
|
+
* @enum {number}
|
|
7133
|
+
*/
|
|
7134
|
+
var PerformanceEventStatus;
|
|
7135
|
+
(function (PerformanceEventStatus) {
|
|
7136
|
+
PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
|
|
7137
|
+
PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
|
|
7138
|
+
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
7139
|
+
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
7140
|
+
|
|
7141
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
7142
|
+
|
|
7143
|
+
/*
|
|
7144
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7145
|
+
* Licensed under the MIT License.
|
|
7146
|
+
*/
|
|
7147
|
+
var PerformanceClient = /** @class */ (function () {
|
|
7148
|
+
/**
|
|
7149
|
+
* Creates an instance of PerformanceClient,
|
|
7150
|
+
* an abstract class containing core performance telemetry logic.
|
|
7151
|
+
*
|
|
7152
|
+
* @constructor
|
|
7153
|
+
* @param {string} clientId Client ID of the application
|
|
7154
|
+
* @param {string} authority Authority used by the application
|
|
7155
|
+
* @param {Logger} logger Logger used by the application
|
|
7156
|
+
* @param {string} libraryName Name of the library
|
|
7157
|
+
* @param {string} libraryVersion Version of the library
|
|
7158
|
+
*/
|
|
7159
|
+
function PerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
7160
|
+
this.authority = authority;
|
|
7161
|
+
this.libraryName = libraryName;
|
|
7162
|
+
this.libraryVersion = libraryVersion;
|
|
7163
|
+
this.applicationTelemetry = applicationTelemetry;
|
|
7164
|
+
this.clientId = clientId;
|
|
7165
|
+
this.logger = logger;
|
|
7166
|
+
this.callbacks = new Map();
|
|
7167
|
+
this.eventsByCorrelationId = new Map();
|
|
7168
|
+
this.measurementsById = new Map();
|
|
7169
|
+
}
|
|
7170
|
+
/**
|
|
7171
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
7172
|
+
*
|
|
7173
|
+
* @param {PerformanceEvents} measureName
|
|
7174
|
+
* @param {?string} [correlationId]
|
|
7175
|
+
* @returns {InProgressPerformanceEvent}
|
|
7176
|
+
*/
|
|
7177
|
+
PerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
7178
|
+
var _this = this;
|
|
7179
|
+
var _a, _b;
|
|
7180
|
+
// Generate a placeholder correlation if the request does not provide one
|
|
7181
|
+
var eventCorrelationId = correlationId || this.generateId();
|
|
7182
|
+
if (!correlationId) {
|
|
7183
|
+
this.logger.info("PerformanceClient: No correlation id provided for " + measureName + ", generating", eventCorrelationId);
|
|
7184
|
+
}
|
|
7185
|
+
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
|
|
7186
|
+
var performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);
|
|
7187
|
+
performanceMeasurement.startMeasurement();
|
|
7188
|
+
var inProgressEvent = {
|
|
7189
|
+
eventId: this.generateId(),
|
|
7190
|
+
status: PerformanceEventStatus.InProgress,
|
|
7191
|
+
authority: this.authority,
|
|
7192
|
+
libraryName: this.libraryName,
|
|
7193
|
+
libraryVersion: this.libraryVersion,
|
|
7194
|
+
appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
|
|
7195
|
+
appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
|
|
7196
|
+
clientId: this.clientId,
|
|
7197
|
+
name: measureName,
|
|
7198
|
+
startTimeMs: Date.now(),
|
|
7199
|
+
correlationId: eventCorrelationId
|
|
7200
|
+
};
|
|
7201
|
+
// Store in progress events so they can be discarded if not ended properly
|
|
7202
|
+
this.cacheEventByCorrelationId(inProgressEvent);
|
|
7203
|
+
this.cacheMeasurement(inProgressEvent, performanceMeasurement);
|
|
7204
|
+
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
7205
|
+
return {
|
|
7206
|
+
endMeasurement: function (event) {
|
|
7207
|
+
var completedEvent = _this.endMeasurement(__assign(__assign({}, inProgressEvent), event));
|
|
7208
|
+
if (completedEvent) {
|
|
7209
|
+
// Cache event so that submeasurements can be added downstream
|
|
7210
|
+
_this.cacheEventByCorrelationId(completedEvent);
|
|
7211
|
+
}
|
|
7212
|
+
return completedEvent;
|
|
7213
|
+
},
|
|
7214
|
+
flushMeasurement: function () {
|
|
7215
|
+
return _this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);
|
|
7216
|
+
},
|
|
7217
|
+
discardMeasurement: function () {
|
|
7218
|
+
return _this.discardMeasurements(inProgressEvent.correlationId);
|
|
7219
|
+
},
|
|
7220
|
+
measurement: performanceMeasurement,
|
|
7221
|
+
event: inProgressEvent
|
|
7222
|
+
};
|
|
7223
|
+
};
|
|
7224
|
+
/**
|
|
7225
|
+
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
|
|
7226
|
+
* as consumers should instead use the function returned by startMeasurement.
|
|
7227
|
+
*
|
|
7228
|
+
* @param {PerformanceEvent} event
|
|
7229
|
+
* @returns {(PerformanceEvent | null)}
|
|
7230
|
+
*/
|
|
7231
|
+
PerformanceClient.prototype.endMeasurement = function (event) {
|
|
7232
|
+
var performanceMeasurement = this.measurementsById.get(event.eventId);
|
|
7233
|
+
if (performanceMeasurement) {
|
|
7234
|
+
// Immediately delete so that the same event isnt ended twice
|
|
7235
|
+
this.measurementsById.delete(event.eventId);
|
|
7236
|
+
performanceMeasurement.endMeasurement();
|
|
7237
|
+
var durationMs = performanceMeasurement.flushMeasurement();
|
|
7238
|
+
// null indicates no measurement was taken (e.g. needed performance APIs not present)
|
|
7239
|
+
if (durationMs !== null) {
|
|
7240
|
+
this.logger.trace("PerformanceClient: Performance measurement ended for " + event.name + ": " + durationMs + " ms", event.correlationId);
|
|
7241
|
+
var completedEvent = __assign(__assign({
|
|
7242
|
+
// Allow duration to be overwritten when event ends (e.g. testing), but not status
|
|
7243
|
+
durationMs: Math.round(durationMs) }, event), { status: PerformanceEventStatus.Completed });
|
|
7244
|
+
return completedEvent;
|
|
7245
|
+
}
|
|
7246
|
+
else {
|
|
7247
|
+
this.logger.trace("PerformanceClient: Performance measurement not taken", event.correlationId);
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
7250
|
+
else {
|
|
7251
|
+
this.logger.trace("PerformanceClient: Measurement not found for " + event.eventId, event.correlationId);
|
|
7252
|
+
}
|
|
7253
|
+
return null;
|
|
7254
|
+
};
|
|
7255
|
+
/**
|
|
7256
|
+
* Upserts event into event cache.
|
|
7257
|
+
* First key is the correlation id, second key is the event id.
|
|
7258
|
+
* Allows for events to be grouped by correlation id,
|
|
7259
|
+
* and to easily allow for properties on them to be updated.
|
|
7260
|
+
*
|
|
7261
|
+
* @private
|
|
7262
|
+
* @param {PerformanceEvent} event
|
|
7263
|
+
*/
|
|
7264
|
+
PerformanceClient.prototype.cacheEventByCorrelationId = function (event) {
|
|
7265
|
+
var existingEvents = this.eventsByCorrelationId.get(event.correlationId);
|
|
7266
|
+
if (existingEvents) {
|
|
7267
|
+
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " added/updated", event.correlationId);
|
|
7268
|
+
existingEvents.set(event.eventId, event);
|
|
7269
|
+
}
|
|
7270
|
+
else {
|
|
7271
|
+
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " started", event.correlationId);
|
|
7272
|
+
this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));
|
|
7273
|
+
}
|
|
7274
|
+
};
|
|
7275
|
+
/**
|
|
7276
|
+
* Cache measurements by their id.
|
|
7277
|
+
*
|
|
7278
|
+
* @private
|
|
7279
|
+
* @param {PerformanceEvent} event
|
|
7280
|
+
* @param {IPerformanceMeasurement} measurement
|
|
7281
|
+
*/
|
|
7282
|
+
PerformanceClient.prototype.cacheMeasurement = function (event, measurement) {
|
|
7283
|
+
this.measurementsById.set(event.eventId, measurement);
|
|
7284
|
+
};
|
|
7285
|
+
/**
|
|
7286
|
+
* Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.
|
|
7287
|
+
*
|
|
7288
|
+
* @param {PerformanceEvents} measureName
|
|
7289
|
+
* @param {string} correlationId
|
|
7290
|
+
*/
|
|
7291
|
+
PerformanceClient.prototype.flushMeasurements = function (measureName, correlationId) {
|
|
7292
|
+
var _this = this;
|
|
7293
|
+
this.logger.trace("PerformanceClient: Performance measurements flushed for " + measureName, correlationId);
|
|
7294
|
+
var eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);
|
|
7295
|
+
if (eventsForCorrelationId) {
|
|
7296
|
+
this.discardMeasurements(correlationId);
|
|
7297
|
+
/*
|
|
7298
|
+
* Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.
|
|
7299
|
+
* Incomplete submeasurements are likely an instrumentation bug that should be fixed.
|
|
7300
|
+
* IE only supports Map.forEach.
|
|
7301
|
+
*/
|
|
7302
|
+
var completedEvents_1 = [];
|
|
7303
|
+
eventsForCorrelationId.forEach(function (event) {
|
|
7304
|
+
if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {
|
|
7305
|
+
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + event.name + " found for " + measureName, correlationId);
|
|
7306
|
+
var completedEvent = _this.endMeasurement(event);
|
|
7307
|
+
if (completedEvent) {
|
|
7308
|
+
completedEvents_1.push(completedEvent);
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7311
|
+
completedEvents_1.push(event);
|
|
7312
|
+
});
|
|
7313
|
+
// Sort events by start time (earliest first)
|
|
7314
|
+
var sortedCompletedEvents = completedEvents_1.sort(function (eventA, eventB) { return eventA.startTimeMs - eventB.startTimeMs; });
|
|
7315
|
+
// Take completed top level event and add completed submeasurements durations as properties
|
|
7316
|
+
var topLevelEvents = sortedCompletedEvents.filter(function (event) { return event.name === measureName && event.status === PerformanceEventStatus.Completed; });
|
|
7317
|
+
if (topLevelEvents.length > 0) {
|
|
7318
|
+
/*
|
|
7319
|
+
* Only take the first top-level event if there are multiple events with the same correlation id.
|
|
7320
|
+
* This greatly simplifies logic for submeasurements.
|
|
7321
|
+
*/
|
|
7322
|
+
if (topLevelEvents.length > 1) {
|
|
7323
|
+
this.logger.verbose("PerformanceClient: Multiple distinct top-level performance events found, using the first", correlationId);
|
|
7324
|
+
}
|
|
7325
|
+
var topLevelEvent = topLevelEvents[0];
|
|
7326
|
+
this.logger.verbose("PerformanceClient: Measurement found for " + measureName, correlationId);
|
|
7327
|
+
// Build event object with top level and sub measurements
|
|
7328
|
+
var eventToEmit = sortedCompletedEvents.reduce(function (previous, current) {
|
|
7329
|
+
if (current.name !== measureName) {
|
|
7330
|
+
_this.logger.trace("PerformanceClient: Complete submeasurement found for " + current.name, correlationId);
|
|
7331
|
+
// TODO: Emit additional properties for each subMeasurement
|
|
7332
|
+
var subMeasurementName = current.name + "DurationMs";
|
|
7333
|
+
/*
|
|
7334
|
+
* Some code paths, such as resolving an authority, can occur multiple times.
|
|
7335
|
+
* Only take the first measurement, since the second could be read from the cache,
|
|
7336
|
+
* or due to the same correlation id being used for two distinct requests.
|
|
7337
|
+
*/
|
|
7338
|
+
if (!previous[subMeasurementName]) {
|
|
7339
|
+
previous[subMeasurementName] = current.durationMs;
|
|
7340
|
+
}
|
|
7341
|
+
else {
|
|
7342
|
+
_this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
return previous;
|
|
7346
|
+
}, topLevelEvent);
|
|
7347
|
+
this.emitEvents([eventToEmit], eventToEmit.correlationId);
|
|
7348
|
+
}
|
|
7349
|
+
else {
|
|
7350
|
+
this.logger.verbose("PerformanceClient: No completed top-level measurements found for " + measureName, correlationId);
|
|
7351
|
+
}
|
|
7352
|
+
}
|
|
7353
|
+
else {
|
|
7354
|
+
this.logger.verbose("PerformanceClient: No measurements found", correlationId);
|
|
7355
|
+
}
|
|
7356
|
+
};
|
|
7357
|
+
/**
|
|
7358
|
+
* Removes measurements for a given correlation id.
|
|
7359
|
+
*
|
|
7360
|
+
* @param {string} correlationId
|
|
7361
|
+
*/
|
|
7362
|
+
PerformanceClient.prototype.discardMeasurements = function (correlationId) {
|
|
7363
|
+
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
7364
|
+
this.eventsByCorrelationId.delete(correlationId);
|
|
7365
|
+
};
|
|
7366
|
+
/**
|
|
7367
|
+
* Registers a callback function to receive performance events.
|
|
7368
|
+
*
|
|
7369
|
+
* @param {PerformanceCallbackFunction} callback
|
|
7370
|
+
* @returns {string}
|
|
7371
|
+
*/
|
|
7372
|
+
PerformanceClient.prototype.addPerformanceCallback = function (callback) {
|
|
7373
|
+
var callbackId = this.generateId();
|
|
7374
|
+
this.callbacks.set(callbackId, callback);
|
|
7375
|
+
this.logger.verbose("PerformanceClient: Performance callback registered with id: " + callbackId);
|
|
7376
|
+
return callbackId;
|
|
7377
|
+
};
|
|
7378
|
+
/**
|
|
7379
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
7380
|
+
*
|
|
7381
|
+
* @param {string} callbackId
|
|
7382
|
+
* @returns {boolean}
|
|
7383
|
+
*/
|
|
7384
|
+
PerformanceClient.prototype.removePerformanceCallback = function (callbackId) {
|
|
7385
|
+
var result = this.callbacks.delete(callbackId);
|
|
7386
|
+
if (result) {
|
|
7387
|
+
this.logger.verbose("PerformanceClient: Performance callback " + callbackId + " removed.");
|
|
7388
|
+
}
|
|
7389
|
+
else {
|
|
7390
|
+
this.logger.verbose("PerformanceClient: Performance callback " + callbackId + " not removed.");
|
|
7391
|
+
}
|
|
7392
|
+
return result;
|
|
7393
|
+
};
|
|
7394
|
+
/**
|
|
7395
|
+
* Emits events to all registered callbacks.
|
|
7396
|
+
*
|
|
7397
|
+
* @param {PerformanceEvent[]} events
|
|
7398
|
+
* @param {?string} [correlationId]
|
|
7399
|
+
*/
|
|
7400
|
+
PerformanceClient.prototype.emitEvents = function (events, correlationId) {
|
|
7401
|
+
var _this = this;
|
|
7402
|
+
this.logger.verbose("PerformanceClient: Emitting performance events", correlationId);
|
|
7403
|
+
this.callbacks.forEach(function (callback, callbackId) {
|
|
7404
|
+
_this.logger.trace("PerformanceClient: Emitting event to callback " + callbackId, correlationId);
|
|
7405
|
+
callback.apply(null, [events]);
|
|
7406
|
+
});
|
|
7407
|
+
};
|
|
7408
|
+
return PerformanceClient;
|
|
7409
|
+
}());
|
|
7410
|
+
|
|
7411
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
7412
|
+
|
|
7413
|
+
/*
|
|
7414
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7415
|
+
* Licensed under the MIT License.
|
|
7416
|
+
*/
|
|
7417
|
+
var StubPerformanceMeasurement = /** @class */ (function () {
|
|
7418
|
+
function StubPerformanceMeasurement() {
|
|
7419
|
+
}
|
|
7420
|
+
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
|
7421
|
+
StubPerformanceMeasurement.prototype.startMeasurement = function () { };
|
|
7422
|
+
/* eslint-disable-next-line @typescript-eslint/no-empty-function */
|
|
7423
|
+
StubPerformanceMeasurement.prototype.endMeasurement = function () { };
|
|
7424
|
+
StubPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
7425
|
+
return null;
|
|
7426
|
+
};
|
|
7427
|
+
return StubPerformanceMeasurement;
|
|
7428
|
+
}());
|
|
7429
|
+
var StubPerformanceClient = /** @class */ (function (_super) {
|
|
7430
|
+
__extends(StubPerformanceClient, _super);
|
|
7431
|
+
function StubPerformanceClient() {
|
|
7432
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7433
|
+
}
|
|
7434
|
+
StubPerformanceClient.prototype.generateId = function () {
|
|
7435
|
+
return "callback-id";
|
|
7436
|
+
};
|
|
7437
|
+
StubPerformanceClient.prototype.startPerformanceMeasuremeant = function () {
|
|
7438
|
+
return new StubPerformanceMeasurement();
|
|
7439
|
+
};
|
|
7440
|
+
return StubPerformanceClient;
|
|
7441
|
+
}(PerformanceClient));
|
|
7442
|
+
|
|
7029
7443
|
/*
|
|
7030
7444
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7031
7445
|
* Licensed under the MIT License.
|
|
@@ -7263,7 +7677,7 @@ var GuidGenerator = /** @class */ (function () {
|
|
|
7263
7677
|
var guidHolder = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
7264
7678
|
var hex = "0123456789abcdef";
|
|
7265
7679
|
var r = 0;
|
|
7266
|
-
var guidResponse =
|
|
7680
|
+
var guidResponse = Constants.EMPTY_STRING;
|
|
7267
7681
|
for (var i = 0; i < 36; i++) {
|
|
7268
7682
|
if (guidHolder[i] !== "-" && guidHolder[i] !== "4") {
|
|
7269
7683
|
// each x and y needs to be random
|
|
@@ -7289,7 +7703,7 @@ var GuidGenerator = /** @class */ (function () {
|
|
|
7289
7703
|
* verifies if a string is GUID
|
|
7290
7704
|
* @param guid
|
|
7291
7705
|
*/
|
|
7292
|
-
GuidGenerator.isGuid = function (guid) {
|
|
7706
|
+
GuidGenerator.prototype.isGuid = function (guid) {
|
|
7293
7707
|
var regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
7294
7708
|
return regexGuid.test(guid);
|
|
7295
7709
|
};
|
|
@@ -7383,7 +7797,7 @@ var BrowserStringUtils = /** @class */ (function () {
|
|
|
7383
7797
|
* @param aBytes
|
|
7384
7798
|
*/
|
|
7385
7799
|
BrowserStringUtils.utf8ArrToString = function (aBytes) {
|
|
7386
|
-
var sView =
|
|
7800
|
+
var sView = Constants.EMPTY_STRING;
|
|
7387
7801
|
for (var nPart = void 0, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {
|
|
7388
7802
|
nPart = aBytes[nIdx];
|
|
7389
7803
|
sView += String.fromCharCode(nPart > 251 && nPart < 254 && nIdx + 5 < nLen ? /* six bytes */
|
|
@@ -7422,7 +7836,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7422
7836
|
*/
|
|
7423
7837
|
Base64Encode.prototype.urlEncode = function (input) {
|
|
7424
7838
|
return encodeURIComponent(this.encode(input)
|
|
7425
|
-
.replace(/=/g,
|
|
7839
|
+
.replace(/=/g, Constants.EMPTY_STRING)
|
|
7426
7840
|
.replace(/\+/g, "-")
|
|
7427
7841
|
.replace(/\//g, "_"));
|
|
7428
7842
|
};
|
|
@@ -7432,7 +7846,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7432
7846
|
*/
|
|
7433
7847
|
Base64Encode.prototype.urlEncodeArr = function (inputArr) {
|
|
7434
7848
|
return this.base64EncArr(inputArr)
|
|
7435
|
-
.replace(/=/g,
|
|
7849
|
+
.replace(/=/g, Constants.EMPTY_STRING)
|
|
7436
7850
|
.replace(/\+/g, "-")
|
|
7437
7851
|
.replace(/\//g, "_");
|
|
7438
7852
|
};
|
|
@@ -7450,7 +7864,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7450
7864
|
*/
|
|
7451
7865
|
Base64Encode.prototype.base64EncArr = function (aBytes) {
|
|
7452
7866
|
var eqLen = (3 - (aBytes.length % 3)) % 3;
|
|
7453
|
-
var sB64Enc =
|
|
7867
|
+
var sB64Enc = Constants.EMPTY_STRING;
|
|
7454
7868
|
for (var nMod3 = void 0, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {
|
|
7455
7869
|
nMod3 = nIdx % 3;
|
|
7456
7870
|
/* Uncomment the following line in order to split the output in lines 76-character long: */
|
|
@@ -7524,7 +7938,7 @@ var Base64Decode = /** @class */ (function () {
|
|
|
7524
7938
|
* @param nBlockSize
|
|
7525
7939
|
*/
|
|
7526
7940
|
Base64Decode.prototype.base64DecToArr = function (base64String, nBlockSize) {
|
|
7527
|
-
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g,
|
|
7941
|
+
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g, Constants.EMPTY_STRING);
|
|
7528
7942
|
var nInLen = sB64Enc.length;
|
|
7529
7943
|
var nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2;
|
|
7530
7944
|
var aBytes = new Uint8Array(nOutLen);
|
|
@@ -8242,11 +8656,11 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
8242
8656
|
msExportKey.addEventListener("complete", function (e) {
|
|
8243
8657
|
var resultBuffer = e.target.result;
|
|
8244
8658
|
var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
|
|
8245
|
-
.replace(/\r/g,
|
|
8246
|
-
.replace(/\n/g,
|
|
8247
|
-
.replace(/\t/g,
|
|
8248
|
-
.split(" ").join(
|
|
8249
|
-
.replace("\u0000",
|
|
8659
|
+
.replace(/\r/g, Constants.EMPTY_STRING)
|
|
8660
|
+
.replace(/\n/g, Constants.EMPTY_STRING)
|
|
8661
|
+
.replace(/\t/g, Constants.EMPTY_STRING)
|
|
8662
|
+
.split(" ").join(Constants.EMPTY_STRING)
|
|
8663
|
+
.replace("\u0000", Constants.EMPTY_STRING);
|
|
8250
8664
|
try {
|
|
8251
8665
|
resolve(JSON.parse(resultString));
|
|
8252
8666
|
}
|
|
@@ -8353,6 +8767,17 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8353
8767
|
});
|
|
8354
8768
|
});
|
|
8355
8769
|
};
|
|
8770
|
+
/**
|
|
8771
|
+
* Closes the connection to IndexedDB database when all pending transactions
|
|
8772
|
+
* complete.
|
|
8773
|
+
*/
|
|
8774
|
+
DatabaseStorage.prototype.closeConnection = function () {
|
|
8775
|
+
var db = this.db;
|
|
8776
|
+
if (db && this.dbOpen) {
|
|
8777
|
+
db.close();
|
|
8778
|
+
this.dbOpen = false;
|
|
8779
|
+
}
|
|
8780
|
+
};
|
|
8356
8781
|
/**
|
|
8357
8782
|
* Opens database if it's not already open
|
|
8358
8783
|
*/
|
|
@@ -8391,9 +8816,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8391
8816
|
var dbGet = objectStore.get(key);
|
|
8392
8817
|
dbGet.addEventListener("success", function (e) {
|
|
8393
8818
|
var event = e;
|
|
8819
|
+
_this.closeConnection();
|
|
8394
8820
|
resolve(event.target.result);
|
|
8395
8821
|
});
|
|
8396
|
-
dbGet.addEventListener("error", function (e) {
|
|
8822
|
+
dbGet.addEventListener("error", function (e) {
|
|
8823
|
+
_this.closeConnection();
|
|
8824
|
+
reject(e);
|
|
8825
|
+
});
|
|
8397
8826
|
})];
|
|
8398
8827
|
}
|
|
8399
8828
|
});
|
|
@@ -8420,8 +8849,14 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8420
8849
|
var transaction = _this.db.transaction([_this.tableName], "readwrite");
|
|
8421
8850
|
var objectStore = transaction.objectStore(_this.tableName);
|
|
8422
8851
|
var dbPut = objectStore.put(payload, key);
|
|
8423
|
-
dbPut.addEventListener("success", function () {
|
|
8424
|
-
|
|
8852
|
+
dbPut.addEventListener("success", function () {
|
|
8853
|
+
_this.closeConnection();
|
|
8854
|
+
resolve();
|
|
8855
|
+
});
|
|
8856
|
+
dbPut.addEventListener("error", function (e) {
|
|
8857
|
+
_this.closeConnection();
|
|
8858
|
+
reject(e);
|
|
8859
|
+
});
|
|
8425
8860
|
})];
|
|
8426
8861
|
}
|
|
8427
8862
|
});
|
|
@@ -8446,8 +8881,14 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8446
8881
|
var transaction = _this.db.transaction([_this.tableName], "readwrite");
|
|
8447
8882
|
var objectStore = transaction.objectStore(_this.tableName);
|
|
8448
8883
|
var dbDelete = objectStore.delete(key);
|
|
8449
|
-
dbDelete.addEventListener("success", function () {
|
|
8450
|
-
|
|
8884
|
+
dbDelete.addEventListener("success", function () {
|
|
8885
|
+
_this.closeConnection();
|
|
8886
|
+
resolve();
|
|
8887
|
+
});
|
|
8888
|
+
dbDelete.addEventListener("error", function (e) {
|
|
8889
|
+
_this.closeConnection();
|
|
8890
|
+
reject(e);
|
|
8891
|
+
});
|
|
8451
8892
|
})];
|
|
8452
8893
|
}
|
|
8453
8894
|
});
|
|
@@ -8473,9 +8914,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8473
8914
|
var dbGetKeys = objectStore.getAllKeys();
|
|
8474
8915
|
dbGetKeys.addEventListener("success", function (e) {
|
|
8475
8916
|
var event = e;
|
|
8917
|
+
_this.closeConnection();
|
|
8476
8918
|
resolve(event.target.result);
|
|
8477
8919
|
});
|
|
8478
|
-
dbGetKeys.addEventListener("error", function (e) {
|
|
8920
|
+
dbGetKeys.addEventListener("error", function (e) {
|
|
8921
|
+
_this.closeConnection();
|
|
8922
|
+
reject(e);
|
|
8923
|
+
});
|
|
8479
8924
|
})];
|
|
8480
8925
|
}
|
|
8481
8926
|
});
|
|
@@ -8502,9 +8947,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8502
8947
|
var dbContainsKey = objectStore.count(key);
|
|
8503
8948
|
dbContainsKey.addEventListener("success", function (e) {
|
|
8504
8949
|
var event = e;
|
|
8950
|
+
_this.closeConnection();
|
|
8505
8951
|
resolve(event.target.result === 1);
|
|
8506
8952
|
});
|
|
8507
|
-
dbContainsKey.addEventListener("error", function (e) {
|
|
8953
|
+
dbContainsKey.addEventListener("error", function (e) {
|
|
8954
|
+
_this.closeConnection();
|
|
8955
|
+
reject(e);
|
|
8956
|
+
});
|
|
8508
8957
|
})];
|
|
8509
8958
|
}
|
|
8510
8959
|
});
|
|
@@ -8517,12 +8966,29 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8517
8966
|
*/
|
|
8518
8967
|
DatabaseStorage.prototype.deleteDatabase = function () {
|
|
8519
8968
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8969
|
+
var existingDatabases, database;
|
|
8520
8970
|
return __generator$1(this, function (_a) {
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8971
|
+
switch (_a.label) {
|
|
8972
|
+
case 0:
|
|
8973
|
+
// Check if database being deleted exists
|
|
8974
|
+
if (this.db && this.dbOpen) {
|
|
8975
|
+
this.closeConnection();
|
|
8976
|
+
}
|
|
8977
|
+
return [4 /*yield*/, window.indexedDB.databases()];
|
|
8978
|
+
case 1:
|
|
8979
|
+
existingDatabases = _a.sent();
|
|
8980
|
+
database = existingDatabases.find(function (database) { return database.name === DB_NAME; });
|
|
8981
|
+
// If database exists, delete it
|
|
8982
|
+
if (database) {
|
|
8983
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
8984
|
+
var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
|
|
8985
|
+
deleteDbRequest.addEventListener("success", function () { return resolve(true); });
|
|
8986
|
+
deleteDbRequest.addEventListener("error", function () { return reject(false); });
|
|
8987
|
+
})];
|
|
8988
|
+
}
|
|
8989
|
+
// Database doesn't exist, return true
|
|
8990
|
+
return [2 /*return*/, true];
|
|
8991
|
+
}
|
|
8526
8992
|
});
|
|
8527
8993
|
});
|
|
8528
8994
|
};
|
|
@@ -8571,15 +9037,19 @@ var MemoryStorage = /** @class */ (function () {
|
|
|
8571
9037
|
* backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
|
|
8572
9038
|
*/
|
|
8573
9039
|
var AsyncMemoryStorage = /** @class */ (function () {
|
|
8574
|
-
function AsyncMemoryStorage(logger) {
|
|
9040
|
+
function AsyncMemoryStorage(logger, storeName) {
|
|
8575
9041
|
this.inMemoryCache = new MemoryStorage();
|
|
8576
9042
|
this.indexedDBCache = new DatabaseStorage();
|
|
8577
9043
|
this.logger = logger;
|
|
9044
|
+
this.storeName = storeName;
|
|
8578
9045
|
}
|
|
8579
9046
|
AsyncMemoryStorage.prototype.handleDatabaseAccessError = function (error) {
|
|
8580
9047
|
if (error instanceof BrowserAuthError && error.errorCode === BrowserAuthErrorMessage.databaseUnavailable.code) {
|
|
8581
9048
|
this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");
|
|
8582
9049
|
}
|
|
9050
|
+
else {
|
|
9051
|
+
throw error;
|
|
9052
|
+
}
|
|
8583
9053
|
};
|
|
8584
9054
|
/**
|
|
8585
9055
|
* Get the item matching the given key. Tries in-memory cache first, then in the asynchronous
|
|
@@ -8724,22 +9194,29 @@ var AsyncMemoryStorage = /** @class */ (function () {
|
|
|
8724
9194
|
*/
|
|
8725
9195
|
AsyncMemoryStorage.prototype.clear = function () {
|
|
8726
9196
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8727
|
-
var e_6;
|
|
9197
|
+
var dbDeleted, e_6;
|
|
8728
9198
|
return __generator$1(this, function (_a) {
|
|
8729
9199
|
switch (_a.label) {
|
|
8730
9200
|
case 0:
|
|
9201
|
+
// InMemory cache is a Map instance, clear is straightforward
|
|
9202
|
+
this.logger.verbose("Deleting in-memory keystore " + this.storeName);
|
|
8731
9203
|
this.inMemoryCache.clear();
|
|
9204
|
+
this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
|
|
9205
|
+
this.logger.verbose("Deleting persistent keystore " + this.storeName);
|
|
8732
9206
|
_a.label = 1;
|
|
8733
9207
|
case 1:
|
|
8734
9208
|
_a.trys.push([1, 3, , 4]);
|
|
8735
9209
|
return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];
|
|
8736
9210
|
case 2:
|
|
8737
|
-
_a.sent();
|
|
8738
|
-
|
|
9211
|
+
dbDeleted = _a.sent();
|
|
9212
|
+
if (dbDeleted) {
|
|
9213
|
+
this.logger.verbose("Persistent keystore " + this.storeName + " deleted");
|
|
9214
|
+
}
|
|
9215
|
+
return [2 /*return*/, dbDeleted];
|
|
8739
9216
|
case 3:
|
|
8740
9217
|
e_6 = _a.sent();
|
|
8741
9218
|
this.handleDatabaseAccessError(e_6);
|
|
8742
|
-
return [
|
|
9219
|
+
return [2 /*return*/, false];
|
|
8743
9220
|
case 4: return [2 /*return*/];
|
|
8744
9221
|
}
|
|
8745
9222
|
});
|
|
@@ -8752,12 +9229,17 @@ var AsyncMemoryStorage = /** @class */ (function () {
|
|
|
8752
9229
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8753
9230
|
* Licensed under the MIT License.
|
|
8754
9231
|
*/
|
|
9232
|
+
var CryptoKeyStoreNames;
|
|
9233
|
+
(function (CryptoKeyStoreNames) {
|
|
9234
|
+
CryptoKeyStoreNames["asymmetricKeys"] = "asymmetricKeys";
|
|
9235
|
+
CryptoKeyStoreNames["symmetricKeys"] = "symmetricKeys";
|
|
9236
|
+
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
|
|
8755
9237
|
/**
|
|
8756
9238
|
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
8757
9239
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
8758
9240
|
*/
|
|
8759
9241
|
var CryptoOps = /** @class */ (function () {
|
|
8760
|
-
function CryptoOps(logger) {
|
|
9242
|
+
function CryptoOps(logger, performanceClient) {
|
|
8761
9243
|
this.logger = logger;
|
|
8762
9244
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
8763
9245
|
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
@@ -8766,9 +9248,10 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8766
9248
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
8767
9249
|
this.pkceGenerator = new PkceGenerator(this.browserCrypto);
|
|
8768
9250
|
this.cache = {
|
|
8769
|
-
asymmetricKeys: new AsyncMemoryStorage(this.logger),
|
|
8770
|
-
symmetricKeys: new AsyncMemoryStorage(this.logger)
|
|
9251
|
+
asymmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys),
|
|
9252
|
+
symmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys)
|
|
8771
9253
|
};
|
|
9254
|
+
this.performanceClient = performanceClient;
|
|
8772
9255
|
}
|
|
8773
9256
|
/**
|
|
8774
9257
|
* Creates a new random GUID - used to populate state and nonce.
|
|
@@ -8806,16 +9289,19 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8806
9289
|
* @param request
|
|
8807
9290
|
*/
|
|
8808
9291
|
CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
|
|
9292
|
+
var _a;
|
|
8809
9293
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8810
|
-
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
|
|
8811
|
-
return __generator$1(this, function (
|
|
8812
|
-
switch (
|
|
8813
|
-
case 0:
|
|
9294
|
+
var publicKeyThumbMeasurement, keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
|
|
9295
|
+
return __generator$1(this, function (_b) {
|
|
9296
|
+
switch (_b.label) {
|
|
9297
|
+
case 0:
|
|
9298
|
+
publicKeyThumbMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
9299
|
+
return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
|
|
8814
9300
|
case 1:
|
|
8815
|
-
keyPair =
|
|
9301
|
+
keyPair = _b.sent();
|
|
8816
9302
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.publicKey)];
|
|
8817
9303
|
case 2:
|
|
8818
|
-
publicKeyJwk =
|
|
9304
|
+
publicKeyJwk = _b.sent();
|
|
8819
9305
|
pubKeyThumprintObj = {
|
|
8820
9306
|
e: publicKeyJwk.e,
|
|
8821
9307
|
kty: publicKeyJwk.kty,
|
|
@@ -8824,13 +9310,13 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8824
9310
|
publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);
|
|
8825
9311
|
return [4 /*yield*/, this.hashString(publicJwkString)];
|
|
8826
9312
|
case 3:
|
|
8827
|
-
publicJwkHash =
|
|
9313
|
+
publicJwkHash = _b.sent();
|
|
8828
9314
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
|
|
8829
9315
|
case 4:
|
|
8830
|
-
privateKeyJwk =
|
|
9316
|
+
privateKeyJwk = _b.sent();
|
|
8831
9317
|
return [4 /*yield*/, this.browserCrypto.importJwk(privateKeyJwk, false, ["sign"])];
|
|
8832
9318
|
case 5:
|
|
8833
|
-
unextractablePrivateKey =
|
|
9319
|
+
unextractablePrivateKey = _b.sent();
|
|
8834
9320
|
// Store Keypair data in keystore
|
|
8835
9321
|
return [4 /*yield*/, this.cache.asymmetricKeys.setItem(publicJwkHash, {
|
|
8836
9322
|
privateKey: unextractablePrivateKey,
|
|
@@ -8840,7 +9326,12 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8840
9326
|
})];
|
|
8841
9327
|
case 6:
|
|
8842
9328
|
// Store Keypair data in keystore
|
|
8843
|
-
|
|
9329
|
+
_b.sent();
|
|
9330
|
+
if (publicKeyThumbMeasurement) {
|
|
9331
|
+
publicKeyThumbMeasurement.endMeasurement({
|
|
9332
|
+
success: true
|
|
9333
|
+
});
|
|
9334
|
+
}
|
|
8844
9335
|
return [2 /*return*/, publicJwkHash];
|
|
8845
9336
|
}
|
|
8846
9337
|
});
|
|
@@ -8871,21 +9362,32 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8871
9362
|
*/
|
|
8872
9363
|
CryptoOps.prototype.clearKeystore = function () {
|
|
8873
9364
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8874
|
-
var
|
|
8875
|
-
return __generator$1(this, function (
|
|
8876
|
-
switch (
|
|
9365
|
+
var e_1;
|
|
9366
|
+
return __generator$1(this, function (_a) {
|
|
9367
|
+
switch (_a.label) {
|
|
8877
9368
|
case 0:
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
return [4 /*yield*/, databaseStorage.deleteDatabase()];
|
|
9369
|
+
_a.trys.push([0, 3, , 4]);
|
|
9370
|
+
this.logger.verbose("Deleting in-memory and persistent asymmetric key stores");
|
|
9371
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.clear()];
|
|
8882
9372
|
case 1:
|
|
8883
|
-
_a
|
|
8884
|
-
|
|
9373
|
+
_a.sent();
|
|
9374
|
+
this.logger.verbose("Successfully deleted asymmetric key stores");
|
|
9375
|
+
this.logger.verbose("Deleting in-memory and persistent symmetric key stores");
|
|
9376
|
+
return [4 /*yield*/, this.cache.symmetricKeys.clear()];
|
|
8885
9377
|
case 2:
|
|
8886
|
-
_a
|
|
8887
|
-
|
|
8888
|
-
|
|
9378
|
+
_a.sent();
|
|
9379
|
+
this.logger.verbose("Successfully deleted symmetric key stores");
|
|
9380
|
+
return [2 /*return*/, true];
|
|
9381
|
+
case 3:
|
|
9382
|
+
e_1 = _a.sent();
|
|
9383
|
+
if (e_1 instanceof Error) {
|
|
9384
|
+
this.logger.error("Clearing keystore failed with error: " + e_1.message);
|
|
9385
|
+
}
|
|
9386
|
+
else {
|
|
9387
|
+
this.logger.error("Clearing keystore failed with unknown error");
|
|
9388
|
+
}
|
|
9389
|
+
return [2 /*return*/, false];
|
|
9390
|
+
case 4: return [2 /*return*/];
|
|
8889
9391
|
}
|
|
8890
9392
|
});
|
|
8891
9393
|
});
|
|
@@ -8895,20 +9397,23 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8895
9397
|
* @param payload
|
|
8896
9398
|
* @param kid
|
|
8897
9399
|
*/
|
|
8898
|
-
CryptoOps.prototype.signJwt = function (payload, kid) {
|
|
9400
|
+
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
9401
|
+
var _a;
|
|
8899
9402
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8900
|
-
var cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature;
|
|
8901
|
-
return __generator$1(this, function (
|
|
8902
|
-
switch (
|
|
8903
|
-
case 0:
|
|
9403
|
+
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
|
|
9404
|
+
return __generator$1(this, function (_b) {
|
|
9405
|
+
switch (_b.label) {
|
|
9406
|
+
case 0:
|
|
9407
|
+
signJwtMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
9408
|
+
return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
|
|
8904
9409
|
case 1:
|
|
8905
|
-
cachedKeyPair =
|
|
9410
|
+
cachedKeyPair = _b.sent();
|
|
8906
9411
|
if (!cachedKeyPair) {
|
|
8907
9412
|
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
8908
9413
|
}
|
|
8909
9414
|
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
8910
9415
|
case 2:
|
|
8911
|
-
publicKeyJwk =
|
|
9416
|
+
publicKeyJwk = _b.sent();
|
|
8912
9417
|
publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);
|
|
8913
9418
|
header = {
|
|
8914
9419
|
alg: publicKeyJwk.alg,
|
|
@@ -8924,9 +9429,15 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8924
9429
|
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
8925
9430
|
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
8926
9431
|
case 3:
|
|
8927
|
-
signatureBuffer =
|
|
9432
|
+
signatureBuffer = _b.sent();
|
|
8928
9433
|
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
8929
|
-
|
|
9434
|
+
signedJwt = tokenString + "." + encodedSignature;
|
|
9435
|
+
if (signJwtMeasurement) {
|
|
9436
|
+
signJwtMeasurement.endMeasurement({
|
|
9437
|
+
success: true
|
|
9438
|
+
});
|
|
9439
|
+
}
|
|
9440
|
+
return [2 /*return*/, signedJwt];
|
|
8930
9441
|
}
|
|
8931
9442
|
});
|
|
8932
9443
|
});
|
|
@@ -9446,8 +9957,8 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9446
9957
|
* Returns wrapper metadata from in-memory storage
|
|
9447
9958
|
*/
|
|
9448
9959
|
BrowserCacheManager.prototype.getWrapperMetadata = function () {
|
|
9449
|
-
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) ||
|
|
9450
|
-
var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) ||
|
|
9960
|
+
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) || Constants.EMPTY_STRING;
|
|
9961
|
+
var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) || Constants.EMPTY_STRING;
|
|
9451
9962
|
return [sku, version];
|
|
9452
9963
|
};
|
|
9453
9964
|
/**
|
|
@@ -9669,7 +10180,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9669
10180
|
return decodeURIComponent(cookie.substring(name.length, cookie.length));
|
|
9670
10181
|
}
|
|
9671
10182
|
}
|
|
9672
|
-
return
|
|
10183
|
+
return Constants.EMPTY_STRING;
|
|
9673
10184
|
};
|
|
9674
10185
|
/**
|
|
9675
10186
|
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
@@ -9694,7 +10205,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9694
10205
|
* @param cookieName
|
|
9695
10206
|
*/
|
|
9696
10207
|
BrowserCacheManager.prototype.clearItemCookie = function (cookieName) {
|
|
9697
|
-
this.setItemCookie(cookieName,
|
|
10208
|
+
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
9698
10209
|
};
|
|
9699
10210
|
/**
|
|
9700
10211
|
* Get cookie expiration time
|
|
@@ -9839,7 +10350,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9839
10350
|
var stateKey = this.generateStateKey(stateString);
|
|
9840
10351
|
var cachedState = this.temporaryCacheStorage.getItem(stateKey);
|
|
9841
10352
|
this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: " + cachedState);
|
|
9842
|
-
this.resetRequestCache(cachedState ||
|
|
10353
|
+
this.resetRequestCache(cachedState || Constants.EMPTY_STRING);
|
|
9843
10354
|
}
|
|
9844
10355
|
this.clearMsalCookies();
|
|
9845
10356
|
};
|
|
@@ -10062,7 +10573,7 @@ var FetchClient = /** @class */ (function () {
|
|
|
10062
10573
|
return __generator$1(this, function (_b) {
|
|
10063
10574
|
switch (_b.label) {
|
|
10064
10575
|
case 0:
|
|
10065
|
-
reqBody = (options && options.body) ||
|
|
10576
|
+
reqBody = (options && options.body) || Constants.EMPTY_STRING;
|
|
10066
10577
|
_b.label = 1;
|
|
10067
10578
|
case 1:
|
|
10068
10579
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -10282,7 +10793,7 @@ var BrowserUtils = /** @class */ (function () {
|
|
|
10282
10793
|
BrowserUtils.replaceHash = function (url) {
|
|
10283
10794
|
var urlParts = url.split("#");
|
|
10284
10795
|
urlParts.shift(); // Remove part before the hash
|
|
10285
|
-
window.location.hash = urlParts.length > 0 ? urlParts.join("#") :
|
|
10796
|
+
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
|
|
10286
10797
|
};
|
|
10287
10798
|
/**
|
|
10288
10799
|
* Returns boolean of whether the current window is in an iframe or not.
|
|
@@ -10443,22 +10954,22 @@ var DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
|
10443
10954
|
* @returns Configuration object
|
|
10444
10955
|
*/
|
|
10445
10956
|
function buildConfiguration(_a, isBrowserEnvironment) {
|
|
10446
|
-
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system;
|
|
10957
|
+
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system, userInputTelemetry = _a.telemetry;
|
|
10447
10958
|
// Default auth options for browser
|
|
10448
10959
|
var DEFAULT_AUTH_OPTIONS = {
|
|
10449
|
-
clientId:
|
|
10960
|
+
clientId: Constants.EMPTY_STRING,
|
|
10450
10961
|
authority: "" + Constants.DEFAULT_AUTHORITY,
|
|
10451
10962
|
knownAuthorities: [],
|
|
10452
|
-
cloudDiscoveryMetadata:
|
|
10453
|
-
authorityMetadata:
|
|
10454
|
-
redirectUri:
|
|
10455
|
-
postLogoutRedirectUri:
|
|
10963
|
+
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
|
|
10964
|
+
authorityMetadata: Constants.EMPTY_STRING,
|
|
10965
|
+
redirectUri: Constants.EMPTY_STRING,
|
|
10966
|
+
postLogoutRedirectUri: Constants.EMPTY_STRING,
|
|
10456
10967
|
navigateToLoginRequestUrl: true,
|
|
10457
10968
|
clientCapabilities: [],
|
|
10458
10969
|
protocolMode: exports.ProtocolMode.AAD,
|
|
10459
10970
|
azureCloudOptions: {
|
|
10460
10971
|
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
10461
|
-
tenant:
|
|
10972
|
+
tenant: Constants.EMPTY_STRING
|
|
10462
10973
|
},
|
|
10463
10974
|
};
|
|
10464
10975
|
// Default cache options for browser
|
|
@@ -10478,17 +10989,24 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
10478
10989
|
var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign$1(__assign$1({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0,
|
|
10479
10990
|
// If loadFrameTimeout is provided, use that as default.
|
|
10480
10991
|
windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false });
|
|
10992
|
+
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
10993
|
+
application: {
|
|
10994
|
+
appName: Constants.EMPTY_STRING,
|
|
10995
|
+
appVersion: Constants.EMPTY_STRING
|
|
10996
|
+
}
|
|
10997
|
+
};
|
|
10481
10998
|
var overlayedConfig = {
|
|
10482
10999
|
auth: __assign$1(__assign$1({}, DEFAULT_AUTH_OPTIONS), userInputAuth),
|
|
10483
11000
|
cache: __assign$1(__assign$1({}, DEFAULT_CACHE_OPTIONS), userInputCache),
|
|
10484
|
-
system: __assign$1(__assign$1({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem)
|
|
11001
|
+
system: __assign$1(__assign$1({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem),
|
|
11002
|
+
telemetry: __assign$1(__assign$1({}, DEFAULT_TELEMETRY_OPTIONS), userInputTelemetry)
|
|
10485
11003
|
};
|
|
10486
11004
|
return overlayedConfig;
|
|
10487
11005
|
}
|
|
10488
11006
|
|
|
10489
11007
|
/* eslint-disable header/header */
|
|
10490
11008
|
var name = "@azure/msal-browser";
|
|
10491
|
-
var version = "2.
|
|
11009
|
+
var version = "2.23.0";
|
|
10492
11010
|
|
|
10493
11011
|
/*
|
|
10494
11012
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10645,7 +11163,7 @@ var EventHandler = /** @class */ (function () {
|
|
|
10645
11163
|
* Licensed under the MIT License.
|
|
10646
11164
|
*/
|
|
10647
11165
|
var BaseInteractionClient = /** @class */ (function () {
|
|
10648
|
-
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, correlationId) {
|
|
11166
|
+
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, performanceClient, correlationId) {
|
|
10649
11167
|
this.config = config;
|
|
10650
11168
|
this.browserStorage = storageImpl;
|
|
10651
11169
|
this.browserCrypto = browserCrypto;
|
|
@@ -10653,6 +11171,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10653
11171
|
this.eventHandler = eventHandler;
|
|
10654
11172
|
this.correlationId = correlationId || this.browserCrypto.createNewGuid();
|
|
10655
11173
|
this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);
|
|
11174
|
+
this.performanceClient = performanceClient;
|
|
10656
11175
|
}
|
|
10657
11176
|
BaseInteractionClient.prototype.clearCacheOnLogout = function (account) {
|
|
10658
11177
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
@@ -10679,6 +11198,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10679
11198
|
case 4: return [3 /*break*/, 9];
|
|
10680
11199
|
case 5:
|
|
10681
11200
|
_a.trys.push([5, 8, , 9]);
|
|
11201
|
+
this.logger.verbose("No account provided in logout request, clearing all cache items.", this.correlationId);
|
|
10682
11202
|
// Clear all accounts and tokens
|
|
10683
11203
|
return [4 /*yield*/, this.browserStorage.clear()];
|
|
10684
11204
|
case 6:
|
|
@@ -10689,7 +11209,6 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10689
11209
|
case 7:
|
|
10690
11210
|
// Clear any stray keys from IndexedDB
|
|
10691
11211
|
_a.sent();
|
|
10692
|
-
this.logger.verbose("No account provided in logout request, clearing all cache items.");
|
|
10693
11212
|
return [3 /*break*/, 9];
|
|
10694
11213
|
case 8:
|
|
10695
11214
|
_a.sent();
|
|
@@ -10784,8 +11303,8 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10784
11303
|
*/
|
|
10785
11304
|
var StandardInteractionClient = /** @class */ (function (_super) {
|
|
10786
11305
|
__extends$1(StandardInteractionClient, _super);
|
|
10787
|
-
function StandardInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) {
|
|
10788
|
-
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, correlationId) || this;
|
|
11306
|
+
function StandardInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) {
|
|
11307
|
+
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, performanceClient, correlationId) || this;
|
|
10789
11308
|
_this.navigationClient = navigationClient;
|
|
10790
11309
|
return _this;
|
|
10791
11310
|
}
|
|
@@ -10803,7 +11322,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10803
11322
|
return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];
|
|
10804
11323
|
case 1:
|
|
10805
11324
|
generatedPkceParams = _a.sent();
|
|
10806
|
-
authCodeRequest = __assign$1(__assign$1({}, request), { redirectUri: request.redirectUri, code:
|
|
11325
|
+
authCodeRequest = __assign$1(__assign$1({}, request), { redirectUri: request.redirectUri, code: Constants.EMPTY_STRING, codeVerifier: generatedPkceParams.verifier });
|
|
10807
11326
|
request.codeChallenge = generatedPkceParams.challenge;
|
|
10808
11327
|
request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;
|
|
10809
11328
|
return [2 /*return*/, authCodeRequest];
|
|
@@ -10919,7 +11438,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10919
11438
|
return __generator$1(this, function (_a) {
|
|
10920
11439
|
switch (_a.label) {
|
|
10921
11440
|
case 0:
|
|
10922
|
-
this.logger.verbose("getClientConfiguration called");
|
|
11441
|
+
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
10923
11442
|
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
|
|
10924
11443
|
case 1:
|
|
10925
11444
|
discoveredAuthority = _a.sent();
|
|
@@ -10946,9 +11465,10 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10946
11465
|
libraryInfo: {
|
|
10947
11466
|
sku: BrowserConstants.MSAL_SKU,
|
|
10948
11467
|
version: version,
|
|
10949
|
-
cpu:
|
|
10950
|
-
os:
|
|
10951
|
-
}
|
|
11468
|
+
cpu: Constants.EMPTY_STRING,
|
|
11469
|
+
os: Constants.EMPTY_STRING
|
|
11470
|
+
},
|
|
11471
|
+
telemetry: this.config.telemetry
|
|
10952
11472
|
}];
|
|
10953
11473
|
}
|
|
10954
11474
|
});
|
|
@@ -10982,11 +11502,12 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10982
11502
|
*/
|
|
10983
11503
|
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
|
|
10984
11504
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10985
|
-
var authorityOptions, userAuthority, builtAuthority;
|
|
11505
|
+
var getAuthorityMeasurement, authorityOptions, userAuthority, builtAuthority;
|
|
10986
11506
|
return __generator$1(this, function (_a) {
|
|
10987
11507
|
switch (_a.label) {
|
|
10988
11508
|
case 0:
|
|
10989
|
-
this.logger.verbose("getDiscoveredAuthority called");
|
|
11509
|
+
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
11510
|
+
getAuthorityMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10990
11511
|
authorityOptions = {
|
|
10991
11512
|
protocolMode: this.config.auth.protocolMode,
|
|
10992
11513
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
@@ -10995,8 +11516,20 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10995
11516
|
};
|
|
10996
11517
|
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
10997
11518
|
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
10998
|
-
this.logger.verbose("Creating discovered authority with configured authority");
|
|
10999
|
-
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)
|
|
11519
|
+
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
|
|
11520
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)
|
|
11521
|
+
.then(function (result) {
|
|
11522
|
+
getAuthorityMeasurement.endMeasurement({
|
|
11523
|
+
success: true
|
|
11524
|
+
});
|
|
11525
|
+
return result;
|
|
11526
|
+
})
|
|
11527
|
+
.catch(function (error) {
|
|
11528
|
+
getAuthorityMeasurement.endMeasurement({
|
|
11529
|
+
success: false
|
|
11530
|
+
});
|
|
11531
|
+
throw error;
|
|
11532
|
+
})];
|
|
11000
11533
|
case 1: return [2 /*return*/, _a.sent()];
|
|
11001
11534
|
}
|
|
11002
11535
|
});
|
|
@@ -11013,7 +11546,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
11013
11546
|
return __generator$1(this, function (_b) {
|
|
11014
11547
|
switch (_b.label) {
|
|
11015
11548
|
case 0:
|
|
11016
|
-
this.logger.verbose("initializeAuthorizationRequest called");
|
|
11549
|
+
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
11017
11550
|
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
11018
11551
|
browserState = {
|
|
11019
11552
|
interactionType: interactionType
|
|
@@ -11025,8 +11558,8 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
11025
11558
|
validatedRequest = __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT }]);
|
|
11026
11559
|
account = request.account || this.browserStorage.getActiveAccount();
|
|
11027
11560
|
if (account) {
|
|
11028
|
-
this.logger.verbose("Setting validated request account");
|
|
11029
|
-
this.logger.verbosePii("Setting validated request account: " + account);
|
|
11561
|
+
this.logger.verbose("Setting validated request account", this.correlationId);
|
|
11562
|
+
this.logger.verbosePii("Setting validated request account: " + account.homeAccountId, this.correlationId);
|
|
11030
11563
|
validatedRequest.account = account;
|
|
11031
11564
|
}
|
|
11032
11565
|
// Check for ADAL/MSAL v1 SSO
|
|
@@ -11497,7 +12030,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11497
12030
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
|
|
11498
12031
|
case 1:
|
|
11499
12032
|
validRequest = _a.sent();
|
|
11500
|
-
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint ||
|
|
12033
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
11501
12034
|
_a.label = 2;
|
|
11502
12035
|
case 2:
|
|
11503
12036
|
_a.trys.push([2, 8, , 9]);
|
|
@@ -11786,7 +12319,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11786
12319
|
case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
|
|
11787
12320
|
case 1:
|
|
11788
12321
|
validRequest = _a.sent();
|
|
11789
|
-
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint ||
|
|
12322
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
11790
12323
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
|
|
11791
12324
|
handleBackButton = function (event) {
|
|
11792
12325
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
@@ -11873,7 +12406,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11873
12406
|
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
11874
12407
|
return [2 /*return*/, null];
|
|
11875
12408
|
}
|
|
11876
|
-
loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) ||
|
|
12409
|
+
loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) || Constants.EMPTY_STRING;
|
|
11877
12410
|
loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
|
|
11878
12411
|
currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
|
|
11879
12412
|
if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];
|
|
@@ -12223,8 +12756,8 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12223
12756
|
*/
|
|
12224
12757
|
var SilentIframeClient = /** @class */ (function (_super) {
|
|
12225
12758
|
__extends$1(SilentIframeClient, _super);
|
|
12226
|
-
function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
|
|
12227
|
-
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
|
|
12759
|
+
function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId) {
|
|
12760
|
+
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) || this;
|
|
12228
12761
|
_this.apiId = apiId;
|
|
12229
12762
|
return _this;
|
|
12230
12763
|
}
|
|
@@ -12234,23 +12767,27 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12234
12767
|
*/
|
|
12235
12768
|
SilentIframeClient.prototype.acquireToken = function (request) {
|
|
12236
12769
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12237
|
-
var silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
|
|
12770
|
+
var acquireTokenMeasurement, silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
|
|
12238
12771
|
return __generator$1(this, function (_a) {
|
|
12239
12772
|
switch (_a.label) {
|
|
12240
12773
|
case 0:
|
|
12241
12774
|
this.logger.verbose("acquireTokenByIframe called");
|
|
12775
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
12242
12776
|
// Check that we have some SSO data
|
|
12243
12777
|
if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {
|
|
12244
12778
|
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
|
12245
12779
|
}
|
|
12246
12780
|
// Check that prompt is set to none, throw error if it is set to anything else.
|
|
12247
12781
|
if (request.prompt && request.prompt !== PromptValue.NONE) {
|
|
12782
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12783
|
+
success: false
|
|
12784
|
+
});
|
|
12248
12785
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
12249
12786
|
}
|
|
12250
12787
|
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12251
12788
|
case 1:
|
|
12252
12789
|
silentRequest = _a.sent();
|
|
12253
|
-
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint ||
|
|
12790
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
12254
12791
|
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12255
12792
|
_a.label = 2;
|
|
12256
12793
|
case 2:
|
|
@@ -12265,7 +12802,14 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12265
12802
|
return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];
|
|
12266
12803
|
case 5:
|
|
12267
12804
|
navigateUrl = _a.sent();
|
|
12268
|
-
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)
|
|
12805
|
+
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)
|
|
12806
|
+
.then(function (result) {
|
|
12807
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12808
|
+
success: true,
|
|
12809
|
+
fromCache: false
|
|
12810
|
+
});
|
|
12811
|
+
return result;
|
|
12812
|
+
})];
|
|
12269
12813
|
case 6: return [2 /*return*/, _a.sent()];
|
|
12270
12814
|
case 7:
|
|
12271
12815
|
e_1 = _a.sent();
|
|
@@ -12274,6 +12818,9 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12274
12818
|
}
|
|
12275
12819
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12276
12820
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12821
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12822
|
+
success: false
|
|
12823
|
+
});
|
|
12277
12824
|
throw e_1;
|
|
12278
12825
|
case 8: return [2 /*return*/];
|
|
12279
12826
|
}
|
|
@@ -12331,7 +12878,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12331
12878
|
*/
|
|
12332
12879
|
SilentRefreshClient.prototype.acquireToken = function (request) {
|
|
12333
12880
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12334
|
-
var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
|
|
12881
|
+
var silentRequest, _a, acquireTokenMeasurement, serverTelemetryManager, refreshTokenClient;
|
|
12335
12882
|
var _this = this;
|
|
12336
12883
|
return __generator$1(this, function (_b) {
|
|
12337
12884
|
switch (_b.label) {
|
|
@@ -12340,17 +12887,29 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12340
12887
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
12341
12888
|
case 1:
|
|
12342
12889
|
silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
|
|
12890
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
12343
12891
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
12344
12892
|
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12345
12893
|
case 2:
|
|
12346
12894
|
refreshTokenClient = _b.sent();
|
|
12347
12895
|
this.logger.verbose("Refresh token client created");
|
|
12348
12896
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
12349
|
-
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)
|
|
12897
|
+
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)
|
|
12898
|
+
.then(function (result) {
|
|
12899
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12900
|
+
success: true,
|
|
12901
|
+
fromCache: result.fromCache
|
|
12902
|
+
});
|
|
12903
|
+
return result;
|
|
12904
|
+
})
|
|
12905
|
+
.catch(function (e) {
|
|
12350
12906
|
if (e instanceof AuthError) {
|
|
12351
12907
|
e.setCorrelationId(_this.correlationId);
|
|
12352
12908
|
}
|
|
12353
12909
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
12910
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12911
|
+
success: false
|
|
12912
|
+
});
|
|
12354
12913
|
throw e;
|
|
12355
12914
|
})];
|
|
12356
12915
|
}
|
|
@@ -12523,8 +13082,8 @@ var HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
12523
13082
|
*/
|
|
12524
13083
|
var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
12525
13084
|
__extends$1(SilentAuthCodeClient, _super);
|
|
12526
|
-
function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
|
|
12527
|
-
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
|
|
13085
|
+
function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId) {
|
|
13086
|
+
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) || this;
|
|
12528
13087
|
_this.apiId = apiId;
|
|
12529
13088
|
return _this;
|
|
12530
13089
|
}
|
|
@@ -12546,7 +13105,7 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
12546
13105
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
12547
13106
|
case 1:
|
|
12548
13107
|
silentRequest = _a.sent();
|
|
12549
|
-
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint ||
|
|
13108
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
12550
13109
|
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12551
13110
|
_a.label = 2;
|
|
12552
13111
|
case 2:
|
|
@@ -12588,6 +13147,110 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
12588
13147
|
return SilentAuthCodeClient;
|
|
12589
13148
|
}(StandardInteractionClient));
|
|
12590
13149
|
|
|
13150
|
+
/*
|
|
13151
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13152
|
+
* Licensed under the MIT License.
|
|
13153
|
+
*/
|
|
13154
|
+
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
13155
|
+
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
13156
|
+
this.correlationId = correlationId;
|
|
13157
|
+
this.measureName = "msal.measure." + name + "." + this.correlationId;
|
|
13158
|
+
this.startMark = "msal.start." + name + "." + this.correlationId;
|
|
13159
|
+
this.endMark = "msal.end." + name + "." + this.correlationId;
|
|
13160
|
+
}
|
|
13161
|
+
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
13162
|
+
return typeof window !== "undefined" &&
|
|
13163
|
+
typeof window.performance !== "undefined" &&
|
|
13164
|
+
typeof window.performance.mark === "function" &&
|
|
13165
|
+
typeof window.performance.measure === "function" &&
|
|
13166
|
+
typeof window.performance.clearMarks === "function" &&
|
|
13167
|
+
typeof window.performance.clearMeasures === "function" &&
|
|
13168
|
+
typeof window.performance.getEntriesByName === "function";
|
|
13169
|
+
};
|
|
13170
|
+
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
13171
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
13172
|
+
try {
|
|
13173
|
+
window.performance.mark(this.startMark);
|
|
13174
|
+
}
|
|
13175
|
+
catch (e) {
|
|
13176
|
+
// Silently catch
|
|
13177
|
+
}
|
|
13178
|
+
}
|
|
13179
|
+
};
|
|
13180
|
+
BrowserPerformanceMeasurement.prototype.endMeasurement = function () {
|
|
13181
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
13182
|
+
try {
|
|
13183
|
+
window.performance.mark(this.endMark);
|
|
13184
|
+
window.performance.measure(this.measureName, this.startMark, this.endMark);
|
|
13185
|
+
}
|
|
13186
|
+
catch (e) {
|
|
13187
|
+
// Silently catch
|
|
13188
|
+
}
|
|
13189
|
+
}
|
|
13190
|
+
};
|
|
13191
|
+
BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {
|
|
13192
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
13193
|
+
try {
|
|
13194
|
+
var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, "measure");
|
|
13195
|
+
if (entriesForMeasurement.length > 0) {
|
|
13196
|
+
var durationMs = entriesForMeasurement[0].duration;
|
|
13197
|
+
window.performance.clearMeasures(this.measureName);
|
|
13198
|
+
window.performance.clearMarks(this.startMark);
|
|
13199
|
+
window.performance.clearMarks(this.endMark);
|
|
13200
|
+
return durationMs;
|
|
13201
|
+
}
|
|
13202
|
+
}
|
|
13203
|
+
catch (e) {
|
|
13204
|
+
// Silently catch and return null
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
return null;
|
|
13208
|
+
};
|
|
13209
|
+
return BrowserPerformanceMeasurement;
|
|
13210
|
+
}());
|
|
13211
|
+
|
|
13212
|
+
/*
|
|
13213
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13214
|
+
* Licensed under the MIT License.
|
|
13215
|
+
*/
|
|
13216
|
+
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
13217
|
+
__extends$1(BrowserPerformanceClient, _super);
|
|
13218
|
+
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
13219
|
+
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
13220
|
+
_this.browserCrypto = new BrowserCrypto(_this.logger);
|
|
13221
|
+
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
13222
|
+
return _this;
|
|
13223
|
+
}
|
|
13224
|
+
BrowserPerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {
|
|
13225
|
+
return new BrowserPerformanceMeasurement(measureName, correlationId);
|
|
13226
|
+
};
|
|
13227
|
+
BrowserPerformanceClient.prototype.generateId = function () {
|
|
13228
|
+
return this.guidGenerator.generateGuid();
|
|
13229
|
+
};
|
|
13230
|
+
BrowserPerformanceClient.prototype.getPageVisibility = function () {
|
|
13231
|
+
var _a;
|
|
13232
|
+
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
13233
|
+
};
|
|
13234
|
+
/**
|
|
13235
|
+
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
13236
|
+
* Also captures browser page visibilityState.
|
|
13237
|
+
*
|
|
13238
|
+
* @param {PerformanceEvents} measureName
|
|
13239
|
+
* @param {?string} [correlationId]
|
|
13240
|
+
* @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
|
|
13241
|
+
*/
|
|
13242
|
+
BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {
|
|
13243
|
+
var _this = this;
|
|
13244
|
+
// Capture page visibilityState and then invoke start/end measurement
|
|
13245
|
+
var startPageVisibility = this.getPageVisibility();
|
|
13246
|
+
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
13247
|
+
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
13248
|
+
return inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
13249
|
+
} });
|
|
13250
|
+
};
|
|
13251
|
+
return BrowserPerformanceClient;
|
|
13252
|
+
}(PerformanceClient));
|
|
13253
|
+
|
|
12591
13254
|
/*
|
|
12592
13255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12593
13256
|
* Licensed under the MIT License.
|
|
@@ -12633,8 +13296,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12633
13296
|
this.redirectResponse = new Map();
|
|
12634
13297
|
// Initial hybrid spa map
|
|
12635
13298
|
this.hybridAuthCodeResponses = new Map();
|
|
13299
|
+
// Initialize performance client
|
|
13300
|
+
this.performanceClient = this.isBrowserEnvironment ?
|
|
13301
|
+
new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application) :
|
|
13302
|
+
new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
12636
13303
|
// Initialize the crypto class.
|
|
12637
|
-
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
13304
|
+
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
12638
13305
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
12639
13306
|
// Initialize the browser storage class.
|
|
12640
13307
|
this.browserStorage = this.isBrowserEnvironment ?
|
|
@@ -12664,8 +13331,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12664
13331
|
if (typeof response === "undefined") {
|
|
12665
13332
|
this.eventHandler.emitEvent(exports.EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
12666
13333
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
12667
|
-
correlationId = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, true) ||
|
|
12668
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
|
|
13334
|
+
correlationId = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
|
|
13335
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
12669
13336
|
response = redirectClient.handleRedirectPromise(hash)
|
|
12670
13337
|
.then(function (result) {
|
|
12671
13338
|
if (result) {
|
|
@@ -12717,11 +13384,11 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12717
13384
|
*/
|
|
12718
13385
|
ClientApplication.prototype.acquireTokenRedirect = function (request) {
|
|
12719
13386
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12720
|
-
var isLoggedIn, redirectClient;
|
|
13387
|
+
var correlationId, isLoggedIn, redirectClient;
|
|
12721
13388
|
var _this = this;
|
|
12722
13389
|
return __generator$1(this, function (_a) {
|
|
12723
|
-
|
|
12724
|
-
this.logger.verbose("acquireTokenRedirect called");
|
|
13390
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
13391
|
+
this.logger.verbose("acquireTokenRedirect called", correlationId);
|
|
12725
13392
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12726
13393
|
isLoggedIn = this.getAllAccounts().length > 0;
|
|
12727
13394
|
if (isLoggedIn) {
|
|
@@ -12730,8 +13397,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12730
13397
|
else {
|
|
12731
13398
|
this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Redirect, request);
|
|
12732
13399
|
}
|
|
12733
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12734
|
-
return [2 /*return*/, redirectClient.acquireToken(request).catch(function (e) {
|
|
13400
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
13401
|
+
return [2 /*return*/, redirectClient.acquireToken(__assign$1(__assign$1({}, request), { correlationId: correlationId })).catch(function (e) {
|
|
12735
13402
|
// If logged in, emit acquire token events
|
|
12736
13403
|
if (isLoggedIn) {
|
|
12737
13404
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
@@ -12755,8 +13422,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12755
13422
|
*/
|
|
12756
13423
|
ClientApplication.prototype.acquireTokenPopup = function (request) {
|
|
12757
13424
|
var _this = this;
|
|
13425
|
+
var correlationId = this.getRequestCorrelationId(request);
|
|
12758
13426
|
try {
|
|
12759
|
-
this.logger.verbose("acquireTokenPopup called",
|
|
13427
|
+
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
12760
13428
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12761
13429
|
}
|
|
12762
13430
|
catch (e) {
|
|
@@ -12771,8 +13439,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12771
13439
|
else {
|
|
12772
13440
|
this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Popup, request);
|
|
12773
13441
|
}
|
|
12774
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12775
|
-
return popupClient.acquireToken(request).then(function (result) {
|
|
13442
|
+
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
13443
|
+
return popupClient.acquireToken(__assign$1(__assign$1({}, request), { correlationId: correlationId })).then(function (result) {
|
|
12776
13444
|
// If logged in, emit acquire token events
|
|
12777
13445
|
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
|
|
12778
13446
|
if (isLoggingIn) {
|
|
@@ -12812,25 +13480,35 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12812
13480
|
*/
|
|
12813
13481
|
ClientApplication.prototype.ssoSilent = function (request) {
|
|
12814
13482
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12815
|
-
var silentIframeClient, silentTokenResult, e_1;
|
|
13483
|
+
var correlationId, ssoSilentMeasurement, silentIframeClient, silentTokenResult, e_1;
|
|
12816
13484
|
return __generator$1(this, function (_a) {
|
|
12817
13485
|
switch (_a.label) {
|
|
12818
13486
|
case 0:
|
|
13487
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
12819
13488
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
12820
|
-
this.
|
|
13489
|
+
ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
13490
|
+
this.logger.verbose("ssoSilent called", correlationId);
|
|
12821
13491
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_START, exports.InteractionType.Silent, request);
|
|
12822
13492
|
_a.label = 1;
|
|
12823
13493
|
case 1:
|
|
12824
13494
|
_a.trys.push([1, 3, , 4]);
|
|
12825
|
-
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent,
|
|
12826
|
-
return [4 /*yield*/, silentIframeClient.acquireToken(request)];
|
|
13495
|
+
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent, this.performanceClient, correlationId);
|
|
13496
|
+
return [4 /*yield*/, silentIframeClient.acquireToken(__assign$1(__assign$1({}, request), { correlationId: correlationId }))];
|
|
12827
13497
|
case 2:
|
|
12828
13498
|
silentTokenResult = _a.sent();
|
|
12829
13499
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, silentTokenResult);
|
|
13500
|
+
ssoSilentMeasurement.endMeasurement({
|
|
13501
|
+
success: true
|
|
13502
|
+
});
|
|
13503
|
+
ssoSilentMeasurement.flushMeasurement();
|
|
12830
13504
|
return [2 /*return*/, silentTokenResult];
|
|
12831
13505
|
case 3:
|
|
12832
13506
|
e_1 = _a.sent();
|
|
12833
13507
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e_1);
|
|
13508
|
+
ssoSilentMeasurement.endMeasurement({
|
|
13509
|
+
success: false
|
|
13510
|
+
});
|
|
13511
|
+
ssoSilentMeasurement.flushMeasurement();
|
|
12834
13512
|
throw e_1;
|
|
12835
13513
|
case 4: return [2 /*return*/];
|
|
12836
13514
|
}
|
|
@@ -12849,38 +13527,56 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12849
13527
|
*/
|
|
12850
13528
|
ClientApplication.prototype.acquireTokenByCode = function (request) {
|
|
12851
13529
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12852
|
-
var response;
|
|
13530
|
+
var correlationId, atbcMeasurement, response;
|
|
12853
13531
|
var _this = this;
|
|
12854
13532
|
return __generator$1(this, function (_a) {
|
|
13533
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
12855
13534
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
12856
|
-
this.logger.trace("acquireTokenByCode called",
|
|
13535
|
+
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
12857
13536
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
13537
|
+
atbcMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenByCode, request.correlationId);
|
|
12858
13538
|
try {
|
|
12859
13539
|
if (!request.code) {
|
|
12860
13540
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
12861
13541
|
}
|
|
12862
13542
|
response = this.hybridAuthCodeResponses.get(request.code);
|
|
12863
13543
|
if (!response) {
|
|
12864
|
-
this.logger.verbose("Initiating new acquireTokenByCode request",
|
|
12865
|
-
response = this.acquireTokenByCodeAsync(request)
|
|
13544
|
+
this.logger.verbose("Initiating new acquireTokenByCode request", correlationId);
|
|
13545
|
+
response = this.acquireTokenByCodeAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }))
|
|
12866
13546
|
.then(function (result) {
|
|
12867
13547
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
12868
13548
|
_this.hybridAuthCodeResponses.delete(request.code);
|
|
13549
|
+
atbcMeasurement.endMeasurement({
|
|
13550
|
+
success: true
|
|
13551
|
+
});
|
|
13552
|
+
atbcMeasurement.flushMeasurement();
|
|
12869
13553
|
return result;
|
|
12870
13554
|
})
|
|
12871
13555
|
.catch(function (error) {
|
|
12872
13556
|
_this.hybridAuthCodeResponses.delete(request.code);
|
|
13557
|
+
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
13558
|
+
atbcMeasurement.endMeasurement({
|
|
13559
|
+
success: false
|
|
13560
|
+
});
|
|
13561
|
+
atbcMeasurement.flushMeasurement();
|
|
12873
13562
|
throw error;
|
|
12874
13563
|
});
|
|
12875
13564
|
this.hybridAuthCodeResponses.set(request.code, response);
|
|
12876
13565
|
}
|
|
12877
13566
|
else {
|
|
12878
13567
|
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
|
|
13568
|
+
atbcMeasurement.endMeasurement({
|
|
13569
|
+
success: true
|
|
13570
|
+
});
|
|
13571
|
+
atbcMeasurement.discardMeasurement();
|
|
12879
13572
|
}
|
|
12880
13573
|
return [2 /*return*/, response];
|
|
12881
13574
|
}
|
|
12882
13575
|
catch (e) {
|
|
12883
13576
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
13577
|
+
atbcMeasurement.endMeasurement({
|
|
13578
|
+
success: false
|
|
13579
|
+
});
|
|
12884
13580
|
throw e;
|
|
12885
13581
|
}
|
|
12886
13582
|
return [2 /*return*/];
|
|
@@ -12899,7 +13595,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12899
13595
|
switch (_a.label) {
|
|
12900
13596
|
case 0:
|
|
12901
13597
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
12902
|
-
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenByCode, request.correlationId);
|
|
13598
|
+
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.acquireTokenByCode, this.performanceClient, request.correlationId);
|
|
12903
13599
|
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
|
|
12904
13600
|
case 1:
|
|
12905
13601
|
silentTokenResult = _a.sent();
|
|
@@ -12921,22 +13617,47 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12921
13617
|
*/
|
|
12922
13618
|
ClientApplication.prototype.acquireTokenByRefreshToken = function (request) {
|
|
12923
13619
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12924
|
-
var silentRefreshClient;
|
|
13620
|
+
var atbrtMeasurement, silentRefreshClient;
|
|
12925
13621
|
var _this = this;
|
|
12926
13622
|
return __generator$1(this, function (_a) {
|
|
12927
|
-
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, request);
|
|
12928
13623
|
// block the reload if it occurred inside a hidden iframe
|
|
12929
13624
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
12930
|
-
|
|
12931
|
-
|
|
13625
|
+
atbrtMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenByRefreshToken, request.correlationId);
|
|
13626
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, request);
|
|
13627
|
+
silentRefreshClient = new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, request.correlationId);
|
|
13628
|
+
return [2 /*return*/, silentRefreshClient.acquireToken(request)
|
|
13629
|
+
.then(function (result) {
|
|
13630
|
+
atbrtMeasurement.endMeasurement({
|
|
13631
|
+
success: true,
|
|
13632
|
+
fromCache: result.fromCache
|
|
13633
|
+
});
|
|
13634
|
+
return result;
|
|
13635
|
+
})
|
|
13636
|
+
.catch(function (e) {
|
|
12932
13637
|
var isServerError = e instanceof ServerError;
|
|
12933
13638
|
var isInteractionRequiredError = e instanceof InteractionRequiredAuthError;
|
|
12934
13639
|
var isInvalidGrantError = (e.errorCode === BrowserConstants.INVALID_GRANT_ERROR);
|
|
12935
13640
|
if (isServerError && isInvalidGrantError && !isInteractionRequiredError) {
|
|
12936
13641
|
_this.logger.verbose("Refresh token expired or invalid, attempting acquire token by iframe", request.correlationId);
|
|
12937
|
-
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, exports.ApiId.acquireTokenSilent_authCode, request.correlationId);
|
|
12938
|
-
return silentIframeClient.acquireToken(request)
|
|
13642
|
+
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, exports.ApiId.acquireTokenSilent_authCode, _this.performanceClient, request.correlationId);
|
|
13643
|
+
return silentIframeClient.acquireToken(request)
|
|
13644
|
+
.then(function (result) {
|
|
13645
|
+
atbrtMeasurement.endMeasurement({
|
|
13646
|
+
success: true,
|
|
13647
|
+
fromCache: result.fromCache
|
|
13648
|
+
});
|
|
13649
|
+
return result;
|
|
13650
|
+
})
|
|
13651
|
+
.catch(function (error) {
|
|
13652
|
+
atbrtMeasurement.endMeasurement({
|
|
13653
|
+
success: false
|
|
13654
|
+
});
|
|
13655
|
+
throw error;
|
|
13656
|
+
});
|
|
12939
13657
|
}
|
|
13658
|
+
atbrtMeasurement.endMeasurement({
|
|
13659
|
+
success: false
|
|
13660
|
+
});
|
|
12940
13661
|
throw e;
|
|
12941
13662
|
})];
|
|
12942
13663
|
});
|
|
@@ -12951,9 +13672,11 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12951
13672
|
*/
|
|
12952
13673
|
ClientApplication.prototype.logout = function (logoutRequest) {
|
|
12953
13674
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13675
|
+
var correlationId;
|
|
12954
13676
|
return __generator$1(this, function (_a) {
|
|
12955
|
-
this.
|
|
12956
|
-
|
|
13677
|
+
correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
13678
|
+
this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.", correlationId);
|
|
13679
|
+
return [2 /*return*/, this.logoutRedirect(__assign$1({ correlationId: correlationId }, logoutRequest))];
|
|
12957
13680
|
});
|
|
12958
13681
|
});
|
|
12959
13682
|
};
|
|
@@ -12964,11 +13687,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12964
13687
|
*/
|
|
12965
13688
|
ClientApplication.prototype.logoutRedirect = function (logoutRequest) {
|
|
12966
13689
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12967
|
-
var redirectClient;
|
|
13690
|
+
var correlationId, redirectClient;
|
|
12968
13691
|
return __generator$1(this, function (_a) {
|
|
13692
|
+
correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
12969
13693
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12970
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12971
|
-
return [2 /*return*/, redirectClient.logout(logoutRequest)];
|
|
13694
|
+
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
13695
|
+
return [2 /*return*/, redirectClient.logout(__assign$1({ correlationId: correlationId }, logoutRequest))];
|
|
12972
13696
|
});
|
|
12973
13697
|
});
|
|
12974
13698
|
};
|
|
@@ -12978,9 +13702,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12978
13702
|
*/
|
|
12979
13703
|
ClientApplication.prototype.logoutPopup = function (logoutRequest) {
|
|
12980
13704
|
try {
|
|
13705
|
+
var correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
12981
13706
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12982
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12983
|
-
return popupClient.logout(logoutRequest);
|
|
13707
|
+
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
|
|
13708
|
+
return popupClient.logout(__assign$1({ correlationId: correlationId }, logoutRequest));
|
|
12984
13709
|
}
|
|
12985
13710
|
catch (e) {
|
|
12986
13711
|
// Since this function is syncronous we need to reject
|
|
@@ -13122,6 +13847,24 @@ var ClientApplication = /** @class */ (function () {
|
|
|
13122
13847
|
ClientApplication.prototype.removeEventCallback = function (callbackId) {
|
|
13123
13848
|
this.eventHandler.removeEventCallback(callbackId);
|
|
13124
13849
|
};
|
|
13850
|
+
/**
|
|
13851
|
+
* Registers a callback to receive performance events.
|
|
13852
|
+
*
|
|
13853
|
+
* @param {PerformanceCallbackFunction} callback
|
|
13854
|
+
* @returns {string}
|
|
13855
|
+
*/
|
|
13856
|
+
ClientApplication.prototype.addPerformanceCallback = function (callback) {
|
|
13857
|
+
return this.performanceClient.addPerformanceCallback(callback);
|
|
13858
|
+
};
|
|
13859
|
+
/**
|
|
13860
|
+
* Removes a callback registered with addPerformanceCallback.
|
|
13861
|
+
*
|
|
13862
|
+
* @param {string} callbackId
|
|
13863
|
+
* @returns {boolean}
|
|
13864
|
+
*/
|
|
13865
|
+
ClientApplication.prototype.removePerformanceCallback = function (callbackId) {
|
|
13866
|
+
return this.performanceClient.removePerformanceCallback(callbackId);
|
|
13867
|
+
};
|
|
13125
13868
|
/**
|
|
13126
13869
|
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
|
|
13127
13870
|
*/
|
|
@@ -13175,6 +13918,26 @@ var ClientApplication = /** @class */ (function () {
|
|
|
13175
13918
|
ClientApplication.prototype.getConfiguration = function () {
|
|
13176
13919
|
return this.config;
|
|
13177
13920
|
};
|
|
13921
|
+
/**
|
|
13922
|
+
* Generates a correlation id for a request if none is provided.
|
|
13923
|
+
*
|
|
13924
|
+
* @protected
|
|
13925
|
+
* @param {?Partial<BaseAuthRequest>} [request]
|
|
13926
|
+
* @returns {string}
|
|
13927
|
+
*/
|
|
13928
|
+
ClientApplication.prototype.getRequestCorrelationId = function (request) {
|
|
13929
|
+
if (request === null || request === void 0 ? void 0 : request.correlationId) {
|
|
13930
|
+
return request.correlationId;
|
|
13931
|
+
}
|
|
13932
|
+
if (this.isBrowserEnvironment) {
|
|
13933
|
+
return this.browserCrypto.createNewGuid();
|
|
13934
|
+
}
|
|
13935
|
+
/*
|
|
13936
|
+
* Included for fallback for non-browser environments,
|
|
13937
|
+
* and to ensure this method always returns a string.
|
|
13938
|
+
*/
|
|
13939
|
+
return Constants.EMPTY_STRING;
|
|
13940
|
+
};
|
|
13178
13941
|
return ClientApplication;
|
|
13179
13942
|
}());
|
|
13180
13943
|
|
|
@@ -13193,10 +13956,11 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
13193
13956
|
*/
|
|
13194
13957
|
SilentCacheClient.prototype.acquireToken = function (silentRequest) {
|
|
13195
13958
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13196
|
-
var serverTelemetryManager, silentAuthClient, cachedToken, error_1;
|
|
13959
|
+
var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
|
|
13197
13960
|
return __generator$1(this, function (_a) {
|
|
13198
13961
|
switch (_a.label) {
|
|
13199
13962
|
case 0:
|
|
13963
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
13200
13964
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
13201
13965
|
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
13202
13966
|
case 1:
|
|
@@ -13209,12 +13973,19 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
13209
13973
|
case 3:
|
|
13210
13974
|
cachedToken = _a.sent();
|
|
13211
13975
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, cachedToken);
|
|
13976
|
+
acquireTokenMeasurement.endMeasurement({
|
|
13977
|
+
success: true,
|
|
13978
|
+
fromCache: true
|
|
13979
|
+
});
|
|
13212
13980
|
return [2 /*return*/, cachedToken];
|
|
13213
13981
|
case 4:
|
|
13214
13982
|
error_1 = _a.sent();
|
|
13215
13983
|
if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
|
|
13216
13984
|
this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
|
|
13217
13985
|
}
|
|
13986
|
+
acquireTokenMeasurement.endMeasurement({
|
|
13987
|
+
success: false
|
|
13988
|
+
});
|
|
13218
13989
|
throw error_1;
|
|
13219
13990
|
case 5: return [2 /*return*/];
|
|
13220
13991
|
}
|
|
@@ -13309,9 +14080,11 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13309
14080
|
*/
|
|
13310
14081
|
PublicClientApplication.prototype.loginRedirect = function (request) {
|
|
13311
14082
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
14083
|
+
var correlationId;
|
|
13312
14084
|
return __generator$1(this, function (_a) {
|
|
13313
|
-
this.
|
|
13314
|
-
|
|
14085
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
14086
|
+
this.logger.verbose("loginRedirect called", correlationId);
|
|
14087
|
+
return [2 /*return*/, this.acquireTokenRedirect(__assign$1({ correlationId: correlationId }, (request || DEFAULT_REQUEST)))];
|
|
13315
14088
|
});
|
|
13316
14089
|
});
|
|
13317
14090
|
};
|
|
@@ -13323,8 +14096,9 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13323
14096
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
13324
14097
|
*/
|
|
13325
14098
|
PublicClientApplication.prototype.loginPopup = function (request) {
|
|
13326
|
-
this.
|
|
13327
|
-
|
|
14099
|
+
var correlationId = this.getRequestCorrelationId(request);
|
|
14100
|
+
this.logger.verbose("loginPopup called", correlationId);
|
|
14101
|
+
return this.acquireTokenPopup(__assign$1({ correlationId: correlationId }, (request || DEFAULT_REQUEST)));
|
|
13328
14102
|
};
|
|
13329
14103
|
/**
|
|
13330
14104
|
* Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
|
|
@@ -13334,18 +14108,20 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13334
14108
|
*/
|
|
13335
14109
|
PublicClientApplication.prototype.acquireTokenSilent = function (request) {
|
|
13336
14110
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13337
|
-
var account, thumbprint, silentRequestKey, cachedResponse, response;
|
|
14111
|
+
var correlationId, atsMeasurement, account, thumbprint, silentRequestKey, cachedResponse, response;
|
|
13338
14112
|
var _this = this;
|
|
13339
14113
|
return __generator$1(this, function (_a) {
|
|
14114
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
14115
|
+
atsMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
13340
14116
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
13341
|
-
this.logger.verbose("acquireTokenSilent called",
|
|
14117
|
+
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
13342
14118
|
account = request.account || this.getActiveAccount();
|
|
13343
14119
|
if (!account) {
|
|
13344
14120
|
throw BrowserAuthError.createNoAccountError();
|
|
13345
14121
|
}
|
|
13346
14122
|
thumbprint = {
|
|
13347
14123
|
clientId: this.config.auth.clientId,
|
|
13348
|
-
authority: request.authority ||
|
|
14124
|
+
authority: request.authority || Constants.EMPTY_STRING,
|
|
13349
14125
|
scopes: request.scopes,
|
|
13350
14126
|
homeAccountIdentifier: account.homeAccountId,
|
|
13351
14127
|
claims: request.claims,
|
|
@@ -13358,21 +14134,35 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13358
14134
|
silentRequestKey = JSON.stringify(thumbprint);
|
|
13359
14135
|
cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
13360
14136
|
if (typeof cachedResponse === "undefined") {
|
|
13361
|
-
this.logger.verbose("acquireTokenSilent called for the first time, storing active request",
|
|
13362
|
-
response = this.acquireTokenSilentAsync(request, account)
|
|
14137
|
+
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
14138
|
+
response = this.acquireTokenSilentAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }), account)
|
|
13363
14139
|
.then(function (result) {
|
|
13364
14140
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
14141
|
+
atsMeasurement.endMeasurement({
|
|
14142
|
+
success: true,
|
|
14143
|
+
fromCache: result.fromCache
|
|
14144
|
+
});
|
|
14145
|
+
atsMeasurement.flushMeasurement();
|
|
13365
14146
|
return result;
|
|
13366
14147
|
})
|
|
13367
14148
|
.catch(function (error) {
|
|
13368
14149
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
14150
|
+
atsMeasurement.endMeasurement({
|
|
14151
|
+
success: false
|
|
14152
|
+
});
|
|
14153
|
+
atsMeasurement.flushMeasurement();
|
|
13369
14154
|
throw error;
|
|
13370
14155
|
});
|
|
13371
14156
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
13372
14157
|
return [2 /*return*/, response];
|
|
13373
14158
|
}
|
|
13374
14159
|
else {
|
|
13375
|
-
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",
|
|
14160
|
+
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
|
|
14161
|
+
atsMeasurement.endMeasurement({
|
|
14162
|
+
success: true
|
|
14163
|
+
});
|
|
14164
|
+
// Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics
|
|
14165
|
+
atsMeasurement.discardMeasurement();
|
|
13376
14166
|
return [2 /*return*/, cachedResponse];
|
|
13377
14167
|
}
|
|
13378
14168
|
});
|
|
@@ -13386,17 +14176,26 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13386
14176
|
*/
|
|
13387
14177
|
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
|
|
13388
14178
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13389
|
-
var silentCacheClient, silentRequest;
|
|
14179
|
+
var astsAsyncMeasurement, silentCacheClient, silentRequest;
|
|
13390
14180
|
var _this = this;
|
|
13391
14181
|
return __generator$1(this, function (_a) {
|
|
13392
14182
|
switch (_a.label) {
|
|
13393
14183
|
case 0:
|
|
13394
|
-
|
|
14184
|
+
astsAsyncMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
14185
|
+
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, request.correlationId);
|
|
13395
14186
|
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
13396
14187
|
case 1:
|
|
13397
14188
|
silentRequest = _a.sent();
|
|
13398
14189
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
13399
|
-
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest)
|
|
14190
|
+
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest)
|
|
14191
|
+
.then(function (result) {
|
|
14192
|
+
astsAsyncMeasurement.endMeasurement({
|
|
14193
|
+
success: true,
|
|
14194
|
+
fromCache: result.fromCache
|
|
14195
|
+
});
|
|
14196
|
+
return result;
|
|
14197
|
+
})
|
|
14198
|
+
.catch(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
13400
14199
|
var tokenRenewalResult, tokenRenewalError_1;
|
|
13401
14200
|
return __generator$1(this, function (_a) {
|
|
13402
14201
|
switch (_a.label) {
|
|
@@ -13406,10 +14205,17 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13406
14205
|
case 1:
|
|
13407
14206
|
tokenRenewalResult = _a.sent();
|
|
13408
14207
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
|
|
14208
|
+
astsAsyncMeasurement.endMeasurement({
|
|
14209
|
+
success: true,
|
|
14210
|
+
fromCache: tokenRenewalResult.fromCache
|
|
14211
|
+
});
|
|
13409
14212
|
return [2 /*return*/, tokenRenewalResult];
|
|
13410
14213
|
case 2:
|
|
13411
14214
|
tokenRenewalError_1 = _a.sent();
|
|
13412
14215
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
|
|
14216
|
+
astsAsyncMeasurement.endMeasurement({
|
|
14217
|
+
success: false
|
|
14218
|
+
});
|
|
13413
14219
|
throw tokenRenewalError_1;
|
|
13414
14220
|
case 3: return [2 /*return*/];
|
|
13415
14221
|
}
|
|
@@ -13478,6 +14284,12 @@ var stubbedPublicClientApplication = {
|
|
|
13478
14284
|
removeEventCallback: function () {
|
|
13479
14285
|
return;
|
|
13480
14286
|
},
|
|
14287
|
+
addPerformanceCallback: function () {
|
|
14288
|
+
return "";
|
|
14289
|
+
},
|
|
14290
|
+
removePerformanceCallback: function () {
|
|
14291
|
+
return false;
|
|
14292
|
+
},
|
|
13481
14293
|
enableAccountStorageEvents: function () {
|
|
13482
14294
|
return;
|
|
13483
14295
|
},
|
|
@@ -13645,6 +14457,7 @@ exports.BrowserCacheManager = BrowserCacheManager;
|
|
|
13645
14457
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
13646
14458
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
13647
14459
|
exports.BrowserConstants = BrowserConstants;
|
|
14460
|
+
exports.BrowserPerformanceClient = BrowserPerformanceClient;
|
|
13648
14461
|
exports.BrowserUtils = BrowserUtils;
|
|
13649
14462
|
exports.ClientAuthError = ClientAuthError;
|
|
13650
14463
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|