@azure/msal-browser 2.21.0 → 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 +31 -2
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +152 -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 +2 -2
- 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.d.ts +14 -12
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +16 -12
- 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.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +4 -3
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +23 -10
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +21 -10
- 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 +1380 -436
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +4 -3
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +14 -14
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts +4 -3
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +52 -60
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +3 -3
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +22 -10
- 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 -4
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +2 -2
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +14 -6
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +4 -4
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +22 -7
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +19 -7
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +11 -11
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +84 -56
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
- package/dist/interaction_handler/PopupHandler.js +1 -3
- package/dist/interaction_handler/PopupHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -2
- package/dist/interaction_handler/RedirectHandler.js.map +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/request/EndSessionPopupRequest.d.ts +1 -0
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/EndSessionRequest.d.ts +1 -0
- package/dist/request/EndSessionRequest.d.ts.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.d.ts +2 -1
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +2 -1
- package/dist/utils/BrowserConstants.js.map +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.d.ts +1 -2
- package/dist/utils/PopupUtils.d.ts.map +1 -1
- package/dist/utils/PopupUtils.js +3 -3
- package/dist/utils/PopupUtils.js.map +1 -1
- package/lib/msal-browser.js +1380 -436
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +41 -31
- package/package.json +2 -2
- package/CHANGELOG.json +0 -1685
- package/CHANGELOG.md +0 -536
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.
|
|
@@ -206,6 +206,7 @@ var Constants = {
|
|
|
206
206
|
// default authority
|
|
207
207
|
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
208
208
|
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
209
|
+
DEFAULT_COMMON_TENANT: "common",
|
|
209
210
|
// ADFS String
|
|
210
211
|
ADFS: "adfs",
|
|
211
212
|
// Default AAD Instance Discovery Endpoint
|
|
@@ -316,6 +317,8 @@ var AADServerParamKeys;
|
|
|
316
317
|
AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
|
|
317
318
|
AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
|
|
318
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";
|
|
319
322
|
AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
|
|
320
323
|
AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
|
|
321
324
|
AADServerParamKeys["DEVICE_CODE"] = "device_code";
|
|
@@ -330,6 +333,7 @@ var AADServerParamKeys;
|
|
|
330
333
|
AADServerParamKeys["FOCI"] = "foci";
|
|
331
334
|
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
332
335
|
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
336
|
+
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
333
337
|
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
334
338
|
/**
|
|
335
339
|
* Claims request keys
|
|
@@ -554,7 +558,7 @@ var CacheOutcome;
|
|
|
554
558
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
555
559
|
})(CacheOutcome || (CacheOutcome = {}));
|
|
556
560
|
|
|
557
|
-
/*! @azure/msal-common v6.
|
|
561
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
558
562
|
|
|
559
563
|
/*
|
|
560
564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -580,8 +584,8 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
580
584
|
_this = _super.call(this, errorString) || this;
|
|
581
585
|
Object.setPrototypeOf(_this, AuthError.prototype);
|
|
582
586
|
_this.errorCode = errorCode || Constants.EMPTY_STRING;
|
|
583
|
-
_this.errorMessage = errorMessage ||
|
|
584
|
-
_this.subError = suberror ||
|
|
587
|
+
_this.errorMessage = errorMessage || Constants.EMPTY_STRING;
|
|
588
|
+
_this.subError = suberror || Constants.EMPTY_STRING;
|
|
585
589
|
_this.name = "AuthError";
|
|
586
590
|
return _this;
|
|
587
591
|
}
|
|
@@ -598,7 +602,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
598
602
|
return AuthError;
|
|
599
603
|
}(Error));
|
|
600
604
|
|
|
601
|
-
/*! @azure/msal-common v6.
|
|
605
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
602
606
|
|
|
603
607
|
/*
|
|
604
608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -673,7 +677,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
673
677
|
}
|
|
674
678
|
};
|
|
675
679
|
|
|
676
|
-
/*! @azure/msal-common v6.
|
|
680
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
677
681
|
|
|
678
682
|
/*
|
|
679
683
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1135,7 +1139,7 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1135
1139
|
return ClientAuthError;
|
|
1136
1140
|
}(AuthError));
|
|
1137
1141
|
|
|
1138
|
-
/*! @azure/msal-common v6.
|
|
1142
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1139
1143
|
|
|
1140
1144
|
/*
|
|
1141
1145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1260,7 +1264,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1260
1264
|
return StringUtils;
|
|
1261
1265
|
}());
|
|
1262
1266
|
|
|
1263
|
-
/*! @azure/msal-common v6.
|
|
1267
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1264
1268
|
|
|
1265
1269
|
/*
|
|
1266
1270
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1290,7 +1294,7 @@ var Logger = /** @class */ (function () {
|
|
|
1290
1294
|
this.localCallback = loggerOptions.loggerCallback || defaultLoggerCallback;
|
|
1291
1295
|
this.piiLoggingEnabled = loggerOptions.piiLoggingEnabled || false;
|
|
1292
1296
|
this.level = typeof (loggerOptions.logLevel) === "number" ? loggerOptions.logLevel : exports.LogLevel.Info;
|
|
1293
|
-
this.correlationId = loggerOptions.correlationId ||
|
|
1297
|
+
this.correlationId = loggerOptions.correlationId || Constants.EMPTY_STRING;
|
|
1294
1298
|
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
1295
1299
|
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
1296
1300
|
}
|
|
@@ -1320,7 +1324,7 @@ var Logger = /** @class */ (function () {
|
|
|
1320
1324
|
logHeader = "[" + timestamp + "]";
|
|
1321
1325
|
}
|
|
1322
1326
|
var log = logHeader + " : " + this.packageName + "@" + this.packageVersion + " : " + exports.LogLevel[options.logLevel] + " - " + logMessage;
|
|
1323
|
-
// 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);
|
|
1324
1328
|
this.executeCallback(options.logLevel, log, options.containsPii || false);
|
|
1325
1329
|
};
|
|
1326
1330
|
/**
|
|
@@ -1338,7 +1342,7 @@ var Logger = /** @class */ (function () {
|
|
|
1338
1342
|
this.logMessage(message, {
|
|
1339
1343
|
logLevel: exports.LogLevel.Error,
|
|
1340
1344
|
containsPii: false,
|
|
1341
|
-
correlationId: correlationId ||
|
|
1345
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1342
1346
|
});
|
|
1343
1347
|
};
|
|
1344
1348
|
/**
|
|
@@ -1348,7 +1352,7 @@ var Logger = /** @class */ (function () {
|
|
|
1348
1352
|
this.logMessage(message, {
|
|
1349
1353
|
logLevel: exports.LogLevel.Error,
|
|
1350
1354
|
containsPii: true,
|
|
1351
|
-
correlationId: correlationId ||
|
|
1355
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1352
1356
|
});
|
|
1353
1357
|
};
|
|
1354
1358
|
/**
|
|
@@ -1358,7 +1362,7 @@ var Logger = /** @class */ (function () {
|
|
|
1358
1362
|
this.logMessage(message, {
|
|
1359
1363
|
logLevel: exports.LogLevel.Warning,
|
|
1360
1364
|
containsPii: false,
|
|
1361
|
-
correlationId: correlationId ||
|
|
1365
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1362
1366
|
});
|
|
1363
1367
|
};
|
|
1364
1368
|
/**
|
|
@@ -1368,7 +1372,7 @@ var Logger = /** @class */ (function () {
|
|
|
1368
1372
|
this.logMessage(message, {
|
|
1369
1373
|
logLevel: exports.LogLevel.Warning,
|
|
1370
1374
|
containsPii: true,
|
|
1371
|
-
correlationId: correlationId ||
|
|
1375
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1372
1376
|
});
|
|
1373
1377
|
};
|
|
1374
1378
|
/**
|
|
@@ -1378,7 +1382,7 @@ var Logger = /** @class */ (function () {
|
|
|
1378
1382
|
this.logMessage(message, {
|
|
1379
1383
|
logLevel: exports.LogLevel.Info,
|
|
1380
1384
|
containsPii: false,
|
|
1381
|
-
correlationId: correlationId ||
|
|
1385
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1382
1386
|
});
|
|
1383
1387
|
};
|
|
1384
1388
|
/**
|
|
@@ -1388,7 +1392,7 @@ var Logger = /** @class */ (function () {
|
|
|
1388
1392
|
this.logMessage(message, {
|
|
1389
1393
|
logLevel: exports.LogLevel.Info,
|
|
1390
1394
|
containsPii: true,
|
|
1391
|
-
correlationId: correlationId ||
|
|
1395
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1392
1396
|
});
|
|
1393
1397
|
};
|
|
1394
1398
|
/**
|
|
@@ -1398,7 +1402,7 @@ var Logger = /** @class */ (function () {
|
|
|
1398
1402
|
this.logMessage(message, {
|
|
1399
1403
|
logLevel: exports.LogLevel.Verbose,
|
|
1400
1404
|
containsPii: false,
|
|
1401
|
-
correlationId: correlationId ||
|
|
1405
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1402
1406
|
});
|
|
1403
1407
|
};
|
|
1404
1408
|
/**
|
|
@@ -1408,7 +1412,7 @@ var Logger = /** @class */ (function () {
|
|
|
1408
1412
|
this.logMessage(message, {
|
|
1409
1413
|
logLevel: exports.LogLevel.Verbose,
|
|
1410
1414
|
containsPii: true,
|
|
1411
|
-
correlationId: correlationId ||
|
|
1415
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1412
1416
|
});
|
|
1413
1417
|
};
|
|
1414
1418
|
/**
|
|
@@ -1418,7 +1422,7 @@ var Logger = /** @class */ (function () {
|
|
|
1418
1422
|
this.logMessage(message, {
|
|
1419
1423
|
logLevel: exports.LogLevel.Trace,
|
|
1420
1424
|
containsPii: false,
|
|
1421
|
-
correlationId: correlationId ||
|
|
1425
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1422
1426
|
});
|
|
1423
1427
|
};
|
|
1424
1428
|
/**
|
|
@@ -1428,7 +1432,7 @@ var Logger = /** @class */ (function () {
|
|
|
1428
1432
|
this.logMessage(message, {
|
|
1429
1433
|
logLevel: exports.LogLevel.Trace,
|
|
1430
1434
|
containsPii: true,
|
|
1431
|
-
correlationId: correlationId ||
|
|
1435
|
+
correlationId: correlationId || Constants.EMPTY_STRING
|
|
1432
1436
|
});
|
|
1433
1437
|
};
|
|
1434
1438
|
/**
|
|
@@ -1440,12 +1444,33 @@ var Logger = /** @class */ (function () {
|
|
|
1440
1444
|
return Logger;
|
|
1441
1445
|
}());
|
|
1442
1446
|
|
|
1443
|
-
/*! @azure/msal-common v6.
|
|
1447
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1444
1448
|
/* eslint-disable header/header */
|
|
1445
1449
|
var name$1 = "@azure/msal-common";
|
|
1446
|
-
var version$1 = "6.
|
|
1450
|
+
var version$1 = "6.2.0";
|
|
1447
1451
|
|
|
1448
|
-
/*! @azure/msal-common v6.
|
|
1452
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1453
|
+
/*
|
|
1454
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1455
|
+
* Licensed under the MIT License.
|
|
1456
|
+
*/
|
|
1457
|
+
exports.AzureCloudInstance = void 0;
|
|
1458
|
+
(function (AzureCloudInstance) {
|
|
1459
|
+
// AzureCloudInstance is not specified.
|
|
1460
|
+
AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
|
|
1461
|
+
// Microsoft Azure public cloud
|
|
1462
|
+
AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
|
|
1463
|
+
// Microsoft PPE
|
|
1464
|
+
AzureCloudInstance["AzurePpe"] = "https://login.windows-ppe.net";
|
|
1465
|
+
// Microsoft Chinese national cloud
|
|
1466
|
+
AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
|
|
1467
|
+
// Microsoft German national cloud ("Black Forest")
|
|
1468
|
+
AzureCloudInstance["AzureGermany"] = "https://login.microsoftonline.de";
|
|
1469
|
+
// US Government cloud
|
|
1470
|
+
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1471
|
+
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1472
|
+
|
|
1473
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1449
1474
|
|
|
1450
1475
|
/*
|
|
1451
1476
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1575,7 +1600,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1575
1600
|
var credentialId = [
|
|
1576
1601
|
credentialType,
|
|
1577
1602
|
clientOrFamilyId,
|
|
1578
|
-
realm ||
|
|
1603
|
+
realm || Constants.EMPTY_STRING,
|
|
1579
1604
|
];
|
|
1580
1605
|
return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1581
1606
|
};
|
|
@@ -1583,13 +1608,13 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1583
1608
|
* Generate target key component as per schema: <target>
|
|
1584
1609
|
*/
|
|
1585
1610
|
CredentialEntity.generateTargetForCacheKey = function (scopes) {
|
|
1586
|
-
return (scopes ||
|
|
1611
|
+
return (scopes || Constants.EMPTY_STRING).toLowerCase();
|
|
1587
1612
|
};
|
|
1588
1613
|
/**
|
|
1589
1614
|
* Generate requested claims key component as per schema: <requestedClaims>
|
|
1590
1615
|
*/
|
|
1591
1616
|
CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
|
|
1592
|
-
return (requestedClaimsHash ||
|
|
1617
|
+
return (requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();
|
|
1593
1618
|
};
|
|
1594
1619
|
/**
|
|
1595
1620
|
* Generate scheme key componenet as per schema: <scheme>
|
|
@@ -1599,12 +1624,12 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1599
1624
|
* PoP Tokens and SSH certs include scheme in cache key
|
|
1600
1625
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
1601
1626
|
*/
|
|
1602
|
-
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() :
|
|
1627
|
+
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
1603
1628
|
};
|
|
1604
1629
|
return CredentialEntity;
|
|
1605
1630
|
}());
|
|
1606
1631
|
|
|
1607
|
-
/*! @azure/msal-common v6.
|
|
1632
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1608
1633
|
|
|
1609
1634
|
/*
|
|
1610
1635
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1686,6 +1711,10 @@ var ClientConfigurationErrorMessage = {
|
|
|
1686
1711
|
code: "untrusted_authority",
|
|
1687
1712
|
desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."
|
|
1688
1713
|
},
|
|
1714
|
+
invalidAzureCloudInstance: {
|
|
1715
|
+
code: "invalid_azure_cloud_instance",
|
|
1716
|
+
desc: "Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"
|
|
1717
|
+
},
|
|
1689
1718
|
missingSshJwk: {
|
|
1690
1719
|
code: "missing_ssh_jwk",
|
|
1691
1720
|
desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."
|
|
@@ -1822,7 +1851,13 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1822
1851
|
ClientConfigurationError.createUntrustedAuthorityError = function () {
|
|
1823
1852
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);
|
|
1824
1853
|
};
|
|
1825
|
-
|
|
1854
|
+
/**
|
|
1855
|
+
* Throws error when the AzureCloudInstance is set to an invalid value
|
|
1856
|
+
*/
|
|
1857
|
+
ClientConfigurationError.createInvalidAzureCloudInstanceError = function () {
|
|
1858
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code, ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);
|
|
1859
|
+
};
|
|
1860
|
+
/**
|
|
1826
1861
|
* Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
|
|
1827
1862
|
*/
|
|
1828
1863
|
ClientConfigurationError.createMissingSshJwkError = function () {
|
|
@@ -1849,7 +1884,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1849
1884
|
return ClientConfigurationError;
|
|
1850
1885
|
}(ClientAuthError));
|
|
1851
1886
|
|
|
1852
|
-
/*! @azure/msal-common v6.
|
|
1887
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
1853
1888
|
|
|
1854
1889
|
/*
|
|
1855
1890
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1878,7 +1913,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
1878
1913
|
* @param scopesRequired
|
|
1879
1914
|
*/
|
|
1880
1915
|
ScopeSet.fromString = function (inputScopeString) {
|
|
1881
|
-
var scopeString = inputScopeString ||
|
|
1916
|
+
var scopeString = inputScopeString || Constants.EMPTY_STRING;
|
|
1882
1917
|
var inputScopes = scopeString.split(" ");
|
|
1883
1918
|
return new ScopeSet(inputScopes);
|
|
1884
1919
|
};
|
|
@@ -2022,7 +2057,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2022
2057
|
var scopeArr = this.asArray();
|
|
2023
2058
|
return scopeArr.join(" ");
|
|
2024
2059
|
}
|
|
2025
|
-
return
|
|
2060
|
+
return Constants.EMPTY_STRING;
|
|
2026
2061
|
};
|
|
2027
2062
|
/**
|
|
2028
2063
|
* Prints scopes into a space-delimited lower-case string (used for caching)
|
|
@@ -2033,7 +2068,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2033
2068
|
return ScopeSet;
|
|
2034
2069
|
}());
|
|
2035
2070
|
|
|
2036
|
-
/*! @azure/msal-common v6.
|
|
2071
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2037
2072
|
|
|
2038
2073
|
/*
|
|
2039
2074
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2071,7 +2106,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2071
2106
|
};
|
|
2072
2107
|
}
|
|
2073
2108
|
|
|
2074
|
-
/*! @azure/msal-common v6.
|
|
2109
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2075
2110
|
/*
|
|
2076
2111
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2077
2112
|
* Licensed under the MIT License.
|
|
@@ -2085,7 +2120,7 @@ var AuthorityType;
|
|
|
2085
2120
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2086
2121
|
})(AuthorityType || (AuthorityType = {}));
|
|
2087
2122
|
|
|
2088
|
-
/*! @azure/msal-common v6.
|
|
2123
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2089
2124
|
|
|
2090
2125
|
/*
|
|
2091
2126
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2175,8 +2210,8 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2175
2210
|
AccountEntity.generateAccountCacheKey = function (accountInterface) {
|
|
2176
2211
|
var accountKey = [
|
|
2177
2212
|
accountInterface.homeAccountId,
|
|
2178
|
-
accountInterface.environment ||
|
|
2179
|
-
accountInterface.tenantId ||
|
|
2213
|
+
accountInterface.environment || Constants.EMPTY_STRING,
|
|
2214
|
+
accountInterface.tenantId || Constants.EMPTY_STRING,
|
|
2180
2215
|
];
|
|
2181
2216
|
return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
2182
2217
|
};
|
|
@@ -2199,17 +2234,17 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2199
2234
|
}
|
|
2200
2235
|
account.environment = env;
|
|
2201
2236
|
// non AAD scenarios can have empty realm
|
|
2202
|
-
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;
|
|
2203
2238
|
account.oboAssertion = oboAssertion;
|
|
2204
2239
|
if (idToken) {
|
|
2205
2240
|
account.idTokenClaims = idToken.claims;
|
|
2206
2241
|
// How do you account for MSA CID here?
|
|
2207
|
-
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;
|
|
2208
2243
|
/*
|
|
2209
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.
|
|
2210
2245
|
* This field should not be relied upon if a custom policy is configured to return more than 1 email.
|
|
2211
2246
|
*/
|
|
2212
|
-
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);
|
|
2213
2248
|
account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;
|
|
2214
2249
|
}
|
|
2215
2250
|
account.cloudGraphHostName = cloudGraphHostName;
|
|
@@ -2227,7 +2262,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2227
2262
|
account.authorityType = (authority && authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
2228
2263
|
account.homeAccountId = homeAccountId;
|
|
2229
2264
|
// non AAD scenarios can have empty realm
|
|
2230
|
-
account.realm =
|
|
2265
|
+
account.realm = Constants.EMPTY_STRING;
|
|
2231
2266
|
account.oboAssertion = oboAssertion;
|
|
2232
2267
|
var env = environment || authority && authority.getPreferredCache();
|
|
2233
2268
|
if (!env) {
|
|
@@ -2235,10 +2270,10 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2235
2270
|
}
|
|
2236
2271
|
if (idToken) {
|
|
2237
2272
|
// How do you account for MSA CID here?
|
|
2238
|
-
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;
|
|
2239
2274
|
// upn claim for most ADFS scenarios
|
|
2240
|
-
account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) ||
|
|
2241
|
-
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;
|
|
2242
2277
|
account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;
|
|
2243
2278
|
}
|
|
2244
2279
|
account.environment = env;
|
|
@@ -2319,7 +2354,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2319
2354
|
return AccountEntity;
|
|
2320
2355
|
}());
|
|
2321
2356
|
|
|
2322
|
-
/*! @azure/msal-common v6.
|
|
2357
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2323
2358
|
|
|
2324
2359
|
/*
|
|
2325
2360
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2357,7 +2392,7 @@ var AuthToken = /** @class */ (function () {
|
|
|
2357
2392
|
return AuthToken;
|
|
2358
2393
|
}());
|
|
2359
2394
|
|
|
2360
|
-
/*! @azure/msal-common v6.
|
|
2395
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
2361
2396
|
|
|
2362
2397
|
/*
|
|
2363
2398
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2479,7 +2514,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2479
2514
|
* @param realm
|
|
2480
2515
|
*/
|
|
2481
2516
|
CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {
|
|
2482
|
-
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);
|
|
2483
2518
|
};
|
|
2484
2519
|
/**
|
|
2485
2520
|
* retrieve accounts matching all provided filters; if no filter is set, get all accounts
|
|
@@ -3199,7 +3234,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3199
3234
|
return DefaultStorageClass;
|
|
3200
3235
|
}(CacheManager));
|
|
3201
3236
|
|
|
3202
|
-
/*! @azure/msal-common v6.
|
|
3237
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3203
3238
|
|
|
3204
3239
|
/*
|
|
3205
3240
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3209,7 +3244,8 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3209
3244
|
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3210
3245
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3211
3246
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3212
|
-
preventCorsPreflight: false
|
|
3247
|
+
preventCorsPreflight: false,
|
|
3248
|
+
proxyUrl: Constants.EMPTY_STRING
|
|
3213
3249
|
};
|
|
3214
3250
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3215
3251
|
loggerCallback: function () {
|
|
@@ -3217,7 +3253,7 @@ var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
|
3217
3253
|
},
|
|
3218
3254
|
piiLoggingEnabled: false,
|
|
3219
3255
|
logLevel: exports.LogLevel.Info,
|
|
3220
|
-
correlationId:
|
|
3256
|
+
correlationId: Constants.EMPTY_STRING
|
|
3221
3257
|
};
|
|
3222
3258
|
var DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
3223
3259
|
sendGetRequestAsync: function () {
|
|
@@ -3242,13 +3278,23 @@ var DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
|
3242
3278
|
var DEFAULT_LIBRARY_INFO = {
|
|
3243
3279
|
sku: Constants.SKU,
|
|
3244
3280
|
version: version$1,
|
|
3245
|
-
cpu:
|
|
3246
|
-
os:
|
|
3281
|
+
cpu: Constants.EMPTY_STRING,
|
|
3282
|
+
os: Constants.EMPTY_STRING
|
|
3247
3283
|
};
|
|
3248
3284
|
var DEFAULT_CLIENT_CREDENTIALS = {
|
|
3249
|
-
clientSecret:
|
|
3285
|
+
clientSecret: Constants.EMPTY_STRING,
|
|
3250
3286
|
clientAssertion: undefined
|
|
3251
3287
|
};
|
|
3288
|
+
var DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3289
|
+
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
3290
|
+
tenant: "" + Constants.DEFAULT_COMMON_TENANT
|
|
3291
|
+
};
|
|
3292
|
+
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
3293
|
+
application: {
|
|
3294
|
+
appName: "",
|
|
3295
|
+
appVersion: ""
|
|
3296
|
+
}
|
|
3297
|
+
};
|
|
3252
3298
|
/**
|
|
3253
3299
|
* Function that sets the default options when not explicitly configured from app developer
|
|
3254
3300
|
*
|
|
@@ -3257,7 +3303,7 @@ var DEFAULT_CLIENT_CREDENTIALS = {
|
|
|
3257
3303
|
* @returns Configuration
|
|
3258
3304
|
*/
|
|
3259
3305
|
function buildClientConfiguration(_a) {
|
|
3260
|
-
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;
|
|
3261
3307
|
var loggerOptions = __assign(__assign({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption);
|
|
3262
3308
|
return {
|
|
3263
3309
|
authOptions: buildAuthOptions(userAuthOptions),
|
|
@@ -3268,6 +3314,7 @@ function buildClientConfiguration(_a) {
|
|
|
3268
3314
|
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
3269
3315
|
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
3270
3316
|
libraryInfo: __assign(__assign({}, DEFAULT_LIBRARY_INFO), libraryInfo),
|
|
3317
|
+
telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), telemetry),
|
|
3271
3318
|
serverTelemetryManager: serverTelemetryManager || null,
|
|
3272
3319
|
persistencePlugin: persistencePlugin || null,
|
|
3273
3320
|
serializableCache: serializableCache || null
|
|
@@ -3278,10 +3325,10 @@ function buildClientConfiguration(_a) {
|
|
|
3278
3325
|
* @param authOptions
|
|
3279
3326
|
*/
|
|
3280
3327
|
function buildAuthOptions(authOptions) {
|
|
3281
|
-
return __assign({ clientCapabilities: [] }, authOptions);
|
|
3328
|
+
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
|
|
3282
3329
|
}
|
|
3283
3330
|
|
|
3284
|
-
/*! @azure/msal-common v6.
|
|
3331
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3285
3332
|
|
|
3286
3333
|
/*
|
|
3287
3334
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3301,7 +3348,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3301
3348
|
return ServerError;
|
|
3302
3349
|
}(AuthError));
|
|
3303
3350
|
|
|
3304
|
-
/*! @azure/msal-common v6.
|
|
3351
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3305
3352
|
|
|
3306
3353
|
/*
|
|
3307
3354
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3397,7 +3444,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3397
3444
|
return ThrottlingUtils;
|
|
3398
3445
|
}());
|
|
3399
3446
|
|
|
3400
|
-
/*! @azure/msal-common v6.
|
|
3447
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3401
3448
|
|
|
3402
3449
|
/*
|
|
3403
3450
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3446,7 +3493,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3446
3493
|
return NetworkManager;
|
|
3447
3494
|
}());
|
|
3448
3495
|
|
|
3449
|
-
/*! @azure/msal-common v6.
|
|
3496
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3450
3497
|
/*
|
|
3451
3498
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3452
3499
|
* Licensed under the MIT License.
|
|
@@ -3457,7 +3504,7 @@ var CcsCredentialType;
|
|
|
3457
3504
|
CcsCredentialType["UPN"] = "UPN";
|
|
3458
3505
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3459
3506
|
|
|
3460
|
-
/*! @azure/msal-common v6.
|
|
3507
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3461
3508
|
|
|
3462
3509
|
/*
|
|
3463
3510
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3521,7 +3568,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3521
3568
|
var response;
|
|
3522
3569
|
return __generator(this, function (_a) {
|
|
3523
3570
|
switch (_a.label) {
|
|
3524
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
|
|
3571
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
|
|
3525
3572
|
case 1:
|
|
3526
3573
|
response = _a.sent();
|
|
3527
3574
|
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
@@ -3546,7 +3593,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3546
3593
|
return BaseClient;
|
|
3547
3594
|
}());
|
|
3548
3595
|
|
|
3549
|
-
/*! @azure/msal-common v6.
|
|
3596
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3550
3597
|
|
|
3551
3598
|
/*
|
|
3552
3599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3632,7 +3679,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3632
3679
|
return RequestValidator;
|
|
3633
3680
|
}());
|
|
3634
3681
|
|
|
3635
|
-
/*! @azure/msal-common v6.
|
|
3682
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3636
3683
|
|
|
3637
3684
|
/*
|
|
3638
3685
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3755,8 +3802,24 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3755
3802
|
// Telemetry Info
|
|
3756
3803
|
this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
|
|
3757
3804
|
this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
|
|
3758
|
-
|
|
3759
|
-
|
|
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
|
+
}
|
|
3760
3823
|
};
|
|
3761
3824
|
/**
|
|
3762
3825
|
* add prompt
|
|
@@ -3959,6 +4022,12 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3959
4022
|
RequestParameterBuilder.prototype.addThrottling = function () {
|
|
3960
4023
|
this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
|
|
3961
4024
|
};
|
|
4025
|
+
/**
|
|
4026
|
+
* Adds logout_hint parameter for "silent" logout which prevent server account picker
|
|
4027
|
+
*/
|
|
4028
|
+
RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {
|
|
4029
|
+
this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
|
|
4030
|
+
};
|
|
3962
4031
|
/**
|
|
3963
4032
|
* Utility to create a URL from the params map
|
|
3964
4033
|
*/
|
|
@@ -3972,7 +4041,7 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3972
4041
|
return RequestParameterBuilder;
|
|
3973
4042
|
}());
|
|
3974
4043
|
|
|
3975
|
-
/*! @azure/msal-common v6.
|
|
4044
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
3976
4045
|
|
|
3977
4046
|
/*
|
|
3978
4047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4037,7 +4106,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4037
4106
|
return IdTokenEntity;
|
|
4038
4107
|
}(CredentialEntity));
|
|
4039
4108
|
|
|
4040
|
-
/*! @azure/msal-common v6.
|
|
4109
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4041
4110
|
/*
|
|
4042
4111
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4043
4112
|
* Licensed under the MIT License.
|
|
@@ -4087,7 +4156,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4087
4156
|
return TimeUtils;
|
|
4088
4157
|
}());
|
|
4089
4158
|
|
|
4090
|
-
/*! @azure/msal-common v6.
|
|
4159
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4091
4160
|
|
|
4092
4161
|
/*
|
|
4093
4162
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4201,7 +4270,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4201
4270
|
return AccessTokenEntity;
|
|
4202
4271
|
}(CredentialEntity));
|
|
4203
4272
|
|
|
4204
|
-
/*! @azure/msal-common v6.
|
|
4273
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4205
4274
|
|
|
4206
4275
|
/*
|
|
4207
4276
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4268,7 +4337,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4268
4337
|
return RefreshTokenEntity;
|
|
4269
4338
|
}(CredentialEntity));
|
|
4270
4339
|
|
|
4271
|
-
/*! @azure/msal-common v6.
|
|
4340
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4272
4341
|
|
|
4273
4342
|
/*
|
|
4274
4343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4332,7 +4401,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4332
4401
|
return InteractionRequiredAuthError;
|
|
4333
4402
|
}(AuthError));
|
|
4334
4403
|
|
|
4335
|
-
/*! @azure/msal-common v6.
|
|
4404
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4336
4405
|
/*
|
|
4337
4406
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4338
4407
|
* Licensed under the MIT License.
|
|
@@ -4348,7 +4417,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4348
4417
|
return CacheRecord;
|
|
4349
4418
|
}());
|
|
4350
4419
|
|
|
4351
|
-
/*! @azure/msal-common v6.
|
|
4420
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4352
4421
|
|
|
4353
4422
|
/*
|
|
4354
4423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4404,11 +4473,11 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4404
4473
|
// Split the state between library state and user passed state and decode them separately
|
|
4405
4474
|
var splitState = state.split(Constants.RESOURCE_DELIM);
|
|
4406
4475
|
var libraryState = splitState[0];
|
|
4407
|
-
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;
|
|
4408
4477
|
var libraryStateString = cryptoObj.base64Decode(libraryState);
|
|
4409
4478
|
var libraryStateObj = JSON.parse(libraryStateString);
|
|
4410
4479
|
return {
|
|
4411
|
-
userRequestState: !StringUtils.isEmpty(userState) ? userState :
|
|
4480
|
+
userRequestState: !StringUtils.isEmpty(userState) ? userState : Constants.EMPTY_STRING,
|
|
4412
4481
|
libraryState: libraryStateObj
|
|
4413
4482
|
};
|
|
4414
4483
|
}
|
|
@@ -4419,7 +4488,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4419
4488
|
return ProtocolUtils;
|
|
4420
4489
|
}());
|
|
4421
4490
|
|
|
4422
|
-
/*! @azure/msal-common v6.
|
|
4491
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4423
4492
|
|
|
4424
4493
|
/*
|
|
4425
4494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4580,7 +4649,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4580
4649
|
else if (hashIndex1 > -1) {
|
|
4581
4650
|
return hashString.substring(hashIndex1 + 1);
|
|
4582
4651
|
}
|
|
4583
|
-
return
|
|
4652
|
+
return Constants.EMPTY_STRING;
|
|
4584
4653
|
};
|
|
4585
4654
|
UrlString.constructAuthorityUriFromObject = function (urlObject) {
|
|
4586
4655
|
return new UrlString(urlObject.Protocol + "//" + urlObject.HostNameAndPort + "/" + urlObject.PathSegments.join("/"));
|
|
@@ -4620,7 +4689,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4620
4689
|
return UrlString;
|
|
4621
4690
|
}());
|
|
4622
4691
|
|
|
4623
|
-
/*! @azure/msal-common v6.
|
|
4692
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4624
4693
|
|
|
4625
4694
|
/*
|
|
4626
4695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4686,7 +4755,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4686
4755
|
resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims, shrNonce = request.shrNonce;
|
|
4687
4756
|
resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;
|
|
4688
4757
|
resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();
|
|
4689
|
-
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)];
|
|
4690
4759
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4691
4760
|
}
|
|
4692
4761
|
});
|
|
@@ -4695,7 +4764,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4695
4764
|
return PopTokenGenerator;
|
|
4696
4765
|
}());
|
|
4697
4766
|
|
|
4698
|
-
/*! @azure/msal-common v6.
|
|
4767
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4699
4768
|
|
|
4700
4769
|
/*
|
|
4701
4770
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4765,7 +4834,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4765
4834
|
return AppMetadataEntity;
|
|
4766
4835
|
}());
|
|
4767
4836
|
|
|
4768
|
-
/*! @azure/msal-common v6.
|
|
4837
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4769
4838
|
/*
|
|
4770
4839
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4771
4840
|
* Licensed under the MIT License.
|
|
@@ -4801,7 +4870,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4801
4870
|
return TokenCacheContext;
|
|
4802
4871
|
}());
|
|
4803
4872
|
|
|
4804
|
-
/*! @azure/msal-common v6.
|
|
4873
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
4805
4874
|
|
|
4806
4875
|
/*
|
|
4807
4876
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4982,8 +5051,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
4982
5051
|
*/
|
|
4983
5052
|
ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, oboAssertion, authCodePayload) {
|
|
4984
5053
|
var authorityType = authority.authorityType;
|
|
4985
|
-
var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name :
|
|
4986
|
-
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;
|
|
4987
5056
|
// ADFS does not require client_info in the response
|
|
4988
5057
|
if (authorityType === AuthorityType.Adfs) {
|
|
4989
5058
|
this.logger.verbose("Authority type is ADFS, creating ADFS account");
|
|
@@ -5014,7 +5083,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5014
5083
|
return __generator(this, function (_d) {
|
|
5015
5084
|
switch (_d.label) {
|
|
5016
5085
|
case 0:
|
|
5017
|
-
accessToken =
|
|
5086
|
+
accessToken = Constants.EMPTY_STRING;
|
|
5018
5087
|
responseScopes = [];
|
|
5019
5088
|
expiresOn = null;
|
|
5020
5089
|
familyId = Constants.EMPTY_STRING;
|
|
@@ -5066,7 +5135,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5066
5135
|
return ResponseHandler;
|
|
5067
5136
|
}());
|
|
5068
5137
|
|
|
5069
|
-
/*! @azure/msal-common v6.
|
|
5138
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5070
5139
|
|
|
5071
5140
|
/*
|
|
5072
5141
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5254,6 +5323,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5254
5323
|
parameterBuilder.addAuthorizationCode(request.code);
|
|
5255
5324
|
// Add library metadata
|
|
5256
5325
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5326
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5257
5327
|
parameterBuilder.addThrottling();
|
|
5258
5328
|
if (this.serverTelemetryManager) {
|
|
5259
5329
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
@@ -5362,6 +5432,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5362
5432
|
parameterBuilder.addResponseTypeCode();
|
|
5363
5433
|
// add library info parameters
|
|
5364
5434
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5435
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5365
5436
|
// add client_info=1
|
|
5366
5437
|
parameterBuilder.addClientInfo();
|
|
5367
5438
|
if (request.codeChallenge && request.codeChallengeMethod) {
|
|
@@ -5455,6 +5526,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5455
5526
|
if (request.state) {
|
|
5456
5527
|
parameterBuilder.addState(request.state);
|
|
5457
5528
|
}
|
|
5529
|
+
if (request.logoutHint) {
|
|
5530
|
+
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
5531
|
+
}
|
|
5458
5532
|
if (request.extraQueryParameters) {
|
|
5459
5533
|
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5460
5534
|
}
|
|
@@ -5474,7 +5548,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5474
5548
|
return AuthorizationCodeClient;
|
|
5475
5549
|
}(BaseClient));
|
|
5476
5550
|
|
|
5477
|
-
/*! @azure/msal-common v6.
|
|
5551
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5478
5552
|
|
|
5479
5553
|
/*
|
|
5480
5554
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5625,6 +5699,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5625
5699
|
parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);
|
|
5626
5700
|
parameterBuilder.addClientInfo();
|
|
5627
5701
|
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
5702
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
5628
5703
|
parameterBuilder.addThrottling();
|
|
5629
5704
|
if (this.serverTelemetryManager) {
|
|
5630
5705
|
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
@@ -5685,7 +5760,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5685
5760
|
return RefreshTokenClient;
|
|
5686
5761
|
}(BaseClient));
|
|
5687
5762
|
|
|
5688
|
-
/*! @azure/msal-common v6.
|
|
5763
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5689
5764
|
|
|
5690
5765
|
/*
|
|
5691
5766
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5801,7 +5876,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
5801
5876
|
return SilentFlowClient;
|
|
5802
5877
|
}(BaseClient));
|
|
5803
5878
|
|
|
5804
|
-
/*! @azure/msal-common v6.
|
|
5879
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5805
5880
|
/*
|
|
5806
5881
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5807
5882
|
* Licensed under the MIT License.
|
|
@@ -5812,7 +5887,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
5812
5887
|
response.hasOwnProperty("issuer"));
|
|
5813
5888
|
}
|
|
5814
5889
|
|
|
5815
|
-
/*! @azure/msal-common v6.
|
|
5890
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5816
5891
|
/*
|
|
5817
5892
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5818
5893
|
* Licensed under the MIT License.
|
|
@@ -5826,7 +5901,7 @@ exports.ProtocolMode = void 0;
|
|
|
5826
5901
|
ProtocolMode["OIDC"] = "OIDC";
|
|
5827
5902
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
5828
5903
|
|
|
5829
|
-
/*! @azure/msal-common v6.
|
|
5904
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5830
5905
|
|
|
5831
5906
|
/*
|
|
5832
5907
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5901,7 +5976,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
5901
5976
|
return AuthorityMetadataEntity;
|
|
5902
5977
|
}());
|
|
5903
5978
|
|
|
5904
|
-
/*! @azure/msal-common v6.
|
|
5979
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5905
5980
|
/*
|
|
5906
5981
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5907
5982
|
* Licensed under the MIT License.
|
|
@@ -5911,7 +5986,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
5911
5986
|
response.hasOwnProperty("metadata"));
|
|
5912
5987
|
}
|
|
5913
5988
|
|
|
5914
|
-
/*! @azure/msal-common v6.
|
|
5989
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
5915
5990
|
|
|
5916
5991
|
/*
|
|
5917
5992
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5926,18 +6001,22 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
5926
6001
|
*
|
|
5927
6002
|
* @returns Promise<string | null>
|
|
5928
6003
|
*/
|
|
5929
|
-
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
|
|
6004
|
+
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata, proxyUrl) {
|
|
5930
6005
|
return __awaiter(this, void 0, void 0, function () {
|
|
5931
|
-
var autodetectedRegionName, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
6006
|
+
var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
5932
6007
|
return __generator(this, function (_a) {
|
|
5933
6008
|
switch (_a.label) {
|
|
5934
6009
|
case 0:
|
|
5935
6010
|
autodetectedRegionName = environmentRegion;
|
|
5936
6011
|
if (!!autodetectedRegionName) return [3 /*break*/, 8];
|
|
6012
|
+
options = RegionDiscovery.IMDS_OPTIONS;
|
|
6013
|
+
if (proxyUrl) {
|
|
6014
|
+
options.proxyUrl = proxyUrl;
|
|
6015
|
+
}
|
|
5937
6016
|
_a.label = 1;
|
|
5938
6017
|
case 1:
|
|
5939
6018
|
_a.trys.push([1, 6, , 7]);
|
|
5940
|
-
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION)];
|
|
6019
|
+
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
|
|
5941
6020
|
case 2:
|
|
5942
6021
|
localIMDSVersionResponse = _a.sent();
|
|
5943
6022
|
if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -5945,14 +6024,14 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
5945
6024
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
5946
6025
|
}
|
|
5947
6026
|
if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
|
|
5948
|
-
return [4 /*yield*/, this.getCurrentVersion()];
|
|
6027
|
+
return [4 /*yield*/, this.getCurrentVersion(options)];
|
|
5949
6028
|
case 3:
|
|
5950
6029
|
currentIMDSVersion = _a.sent();
|
|
5951
6030
|
if (!currentIMDSVersion) {
|
|
5952
6031
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
5953
6032
|
return [2 /*return*/, null];
|
|
5954
6033
|
}
|
|
5955
|
-
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion)];
|
|
6034
|
+
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
|
|
5956
6035
|
case 4:
|
|
5957
6036
|
currentIMDSVersionResponse = _a.sent();
|
|
5958
6037
|
if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -5985,10 +6064,10 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
5985
6064
|
* @param imdsEndpointUrl
|
|
5986
6065
|
* @returns Promise<NetworkResponse<string>>
|
|
5987
6066
|
*/
|
|
5988
|
-
RegionDiscovery.prototype.getRegionFromIMDS = function (version) {
|
|
6067
|
+
RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
|
|
5989
6068
|
return __awaiter(this, void 0, void 0, function () {
|
|
5990
6069
|
return __generator(this, function (_a) {
|
|
5991
|
-
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text",
|
|
6070
|
+
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
|
|
5992
6071
|
});
|
|
5993
6072
|
});
|
|
5994
6073
|
};
|
|
@@ -5997,14 +6076,14 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
5997
6076
|
*
|
|
5998
6077
|
* @returns Promise<string | null>
|
|
5999
6078
|
*/
|
|
6000
|
-
RegionDiscovery.prototype.getCurrentVersion = function () {
|
|
6079
|
+
RegionDiscovery.prototype.getCurrentVersion = function (options) {
|
|
6001
6080
|
return __awaiter(this, void 0, void 0, function () {
|
|
6002
6081
|
var response;
|
|
6003
6082
|
return __generator(this, function (_a) {
|
|
6004
6083
|
switch (_a.label) {
|
|
6005
6084
|
case 0:
|
|
6006
6085
|
_a.trys.push([0, 2, , 3]);
|
|
6007
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json",
|
|
6086
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
|
|
6008
6087
|
case 1:
|
|
6009
6088
|
response = _a.sent();
|
|
6010
6089
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
@@ -6021,11 +6100,15 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6021
6100
|
});
|
|
6022
6101
|
};
|
|
6023
6102
|
// Options for the IMDS endpoint request
|
|
6024
|
-
RegionDiscovery.IMDS_OPTIONS = {
|
|
6103
|
+
RegionDiscovery.IMDS_OPTIONS = {
|
|
6104
|
+
headers: {
|
|
6105
|
+
Metadata: "true",
|
|
6106
|
+
},
|
|
6107
|
+
};
|
|
6025
6108
|
return RegionDiscovery;
|
|
6026
6109
|
}());
|
|
6027
6110
|
|
|
6028
|
-
/*! @azure/msal-common v6.
|
|
6111
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6029
6112
|
|
|
6030
6113
|
/*
|
|
6031
6114
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6036,7 +6119,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6036
6119
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
|
6037
6120
|
*/
|
|
6038
6121
|
var Authority = /** @class */ (function () {
|
|
6039
|
-
function Authority(authority, networkInterface, cacheManager, authorityOptions) {
|
|
6122
|
+
function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
6040
6123
|
this.canonicalAuthority = authority;
|
|
6041
6124
|
this._canonicalAuthority.validateAsUri();
|
|
6042
6125
|
this.networkInterface = networkInterface;
|
|
@@ -6044,6 +6127,7 @@ var Authority = /** @class */ (function () {
|
|
|
6044
6127
|
this.authorityOptions = authorityOptions;
|
|
6045
6128
|
this.regionDiscovery = new RegionDiscovery(networkInterface);
|
|
6046
6129
|
this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
|
|
6130
|
+
this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
|
|
6047
6131
|
}
|
|
6048
6132
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
6049
6133
|
// See above for AuthorityType
|
|
@@ -6312,7 +6396,7 @@ var Authority = /** @class */ (function () {
|
|
|
6312
6396
|
metadata = _b.sent();
|
|
6313
6397
|
if (!metadata) return [3 /*break*/, 4];
|
|
6314
6398
|
if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
|
|
6315
|
-
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata)];
|
|
6399
|
+
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
|
|
6316
6400
|
case 2:
|
|
6317
6401
|
autodetectedRegionName = _b.sent();
|
|
6318
6402
|
azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
@@ -6375,19 +6459,25 @@ var Authority = /** @class */ (function () {
|
|
|
6375
6459
|
*/
|
|
6376
6460
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
6377
6461
|
return __awaiter(this, void 0, void 0, function () {
|
|
6378
|
-
var response;
|
|
6462
|
+
var options, response;
|
|
6379
6463
|
return __generator(this, function (_a) {
|
|
6380
6464
|
switch (_a.label) {
|
|
6381
6465
|
case 0:
|
|
6382
|
-
|
|
6383
|
-
|
|
6466
|
+
options = {};
|
|
6467
|
+
if (this.proxyUrl) {
|
|
6468
|
+
options.proxyUrl = this.proxyUrl;
|
|
6469
|
+
}
|
|
6470
|
+
_a.label = 1;
|
|
6384
6471
|
case 1:
|
|
6472
|
+
_a.trys.push([1, 3, , 4]);
|
|
6473
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
6474
|
+
case 2:
|
|
6385
6475
|
response = _a.sent();
|
|
6386
6476
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
6387
|
-
case
|
|
6477
|
+
case 3:
|
|
6388
6478
|
_a.sent();
|
|
6389
6479
|
return [2 /*return*/, null];
|
|
6390
|
-
case
|
|
6480
|
+
case 4: return [2 /*return*/];
|
|
6391
6481
|
}
|
|
6392
6482
|
});
|
|
6393
6483
|
});
|
|
@@ -6457,16 +6547,20 @@ var Authority = /** @class */ (function () {
|
|
|
6457
6547
|
*/
|
|
6458
6548
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
6459
6549
|
return __awaiter(this, void 0, void 0, function () {
|
|
6460
|
-
var instanceDiscoveryEndpoint, match, response, metadata;
|
|
6550
|
+
var instanceDiscoveryEndpoint, options, match, response, metadata;
|
|
6461
6551
|
return __generator(this, function (_a) {
|
|
6462
6552
|
switch (_a.label) {
|
|
6463
6553
|
case 0:
|
|
6464
6554
|
instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
|
|
6555
|
+
options = {};
|
|
6556
|
+
if (this.proxyUrl) {
|
|
6557
|
+
options.proxyUrl = this.proxyUrl;
|
|
6558
|
+
}
|
|
6465
6559
|
match = null;
|
|
6466
6560
|
_a.label = 1;
|
|
6467
6561
|
case 1:
|
|
6468
6562
|
_a.trys.push([1, 3, , 4]);
|
|
6469
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];
|
|
6563
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
6470
6564
|
case 2:
|
|
6471
6565
|
response = _a.sent();
|
|
6472
6566
|
metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
|
|
@@ -6481,7 +6575,7 @@ var Authority = /** @class */ (function () {
|
|
|
6481
6575
|
return [2 /*return*/, null];
|
|
6482
6576
|
case 4:
|
|
6483
6577
|
if (!match) {
|
|
6484
|
-
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
6578
|
+
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
6485
6579
|
match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
|
|
6486
6580
|
}
|
|
6487
6581
|
return [2 /*return*/, match];
|
|
@@ -6499,6 +6593,19 @@ var Authority = /** @class */ (function () {
|
|
|
6499
6593
|
});
|
|
6500
6594
|
return matches.length > 0;
|
|
6501
6595
|
};
|
|
6596
|
+
/**
|
|
6597
|
+
* helper function to populate the authority based on azureCloudOptions
|
|
6598
|
+
* @param authorityString
|
|
6599
|
+
* @param azureCloudOptions
|
|
6600
|
+
*/
|
|
6601
|
+
Authority.generateAuthority = function (authorityString, azureCloudOptions) {
|
|
6602
|
+
var authorityAzureCloudInstance;
|
|
6603
|
+
if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== exports.AzureCloudInstance.None) {
|
|
6604
|
+
var tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;
|
|
6605
|
+
authorityAzureCloudInstance = azureCloudOptions.azureCloudInstance + "/" + tenant + "/";
|
|
6606
|
+
}
|
|
6607
|
+
return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;
|
|
6608
|
+
};
|
|
6502
6609
|
/**
|
|
6503
6610
|
* Creates cloud discovery metadata object from a given host
|
|
6504
6611
|
* @param host
|
|
@@ -6591,7 +6698,7 @@ var Authority = /** @class */ (function () {
|
|
|
6591
6698
|
return Authority;
|
|
6592
6699
|
}());
|
|
6593
6700
|
|
|
6594
|
-
/*! @azure/msal-common v6.
|
|
6701
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6595
6702
|
|
|
6596
6703
|
/*
|
|
6597
6704
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6610,13 +6717,13 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
6610
6717
|
* @param networkClient
|
|
6611
6718
|
* @param protocolMode
|
|
6612
6719
|
*/
|
|
6613
|
-
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions) {
|
|
6720
|
+
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
|
|
6614
6721
|
return __awaiter(this, void 0, void 0, function () {
|
|
6615
6722
|
var acquireTokenAuthority, e_1;
|
|
6616
6723
|
return __generator(this, function (_a) {
|
|
6617
6724
|
switch (_a.label) {
|
|
6618
6725
|
case 0:
|
|
6619
|
-
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions);
|
|
6726
|
+
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
|
|
6620
6727
|
_a.label = 1;
|
|
6621
6728
|
case 1:
|
|
6622
6729
|
_a.trys.push([1, 3, , 4]);
|
|
@@ -6642,17 +6749,17 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
6642
6749
|
* @param networkInterface
|
|
6643
6750
|
* @param protocolMode
|
|
6644
6751
|
*/
|
|
6645
|
-
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions) {
|
|
6752
|
+
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
6646
6753
|
// Throw error if authority url is empty
|
|
6647
6754
|
if (StringUtils.isEmpty(authorityUrl)) {
|
|
6648
6755
|
throw ClientConfigurationError.createUrlEmptyError();
|
|
6649
6756
|
}
|
|
6650
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions);
|
|
6757
|
+
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
|
|
6651
6758
|
};
|
|
6652
6759
|
return AuthorityFactory;
|
|
6653
6760
|
}());
|
|
6654
6761
|
|
|
6655
|
-
/*! @azure/msal-common v6.
|
|
6762
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6656
6763
|
|
|
6657
6764
|
/*
|
|
6658
6765
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6683,7 +6790,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
6683
6790
|
return ServerTelemetryEntity;
|
|
6684
6791
|
}());
|
|
6685
6792
|
|
|
6686
|
-
/*! @azure/msal-common v6.
|
|
6793
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6687
6794
|
|
|
6688
6795
|
/*
|
|
6689
6796
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6711,7 +6818,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
6711
6818
|
return ThrottlingEntity;
|
|
6712
6819
|
}());
|
|
6713
6820
|
|
|
6714
|
-
/*! @azure/msal-common v6.
|
|
6821
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6715
6822
|
|
|
6716
6823
|
/*
|
|
6717
6824
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6728,7 +6835,7 @@ var StubbedNetworkModule = {
|
|
|
6728
6835
|
}
|
|
6729
6836
|
};
|
|
6730
6837
|
|
|
6731
|
-
/*! @azure/msal-common v6.
|
|
6838
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6732
6839
|
|
|
6733
6840
|
/*
|
|
6734
6841
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6780,14 +6887,14 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
6780
6887
|
challenges.forEach(function (challenge) {
|
|
6781
6888
|
var _a = challenge.split("="), key = _a[0], value = _a[1];
|
|
6782
6889
|
// Remove escaped quotation marks (', ") from challenge string to keep only the challenge value
|
|
6783
|
-
challengeMap[key] = unescape(value.replace(/['"]+/g,
|
|
6890
|
+
challengeMap[key] = unescape(value.replace(/['"]+/g, Constants.EMPTY_STRING));
|
|
6784
6891
|
});
|
|
6785
6892
|
return challengeMap;
|
|
6786
6893
|
};
|
|
6787
6894
|
return AuthenticationHeaderParser;
|
|
6788
6895
|
}());
|
|
6789
6896
|
|
|
6790
|
-
/*! @azure/msal-common v6.
|
|
6897
|
+
/*! @azure/msal-common v6.2.0 2022-04-04 */
|
|
6791
6898
|
|
|
6792
6899
|
/*
|
|
6793
6900
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6924,9 +7031,9 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
6924
7031
|
*/
|
|
6925
7032
|
ServerTelemetryManager.prototype.getRegionDiscoveryFields = function () {
|
|
6926
7033
|
var regionDiscoveryFields = [];
|
|
6927
|
-
regionDiscoveryFields.push(this.regionUsed ||
|
|
6928
|
-
regionDiscoveryFields.push(this.regionSource ||
|
|
6929
|
-
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);
|
|
6930
7037
|
return regionDiscoveryFields.join(",");
|
|
6931
7038
|
};
|
|
6932
7039
|
/**
|
|
@@ -6949,6 +7056,390 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
6949
7056
|
return ServerTelemetryManager;
|
|
6950
7057
|
}());
|
|
6951
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
|
+
|
|
6952
7443
|
/*
|
|
6953
7444
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6954
7445
|
* Licensed under the MIT License.
|
|
@@ -7003,7 +7494,7 @@ var HTTP_REQUEST_TYPE;
|
|
|
7003
7494
|
/**
|
|
7004
7495
|
* Temporary cache keys for MSAL, deleted after any request.
|
|
7005
7496
|
*/
|
|
7006
|
-
|
|
7497
|
+
exports.TemporaryCacheKeys = void 0;
|
|
7007
7498
|
(function (TemporaryCacheKeys) {
|
|
7008
7499
|
TemporaryCacheKeys["AUTHORITY"] = "authority";
|
|
7009
7500
|
TemporaryCacheKeys["ACQUIRE_TOKEN_ACCOUNT"] = "acquireToken.account";
|
|
@@ -7018,7 +7509,7 @@ var TemporaryCacheKeys;
|
|
|
7018
7509
|
TemporaryCacheKeys["INTERACTION_STATUS_KEY"] = "interaction.status";
|
|
7019
7510
|
TemporaryCacheKeys["CCS_CREDENTIAL"] = "ccs.credential";
|
|
7020
7511
|
TemporaryCacheKeys["CORRELATION_ID"] = "request.correlationId";
|
|
7021
|
-
})(TemporaryCacheKeys || (TemporaryCacheKeys = {}));
|
|
7512
|
+
})(exports.TemporaryCacheKeys || (exports.TemporaryCacheKeys = {}));
|
|
7022
7513
|
/**
|
|
7023
7514
|
* Cache keys stored in-memory
|
|
7024
7515
|
*/
|
|
@@ -7053,6 +7544,7 @@ exports.InteractionType = void 0;
|
|
|
7053
7544
|
InteractionType["Redirect"] = "redirect";
|
|
7054
7545
|
InteractionType["Popup"] = "popup";
|
|
7055
7546
|
InteractionType["Silent"] = "silent";
|
|
7547
|
+
InteractionType["None"] = "none";
|
|
7056
7548
|
})(exports.InteractionType || (exports.InteractionType = {}));
|
|
7057
7549
|
/**
|
|
7058
7550
|
* Types of interaction currently in progress.
|
|
@@ -7185,7 +7677,7 @@ var GuidGenerator = /** @class */ (function () {
|
|
|
7185
7677
|
var guidHolder = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
7186
7678
|
var hex = "0123456789abcdef";
|
|
7187
7679
|
var r = 0;
|
|
7188
|
-
var guidResponse =
|
|
7680
|
+
var guidResponse = Constants.EMPTY_STRING;
|
|
7189
7681
|
for (var i = 0; i < 36; i++) {
|
|
7190
7682
|
if (guidHolder[i] !== "-" && guidHolder[i] !== "4") {
|
|
7191
7683
|
// each x and y needs to be random
|
|
@@ -7211,7 +7703,7 @@ var GuidGenerator = /** @class */ (function () {
|
|
|
7211
7703
|
* verifies if a string is GUID
|
|
7212
7704
|
* @param guid
|
|
7213
7705
|
*/
|
|
7214
|
-
GuidGenerator.isGuid = function (guid) {
|
|
7706
|
+
GuidGenerator.prototype.isGuid = function (guid) {
|
|
7215
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;
|
|
7216
7708
|
return regexGuid.test(guid);
|
|
7217
7709
|
};
|
|
@@ -7305,7 +7797,7 @@ var BrowserStringUtils = /** @class */ (function () {
|
|
|
7305
7797
|
* @param aBytes
|
|
7306
7798
|
*/
|
|
7307
7799
|
BrowserStringUtils.utf8ArrToString = function (aBytes) {
|
|
7308
|
-
var sView =
|
|
7800
|
+
var sView = Constants.EMPTY_STRING;
|
|
7309
7801
|
for (var nPart = void 0, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {
|
|
7310
7802
|
nPart = aBytes[nIdx];
|
|
7311
7803
|
sView += String.fromCharCode(nPart > 251 && nPart < 254 && nIdx + 5 < nLen ? /* six bytes */
|
|
@@ -7344,7 +7836,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7344
7836
|
*/
|
|
7345
7837
|
Base64Encode.prototype.urlEncode = function (input) {
|
|
7346
7838
|
return encodeURIComponent(this.encode(input)
|
|
7347
|
-
.replace(/=/g,
|
|
7839
|
+
.replace(/=/g, Constants.EMPTY_STRING)
|
|
7348
7840
|
.replace(/\+/g, "-")
|
|
7349
7841
|
.replace(/\//g, "_"));
|
|
7350
7842
|
};
|
|
@@ -7354,7 +7846,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7354
7846
|
*/
|
|
7355
7847
|
Base64Encode.prototype.urlEncodeArr = function (inputArr) {
|
|
7356
7848
|
return this.base64EncArr(inputArr)
|
|
7357
|
-
.replace(/=/g,
|
|
7849
|
+
.replace(/=/g, Constants.EMPTY_STRING)
|
|
7358
7850
|
.replace(/\+/g, "-")
|
|
7359
7851
|
.replace(/\//g, "_");
|
|
7360
7852
|
};
|
|
@@ -7372,7 +7864,7 @@ var Base64Encode = /** @class */ (function () {
|
|
|
7372
7864
|
*/
|
|
7373
7865
|
Base64Encode.prototype.base64EncArr = function (aBytes) {
|
|
7374
7866
|
var eqLen = (3 - (aBytes.length % 3)) % 3;
|
|
7375
|
-
var sB64Enc =
|
|
7867
|
+
var sB64Enc = Constants.EMPTY_STRING;
|
|
7376
7868
|
for (var nMod3 = void 0, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {
|
|
7377
7869
|
nMod3 = nIdx % 3;
|
|
7378
7870
|
/* Uncomment the following line in order to split the output in lines 76-character long: */
|
|
@@ -7446,7 +7938,7 @@ var Base64Decode = /** @class */ (function () {
|
|
|
7446
7938
|
* @param nBlockSize
|
|
7447
7939
|
*/
|
|
7448
7940
|
Base64Decode.prototype.base64DecToArr = function (base64String, nBlockSize) {
|
|
7449
|
-
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g,
|
|
7941
|
+
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g, Constants.EMPTY_STRING);
|
|
7450
7942
|
var nInLen = sB64Enc.length;
|
|
7451
7943
|
var nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2;
|
|
7452
7944
|
var aBytes = new Uint8Array(nOutLen);
|
|
@@ -8164,11 +8656,11 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
8164
8656
|
msExportKey.addEventListener("complete", function (e) {
|
|
8165
8657
|
var resultBuffer = e.target.result;
|
|
8166
8658
|
var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
|
|
8167
|
-
.replace(/\r/g,
|
|
8168
|
-
.replace(/\n/g,
|
|
8169
|
-
.replace(/\t/g,
|
|
8170
|
-
.split(" ").join(
|
|
8171
|
-
.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);
|
|
8172
8664
|
try {
|
|
8173
8665
|
resolve(JSON.parse(resultString));
|
|
8174
8666
|
}
|
|
@@ -8275,6 +8767,17 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8275
8767
|
});
|
|
8276
8768
|
});
|
|
8277
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
|
+
};
|
|
8278
8781
|
/**
|
|
8279
8782
|
* Opens database if it's not already open
|
|
8280
8783
|
*/
|
|
@@ -8313,9 +8816,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8313
8816
|
var dbGet = objectStore.get(key);
|
|
8314
8817
|
dbGet.addEventListener("success", function (e) {
|
|
8315
8818
|
var event = e;
|
|
8819
|
+
_this.closeConnection();
|
|
8316
8820
|
resolve(event.target.result);
|
|
8317
8821
|
});
|
|
8318
|
-
dbGet.addEventListener("error", function (e) {
|
|
8822
|
+
dbGet.addEventListener("error", function (e) {
|
|
8823
|
+
_this.closeConnection();
|
|
8824
|
+
reject(e);
|
|
8825
|
+
});
|
|
8319
8826
|
})];
|
|
8320
8827
|
}
|
|
8321
8828
|
});
|
|
@@ -8342,8 +8849,14 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8342
8849
|
var transaction = _this.db.transaction([_this.tableName], "readwrite");
|
|
8343
8850
|
var objectStore = transaction.objectStore(_this.tableName);
|
|
8344
8851
|
var dbPut = objectStore.put(payload, key);
|
|
8345
|
-
dbPut.addEventListener("success", function () {
|
|
8346
|
-
|
|
8852
|
+
dbPut.addEventListener("success", function () {
|
|
8853
|
+
_this.closeConnection();
|
|
8854
|
+
resolve();
|
|
8855
|
+
});
|
|
8856
|
+
dbPut.addEventListener("error", function (e) {
|
|
8857
|
+
_this.closeConnection();
|
|
8858
|
+
reject(e);
|
|
8859
|
+
});
|
|
8347
8860
|
})];
|
|
8348
8861
|
}
|
|
8349
8862
|
});
|
|
@@ -8368,8 +8881,14 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8368
8881
|
var transaction = _this.db.transaction([_this.tableName], "readwrite");
|
|
8369
8882
|
var objectStore = transaction.objectStore(_this.tableName);
|
|
8370
8883
|
var dbDelete = objectStore.delete(key);
|
|
8371
|
-
dbDelete.addEventListener("success", function () {
|
|
8372
|
-
|
|
8884
|
+
dbDelete.addEventListener("success", function () {
|
|
8885
|
+
_this.closeConnection();
|
|
8886
|
+
resolve();
|
|
8887
|
+
});
|
|
8888
|
+
dbDelete.addEventListener("error", function (e) {
|
|
8889
|
+
_this.closeConnection();
|
|
8890
|
+
reject(e);
|
|
8891
|
+
});
|
|
8373
8892
|
})];
|
|
8374
8893
|
}
|
|
8375
8894
|
});
|
|
@@ -8395,9 +8914,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8395
8914
|
var dbGetKeys = objectStore.getAllKeys();
|
|
8396
8915
|
dbGetKeys.addEventListener("success", function (e) {
|
|
8397
8916
|
var event = e;
|
|
8917
|
+
_this.closeConnection();
|
|
8398
8918
|
resolve(event.target.result);
|
|
8399
8919
|
});
|
|
8400
|
-
dbGetKeys.addEventListener("error", function (e) {
|
|
8920
|
+
dbGetKeys.addEventListener("error", function (e) {
|
|
8921
|
+
_this.closeConnection();
|
|
8922
|
+
reject(e);
|
|
8923
|
+
});
|
|
8401
8924
|
})];
|
|
8402
8925
|
}
|
|
8403
8926
|
});
|
|
@@ -8424,9 +8947,13 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8424
8947
|
var dbContainsKey = objectStore.count(key);
|
|
8425
8948
|
dbContainsKey.addEventListener("success", function (e) {
|
|
8426
8949
|
var event = e;
|
|
8950
|
+
_this.closeConnection();
|
|
8427
8951
|
resolve(event.target.result === 1);
|
|
8428
8952
|
});
|
|
8429
|
-
dbContainsKey.addEventListener("error", function (e) {
|
|
8953
|
+
dbContainsKey.addEventListener("error", function (e) {
|
|
8954
|
+
_this.closeConnection();
|
|
8955
|
+
reject(e);
|
|
8956
|
+
});
|
|
8430
8957
|
})];
|
|
8431
8958
|
}
|
|
8432
8959
|
});
|
|
@@ -8439,12 +8966,29 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
8439
8966
|
*/
|
|
8440
8967
|
DatabaseStorage.prototype.deleteDatabase = function () {
|
|
8441
8968
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8969
|
+
var existingDatabases, database;
|
|
8442
8970
|
return __generator$1(this, function (_a) {
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
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
|
+
}
|
|
8448
8992
|
});
|
|
8449
8993
|
});
|
|
8450
8994
|
};
|
|
@@ -8493,15 +9037,19 @@ var MemoryStorage = /** @class */ (function () {
|
|
|
8493
9037
|
* backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
|
|
8494
9038
|
*/
|
|
8495
9039
|
var AsyncMemoryStorage = /** @class */ (function () {
|
|
8496
|
-
function AsyncMemoryStorage(logger) {
|
|
9040
|
+
function AsyncMemoryStorage(logger, storeName) {
|
|
8497
9041
|
this.inMemoryCache = new MemoryStorage();
|
|
8498
9042
|
this.indexedDBCache = new DatabaseStorage();
|
|
8499
9043
|
this.logger = logger;
|
|
9044
|
+
this.storeName = storeName;
|
|
8500
9045
|
}
|
|
8501
9046
|
AsyncMemoryStorage.prototype.handleDatabaseAccessError = function (error) {
|
|
8502
9047
|
if (error instanceof BrowserAuthError && error.errorCode === BrowserAuthErrorMessage.databaseUnavailable.code) {
|
|
8503
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.");
|
|
8504
9049
|
}
|
|
9050
|
+
else {
|
|
9051
|
+
throw error;
|
|
9052
|
+
}
|
|
8505
9053
|
};
|
|
8506
9054
|
/**
|
|
8507
9055
|
* Get the item matching the given key. Tries in-memory cache first, then in the asynchronous
|
|
@@ -8646,22 +9194,29 @@ var AsyncMemoryStorage = /** @class */ (function () {
|
|
|
8646
9194
|
*/
|
|
8647
9195
|
AsyncMemoryStorage.prototype.clear = function () {
|
|
8648
9196
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8649
|
-
var e_6;
|
|
9197
|
+
var dbDeleted, e_6;
|
|
8650
9198
|
return __generator$1(this, function (_a) {
|
|
8651
9199
|
switch (_a.label) {
|
|
8652
9200
|
case 0:
|
|
9201
|
+
// InMemory cache is a Map instance, clear is straightforward
|
|
9202
|
+
this.logger.verbose("Deleting in-memory keystore " + this.storeName);
|
|
8653
9203
|
this.inMemoryCache.clear();
|
|
9204
|
+
this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
|
|
9205
|
+
this.logger.verbose("Deleting persistent keystore " + this.storeName);
|
|
8654
9206
|
_a.label = 1;
|
|
8655
9207
|
case 1:
|
|
8656
9208
|
_a.trys.push([1, 3, , 4]);
|
|
8657
9209
|
return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];
|
|
8658
9210
|
case 2:
|
|
8659
|
-
_a.sent();
|
|
8660
|
-
|
|
9211
|
+
dbDeleted = _a.sent();
|
|
9212
|
+
if (dbDeleted) {
|
|
9213
|
+
this.logger.verbose("Persistent keystore " + this.storeName + " deleted");
|
|
9214
|
+
}
|
|
9215
|
+
return [2 /*return*/, dbDeleted];
|
|
8661
9216
|
case 3:
|
|
8662
9217
|
e_6 = _a.sent();
|
|
8663
9218
|
this.handleDatabaseAccessError(e_6);
|
|
8664
|
-
return [
|
|
9219
|
+
return [2 /*return*/, false];
|
|
8665
9220
|
case 4: return [2 /*return*/];
|
|
8666
9221
|
}
|
|
8667
9222
|
});
|
|
@@ -8674,12 +9229,17 @@ var AsyncMemoryStorage = /** @class */ (function () {
|
|
|
8674
9229
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8675
9230
|
* Licensed under the MIT License.
|
|
8676
9231
|
*/
|
|
9232
|
+
var CryptoKeyStoreNames;
|
|
9233
|
+
(function (CryptoKeyStoreNames) {
|
|
9234
|
+
CryptoKeyStoreNames["asymmetricKeys"] = "asymmetricKeys";
|
|
9235
|
+
CryptoKeyStoreNames["symmetricKeys"] = "symmetricKeys";
|
|
9236
|
+
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
|
|
8677
9237
|
/**
|
|
8678
9238
|
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
8679
9239
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
8680
9240
|
*/
|
|
8681
9241
|
var CryptoOps = /** @class */ (function () {
|
|
8682
|
-
function CryptoOps(logger) {
|
|
9242
|
+
function CryptoOps(logger, performanceClient) {
|
|
8683
9243
|
this.logger = logger;
|
|
8684
9244
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
8685
9245
|
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
@@ -8688,9 +9248,10 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8688
9248
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
8689
9249
|
this.pkceGenerator = new PkceGenerator(this.browserCrypto);
|
|
8690
9250
|
this.cache = {
|
|
8691
|
-
asymmetricKeys: new AsyncMemoryStorage(this.logger),
|
|
8692
|
-
symmetricKeys: new AsyncMemoryStorage(this.logger)
|
|
9251
|
+
asymmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys),
|
|
9252
|
+
symmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys)
|
|
8693
9253
|
};
|
|
9254
|
+
this.performanceClient = performanceClient;
|
|
8694
9255
|
}
|
|
8695
9256
|
/**
|
|
8696
9257
|
* Creates a new random GUID - used to populate state and nonce.
|
|
@@ -8728,16 +9289,19 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8728
9289
|
* @param request
|
|
8729
9290
|
*/
|
|
8730
9291
|
CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
|
|
9292
|
+
var _a;
|
|
8731
9293
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8732
|
-
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
|
|
8733
|
-
return __generator$1(this, function (
|
|
8734
|
-
switch (
|
|
8735
|
-
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)];
|
|
8736
9300
|
case 1:
|
|
8737
|
-
keyPair =
|
|
9301
|
+
keyPair = _b.sent();
|
|
8738
9302
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.publicKey)];
|
|
8739
9303
|
case 2:
|
|
8740
|
-
publicKeyJwk =
|
|
9304
|
+
publicKeyJwk = _b.sent();
|
|
8741
9305
|
pubKeyThumprintObj = {
|
|
8742
9306
|
e: publicKeyJwk.e,
|
|
8743
9307
|
kty: publicKeyJwk.kty,
|
|
@@ -8746,13 +9310,13 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8746
9310
|
publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);
|
|
8747
9311
|
return [4 /*yield*/, this.hashString(publicJwkString)];
|
|
8748
9312
|
case 3:
|
|
8749
|
-
publicJwkHash =
|
|
9313
|
+
publicJwkHash = _b.sent();
|
|
8750
9314
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
|
|
8751
9315
|
case 4:
|
|
8752
|
-
privateKeyJwk =
|
|
9316
|
+
privateKeyJwk = _b.sent();
|
|
8753
9317
|
return [4 /*yield*/, this.browserCrypto.importJwk(privateKeyJwk, false, ["sign"])];
|
|
8754
9318
|
case 5:
|
|
8755
|
-
unextractablePrivateKey =
|
|
9319
|
+
unextractablePrivateKey = _b.sent();
|
|
8756
9320
|
// Store Keypair data in keystore
|
|
8757
9321
|
return [4 /*yield*/, this.cache.asymmetricKeys.setItem(publicJwkHash, {
|
|
8758
9322
|
privateKey: unextractablePrivateKey,
|
|
@@ -8762,7 +9326,12 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8762
9326
|
})];
|
|
8763
9327
|
case 6:
|
|
8764
9328
|
// Store Keypair data in keystore
|
|
8765
|
-
|
|
9329
|
+
_b.sent();
|
|
9330
|
+
if (publicKeyThumbMeasurement) {
|
|
9331
|
+
publicKeyThumbMeasurement.endMeasurement({
|
|
9332
|
+
success: true
|
|
9333
|
+
});
|
|
9334
|
+
}
|
|
8766
9335
|
return [2 /*return*/, publicJwkHash];
|
|
8767
9336
|
}
|
|
8768
9337
|
});
|
|
@@ -8793,21 +9362,32 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8793
9362
|
*/
|
|
8794
9363
|
CryptoOps.prototype.clearKeystore = function () {
|
|
8795
9364
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8796
|
-
var
|
|
8797
|
-
return __generator$1(this, function (
|
|
8798
|
-
switch (
|
|
9365
|
+
var e_1;
|
|
9366
|
+
return __generator$1(this, function (_a) {
|
|
9367
|
+
switch (_a.label) {
|
|
8799
9368
|
case 0:
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
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()];
|
|
8804
9372
|
case 1:
|
|
8805
|
-
_a
|
|
8806
|
-
|
|
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()];
|
|
8807
9377
|
case 2:
|
|
8808
|
-
_a
|
|
8809
|
-
|
|
8810
|
-
|
|
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*/];
|
|
8811
9391
|
}
|
|
8812
9392
|
});
|
|
8813
9393
|
});
|
|
@@ -8817,20 +9397,23 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8817
9397
|
* @param payload
|
|
8818
9398
|
* @param kid
|
|
8819
9399
|
*/
|
|
8820
|
-
CryptoOps.prototype.signJwt = function (payload, kid) {
|
|
9400
|
+
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
9401
|
+
var _a;
|
|
8821
9402
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8822
|
-
var cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature;
|
|
8823
|
-
return __generator$1(this, function (
|
|
8824
|
-
switch (
|
|
8825
|
-
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)];
|
|
8826
9409
|
case 1:
|
|
8827
|
-
cachedKeyPair =
|
|
9410
|
+
cachedKeyPair = _b.sent();
|
|
8828
9411
|
if (!cachedKeyPair) {
|
|
8829
9412
|
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
8830
9413
|
}
|
|
8831
9414
|
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
8832
9415
|
case 2:
|
|
8833
|
-
publicKeyJwk =
|
|
9416
|
+
publicKeyJwk = _b.sent();
|
|
8834
9417
|
publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);
|
|
8835
9418
|
header = {
|
|
8836
9419
|
alg: publicKeyJwk.alg,
|
|
@@ -8846,9 +9429,15 @@ var CryptoOps = /** @class */ (function () {
|
|
|
8846
9429
|
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
8847
9430
|
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
8848
9431
|
case 3:
|
|
8849
|
-
signatureBuffer =
|
|
9432
|
+
signatureBuffer = _b.sent();
|
|
8850
9433
|
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
8851
|
-
|
|
9434
|
+
signedJwt = tokenString + "." + encodedSignature;
|
|
9435
|
+
if (signJwtMeasurement) {
|
|
9436
|
+
signJwtMeasurement.endMeasurement({
|
|
9437
|
+
success: true
|
|
9438
|
+
});
|
|
9439
|
+
}
|
|
9440
|
+
return [2 /*return*/, signedJwt];
|
|
8852
9441
|
}
|
|
8853
9442
|
});
|
|
8854
9443
|
});
|
|
@@ -9368,8 +9957,8 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9368
9957
|
* Returns wrapper metadata from in-memory storage
|
|
9369
9958
|
*/
|
|
9370
9959
|
BrowserCacheManager.prototype.getWrapperMetadata = function () {
|
|
9371
|
-
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) ||
|
|
9372
|
-
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;
|
|
9373
9962
|
return [sku, version];
|
|
9374
9963
|
};
|
|
9375
9964
|
/**
|
|
@@ -9591,7 +10180,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9591
10180
|
return decodeURIComponent(cookie.substring(name.length, cookie.length));
|
|
9592
10181
|
}
|
|
9593
10182
|
}
|
|
9594
|
-
return
|
|
10183
|
+
return Constants.EMPTY_STRING;
|
|
9595
10184
|
};
|
|
9596
10185
|
/**
|
|
9597
10186
|
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
@@ -9616,7 +10205,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9616
10205
|
* @param cookieName
|
|
9617
10206
|
*/
|
|
9618
10207
|
BrowserCacheManager.prototype.clearItemCookie = function (cookieName) {
|
|
9619
|
-
this.setItemCookie(cookieName,
|
|
10208
|
+
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
9620
10209
|
};
|
|
9621
10210
|
/**
|
|
9622
10211
|
* Get cookie expiration time
|
|
@@ -9660,7 +10249,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9660
10249
|
*/
|
|
9661
10250
|
BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {
|
|
9662
10251
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9663
|
-
return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + "." + stateId);
|
|
10252
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.AUTHORITY + "." + stateId);
|
|
9664
10253
|
};
|
|
9665
10254
|
/**
|
|
9666
10255
|
* Create Nonce key to cache nonce
|
|
@@ -9668,7 +10257,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9668
10257
|
*/
|
|
9669
10258
|
BrowserCacheManager.prototype.generateNonceKey = function (stateString) {
|
|
9670
10259
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9671
|
-
return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
|
|
10260
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
|
|
9672
10261
|
};
|
|
9673
10262
|
/**
|
|
9674
10263
|
* Creates full cache key for the request state
|
|
@@ -9677,7 +10266,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9677
10266
|
BrowserCacheManager.prototype.generateStateKey = function (stateString) {
|
|
9678
10267
|
// Use the library state id to key temp storage for uniqueness for multiple concurrent requests
|
|
9679
10268
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9680
|
-
return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
|
|
10269
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
|
|
9681
10270
|
};
|
|
9682
10271
|
/**
|
|
9683
10272
|
* Gets the cached authority based on the cached state. Returns empty if no cached state found.
|
|
@@ -9712,14 +10301,14 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9712
10301
|
credential: account.homeAccountId,
|
|
9713
10302
|
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
9714
10303
|
};
|
|
9715
|
-
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
10304
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9716
10305
|
}
|
|
9717
10306
|
else if (!StringUtils.isEmpty(loginHint)) {
|
|
9718
10307
|
var ccsCredential = {
|
|
9719
10308
|
credential: loginHint,
|
|
9720
10309
|
type: CcsCredentialType.UPN
|
|
9721
10310
|
};
|
|
9722
|
-
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
10311
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9723
10312
|
}
|
|
9724
10313
|
};
|
|
9725
10314
|
/**
|
|
@@ -9743,11 +10332,11 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9743
10332
|
this.removeItem(this.generateNonceKey(state));
|
|
9744
10333
|
this.removeItem(this.generateAuthorityKey(state));
|
|
9745
10334
|
}
|
|
9746
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9747
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
|
|
9748
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
9749
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
|
|
9750
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
10335
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
|
|
10336
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.ORIGIN_URI));
|
|
10337
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
|
|
10338
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CORRELATION_ID));
|
|
10339
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
9751
10340
|
this.setInteractionInProgress(false);
|
|
9752
10341
|
};
|
|
9753
10342
|
/**
|
|
@@ -9761,7 +10350,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9761
10350
|
var stateKey = this.generateStateKey(stateString);
|
|
9762
10351
|
var cachedState = this.temporaryCacheStorage.getItem(stateKey);
|
|
9763
10352
|
this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: " + cachedState);
|
|
9764
|
-
this.resetRequestCache(cachedState ||
|
|
10353
|
+
this.resetRequestCache(cachedState || Constants.EMPTY_STRING);
|
|
9765
10354
|
}
|
|
9766
10355
|
this.clearMsalCookies();
|
|
9767
10356
|
};
|
|
@@ -9776,7 +10365,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9776
10365
|
// Loop through all keys to find state key
|
|
9777
10366
|
this.getKeys().forEach(function (key) {
|
|
9778
10367
|
// If this key is not the state key, move on
|
|
9779
|
-
if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
10368
|
+
if (key.indexOf(exports.TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
9780
10369
|
return;
|
|
9781
10370
|
}
|
|
9782
10371
|
// Retrieve state value, return if not a valid value
|
|
@@ -9797,7 +10386,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9797
10386
|
BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
|
|
9798
10387
|
this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
|
|
9799
10388
|
var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));
|
|
9800
|
-
this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
|
|
10389
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
|
|
9801
10390
|
};
|
|
9802
10391
|
/**
|
|
9803
10392
|
* Gets the token exchange parameters from the cache. Throws an error if nothing is found.
|
|
@@ -9805,7 +10394,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9805
10394
|
BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {
|
|
9806
10395
|
this.logger.trace("BrowserCacheManager.getCachedRequest called");
|
|
9807
10396
|
// Get token request from cache and parse as TokenExchangeParameters.
|
|
9808
|
-
var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);
|
|
10397
|
+
var encodedTokenRequest = this.getTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, true);
|
|
9809
10398
|
if (!encodedTokenRequest) {
|
|
9810
10399
|
throw BrowserAuthError.createNoTokenRequestCacheError();
|
|
9811
10400
|
}
|
|
@@ -9813,7 +10402,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9813
10402
|
if (!parsedRequest) {
|
|
9814
10403
|
throw BrowserAuthError.createUnableToParseTokenRequestCacheError();
|
|
9815
10404
|
}
|
|
9816
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
10405
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9817
10406
|
// Get cached authority and use if no authority is cached with request.
|
|
9818
10407
|
if (StringUtils.isEmpty(parsedRequest.authority)) {
|
|
9819
10408
|
var authorityCacheKey = this.generateAuthorityKey(state);
|
|
@@ -9835,18 +10424,22 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
9835
10424
|
}
|
|
9836
10425
|
};
|
|
9837
10426
|
BrowserCacheManager.prototype.getInteractionInProgress = function () {
|
|
9838
|
-
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
10427
|
+
var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9839
10428
|
return this.getTemporaryCache(key, false);
|
|
9840
10429
|
};
|
|
9841
10430
|
BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {
|
|
9842
|
-
var clientId = this.getInteractionInProgress();
|
|
9843
10431
|
// Ensure we don't overwrite interaction in progress for a different clientId
|
|
9844
|
-
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9845
|
-
if (inProgress
|
|
9846
|
-
|
|
9847
|
-
|
|
10432
|
+
var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
10433
|
+
if (inProgress) {
|
|
10434
|
+
if (this.getInteractionInProgress()) {
|
|
10435
|
+
throw BrowserAuthError.createInteractionInProgressError();
|
|
10436
|
+
}
|
|
10437
|
+
else {
|
|
10438
|
+
// No interaction is in progress
|
|
10439
|
+
this.setTemporaryCache(key, this.clientId, false);
|
|
10440
|
+
}
|
|
9848
10441
|
}
|
|
9849
|
-
else if (!inProgress &&
|
|
10442
|
+
else if (!inProgress && this.getInteractionInProgress() === this.clientId) {
|
|
9850
10443
|
this.removeItem(key);
|
|
9851
10444
|
}
|
|
9852
10445
|
};
|
|
@@ -9980,7 +10573,7 @@ var FetchClient = /** @class */ (function () {
|
|
|
9980
10573
|
return __generator$1(this, function (_b) {
|
|
9981
10574
|
switch (_b.label) {
|
|
9982
10575
|
case 0:
|
|
9983
|
-
reqBody = (options && options.body) ||
|
|
10576
|
+
reqBody = (options && options.body) || Constants.EMPTY_STRING;
|
|
9984
10577
|
_b.label = 1;
|
|
9985
10578
|
case 1:
|
|
9986
10579
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -10200,7 +10793,7 @@ var BrowserUtils = /** @class */ (function () {
|
|
|
10200
10793
|
BrowserUtils.replaceHash = function (url) {
|
|
10201
10794
|
var urlParts = url.split("#");
|
|
10202
10795
|
urlParts.shift(); // Remove part before the hash
|
|
10203
|
-
window.location.hash = urlParts.length > 0 ? urlParts.join("#") :
|
|
10796
|
+
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
|
|
10204
10797
|
};
|
|
10205
10798
|
/**
|
|
10206
10799
|
* Returns boolean of whether the current window is in an iframe or not.
|
|
@@ -10361,19 +10954,23 @@ var DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
|
10361
10954
|
* @returns Configuration object
|
|
10362
10955
|
*/
|
|
10363
10956
|
function buildConfiguration(_a, isBrowserEnvironment) {
|
|
10364
|
-
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system;
|
|
10957
|
+
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system, userInputTelemetry = _a.telemetry;
|
|
10365
10958
|
// Default auth options for browser
|
|
10366
10959
|
var DEFAULT_AUTH_OPTIONS = {
|
|
10367
|
-
clientId:
|
|
10960
|
+
clientId: Constants.EMPTY_STRING,
|
|
10368
10961
|
authority: "" + Constants.DEFAULT_AUTHORITY,
|
|
10369
10962
|
knownAuthorities: [],
|
|
10370
|
-
cloudDiscoveryMetadata:
|
|
10371
|
-
authorityMetadata:
|
|
10372
|
-
redirectUri:
|
|
10373
|
-
postLogoutRedirectUri:
|
|
10963
|
+
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
|
|
10964
|
+
authorityMetadata: Constants.EMPTY_STRING,
|
|
10965
|
+
redirectUri: Constants.EMPTY_STRING,
|
|
10966
|
+
postLogoutRedirectUri: Constants.EMPTY_STRING,
|
|
10374
10967
|
navigateToLoginRequestUrl: true,
|
|
10375
10968
|
clientCapabilities: [],
|
|
10376
|
-
protocolMode: exports.ProtocolMode.AAD
|
|
10969
|
+
protocolMode: exports.ProtocolMode.AAD,
|
|
10970
|
+
azureCloudOptions: {
|
|
10971
|
+
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
10972
|
+
tenant: Constants.EMPTY_STRING
|
|
10973
|
+
},
|
|
10377
10974
|
};
|
|
10378
10975
|
// Default cache options for browser
|
|
10379
10976
|
var DEFAULT_CACHE_OPTIONS = {
|
|
@@ -10392,17 +10989,24 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
10392
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,
|
|
10393
10990
|
// If loadFrameTimeout is provided, use that as default.
|
|
10394
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
|
+
};
|
|
10395
10998
|
var overlayedConfig = {
|
|
10396
10999
|
auth: __assign$1(__assign$1({}, DEFAULT_AUTH_OPTIONS), userInputAuth),
|
|
10397
11000
|
cache: __assign$1(__assign$1({}, DEFAULT_CACHE_OPTIONS), userInputCache),
|
|
10398
|
-
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)
|
|
10399
11003
|
};
|
|
10400
11004
|
return overlayedConfig;
|
|
10401
11005
|
}
|
|
10402
11006
|
|
|
10403
11007
|
/* eslint-disable header/header */
|
|
10404
11008
|
var name = "@azure/msal-browser";
|
|
10405
|
-
var version = "2.
|
|
11009
|
+
var version = "2.23.0";
|
|
10406
11010
|
|
|
10407
11011
|
/*
|
|
10408
11012
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10559,7 +11163,7 @@ var EventHandler = /** @class */ (function () {
|
|
|
10559
11163
|
* Licensed under the MIT License.
|
|
10560
11164
|
*/
|
|
10561
11165
|
var BaseInteractionClient = /** @class */ (function () {
|
|
10562
|
-
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, correlationId) {
|
|
11166
|
+
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, performanceClient, correlationId) {
|
|
10563
11167
|
this.config = config;
|
|
10564
11168
|
this.browserStorage = storageImpl;
|
|
10565
11169
|
this.browserCrypto = browserCrypto;
|
|
@@ -10567,6 +11171,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10567
11171
|
this.eventHandler = eventHandler;
|
|
10568
11172
|
this.correlationId = correlationId || this.browserCrypto.createNewGuid();
|
|
10569
11173
|
this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);
|
|
11174
|
+
this.performanceClient = performanceClient;
|
|
10570
11175
|
}
|
|
10571
11176
|
BaseInteractionClient.prototype.clearCacheOnLogout = function (account) {
|
|
10572
11177
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
@@ -10593,6 +11198,7 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10593
11198
|
case 4: return [3 /*break*/, 9];
|
|
10594
11199
|
case 5:
|
|
10595
11200
|
_a.trys.push([5, 8, , 9]);
|
|
11201
|
+
this.logger.verbose("No account provided in logout request, clearing all cache items.", this.correlationId);
|
|
10596
11202
|
// Clear all accounts and tokens
|
|
10597
11203
|
return [4 /*yield*/, this.browserStorage.clear()];
|
|
10598
11204
|
case 6:
|
|
@@ -10603,7 +11209,6 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10603
11209
|
case 7:
|
|
10604
11210
|
// Clear any stray keys from IndexedDB
|
|
10605
11211
|
_a.sent();
|
|
10606
|
-
this.logger.verbose("No account provided in logout request, clearing all cache items.");
|
|
10607
11212
|
return [3 /*break*/, 9];
|
|
10608
11213
|
case 8:
|
|
10609
11214
|
_a.sent();
|
|
@@ -10620,20 +11225,22 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10620
11225
|
*/
|
|
10621
11226
|
BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
|
|
10622
11227
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10623
|
-
var authority, scopes,
|
|
11228
|
+
var authority, scopes, validatedRequest, _a;
|
|
10624
11229
|
return __generator$1(this, function (_b) {
|
|
10625
11230
|
switch (_b.label) {
|
|
10626
11231
|
case 0:
|
|
10627
11232
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
10628
11233
|
authority = request.authority || this.config.auth.authority;
|
|
10629
11234
|
scopes = __spread(((request && request.scopes) || []));
|
|
11235
|
+
validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
11236
|
+
scopes: scopes });
|
|
10630
11237
|
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
10631
|
-
if (!
|
|
10632
|
-
|
|
11238
|
+
if (!validatedRequest.authenticationScheme) {
|
|
11239
|
+
validatedRequest.authenticationScheme = exports.AuthenticationScheme.BEARER;
|
|
10633
11240
|
this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
|
|
10634
11241
|
}
|
|
10635
11242
|
else {
|
|
10636
|
-
if (
|
|
11243
|
+
if (validatedRequest.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
10637
11244
|
if (!request.sshJwk) {
|
|
10638
11245
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
10639
11246
|
}
|
|
@@ -10641,18 +11248,15 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10641
11248
|
throw ClientConfigurationError.createMissingSshKidError();
|
|
10642
11249
|
}
|
|
10643
11250
|
}
|
|
10644
|
-
this.logger.verbose("Authentication Scheme set to \"" +
|
|
11251
|
+
this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
|
|
10645
11252
|
}
|
|
10646
11253
|
if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
|
|
10647
|
-
_a =
|
|
11254
|
+
_a = validatedRequest;
|
|
10648
11255
|
return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
|
|
10649
11256
|
case 1:
|
|
10650
11257
|
_a.requestedClaimsHash = _b.sent();
|
|
10651
11258
|
_b.label = 2;
|
|
10652
|
-
case 2:
|
|
10653
|
-
validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
10654
|
-
scopes: scopes });
|
|
10655
|
-
return [2 /*return*/, validatedRequest];
|
|
11259
|
+
case 2: return [2 /*return*/, validatedRequest];
|
|
10656
11260
|
}
|
|
10657
11261
|
});
|
|
10658
11262
|
});
|
|
@@ -10699,8 +11303,8 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
10699
11303
|
*/
|
|
10700
11304
|
var StandardInteractionClient = /** @class */ (function (_super) {
|
|
10701
11305
|
__extends$1(StandardInteractionClient, _super);
|
|
10702
|
-
function StandardInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) {
|
|
10703
|
-
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;
|
|
10704
11308
|
_this.navigationClient = navigationClient;
|
|
10705
11309
|
return _this;
|
|
10706
11310
|
}
|
|
@@ -10718,7 +11322,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10718
11322
|
return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];
|
|
10719
11323
|
case 1:
|
|
10720
11324
|
generatedPkceParams = _a.sent();
|
|
10721
|
-
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 });
|
|
10722
11326
|
request.codeChallenge = generatedPkceParams.challenge;
|
|
10723
11327
|
request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;
|
|
10724
11328
|
return [2 /*return*/, authCodeRequest];
|
|
@@ -10732,11 +11336,32 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10732
11336
|
*/
|
|
10733
11337
|
StandardInteractionClient.prototype.initializeLogoutRequest = function (logoutRequest) {
|
|
10734
11338
|
this.logger.verbose("initializeLogoutRequest called", logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
|
|
10735
|
-
// Check if interaction is in progress. Throw error if true.
|
|
10736
|
-
if (this.browserStorage.isInteractionInProgress()) {
|
|
10737
|
-
throw BrowserAuthError.createInteractionInProgressError();
|
|
10738
|
-
}
|
|
10739
11339
|
var validLogoutRequest = __assign$1({ correlationId: this.browserCrypto.createNewGuid() }, logoutRequest);
|
|
11340
|
+
/**
|
|
11341
|
+
* Set logout_hint to be login_hint from ID Token Claims if present
|
|
11342
|
+
* and logoutHint attribute wasn't manually set in logout request
|
|
11343
|
+
*/
|
|
11344
|
+
if (logoutRequest) {
|
|
11345
|
+
// If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims
|
|
11346
|
+
if (!logoutRequest.logoutHint) {
|
|
11347
|
+
if (logoutRequest.account) {
|
|
11348
|
+
var logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);
|
|
11349
|
+
if (logoutHint) {
|
|
11350
|
+
this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided");
|
|
11351
|
+
validLogoutRequest.logoutHint = logoutHint;
|
|
11352
|
+
}
|
|
11353
|
+
}
|
|
11354
|
+
else {
|
|
11355
|
+
this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");
|
|
11356
|
+
}
|
|
11357
|
+
}
|
|
11358
|
+
else {
|
|
11359
|
+
this.logger.verbose("logoutHint has already been set in logoutRequest");
|
|
11360
|
+
}
|
|
11361
|
+
}
|
|
11362
|
+
else {
|
|
11363
|
+
this.logger.verbose("logoutHint will not be set since no logout request was configured");
|
|
11364
|
+
}
|
|
10740
11365
|
/*
|
|
10741
11366
|
* Only set redirect uri if logout request isn't provided or the set uri isn't null.
|
|
10742
11367
|
* Otherwise, use passed uri, config, or current page.
|
|
@@ -10763,17 +11388,37 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10763
11388
|
}
|
|
10764
11389
|
return validLogoutRequest;
|
|
10765
11390
|
};
|
|
11391
|
+
/**
|
|
11392
|
+
* Parses login_hint ID Token Claim out of AccountInfo object to be used as
|
|
11393
|
+
* logout_hint in end session request.
|
|
11394
|
+
* @param account
|
|
11395
|
+
*/
|
|
11396
|
+
StandardInteractionClient.prototype.getLogoutHintFromIdTokenClaims = function (account) {
|
|
11397
|
+
var idTokenClaims = account.idTokenClaims;
|
|
11398
|
+
if (idTokenClaims) {
|
|
11399
|
+
if (idTokenClaims.login_hint) {
|
|
11400
|
+
return idTokenClaims.login_hint;
|
|
11401
|
+
}
|
|
11402
|
+
else {
|
|
11403
|
+
this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request");
|
|
11404
|
+
}
|
|
11405
|
+
}
|
|
11406
|
+
else {
|
|
11407
|
+
this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");
|
|
11408
|
+
}
|
|
11409
|
+
return null;
|
|
11410
|
+
};
|
|
10766
11411
|
/**
|
|
10767
11412
|
* Creates an Authorization Code Client with the given authority, or the default authority.
|
|
10768
11413
|
* @param serverTelemetryManager
|
|
10769
11414
|
* @param authorityUrl
|
|
10770
11415
|
*/
|
|
10771
|
-
StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl) {
|
|
11416
|
+
StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
|
|
10772
11417
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10773
11418
|
var clientConfig;
|
|
10774
11419
|
return __generator$1(this, function (_a) {
|
|
10775
11420
|
switch (_a.label) {
|
|
10776
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
11421
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
|
|
10777
11422
|
case 1:
|
|
10778
11423
|
clientConfig = _a.sent();
|
|
10779
11424
|
return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
|
|
@@ -10787,14 +11432,14 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10787
11432
|
* @param requestAuthority
|
|
10788
11433
|
* @param requestCorrelationId
|
|
10789
11434
|
*/
|
|
10790
|
-
StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority) {
|
|
11435
|
+
StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
10791
11436
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10792
11437
|
var discoveredAuthority;
|
|
10793
11438
|
return __generator$1(this, function (_a) {
|
|
10794
11439
|
switch (_a.label) {
|
|
10795
11440
|
case 0:
|
|
10796
|
-
this.logger.verbose("getClientConfiguration called");
|
|
10797
|
-
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority)];
|
|
11441
|
+
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
11442
|
+
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
|
|
10798
11443
|
case 1:
|
|
10799
11444
|
discoveredAuthority = _a.sent();
|
|
10800
11445
|
return [2 /*return*/, {
|
|
@@ -10820,9 +11465,10 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10820
11465
|
libraryInfo: {
|
|
10821
11466
|
sku: BrowserConstants.MSAL_SKU,
|
|
10822
11467
|
version: version,
|
|
10823
|
-
cpu:
|
|
10824
|
-
os:
|
|
10825
|
-
}
|
|
11468
|
+
cpu: Constants.EMPTY_STRING,
|
|
11469
|
+
os: Constants.EMPTY_STRING
|
|
11470
|
+
},
|
|
11471
|
+
telemetry: this.config.telemetry
|
|
10826
11472
|
}];
|
|
10827
11473
|
}
|
|
10828
11474
|
});
|
|
@@ -10854,49 +11500,36 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10854
11500
|
* @param requestAuthority
|
|
10855
11501
|
* @param requestCorrelationId
|
|
10856
11502
|
*/
|
|
10857
|
-
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority) {
|
|
11503
|
+
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
|
|
10858
11504
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10859
|
-
var authorityOptions;
|
|
11505
|
+
var getAuthorityMeasurement, authorityOptions, userAuthority, builtAuthority;
|
|
10860
11506
|
return __generator$1(this, function (_a) {
|
|
10861
11507
|
switch (_a.label) {
|
|
10862
11508
|
case 0:
|
|
10863
|
-
this.logger.verbose("getDiscoveredAuthority called");
|
|
11509
|
+
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
11510
|
+
getAuthorityMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
10864
11511
|
authorityOptions = {
|
|
10865
11512
|
protocolMode: this.config.auth.protocolMode,
|
|
10866
11513
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
10867
11514
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
10868
|
-
authorityMetadata: this.config.auth.authorityMetadata
|
|
11515
|
+
authorityMetadata: this.config.auth.authorityMetadata,
|
|
10869
11516
|
};
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
*/
|
|
10887
|
-
StandardInteractionClient.prototype.preflightInteractiveRequest = function (request, interactionType) {
|
|
10888
|
-
return __awaiter$1(this, void 0, void 0, function () {
|
|
10889
|
-
return __generator$1(this, function (_a) {
|
|
10890
|
-
switch (_a.label) {
|
|
10891
|
-
case 0:
|
|
10892
|
-
this.logger.verbose("preflightInteractiveRequest called, validating app environment", request === null || request === void 0 ? void 0 : request.correlationId);
|
|
10893
|
-
// block the reload if it occurred inside a hidden iframe
|
|
10894
|
-
BrowserUtils.blockReloadInHiddenIframes();
|
|
10895
|
-
// Check if interaction is in progress. Throw error if true.
|
|
10896
|
-
if (this.browserStorage.isInteractionInProgress(false)) {
|
|
10897
|
-
throw BrowserAuthError.createInteractionInProgressError();
|
|
10898
|
-
}
|
|
10899
|
-
return [4 /*yield*/, this.initializeAuthorizationRequest(request, interactionType)];
|
|
11517
|
+
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
11518
|
+
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
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
|
+
})];
|
|
10900
11533
|
case 1: return [2 /*return*/, _a.sent()];
|
|
10901
11534
|
}
|
|
10902
11535
|
});
|
|
@@ -10913,20 +11546,20 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10913
11546
|
return __generator$1(this, function (_b) {
|
|
10914
11547
|
switch (_b.label) {
|
|
10915
11548
|
case 0:
|
|
10916
|
-
this.logger.verbose("initializeAuthorizationRequest called");
|
|
11549
|
+
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
10917
11550
|
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
10918
11551
|
browserState = {
|
|
10919
11552
|
interactionType: interactionType
|
|
10920
11553
|
};
|
|
10921
|
-
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) ||
|
|
11554
|
+
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
10922
11555
|
_a = [{}];
|
|
10923
11556
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
10924
11557
|
case 1:
|
|
10925
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 }]);
|
|
10926
11559
|
account = request.account || this.browserStorage.getActiveAccount();
|
|
10927
11560
|
if (account) {
|
|
10928
|
-
this.logger.verbose("Setting validated request account");
|
|
10929
|
-
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);
|
|
10930
11563
|
validatedRequest.account = account;
|
|
10931
11564
|
}
|
|
10932
11565
|
// Check for ADAL/MSAL v1 SSO
|
|
@@ -10936,7 +11569,6 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10936
11569
|
validatedRequest.loginHint = legacyLoginHint;
|
|
10937
11570
|
}
|
|
10938
11571
|
}
|
|
10939
|
-
this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority, validatedRequest.loginHint || "", validatedRequest.account || null);
|
|
10940
11572
|
return [2 /*return*/, validatedRequest];
|
|
10941
11573
|
}
|
|
10942
11574
|
});
|
|
@@ -11107,8 +11739,8 @@ var PopupUtils = /** @class */ (function () {
|
|
|
11107
11739
|
* @param clientId
|
|
11108
11740
|
* @param request
|
|
11109
11741
|
*/
|
|
11110
|
-
PopupUtils.generatePopupName = function (clientId,
|
|
11111
|
-
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." +
|
|
11742
|
+
PopupUtils.generatePopupName = function (clientId, scopes, authority, correlationId) {
|
|
11743
|
+
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + scopes.join("-") + "." + authority + "." + correlationId;
|
|
11112
11744
|
};
|
|
11113
11745
|
/**
|
|
11114
11746
|
* Generates the name for the popup based on the client id and request for logouts
|
|
@@ -11241,7 +11873,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
11241
11873
|
*/
|
|
11242
11874
|
InteractionHandler.prototype.checkCcsCredentials = function () {
|
|
11243
11875
|
// Look up ccs credential in temp cache
|
|
11244
|
-
var cachedCcsCred = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, true);
|
|
11876
|
+
var cachedCcsCred = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, true);
|
|
11245
11877
|
if (cachedCcsCred) {
|
|
11246
11878
|
try {
|
|
11247
11879
|
return JSON.parse(cachedCcsCred);
|
|
@@ -11279,8 +11911,6 @@ var PopupHandler = /** @class */ (function (_super) {
|
|
|
11279
11911
|
PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {
|
|
11280
11912
|
// Check that request url is not empty.
|
|
11281
11913
|
if (!StringUtils.isEmpty(requestUrl)) {
|
|
11282
|
-
// Set interaction status in the library.
|
|
11283
|
-
this.browserStorage.setInteractionInProgress(true);
|
|
11284
11914
|
this.browserRequestLogger.infoPii("Navigate to: " + requestUrl);
|
|
11285
11915
|
// Open the popup window to requestUrl.
|
|
11286
11916
|
return this.popupUtils.openPopup(requestUrl, params);
|
|
@@ -11330,36 +11960,25 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11330
11960
|
* @param request
|
|
11331
11961
|
*/
|
|
11332
11962
|
PopupClient.prototype.acquireToken = function (request) {
|
|
11333
|
-
|
|
11334
|
-
var
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11353
|
-
popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
|
|
11354
|
-
return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup)];
|
|
11355
|
-
}
|
|
11356
|
-
case 2:
|
|
11357
|
-
e_1 = _a.sent();
|
|
11358
|
-
return [2 /*return*/, Promise.reject(e_1)];
|
|
11359
|
-
case 3: return [2 /*return*/];
|
|
11360
|
-
}
|
|
11361
|
-
});
|
|
11362
|
-
});
|
|
11963
|
+
try {
|
|
11964
|
+
var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
|
|
11965
|
+
var popupWindowAttributes = request.popupWindowAttributes || {};
|
|
11966
|
+
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
11967
|
+
if (this.config.system.asyncPopups) {
|
|
11968
|
+
this.logger.verbose("asyncPopups set to true, acquiring token");
|
|
11969
|
+
// Passes on popup position and dimensions if in request
|
|
11970
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
|
|
11971
|
+
}
|
|
11972
|
+
else {
|
|
11973
|
+
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
|
11974
|
+
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11975
|
+
var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
|
|
11976
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
|
|
11977
|
+
}
|
|
11978
|
+
}
|
|
11979
|
+
catch (e) {
|
|
11980
|
+
return Promise.reject(e);
|
|
11981
|
+
}
|
|
11363
11982
|
};
|
|
11364
11983
|
/**
|
|
11365
11984
|
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
|
|
@@ -11400,26 +12019,30 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11400
12019
|
*
|
|
11401
12020
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
11402
12021
|
*/
|
|
11403
|
-
PopupClient.prototype.acquireTokenPopupAsync = function (
|
|
12022
|
+
PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
|
|
11404
12023
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11405
|
-
var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result,
|
|
12024
|
+
var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
|
|
11406
12025
|
return __generator$1(this, function (_a) {
|
|
11407
12026
|
switch (_a.label) {
|
|
11408
12027
|
case 0:
|
|
11409
12028
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
11410
12029
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
|
|
11411
|
-
|
|
12030
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
|
|
11412
12031
|
case 1:
|
|
11413
|
-
_a.
|
|
11414
|
-
|
|
12032
|
+
validRequest = _a.sent();
|
|
12033
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
12034
|
+
_a.label = 2;
|
|
11415
12035
|
case 2:
|
|
11416
|
-
|
|
11417
|
-
return [4 /*yield*/, this.
|
|
12036
|
+
_a.trys.push([2, 8, , 9]);
|
|
12037
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
11418
12038
|
case 3:
|
|
12039
|
+
authCodeRequest = _a.sent();
|
|
12040
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
12041
|
+
case 4:
|
|
11419
12042
|
authClient = _a.sent();
|
|
11420
12043
|
this.logger.verbose("Auth code client created");
|
|
11421
12044
|
return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
|
|
11422
|
-
case
|
|
12045
|
+
case 5:
|
|
11423
12046
|
navigateUrl = _a.sent();
|
|
11424
12047
|
interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
|
|
11425
12048
|
popupParameters = {
|
|
@@ -11430,28 +12053,28 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11430
12053
|
popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
|
|
11431
12054
|
this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
|
|
11432
12055
|
return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
|
|
11433
|
-
case
|
|
12056
|
+
case 6:
|
|
11434
12057
|
hash = _a.sent();
|
|
11435
12058
|
state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
|
|
11436
12059
|
// Remove throttle if it exists
|
|
11437
12060
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
|
|
11438
12061
|
return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
11439
|
-
case
|
|
12062
|
+
case 7:
|
|
11440
12063
|
result = _a.sent();
|
|
11441
12064
|
return [2 /*return*/, result];
|
|
11442
|
-
case
|
|
11443
|
-
|
|
12065
|
+
case 8:
|
|
12066
|
+
e_1 = _a.sent();
|
|
11444
12067
|
if (popup) {
|
|
11445
12068
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
11446
12069
|
popup.close();
|
|
11447
12070
|
}
|
|
11448
|
-
if (
|
|
11449
|
-
|
|
12071
|
+
if (e_1 instanceof AuthError) {
|
|
12072
|
+
e_1.setCorrelationId(this.correlationId);
|
|
11450
12073
|
}
|
|
11451
|
-
serverTelemetryManager.cacheFailedRequest(
|
|
12074
|
+
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
11452
12075
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11453
|
-
throw
|
|
11454
|
-
case
|
|
12076
|
+
throw e_1;
|
|
12077
|
+
case 9: return [2 /*return*/];
|
|
11455
12078
|
}
|
|
11456
12079
|
});
|
|
11457
12080
|
});
|
|
@@ -11467,7 +12090,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11467
12090
|
*/
|
|
11468
12091
|
PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
|
|
11469
12092
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11470
|
-
var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow,
|
|
12093
|
+
var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_2, navigationOptions, absoluteUrl, e_3;
|
|
11471
12094
|
return __generator$1(this, function (_a) {
|
|
11472
12095
|
switch (_a.label) {
|
|
11473
12096
|
case 0:
|
|
@@ -11482,7 +12105,6 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11482
12105
|
case 2:
|
|
11483
12106
|
// Clear cache on logout
|
|
11484
12107
|
_a.sent();
|
|
11485
|
-
this.browserStorage.setInteractionInProgress(true);
|
|
11486
12108
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
|
|
11487
12109
|
case 3:
|
|
11488
12110
|
authClient = _a.sent();
|
|
@@ -11503,8 +12125,8 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11503
12125
|
this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
|
|
11504
12126
|
return [3 /*break*/, 7];
|
|
11505
12127
|
case 6:
|
|
11506
|
-
|
|
11507
|
-
this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " +
|
|
12128
|
+
e_2 = _a.sent();
|
|
12129
|
+
this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
|
|
11508
12130
|
return [3 /*break*/, 7];
|
|
11509
12131
|
case 7:
|
|
11510
12132
|
popupUtils.cleanPopup(popupWindow);
|
|
@@ -11516,7 +12138,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11516
12138
|
};
|
|
11517
12139
|
absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
|
|
11518
12140
|
this.logger.verbose("Redirecting main window to url specified in the request");
|
|
11519
|
-
this.logger.verbosePii("
|
|
12141
|
+
this.logger.verbosePii("Redirecting main window to: " + absoluteUrl);
|
|
11520
12142
|
this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
|
|
11521
12143
|
}
|
|
11522
12144
|
else {
|
|
@@ -11524,19 +12146,19 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11524
12146
|
}
|
|
11525
12147
|
return [3 /*break*/, 9];
|
|
11526
12148
|
case 8:
|
|
11527
|
-
|
|
12149
|
+
e_3 = _a.sent();
|
|
11528
12150
|
if (popup) {
|
|
11529
12151
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
11530
12152
|
popup.close();
|
|
11531
12153
|
}
|
|
11532
|
-
if (
|
|
11533
|
-
|
|
12154
|
+
if (e_3 instanceof AuthError) {
|
|
12155
|
+
e_3.setCorrelationId(this.correlationId);
|
|
11534
12156
|
}
|
|
11535
12157
|
this.browserStorage.setInteractionInProgress(false);
|
|
11536
|
-
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null,
|
|
12158
|
+
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e_3);
|
|
11537
12159
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11538
|
-
serverTelemetryManager.cacheFailedRequest(
|
|
11539
|
-
throw
|
|
12160
|
+
serverTelemetryManager.cacheFailedRequest(e_3);
|
|
12161
|
+
throw e_3;
|
|
11540
12162
|
case 9:
|
|
11541
12163
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11542
12164
|
return [2 /*return*/];
|
|
@@ -11573,11 +12195,10 @@ var RedirectHandler = /** @class */ (function (_super) {
|
|
|
11573
12195
|
// Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true
|
|
11574
12196
|
if (params.redirectStartPage) {
|
|
11575
12197
|
this.browserRequestLogger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page");
|
|
11576
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
|
|
12198
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
|
|
11577
12199
|
}
|
|
11578
12200
|
// Set interaction status in the library.
|
|
11579
|
-
this.browserStorage.
|
|
11580
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
|
|
12201
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
|
|
11581
12202
|
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
|
|
11582
12203
|
this.browserRequestLogger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl);
|
|
11583
12204
|
navigationOptions = {
|
|
@@ -11691,20 +12312,29 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11691
12312
|
*/
|
|
11692
12313
|
RedirectClient.prototype.acquireToken = function (request) {
|
|
11693
12314
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11694
|
-
var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
|
|
12315
|
+
var validRequest, serverTelemetryManager, handleBackButton, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
|
|
12316
|
+
var _this = this;
|
|
11695
12317
|
return __generator$1(this, function (_a) {
|
|
11696
12318
|
switch (_a.label) {
|
|
11697
|
-
case 0: return [4 /*yield*/, this.
|
|
12319
|
+
case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
|
|
11698
12320
|
case 1:
|
|
11699
12321
|
validRequest = _a.sent();
|
|
12322
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
11700
12323
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
|
|
12324
|
+
handleBackButton = function (event) {
|
|
12325
|
+
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
12326
|
+
if (event.persisted) {
|
|
12327
|
+
_this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
|
12328
|
+
_this.browserStorage.cleanRequestByState(validRequest.state);
|
|
12329
|
+
}
|
|
12330
|
+
};
|
|
11701
12331
|
_a.label = 2;
|
|
11702
12332
|
case 2:
|
|
11703
12333
|
_a.trys.push([2, 7, , 8]);
|
|
11704
12334
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
11705
12335
|
case 3:
|
|
11706
12336
|
authCodeRequest = _a.sent();
|
|
11707
|
-
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
|
|
12337
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
11708
12338
|
case 4:
|
|
11709
12339
|
authClient = _a.sent();
|
|
11710
12340
|
this.logger.verbose("Auth code client created");
|
|
@@ -11714,6 +12344,8 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11714
12344
|
navigateUrl = _a.sent();
|
|
11715
12345
|
redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
11716
12346
|
this.logger.verbosePii("Redirect start page: " + redirectStartPage);
|
|
12347
|
+
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
12348
|
+
window.addEventListener("pageshow", handleBackButton);
|
|
11717
12349
|
return [4 /*yield*/, interactionHandler.initiateAuthRequest(navigateUrl, {
|
|
11718
12350
|
navigationClient: this.navigationClient,
|
|
11719
12351
|
redirectTimeout: this.config.system.redirectNavigationTimeout,
|
|
@@ -11728,6 +12360,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11728
12360
|
if (e_1 instanceof AuthError) {
|
|
11729
12361
|
e_1.setCorrelationId(this.correlationId);
|
|
11730
12362
|
}
|
|
12363
|
+
window.removeEventListener("pageshow", handleBackButton);
|
|
11731
12364
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
11732
12365
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11733
12366
|
throw e_1;
|
|
@@ -11766,7 +12399,6 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11766
12399
|
state = void 0;
|
|
11767
12400
|
try {
|
|
11768
12401
|
state = this.validateAndExtractStateFromHash(responseHash, exports.InteractionType.Redirect);
|
|
11769
|
-
BrowserUtils.clearHash(window);
|
|
11770
12402
|
this.logger.verbose("State extracted from hash");
|
|
11771
12403
|
}
|
|
11772
12404
|
catch (e) {
|
|
@@ -11774,7 +12406,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11774
12406
|
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
11775
12407
|
return [2 /*return*/, null];
|
|
11776
12408
|
}
|
|
11777
|
-
loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) ||
|
|
12409
|
+
loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) || Constants.EMPTY_STRING;
|
|
11778
12410
|
loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
|
|
11779
12411
|
currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
|
|
11780
12412
|
if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];
|
|
@@ -11798,7 +12430,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11798
12430
|
* Returned from authority using redirect - need to perform navigation before processing response
|
|
11799
12431
|
* Cache the hash to be retrieved after the next redirect
|
|
11800
12432
|
*/
|
|
11801
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
12433
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
11802
12434
|
navigationOptions = {
|
|
11803
12435
|
apiId: exports.ApiId.handleRedirectPromise,
|
|
11804
12436
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
@@ -11808,7 +12440,7 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11808
12440
|
if (!(!loginRequestUrl || loginRequestUrl === "null")) return [3 /*break*/, 6];
|
|
11809
12441
|
homepage = BrowserUtils.getHomepage();
|
|
11810
12442
|
// Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage
|
|
11811
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);
|
|
12443
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, homepage, true);
|
|
11812
12444
|
this.logger.warning("Unable to get valid login request url from cache, redirecting to home page");
|
|
11813
12445
|
return [4 /*yield*/, this.navigationClient.navigateInternal(homepage, navigationOptions)];
|
|
11814
12446
|
case 5:
|
|
@@ -11850,12 +12482,13 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11850
12482
|
this.logger.verbose("getRedirectResponseHash called");
|
|
11851
12483
|
// Get current location hash from window or cache.
|
|
11852
12484
|
var isResponseHash = UrlString.hashContainsKnownProperties(hash);
|
|
11853
|
-
var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
|
|
11854
|
-
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
11855
12485
|
if (isResponseHash) {
|
|
12486
|
+
BrowserUtils.clearHash(window);
|
|
11856
12487
|
this.logger.verbose("Hash contains known properties, returning response hash");
|
|
11857
12488
|
return hash;
|
|
11858
12489
|
}
|
|
12490
|
+
var cachedHash = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, true);
|
|
12491
|
+
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
|
|
11859
12492
|
this.logger.verbose("Hash does not contain known properties, returning cached hash");
|
|
11860
12493
|
return cachedHash;
|
|
11861
12494
|
};
|
|
@@ -12123,8 +12756,8 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12123
12756
|
*/
|
|
12124
12757
|
var SilentIframeClient = /** @class */ (function (_super) {
|
|
12125
12758
|
__extends$1(SilentIframeClient, _super);
|
|
12126
|
-
function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
|
|
12127
|
-
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;
|
|
12128
12761
|
_this.apiId = apiId;
|
|
12129
12762
|
return _this;
|
|
12130
12763
|
}
|
|
@@ -12134,22 +12767,27 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12134
12767
|
*/
|
|
12135
12768
|
SilentIframeClient.prototype.acquireToken = function (request) {
|
|
12136
12769
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12137
|
-
var silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
|
|
12770
|
+
var acquireTokenMeasurement, silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
|
|
12138
12771
|
return __generator$1(this, function (_a) {
|
|
12139
12772
|
switch (_a.label) {
|
|
12140
12773
|
case 0:
|
|
12141
12774
|
this.logger.verbose("acquireTokenByIframe called");
|
|
12775
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
12142
12776
|
// Check that we have some SSO data
|
|
12143
12777
|
if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {
|
|
12144
12778
|
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
|
12145
12779
|
}
|
|
12146
12780
|
// Check that prompt is set to none, throw error if it is set to anything else.
|
|
12147
12781
|
if (request.prompt && request.prompt !== PromptValue.NONE) {
|
|
12782
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12783
|
+
success: false
|
|
12784
|
+
});
|
|
12148
12785
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
12149
12786
|
}
|
|
12150
12787
|
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12151
12788
|
case 1:
|
|
12152
12789
|
silentRequest = _a.sent();
|
|
12790
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
12153
12791
|
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12154
12792
|
_a.label = 2;
|
|
12155
12793
|
case 2:
|
|
@@ -12157,14 +12795,21 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12157
12795
|
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
|
|
12158
12796
|
case 3:
|
|
12159
12797
|
authCodeRequest = _a.sent();
|
|
12160
|
-
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority)];
|
|
12798
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12161
12799
|
case 4:
|
|
12162
12800
|
authClient = _a.sent();
|
|
12163
12801
|
this.logger.verbose("Auth code client created");
|
|
12164
12802
|
return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];
|
|
12165
12803
|
case 5:
|
|
12166
12804
|
navigateUrl = _a.sent();
|
|
12167
|
-
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
|
+
})];
|
|
12168
12813
|
case 6: return [2 /*return*/, _a.sent()];
|
|
12169
12814
|
case 7:
|
|
12170
12815
|
e_1 = _a.sent();
|
|
@@ -12173,6 +12818,9 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12173
12818
|
}
|
|
12174
12819
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12175
12820
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12821
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12822
|
+
success: false
|
|
12823
|
+
});
|
|
12176
12824
|
throw e_1;
|
|
12177
12825
|
case 8: return [2 /*return*/];
|
|
12178
12826
|
}
|
|
@@ -12230,7 +12878,7 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12230
12878
|
*/
|
|
12231
12879
|
SilentRefreshClient.prototype.acquireToken = function (request) {
|
|
12232
12880
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12233
|
-
var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
|
|
12881
|
+
var silentRequest, _a, acquireTokenMeasurement, serverTelemetryManager, refreshTokenClient;
|
|
12234
12882
|
var _this = this;
|
|
12235
12883
|
return __generator$1(this, function (_b) {
|
|
12236
12884
|
switch (_b.label) {
|
|
@@ -12239,17 +12887,29 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12239
12887
|
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
12240
12888
|
case 1:
|
|
12241
12889
|
silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
|
|
12890
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
12242
12891
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
12243
|
-
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];
|
|
12892
|
+
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12244
12893
|
case 2:
|
|
12245
12894
|
refreshTokenClient = _b.sent();
|
|
12246
12895
|
this.logger.verbose("Refresh token client created");
|
|
12247
12896
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
12248
|
-
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) {
|
|
12249
12906
|
if (e instanceof AuthError) {
|
|
12250
12907
|
e.setCorrelationId(_this.correlationId);
|
|
12251
12908
|
}
|
|
12252
12909
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
12910
|
+
acquireTokenMeasurement.endMeasurement({
|
|
12911
|
+
success: false
|
|
12912
|
+
});
|
|
12253
12913
|
throw e;
|
|
12254
12914
|
})];
|
|
12255
12915
|
}
|
|
@@ -12268,12 +12928,12 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12268
12928
|
* @param serverTelemetryManager
|
|
12269
12929
|
* @param authorityUrl
|
|
12270
12930
|
*/
|
|
12271
|
-
SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl) {
|
|
12931
|
+
SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
12272
12932
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12273
12933
|
var clientConfig;
|
|
12274
12934
|
return __generator$1(this, function (_a) {
|
|
12275
12935
|
switch (_a.label) {
|
|
12276
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
12936
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
12277
12937
|
case 1:
|
|
12278
12938
|
clientConfig = _a.sent();
|
|
12279
12939
|
return [2 /*return*/, new RefreshTokenClient(clientConfig)];
|
|
@@ -12316,13 +12976,14 @@ var TokenCache = /** @class */ (function () {
|
|
|
12316
12976
|
this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
|
|
12317
12977
|
}
|
|
12318
12978
|
else if (request.authority) {
|
|
12979
|
+
var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
|
|
12319
12980
|
var authorityOptions = {
|
|
12320
12981
|
protocolMode: this.config.auth.protocolMode,
|
|
12321
12982
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
12322
12983
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
12323
|
-
authorityMetadata: this.config.auth.authorityMetadata
|
|
12984
|
+
authorityMetadata: this.config.auth.authorityMetadata,
|
|
12324
12985
|
};
|
|
12325
|
-
var authority = new Authority(
|
|
12986
|
+
var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
|
|
12326
12987
|
// "clientInfo" from options takes precedence over "clientInfo" in response
|
|
12327
12988
|
if (options.clientInfo) {
|
|
12328
12989
|
this.logger.trace("TokenCache - homeAccountId from options");
|
|
@@ -12421,8 +13082,8 @@ var HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
12421
13082
|
*/
|
|
12422
13083
|
var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
12423
13084
|
__extends$1(SilentAuthCodeClient, _super);
|
|
12424
|
-
function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
|
|
12425
|
-
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;
|
|
12426
13087
|
_this.apiId = apiId;
|
|
12427
13088
|
return _this;
|
|
12428
13089
|
}
|
|
@@ -12444,6 +13105,7 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
12444
13105
|
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
12445
13106
|
case 1:
|
|
12446
13107
|
silentRequest = _a.sent();
|
|
13108
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
12447
13109
|
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12448
13110
|
_a.label = 2;
|
|
12449
13111
|
case 2:
|
|
@@ -12485,6 +13147,110 @@ var SilentAuthCodeClient = /** @class */ (function (_super) {
|
|
|
12485
13147
|
return SilentAuthCodeClient;
|
|
12486
13148
|
}(StandardInteractionClient));
|
|
12487
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
|
+
|
|
12488
13254
|
/*
|
|
12489
13255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12490
13256
|
* Licensed under the MIT License.
|
|
@@ -12530,8 +13296,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12530
13296
|
this.redirectResponse = new Map();
|
|
12531
13297
|
// Initial hybrid spa map
|
|
12532
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);
|
|
12533
13303
|
// Initialize the crypto class.
|
|
12534
|
-
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;
|
|
12535
13305
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
12536
13306
|
// Initialize the browser storage class.
|
|
12537
13307
|
this.browserStorage = this.isBrowserEnvironment ?
|
|
@@ -12561,8 +13331,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12561
13331
|
if (typeof response === "undefined") {
|
|
12562
13332
|
this.eventHandler.emitEvent(exports.EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
12563
13333
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
12564
|
-
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) ||
|
|
12565
|
-
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);
|
|
12566
13336
|
response = redirectClient.handleRedirectPromise(hash)
|
|
12567
13337
|
.then(function (result) {
|
|
12568
13338
|
if (result) {
|
|
@@ -12614,12 +13384,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12614
13384
|
*/
|
|
12615
13385
|
ClientApplication.prototype.acquireTokenRedirect = function (request) {
|
|
12616
13386
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12617
|
-
var isLoggedIn, redirectClient;
|
|
13387
|
+
var correlationId, isLoggedIn, redirectClient;
|
|
12618
13388
|
var _this = this;
|
|
12619
13389
|
return __generator$1(this, function (_a) {
|
|
12620
|
-
|
|
13390
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
13391
|
+
this.logger.verbose("acquireTokenRedirect called", correlationId);
|
|
12621
13392
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12622
|
-
this.logger.verbose("acquireTokenRedirect called");
|
|
12623
13393
|
isLoggedIn = this.getAllAccounts().length > 0;
|
|
12624
13394
|
if (isLoggedIn) {
|
|
12625
13395
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
|
|
@@ -12627,8 +13397,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12627
13397
|
else {
|
|
12628
13398
|
this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Redirect, request);
|
|
12629
13399
|
}
|
|
12630
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12631
|
-
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) {
|
|
12632
13402
|
// If logged in, emit acquire token events
|
|
12633
13403
|
if (isLoggedIn) {
|
|
12634
13404
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
@@ -12652,9 +13422,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12652
13422
|
*/
|
|
12653
13423
|
ClientApplication.prototype.acquireTokenPopup = function (request) {
|
|
12654
13424
|
var _this = this;
|
|
13425
|
+
var correlationId = this.getRequestCorrelationId(request);
|
|
12655
13426
|
try {
|
|
13427
|
+
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
12656
13428
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12657
|
-
this.logger.verbose("acquireTokenPopup called", request.correlationId);
|
|
12658
13429
|
}
|
|
12659
13430
|
catch (e) {
|
|
12660
13431
|
// Since this function is syncronous we need to reject
|
|
@@ -12668,8 +13439,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12668
13439
|
else {
|
|
12669
13440
|
this.eventHandler.emitEvent(exports.EventType.LOGIN_START, exports.InteractionType.Popup, request);
|
|
12670
13441
|
}
|
|
12671
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12672
|
-
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) {
|
|
12673
13444
|
// If logged in, emit acquire token events
|
|
12674
13445
|
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
|
|
12675
13446
|
if (isLoggingIn) {
|
|
@@ -12709,25 +13480,35 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12709
13480
|
*/
|
|
12710
13481
|
ClientApplication.prototype.ssoSilent = function (request) {
|
|
12711
13482
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12712
|
-
var silentIframeClient, silentTokenResult, e_1;
|
|
13483
|
+
var correlationId, ssoSilentMeasurement, silentIframeClient, silentTokenResult, e_1;
|
|
12713
13484
|
return __generator$1(this, function (_a) {
|
|
12714
13485
|
switch (_a.label) {
|
|
12715
13486
|
case 0:
|
|
13487
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
12716
13488
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
12717
|
-
this.
|
|
13489
|
+
ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
13490
|
+
this.logger.verbose("ssoSilent called", correlationId);
|
|
12718
13491
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_START, exports.InteractionType.Silent, request);
|
|
12719
13492
|
_a.label = 1;
|
|
12720
13493
|
case 1:
|
|
12721
13494
|
_a.trys.push([1, 3, , 4]);
|
|
12722
|
-
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, exports.ApiId.ssoSilent,
|
|
12723
|
-
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 }))];
|
|
12724
13497
|
case 2:
|
|
12725
13498
|
silentTokenResult = _a.sent();
|
|
12726
13499
|
this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, silentTokenResult);
|
|
13500
|
+
ssoSilentMeasurement.endMeasurement({
|
|
13501
|
+
success: true
|
|
13502
|
+
});
|
|
13503
|
+
ssoSilentMeasurement.flushMeasurement();
|
|
12727
13504
|
return [2 /*return*/, silentTokenResult];
|
|
12728
13505
|
case 3:
|
|
12729
13506
|
e_1 = _a.sent();
|
|
12730
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();
|
|
12731
13512
|
throw e_1;
|
|
12732
13513
|
case 4: return [2 /*return*/];
|
|
12733
13514
|
}
|
|
@@ -12746,38 +13527,56 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12746
13527
|
*/
|
|
12747
13528
|
ClientApplication.prototype.acquireTokenByCode = function (request) {
|
|
12748
13529
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12749
|
-
var response;
|
|
13530
|
+
var correlationId, atbcMeasurement, response;
|
|
12750
13531
|
var _this = this;
|
|
12751
13532
|
return __generator$1(this, function (_a) {
|
|
13533
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
12752
13534
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
12753
|
-
this.logger.trace("acquireTokenByCode called",
|
|
13535
|
+
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
12754
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);
|
|
12755
13538
|
try {
|
|
12756
13539
|
if (!request.code) {
|
|
12757
13540
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
12758
13541
|
}
|
|
12759
13542
|
response = this.hybridAuthCodeResponses.get(request.code);
|
|
12760
13543
|
if (!response) {
|
|
12761
|
-
this.logger.verbose("Initiating new acquireTokenByCode request",
|
|
12762
|
-
response = this.acquireTokenByCodeAsync(request)
|
|
13544
|
+
this.logger.verbose("Initiating new acquireTokenByCode request", correlationId);
|
|
13545
|
+
response = this.acquireTokenByCodeAsync(__assign$1(__assign$1({}, request), { correlationId: correlationId }))
|
|
12763
13546
|
.then(function (result) {
|
|
12764
13547
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
12765
13548
|
_this.hybridAuthCodeResponses.delete(request.code);
|
|
13549
|
+
atbcMeasurement.endMeasurement({
|
|
13550
|
+
success: true
|
|
13551
|
+
});
|
|
13552
|
+
atbcMeasurement.flushMeasurement();
|
|
12766
13553
|
return result;
|
|
12767
13554
|
})
|
|
12768
13555
|
.catch(function (error) {
|
|
12769
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();
|
|
12770
13562
|
throw error;
|
|
12771
13563
|
});
|
|
12772
13564
|
this.hybridAuthCodeResponses.set(request.code, response);
|
|
12773
13565
|
}
|
|
12774
13566
|
else {
|
|
12775
13567
|
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
|
|
13568
|
+
atbcMeasurement.endMeasurement({
|
|
13569
|
+
success: true
|
|
13570
|
+
});
|
|
13571
|
+
atbcMeasurement.discardMeasurement();
|
|
12776
13572
|
}
|
|
12777
13573
|
return [2 /*return*/, response];
|
|
12778
13574
|
}
|
|
12779
13575
|
catch (e) {
|
|
12780
13576
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
13577
|
+
atbcMeasurement.endMeasurement({
|
|
13578
|
+
success: false
|
|
13579
|
+
});
|
|
12781
13580
|
throw e;
|
|
12782
13581
|
}
|
|
12783
13582
|
return [2 /*return*/];
|
|
@@ -12796,7 +13595,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12796
13595
|
switch (_a.label) {
|
|
12797
13596
|
case 0:
|
|
12798
13597
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
12799
|
-
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);
|
|
12800
13599
|
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
|
|
12801
13600
|
case 1:
|
|
12802
13601
|
silentTokenResult = _a.sent();
|
|
@@ -12818,22 +13617,47 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12818
13617
|
*/
|
|
12819
13618
|
ClientApplication.prototype.acquireTokenByRefreshToken = function (request) {
|
|
12820
13619
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12821
|
-
var silentRefreshClient;
|
|
13620
|
+
var atbrtMeasurement, silentRefreshClient;
|
|
12822
13621
|
var _this = this;
|
|
12823
13622
|
return __generator$1(this, function (_a) {
|
|
12824
|
-
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, request);
|
|
12825
13623
|
// block the reload if it occurred inside a hidden iframe
|
|
12826
13624
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
12827
|
-
|
|
12828
|
-
|
|
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) {
|
|
12829
13637
|
var isServerError = e instanceof ServerError;
|
|
12830
13638
|
var isInteractionRequiredError = e instanceof InteractionRequiredAuthError;
|
|
12831
13639
|
var isInvalidGrantError = (e.errorCode === BrowserConstants.INVALID_GRANT_ERROR);
|
|
12832
13640
|
if (isServerError && isInvalidGrantError && !isInteractionRequiredError) {
|
|
12833
13641
|
_this.logger.verbose("Refresh token expired or invalid, attempting acquire token by iframe", request.correlationId);
|
|
12834
|
-
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, exports.ApiId.acquireTokenSilent_authCode, request.correlationId);
|
|
12835
|
-
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
|
+
});
|
|
12836
13657
|
}
|
|
13658
|
+
atbrtMeasurement.endMeasurement({
|
|
13659
|
+
success: false
|
|
13660
|
+
});
|
|
12837
13661
|
throw e;
|
|
12838
13662
|
})];
|
|
12839
13663
|
});
|
|
@@ -12848,9 +13672,11 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12848
13672
|
*/
|
|
12849
13673
|
ClientApplication.prototype.logout = function (logoutRequest) {
|
|
12850
13674
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13675
|
+
var correlationId;
|
|
12851
13676
|
return __generator$1(this, function (_a) {
|
|
12852
|
-
this.
|
|
12853
|
-
|
|
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))];
|
|
12854
13680
|
});
|
|
12855
13681
|
});
|
|
12856
13682
|
};
|
|
@@ -12861,11 +13687,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12861
13687
|
*/
|
|
12862
13688
|
ClientApplication.prototype.logoutRedirect = function (logoutRequest) {
|
|
12863
13689
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12864
|
-
var redirectClient;
|
|
13690
|
+
var correlationId, redirectClient;
|
|
12865
13691
|
return __generator$1(this, function (_a) {
|
|
13692
|
+
correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
12866
13693
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12867
|
-
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12868
|
-
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))];
|
|
12869
13696
|
});
|
|
12870
13697
|
});
|
|
12871
13698
|
};
|
|
@@ -12875,9 +13702,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12875
13702
|
*/
|
|
12876
13703
|
ClientApplication.prototype.logoutPopup = function (logoutRequest) {
|
|
12877
13704
|
try {
|
|
13705
|
+
var correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
12878
13706
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12879
|
-
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
12880
|
-
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));
|
|
12881
13709
|
}
|
|
12882
13710
|
catch (e) {
|
|
12883
13711
|
// Since this function is syncronous we need to reject
|
|
@@ -12989,6 +13817,21 @@ var ClientApplication = /** @class */ (function () {
|
|
|
12989
13817
|
!this.config.cache.storeAuthStateInCookie) {
|
|
12990
13818
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
12991
13819
|
}
|
|
13820
|
+
if (interactionType === exports.InteractionType.Redirect || interactionType === exports.InteractionType.Popup) {
|
|
13821
|
+
this.preflightInteractiveRequest();
|
|
13822
|
+
}
|
|
13823
|
+
};
|
|
13824
|
+
/**
|
|
13825
|
+
* Helper to validate app environment before making a request.
|
|
13826
|
+
* @param request
|
|
13827
|
+
* @param interactionType
|
|
13828
|
+
*/
|
|
13829
|
+
ClientApplication.prototype.preflightInteractiveRequest = function () {
|
|
13830
|
+
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
13831
|
+
// block the reload if it occurred inside a hidden iframe
|
|
13832
|
+
BrowserUtils.blockReloadInHiddenIframes();
|
|
13833
|
+
// Set interaction in progress temporary cache or throw if alread set.
|
|
13834
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
12992
13835
|
};
|
|
12993
13836
|
/**
|
|
12994
13837
|
* Adds event callbacks to array
|
|
@@ -13004,6 +13847,24 @@ var ClientApplication = /** @class */ (function () {
|
|
|
13004
13847
|
ClientApplication.prototype.removeEventCallback = function (callbackId) {
|
|
13005
13848
|
this.eventHandler.removeEventCallback(callbackId);
|
|
13006
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
|
+
};
|
|
13007
13868
|
/**
|
|
13008
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
|
|
13009
13870
|
*/
|
|
@@ -13057,6 +13918,26 @@ var ClientApplication = /** @class */ (function () {
|
|
|
13057
13918
|
ClientApplication.prototype.getConfiguration = function () {
|
|
13058
13919
|
return this.config;
|
|
13059
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
|
+
};
|
|
13060
13941
|
return ClientApplication;
|
|
13061
13942
|
}());
|
|
13062
13943
|
|
|
@@ -13075,12 +13956,13 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
13075
13956
|
*/
|
|
13076
13957
|
SilentCacheClient.prototype.acquireToken = function (silentRequest) {
|
|
13077
13958
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13078
|
-
var serverTelemetryManager, silentAuthClient, cachedToken, error_1;
|
|
13959
|
+
var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
|
|
13079
13960
|
return __generator$1(this, function (_a) {
|
|
13080
13961
|
switch (_a.label) {
|
|
13081
13962
|
case 0:
|
|
13963
|
+
acquireTokenMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
13082
13964
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
13083
|
-
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority)];
|
|
13965
|
+
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
13084
13966
|
case 1:
|
|
13085
13967
|
silentAuthClient = _a.sent();
|
|
13086
13968
|
this.logger.verbose("Silent auth client created");
|
|
@@ -13091,12 +13973,19 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
13091
13973
|
case 3:
|
|
13092
13974
|
cachedToken = _a.sent();
|
|
13093
13975
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, cachedToken);
|
|
13976
|
+
acquireTokenMeasurement.endMeasurement({
|
|
13977
|
+
success: true,
|
|
13978
|
+
fromCache: true
|
|
13979
|
+
});
|
|
13094
13980
|
return [2 /*return*/, cachedToken];
|
|
13095
13981
|
case 4:
|
|
13096
13982
|
error_1 = _a.sent();
|
|
13097
13983
|
if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {
|
|
13098
13984
|
this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
|
|
13099
13985
|
}
|
|
13986
|
+
acquireTokenMeasurement.endMeasurement({
|
|
13987
|
+
success: false
|
|
13988
|
+
});
|
|
13100
13989
|
throw error_1;
|
|
13101
13990
|
case 5: return [2 /*return*/];
|
|
13102
13991
|
}
|
|
@@ -13115,12 +14004,12 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
13115
14004
|
* @param serverTelemetryManager
|
|
13116
14005
|
* @param authorityUrl
|
|
13117
14006
|
*/
|
|
13118
|
-
SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl) {
|
|
14007
|
+
SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
13119
14008
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13120
14009
|
var clientConfig;
|
|
13121
14010
|
return __generator$1(this, function (_a) {
|
|
13122
14011
|
switch (_a.label) {
|
|
13123
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
14012
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
13124
14013
|
case 1:
|
|
13125
14014
|
clientConfig = _a.sent();
|
|
13126
14015
|
return [2 /*return*/, new SilentFlowClient(clientConfig)];
|
|
@@ -13191,9 +14080,11 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13191
14080
|
*/
|
|
13192
14081
|
PublicClientApplication.prototype.loginRedirect = function (request) {
|
|
13193
14082
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
14083
|
+
var correlationId;
|
|
13194
14084
|
return __generator$1(this, function (_a) {
|
|
13195
|
-
this.
|
|
13196
|
-
|
|
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)))];
|
|
13197
14088
|
});
|
|
13198
14089
|
});
|
|
13199
14090
|
};
|
|
@@ -13205,8 +14096,9 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13205
14096
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
13206
14097
|
*/
|
|
13207
14098
|
PublicClientApplication.prototype.loginPopup = function (request) {
|
|
13208
|
-
this.
|
|
13209
|
-
|
|
14099
|
+
var correlationId = this.getRequestCorrelationId(request);
|
|
14100
|
+
this.logger.verbose("loginPopup called", correlationId);
|
|
14101
|
+
return this.acquireTokenPopup(__assign$1({ correlationId: correlationId }, (request || DEFAULT_REQUEST)));
|
|
13210
14102
|
};
|
|
13211
14103
|
/**
|
|
13212
14104
|
* Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
|
|
@@ -13216,18 +14108,20 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13216
14108
|
*/
|
|
13217
14109
|
PublicClientApplication.prototype.acquireTokenSilent = function (request) {
|
|
13218
14110
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13219
|
-
var account, thumbprint, silentRequestKey, cachedResponse, response;
|
|
14111
|
+
var correlationId, atsMeasurement, account, thumbprint, silentRequestKey, cachedResponse, response;
|
|
13220
14112
|
var _this = this;
|
|
13221
14113
|
return __generator$1(this, function (_a) {
|
|
14114
|
+
correlationId = this.getRequestCorrelationId(request);
|
|
14115
|
+
atsMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
13222
14116
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
13223
|
-
this.logger.verbose("acquireTokenSilent called",
|
|
14117
|
+
this.logger.verbose("acquireTokenSilent called", correlationId);
|
|
13224
14118
|
account = request.account || this.getActiveAccount();
|
|
13225
14119
|
if (!account) {
|
|
13226
14120
|
throw BrowserAuthError.createNoAccountError();
|
|
13227
14121
|
}
|
|
13228
14122
|
thumbprint = {
|
|
13229
14123
|
clientId: this.config.auth.clientId,
|
|
13230
|
-
authority: request.authority ||
|
|
14124
|
+
authority: request.authority || Constants.EMPTY_STRING,
|
|
13231
14125
|
scopes: request.scopes,
|
|
13232
14126
|
homeAccountIdentifier: account.homeAccountId,
|
|
13233
14127
|
claims: request.claims,
|
|
@@ -13240,21 +14134,35 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13240
14134
|
silentRequestKey = JSON.stringify(thumbprint);
|
|
13241
14135
|
cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
13242
14136
|
if (typeof cachedResponse === "undefined") {
|
|
13243
|
-
this.logger.verbose("acquireTokenSilent called for the first time, storing active request",
|
|
13244
|
-
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)
|
|
13245
14139
|
.then(function (result) {
|
|
13246
14140
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
14141
|
+
atsMeasurement.endMeasurement({
|
|
14142
|
+
success: true,
|
|
14143
|
+
fromCache: result.fromCache
|
|
14144
|
+
});
|
|
14145
|
+
atsMeasurement.flushMeasurement();
|
|
13247
14146
|
return result;
|
|
13248
14147
|
})
|
|
13249
14148
|
.catch(function (error) {
|
|
13250
14149
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
14150
|
+
atsMeasurement.endMeasurement({
|
|
14151
|
+
success: false
|
|
14152
|
+
});
|
|
14153
|
+
atsMeasurement.flushMeasurement();
|
|
13251
14154
|
throw error;
|
|
13252
14155
|
});
|
|
13253
14156
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
13254
14157
|
return [2 /*return*/, response];
|
|
13255
14158
|
}
|
|
13256
14159
|
else {
|
|
13257
|
-
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();
|
|
13258
14166
|
return [2 /*return*/, cachedResponse];
|
|
13259
14167
|
}
|
|
13260
14168
|
});
|
|
@@ -13268,17 +14176,26 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13268
14176
|
*/
|
|
13269
14177
|
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
|
|
13270
14178
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13271
|
-
var silentCacheClient, silentRequest;
|
|
14179
|
+
var astsAsyncMeasurement, silentCacheClient, silentRequest;
|
|
13272
14180
|
var _this = this;
|
|
13273
14181
|
return __generator$1(this, function (_a) {
|
|
13274
14182
|
switch (_a.label) {
|
|
13275
14183
|
case 0:
|
|
13276
|
-
|
|
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);
|
|
13277
14186
|
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
13278
14187
|
case 1:
|
|
13279
14188
|
silentRequest = _a.sent();
|
|
13280
14189
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
13281
|
-
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 () {
|
|
13282
14199
|
var tokenRenewalResult, tokenRenewalError_1;
|
|
13283
14200
|
return __generator$1(this, function (_a) {
|
|
13284
14201
|
switch (_a.label) {
|
|
@@ -13288,10 +14205,17 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
13288
14205
|
case 1:
|
|
13289
14206
|
tokenRenewalResult = _a.sent();
|
|
13290
14207
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
|
|
14208
|
+
astsAsyncMeasurement.endMeasurement({
|
|
14209
|
+
success: true,
|
|
14210
|
+
fromCache: tokenRenewalResult.fromCache
|
|
14211
|
+
});
|
|
13291
14212
|
return [2 /*return*/, tokenRenewalResult];
|
|
13292
14213
|
case 2:
|
|
13293
14214
|
tokenRenewalError_1 = _a.sent();
|
|
13294
14215
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
|
|
14216
|
+
astsAsyncMeasurement.endMeasurement({
|
|
14217
|
+
success: false
|
|
14218
|
+
});
|
|
13295
14219
|
throw tokenRenewalError_1;
|
|
13296
14220
|
case 3: return [2 /*return*/];
|
|
13297
14221
|
}
|
|
@@ -13360,6 +14284,12 @@ var stubbedPublicClientApplication = {
|
|
|
13360
14284
|
removeEventCallback: function () {
|
|
13361
14285
|
return;
|
|
13362
14286
|
},
|
|
14287
|
+
addPerformanceCallback: function () {
|
|
14288
|
+
return "";
|
|
14289
|
+
},
|
|
14290
|
+
removePerformanceCallback: function () {
|
|
14291
|
+
return false;
|
|
14292
|
+
},
|
|
13363
14293
|
enableAccountStorageEvents: function () {
|
|
13364
14294
|
return;
|
|
13365
14295
|
},
|
|
@@ -13523,21 +14453,35 @@ exports.AuthErrorMessage = AuthErrorMessage;
|
|
|
13523
14453
|
exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
|
|
13524
14454
|
exports.BrowserAuthError = BrowserAuthError;
|
|
13525
14455
|
exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
|
|
14456
|
+
exports.BrowserCacheManager = BrowserCacheManager;
|
|
13526
14457
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
13527
14458
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
14459
|
+
exports.BrowserConstants = BrowserConstants;
|
|
14460
|
+
exports.BrowserPerformanceClient = BrowserPerformanceClient;
|
|
13528
14461
|
exports.BrowserUtils = BrowserUtils;
|
|
13529
14462
|
exports.ClientAuthError = ClientAuthError;
|
|
13530
14463
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|
|
13531
14464
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
13532
14465
|
exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
|
|
14466
|
+
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
14467
|
+
exports.EventHandler = EventHandler;
|
|
13533
14468
|
exports.EventMessageUtils = EventMessageUtils;
|
|
13534
14469
|
exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
|
|
13535
14470
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
13536
14471
|
exports.Logger = Logger;
|
|
13537
14472
|
exports.NavigationClient = NavigationClient;
|
|
14473
|
+
exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
|
|
14474
|
+
exports.PopupClient = PopupClient;
|
|
14475
|
+
exports.PopupUtils = PopupUtils;
|
|
13538
14476
|
exports.PublicClientApplication = PublicClientApplication;
|
|
14477
|
+
exports.RedirectClient = RedirectClient;
|
|
14478
|
+
exports.RedirectHandler = RedirectHandler;
|
|
13539
14479
|
exports.ServerError = ServerError;
|
|
13540
14480
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
14481
|
+
exports.SilentCacheClient = SilentCacheClient;
|
|
14482
|
+
exports.SilentIframeClient = SilentIframeClient;
|
|
14483
|
+
exports.SilentRefreshClient = SilentRefreshClient;
|
|
14484
|
+
exports.StandardInteractionClient = StandardInteractionClient;
|
|
13541
14485
|
exports.StringUtils = StringUtils;
|
|
13542
14486
|
exports.UrlString = UrlString;
|
|
13543
14487
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|