@azure/msal-common 6.0.0 → 6.1.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/CHANGELOG.json +37 -0
- package/CHANGELOG.md +14 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/account/AuthToken.js +1 -1
- package/dist/account/CcsCredential.js +1 -1
- package/dist/account/ClientInfo.js +1 -1
- package/dist/account/TokenClaims.d.ts +1 -0
- package/dist/account/TokenClaims.d.ts.map +1 -1
- package/dist/authority/Authority.d.ts +9 -1
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +36 -11
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +2 -2
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.js +5 -5
- package/dist/authority/AuthorityFactory.js.map +1 -1
- package/dist/authority/AuthorityOptions.d.ts +7 -0
- package/dist/authority/AuthorityOptions.d.ts.map +1 -1
- package/dist/authority/AuthorityOptions.js +22 -0
- package/dist/authority/AuthorityOptions.js.map +1 -0
- package/dist/authority/AuthorityType.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
- package/dist/authority/ImdsOptions.d.ts +7 -0
- package/dist/authority/ImdsOptions.d.ts.map +1 -0
- package/dist/authority/OpenIdConfigResponse.js +1 -1
- package/dist/authority/ProtocolMode.js +1 -1
- package/dist/authority/RegionDiscovery.d.ts +3 -6
- package/dist/authority/RegionDiscovery.d.ts.map +1 -1
- package/dist/authority/RegionDiscovery.js +19 -11
- package/dist/authority/RegionDiscovery.js.map +1 -1
- package/dist/cache/CacheManager.js +1 -1
- package/dist/cache/entities/AccessTokenEntity.js +1 -1
- package/dist/cache/entities/AccountEntity.js +1 -1
- package/dist/cache/entities/AppMetadataEntity.js +1 -1
- package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
- package/dist/cache/entities/CacheRecord.js +1 -1
- package/dist/cache/entities/CredentialEntity.js +1 -1
- package/dist/cache/entities/IdTokenEntity.js +1 -1
- package/dist/cache/entities/RefreshTokenEntity.js +1 -1
- package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
- package/dist/cache/entities/ThrottlingEntity.js +1 -1
- package/dist/cache/persistence/TokenCacheContext.js +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +4 -1
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.js +2 -2
- package/dist/client/BaseClient.js.map +1 -1
- package/dist/client/ClientCredentialClient.js +1 -1
- package/dist/client/DeviceCodeClient.d.ts.map +1 -1
- package/dist/client/DeviceCodeClient.js +3 -2
- package/dist/client/DeviceCodeClient.js.map +1 -1
- package/dist/client/OnBehalfOfClient.js +1 -1
- package/dist/client/RefreshTokenClient.js +1 -1
- package/dist/client/SilentFlowClient.js +1 -1
- package/dist/client/UsernamePasswordClient.js +1 -1
- package/dist/config/ClientConfiguration.d.ts +13 -0
- package/dist/config/ClientConfiguration.d.ts.map +1 -1
- package/dist/config/ClientConfiguration.js +9 -3
- package/dist/config/ClientConfiguration.js.map +1 -1
- package/dist/crypto/ICrypto.js +1 -1
- package/dist/crypto/PopTokenGenerator.js +1 -1
- package/dist/error/AuthError.js +1 -1
- package/dist/error/ClientAuthError.js +1 -1
- package/dist/error/ClientConfigurationError.d.ts +11 -0
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +12 -2
- package/dist/error/ClientConfigurationError.js.map +1 -1
- package/dist/error/InteractionRequiredAuthError.js +1 -1
- package/dist/error/ServerError.js +1 -1
- package/dist/index.cjs.js +108 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/logger/Logger.js +1 -1
- package/dist/network/INetworkModule.d.ts +1 -0
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.js +1 -1
- package/dist/network/INetworkModule.js.map +1 -1
- package/dist/network/NetworkManager.js +1 -1
- package/dist/network/ThrottlingUtils.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/AuthenticationHeaderParser.js +1 -1
- package/dist/request/BaseAuthRequest.d.ts +8 -5
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/CommonEndSessionRequest.d.ts +2 -0
- package/dist/request/CommonEndSessionRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.d.ts +4 -0
- package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.js +7 -1
- package/dist/request/RequestParameterBuilder.js.map +1 -1
- package/dist/request/RequestValidator.js +1 -1
- package/dist/request/ScopeSet.js +1 -1
- package/dist/response/ResponseHandler.js +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
- package/dist/url/UrlString.js +1 -1
- package/dist/url/UrlString.js.map +1 -1
- package/dist/utils/Constants.d.ts +3 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +3 -1
- package/dist/utils/Constants.js.map +1 -1
- package/dist/utils/ProtocolUtils.js +1 -1
- package/dist/utils/StringUtils.js +1 -1
- package/dist/utils/TimeUtils.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v6.
|
|
1
|
+
/*! @azure/msal-common v6.1.0 2022-02-08 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -102,6 +102,7 @@ var Constants = {
|
|
|
102
102
|
// default authority
|
|
103
103
|
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
104
104
|
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
105
|
+
DEFAULT_COMMON_TENANT: "common",
|
|
105
106
|
// ADFS String
|
|
106
107
|
ADFS: "adfs",
|
|
107
108
|
// Default AAD Instance Discovery Endpoint
|
|
@@ -226,6 +227,7 @@ var AADServerParamKeys;
|
|
|
226
227
|
AADServerParamKeys["FOCI"] = "foci";
|
|
227
228
|
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
228
229
|
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
230
|
+
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
229
231
|
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
230
232
|
/**
|
|
231
233
|
* Claims request keys
|
|
@@ -1335,7 +1337,25 @@ var Logger = /** @class */ (function () {
|
|
|
1335
1337
|
|
|
1336
1338
|
/* eslint-disable header/header */
|
|
1337
1339
|
var name = "@azure/msal-common";
|
|
1338
|
-
var version = "6.
|
|
1340
|
+
var version = "6.1.0";
|
|
1341
|
+
|
|
1342
|
+
/*
|
|
1343
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1344
|
+
* Licensed under the MIT License.
|
|
1345
|
+
*/
|
|
1346
|
+
exports.AzureCloudInstance = void 0;
|
|
1347
|
+
(function (AzureCloudInstance) {
|
|
1348
|
+
// AzureCloudInstance is not specified.
|
|
1349
|
+
AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
|
|
1350
|
+
// Microsoft Azure public cloud
|
|
1351
|
+
AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
|
|
1352
|
+
// Microsoft Chinese national cloud
|
|
1353
|
+
AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
|
|
1354
|
+
// Microsoft German national cloud ("Black Forest")
|
|
1355
|
+
AzureCloudInstance["AzureGermany"] = "https://login.microsoftonline.de";
|
|
1356
|
+
// US Government cloud
|
|
1357
|
+
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1358
|
+
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1339
1359
|
|
|
1340
1360
|
/*
|
|
1341
1361
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1574,6 +1594,10 @@ var ClientConfigurationErrorMessage = {
|
|
|
1574
1594
|
code: "untrusted_authority",
|
|
1575
1595
|
desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."
|
|
1576
1596
|
},
|
|
1597
|
+
invalidAzureCloudInstance: {
|
|
1598
|
+
code: "invalid_azure_cloud_instance",
|
|
1599
|
+
desc: "Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"
|
|
1600
|
+
},
|
|
1577
1601
|
missingSshJwk: {
|
|
1578
1602
|
code: "missing_ssh_jwk",
|
|
1579
1603
|
desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."
|
|
@@ -1710,7 +1734,13 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1710
1734
|
ClientConfigurationError.createUntrustedAuthorityError = function () {
|
|
1711
1735
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);
|
|
1712
1736
|
};
|
|
1713
|
-
|
|
1737
|
+
/**
|
|
1738
|
+
* Throws error when the AzureCloudInstance is set to an invalid value
|
|
1739
|
+
*/
|
|
1740
|
+
ClientConfigurationError.createInvalidAzureCloudInstanceError = function () {
|
|
1741
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code, ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);
|
|
1742
|
+
};
|
|
1743
|
+
/**
|
|
1714
1744
|
* Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
|
|
1715
1745
|
*/
|
|
1716
1746
|
ClientConfigurationError.createMissingSshJwkError = function () {
|
|
@@ -3084,7 +3114,8 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3084
3114
|
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3085
3115
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3086
3116
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3087
|
-
preventCorsPreflight: false
|
|
3117
|
+
preventCorsPreflight: false,
|
|
3118
|
+
proxyUrl: "",
|
|
3088
3119
|
};
|
|
3089
3120
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3090
3121
|
loggerCallback: function () {
|
|
@@ -3124,6 +3155,10 @@ var DEFAULT_CLIENT_CREDENTIALS = {
|
|
|
3124
3155
|
clientSecret: "",
|
|
3125
3156
|
clientAssertion: undefined
|
|
3126
3157
|
};
|
|
3158
|
+
var DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3159
|
+
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
3160
|
+
tenant: "" + Constants.DEFAULT_COMMON_TENANT
|
|
3161
|
+
};
|
|
3127
3162
|
/**
|
|
3128
3163
|
* Function that sets the default options when not explicitly configured from app developer
|
|
3129
3164
|
*
|
|
@@ -3153,7 +3188,7 @@ function buildClientConfiguration(_a) {
|
|
|
3153
3188
|
* @param authOptions
|
|
3154
3189
|
*/
|
|
3155
3190
|
function buildAuthOptions(authOptions) {
|
|
3156
|
-
return __assign({ clientCapabilities: [] }, authOptions);
|
|
3191
|
+
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
|
|
3157
3192
|
}
|
|
3158
3193
|
|
|
3159
3194
|
/*
|
|
@@ -3387,7 +3422,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3387
3422
|
var response;
|
|
3388
3423
|
return __generator(this, function (_a) {
|
|
3389
3424
|
switch (_a.label) {
|
|
3390
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
|
|
3425
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
|
|
3391
3426
|
case 1:
|
|
3392
3427
|
response = _a.sent();
|
|
3393
3428
|
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
@@ -3821,6 +3856,12 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3821
3856
|
RequestParameterBuilder.prototype.addThrottling = function () {
|
|
3822
3857
|
this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
|
|
3823
3858
|
};
|
|
3859
|
+
/**
|
|
3860
|
+
* Adds logout_hint parameter for "silent" logout which prevent server account picker
|
|
3861
|
+
*/
|
|
3862
|
+
RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {
|
|
3863
|
+
this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
|
|
3864
|
+
};
|
|
3824
3865
|
/**
|
|
3825
3866
|
* Utility to create a URL from the params map
|
|
3826
3867
|
*/
|
|
@@ -5294,6 +5335,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5294
5335
|
if (request.state) {
|
|
5295
5336
|
parameterBuilder.addState(request.state);
|
|
5296
5337
|
}
|
|
5338
|
+
if (request.logoutHint) {
|
|
5339
|
+
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
5340
|
+
}
|
|
5297
5341
|
if (request.extraQueryParameters) {
|
|
5298
5342
|
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5299
5343
|
}
|
|
@@ -5390,7 +5434,8 @@ var DeviceCodeClient = /** @class */ (function (_super) {
|
|
|
5390
5434
|
switch (_b.label) {
|
|
5391
5435
|
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, deviceCodeEndpoint, {
|
|
5392
5436
|
body: queryString,
|
|
5393
|
-
headers: headers
|
|
5437
|
+
headers: headers,
|
|
5438
|
+
proxyUrl: this.config.systemOptions.proxyUrl
|
|
5394
5439
|
})];
|
|
5395
5440
|
case 1:
|
|
5396
5441
|
_a = (_b.sent()).body, userCode = _a.user_code, deviceCode = _a.device_code, verificationUri = _a.verification_uri, expiresIn = _a.expires_in, interval = _a.interval, message = _a.message;
|
|
@@ -6432,18 +6477,22 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6432
6477
|
*
|
|
6433
6478
|
* @returns Promise<string | null>
|
|
6434
6479
|
*/
|
|
6435
|
-
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
|
|
6480
|
+
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata, proxyUrl) {
|
|
6436
6481
|
return __awaiter(this, void 0, void 0, function () {
|
|
6437
|
-
var autodetectedRegionName, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
6482
|
+
var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
6438
6483
|
return __generator(this, function (_a) {
|
|
6439
6484
|
switch (_a.label) {
|
|
6440
6485
|
case 0:
|
|
6441
6486
|
autodetectedRegionName = environmentRegion;
|
|
6442
6487
|
if (!!autodetectedRegionName) return [3 /*break*/, 8];
|
|
6488
|
+
options = RegionDiscovery.IMDS_OPTIONS;
|
|
6489
|
+
if (proxyUrl) {
|
|
6490
|
+
options.proxyUrl = proxyUrl;
|
|
6491
|
+
}
|
|
6443
6492
|
_a.label = 1;
|
|
6444
6493
|
case 1:
|
|
6445
6494
|
_a.trys.push([1, 6, , 7]);
|
|
6446
|
-
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION)];
|
|
6495
|
+
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
|
|
6447
6496
|
case 2:
|
|
6448
6497
|
localIMDSVersionResponse = _a.sent();
|
|
6449
6498
|
if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -6451,14 +6500,14 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6451
6500
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
6452
6501
|
}
|
|
6453
6502
|
if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
|
|
6454
|
-
return [4 /*yield*/, this.getCurrentVersion()];
|
|
6503
|
+
return [4 /*yield*/, this.getCurrentVersion(options)];
|
|
6455
6504
|
case 3:
|
|
6456
6505
|
currentIMDSVersion = _a.sent();
|
|
6457
6506
|
if (!currentIMDSVersion) {
|
|
6458
6507
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
6459
6508
|
return [2 /*return*/, null];
|
|
6460
6509
|
}
|
|
6461
|
-
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion)];
|
|
6510
|
+
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
|
|
6462
6511
|
case 4:
|
|
6463
6512
|
currentIMDSVersionResponse = _a.sent();
|
|
6464
6513
|
if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -6491,10 +6540,10 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6491
6540
|
* @param imdsEndpointUrl
|
|
6492
6541
|
* @returns Promise<NetworkResponse<string>>
|
|
6493
6542
|
*/
|
|
6494
|
-
RegionDiscovery.prototype.getRegionFromIMDS = function (version) {
|
|
6543
|
+
RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
|
|
6495
6544
|
return __awaiter(this, void 0, void 0, function () {
|
|
6496
6545
|
return __generator(this, function (_a) {
|
|
6497
|
-
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text",
|
|
6546
|
+
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
|
|
6498
6547
|
});
|
|
6499
6548
|
});
|
|
6500
6549
|
};
|
|
@@ -6503,14 +6552,14 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6503
6552
|
*
|
|
6504
6553
|
* @returns Promise<string | null>
|
|
6505
6554
|
*/
|
|
6506
|
-
RegionDiscovery.prototype.getCurrentVersion = function () {
|
|
6555
|
+
RegionDiscovery.prototype.getCurrentVersion = function (options) {
|
|
6507
6556
|
return __awaiter(this, void 0, void 0, function () {
|
|
6508
6557
|
var response;
|
|
6509
6558
|
return __generator(this, function (_a) {
|
|
6510
6559
|
switch (_a.label) {
|
|
6511
6560
|
case 0:
|
|
6512
6561
|
_a.trys.push([0, 2, , 3]);
|
|
6513
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json",
|
|
6562
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
|
|
6514
6563
|
case 1:
|
|
6515
6564
|
response = _a.sent();
|
|
6516
6565
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
@@ -6527,7 +6576,11 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6527
6576
|
});
|
|
6528
6577
|
};
|
|
6529
6578
|
// Options for the IMDS endpoint request
|
|
6530
|
-
RegionDiscovery.IMDS_OPTIONS = {
|
|
6579
|
+
RegionDiscovery.IMDS_OPTIONS = {
|
|
6580
|
+
headers: {
|
|
6581
|
+
Metadata: "true",
|
|
6582
|
+
},
|
|
6583
|
+
};
|
|
6531
6584
|
return RegionDiscovery;
|
|
6532
6585
|
}());
|
|
6533
6586
|
|
|
@@ -6540,7 +6593,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6540
6593
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
|
6541
6594
|
*/
|
|
6542
6595
|
var Authority = /** @class */ (function () {
|
|
6543
|
-
function Authority(authority, networkInterface, cacheManager, authorityOptions) {
|
|
6596
|
+
function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
6544
6597
|
this.canonicalAuthority = authority;
|
|
6545
6598
|
this._canonicalAuthority.validateAsUri();
|
|
6546
6599
|
this.networkInterface = networkInterface;
|
|
@@ -6548,6 +6601,7 @@ var Authority = /** @class */ (function () {
|
|
|
6548
6601
|
this.authorityOptions = authorityOptions;
|
|
6549
6602
|
this.regionDiscovery = new RegionDiscovery(networkInterface);
|
|
6550
6603
|
this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
|
|
6604
|
+
this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
|
|
6551
6605
|
}
|
|
6552
6606
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
6553
6607
|
// See above for AuthorityType
|
|
@@ -6816,7 +6870,7 @@ var Authority = /** @class */ (function () {
|
|
|
6816
6870
|
metadata = _b.sent();
|
|
6817
6871
|
if (!metadata) return [3 /*break*/, 4];
|
|
6818
6872
|
if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
|
|
6819
|
-
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata)];
|
|
6873
|
+
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
|
|
6820
6874
|
case 2:
|
|
6821
6875
|
autodetectedRegionName = _b.sent();
|
|
6822
6876
|
azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
@@ -6879,19 +6933,25 @@ var Authority = /** @class */ (function () {
|
|
|
6879
6933
|
*/
|
|
6880
6934
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
6881
6935
|
return __awaiter(this, void 0, void 0, function () {
|
|
6882
|
-
var response;
|
|
6936
|
+
var options, response;
|
|
6883
6937
|
return __generator(this, function (_a) {
|
|
6884
6938
|
switch (_a.label) {
|
|
6885
6939
|
case 0:
|
|
6886
|
-
|
|
6887
|
-
|
|
6940
|
+
options = {};
|
|
6941
|
+
if (this.proxyUrl) {
|
|
6942
|
+
options.proxyUrl = this.proxyUrl;
|
|
6943
|
+
}
|
|
6944
|
+
_a.label = 1;
|
|
6888
6945
|
case 1:
|
|
6946
|
+
_a.trys.push([1, 3, , 4]);
|
|
6947
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
6948
|
+
case 2:
|
|
6889
6949
|
response = _a.sent();
|
|
6890
6950
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
6891
|
-
case
|
|
6951
|
+
case 3:
|
|
6892
6952
|
_a.sent();
|
|
6893
6953
|
return [2 /*return*/, null];
|
|
6894
|
-
case
|
|
6954
|
+
case 4: return [2 /*return*/];
|
|
6895
6955
|
}
|
|
6896
6956
|
});
|
|
6897
6957
|
});
|
|
@@ -6961,16 +7021,20 @@ var Authority = /** @class */ (function () {
|
|
|
6961
7021
|
*/
|
|
6962
7022
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
6963
7023
|
return __awaiter(this, void 0, void 0, function () {
|
|
6964
|
-
var instanceDiscoveryEndpoint, match, response, metadata;
|
|
7024
|
+
var instanceDiscoveryEndpoint, options, match, response, metadata;
|
|
6965
7025
|
return __generator(this, function (_a) {
|
|
6966
7026
|
switch (_a.label) {
|
|
6967
7027
|
case 0:
|
|
6968
7028
|
instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
|
|
7029
|
+
options = {};
|
|
7030
|
+
if (this.proxyUrl) {
|
|
7031
|
+
options.proxyUrl = this.proxyUrl;
|
|
7032
|
+
}
|
|
6969
7033
|
match = null;
|
|
6970
7034
|
_a.label = 1;
|
|
6971
7035
|
case 1:
|
|
6972
7036
|
_a.trys.push([1, 3, , 4]);
|
|
6973
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];
|
|
7037
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
6974
7038
|
case 2:
|
|
6975
7039
|
response = _a.sent();
|
|
6976
7040
|
metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
|
|
@@ -6985,7 +7049,7 @@ var Authority = /** @class */ (function () {
|
|
|
6985
7049
|
return [2 /*return*/, null];
|
|
6986
7050
|
case 4:
|
|
6987
7051
|
if (!match) {
|
|
6988
|
-
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
7052
|
+
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
6989
7053
|
match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
|
|
6990
7054
|
}
|
|
6991
7055
|
return [2 /*return*/, match];
|
|
@@ -7003,6 +7067,19 @@ var Authority = /** @class */ (function () {
|
|
|
7003
7067
|
});
|
|
7004
7068
|
return matches.length > 0;
|
|
7005
7069
|
};
|
|
7070
|
+
/**
|
|
7071
|
+
* helper function to populate the authority based on azureCloudOptions
|
|
7072
|
+
* @param authorityString
|
|
7073
|
+
* @param azureCloudOptions
|
|
7074
|
+
*/
|
|
7075
|
+
Authority.generateAuthority = function (authorityString, azureCloudOptions) {
|
|
7076
|
+
var authorityAzureCloudInstance;
|
|
7077
|
+
if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== exports.AzureCloudInstance.None) {
|
|
7078
|
+
var tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;
|
|
7079
|
+
authorityAzureCloudInstance = azureCloudOptions.azureCloudInstance + "/" + tenant + "/";
|
|
7080
|
+
}
|
|
7081
|
+
return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;
|
|
7082
|
+
};
|
|
7006
7083
|
/**
|
|
7007
7084
|
* Creates cloud discovery metadata object from a given host
|
|
7008
7085
|
* @param host
|
|
@@ -7112,13 +7189,13 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7112
7189
|
* @param networkClient
|
|
7113
7190
|
* @param protocolMode
|
|
7114
7191
|
*/
|
|
7115
|
-
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions) {
|
|
7192
|
+
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
|
|
7116
7193
|
return __awaiter(this, void 0, void 0, function () {
|
|
7117
7194
|
var acquireTokenAuthority, e_1;
|
|
7118
7195
|
return __generator(this, function (_a) {
|
|
7119
7196
|
switch (_a.label) {
|
|
7120
7197
|
case 0:
|
|
7121
|
-
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions);
|
|
7198
|
+
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
|
|
7122
7199
|
_a.label = 1;
|
|
7123
7200
|
case 1:
|
|
7124
7201
|
_a.trys.push([1, 3, , 4]);
|
|
@@ -7144,12 +7221,12 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7144
7221
|
* @param networkInterface
|
|
7145
7222
|
* @param protocolMode
|
|
7146
7223
|
*/
|
|
7147
|
-
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions) {
|
|
7224
|
+
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
7148
7225
|
// Throw error if authority url is empty
|
|
7149
7226
|
if (StringUtils.isEmpty(authorityUrl)) {
|
|
7150
7227
|
throw ClientConfigurationError.createUrlEmptyError();
|
|
7151
7228
|
}
|
|
7152
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions);
|
|
7229
|
+
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
|
|
7153
7230
|
};
|
|
7154
7231
|
return AuthorityFactory;
|
|
7155
7232
|
}());
|