@azure/msal-common 9.0.0 → 9.0.2
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/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/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +40 -12
- package/dist/authority/Authority.js.map +1 -1
- package/dist/authority/AuthorityFactory.js +1 -1
- package/dist/authority/AuthorityMetadata.js +1 -1
- package/dist/authority/AuthorityOptions.js +1 -1
- package/dist/authority/AuthorityType.js +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +14 -0
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -0
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +13 -0
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.js.map +1 -0
- package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
- package/dist/authority/OpenIdConfigResponse.js +1 -1
- package/dist/authority/ProtocolMode.js +1 -1
- package/dist/authority/RegionDiscovery.js +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.d.ts.map +1 -1
- package/dist/cache/entities/CredentialEntity.js +10 -13
- package/dist/cache/entities/CredentialEntity.js.map +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 +2 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.js +33 -12
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +1 -1
- 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 +1 -1
- package/dist/client/DeviceCodeClient.js.map +1 -1
- package/dist/client/OnBehalfOfClient.js +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.js +14 -8
- package/dist/client/RefreshTokenClient.js.map +1 -1
- package/dist/client/SilentFlowClient.js +1 -1
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
- package/dist/client/UsernamePasswordClient.js +13 -7
- package/dist/client/UsernamePasswordClient.js.map +1 -1
- package/dist/config/ClientConfiguration.js +1 -1
- package/dist/crypto/ICrypto.js +1 -1
- package/dist/crypto/JoseHeader.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.js +1 -1
- package/dist/error/InteractionRequiredAuthError.js +1 -1
- package/dist/error/JoseHeaderError.js +1 -1
- package/dist/error/ServerError.js +1 -1
- package/dist/index.cjs.js +138 -56
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/Logger.d.ts +1 -0
- package/dist/logger/Logger.d.ts.map +1 -1
- package/dist/logger/Logger.js +15 -5
- package/dist/logger/Logger.js.map +1 -1
- package/dist/network/INetworkModule.js +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/RequestParameterBuilder.js +1 -1
- package/dist/request/RequestValidator.js +1 -1
- package/dist/request/ScopeSet.js +1 -1
- package/dist/response/ResponseHandler.js +2 -2
- package/dist/response/ResponseHandler.js.map +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts +1 -1
- package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.js +2 -2
- package/dist/telemetry/performance/PerformanceClient.js.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.js +6 -1
- package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js +2 -2
- package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
- package/dist/url/UrlString.js +1 -1
- package/dist/utils/Constants.d.ts +3 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.js +4 -2
- 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 v9.0.
|
|
1
|
+
/*! @azure/msal-common v9.0.2 2023-01-09 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -142,7 +142,8 @@ var Constants = {
|
|
|
142
142
|
KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
|
|
143
143
|
TOKEN_RESPONSE_TYPE: "token",
|
|
144
144
|
ID_TOKEN_RESPONSE_TYPE: "id_token",
|
|
145
|
-
SHR_NONCE_VALIDITY: 240
|
|
145
|
+
SHR_NONCE_VALIDITY: 240,
|
|
146
|
+
INVALID_INSTANCE: "invalid_instance",
|
|
146
147
|
};
|
|
147
148
|
var OIDC_DEFAULT_SCOPES = [
|
|
148
149
|
Constants.OPENID_SCOPE,
|
|
@@ -163,6 +164,7 @@ exports.HeaderNames = void 0;
|
|
|
163
164
|
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
|
|
164
165
|
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
|
|
165
166
|
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
|
|
167
|
+
HeaderNames["X_MS_HTTP_VERSION"] = "x-ms-httpver";
|
|
166
168
|
})(exports.HeaderNames || (exports.HeaderNames = {}));
|
|
167
169
|
/**
|
|
168
170
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
@@ -1255,13 +1257,23 @@ var Logger = /** @class */ (function () {
|
|
|
1255
1257
|
var defaultLoggerCallback = function () {
|
|
1256
1258
|
return;
|
|
1257
1259
|
};
|
|
1258
|
-
|
|
1259
|
-
this.
|
|
1260
|
-
this.
|
|
1261
|
-
this.
|
|
1260
|
+
var setLoggerOptions = loggerOptions || Logger.createDefaultLoggerOptions();
|
|
1261
|
+
this.localCallback = setLoggerOptions.loggerCallback || defaultLoggerCallback;
|
|
1262
|
+
this.piiLoggingEnabled = setLoggerOptions.piiLoggingEnabled || false;
|
|
1263
|
+
this.level = typeof (setLoggerOptions.logLevel) === "number" ? setLoggerOptions.logLevel : exports.LogLevel.Info;
|
|
1264
|
+
this.correlationId = setLoggerOptions.correlationId || Constants.EMPTY_STRING;
|
|
1262
1265
|
this.packageName = packageName || Constants.EMPTY_STRING;
|
|
1263
1266
|
this.packageVersion = packageVersion || Constants.EMPTY_STRING;
|
|
1264
1267
|
}
|
|
1268
|
+
Logger.createDefaultLoggerOptions = function () {
|
|
1269
|
+
return {
|
|
1270
|
+
loggerCallback: function () {
|
|
1271
|
+
// allow users to not set loggerCallback
|
|
1272
|
+
},
|
|
1273
|
+
piiLoggingEnabled: false,
|
|
1274
|
+
logLevel: exports.LogLevel.Info
|
|
1275
|
+
};
|
|
1276
|
+
};
|
|
1265
1277
|
/**
|
|
1266
1278
|
* Create new Logger with existing configurations.
|
|
1267
1279
|
*/
|
|
@@ -1410,7 +1422,7 @@ var Logger = /** @class */ (function () {
|
|
|
1410
1422
|
|
|
1411
1423
|
/* eslint-disable header/header */
|
|
1412
1424
|
var name = "@azure/msal-common";
|
|
1413
|
-
var version = "9.0.
|
|
1425
|
+
var version = "9.0.2";
|
|
1414
1426
|
|
|
1415
1427
|
/*
|
|
1416
1428
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1507,19 +1519,16 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1507
1519
|
* @param key
|
|
1508
1520
|
*/
|
|
1509
1521
|
CredentialEntity.getCredentialType = function (key) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1522
|
+
var separator = Separators.CACHE_KEY_SEPARATOR;
|
|
1523
|
+
// Match host names like "login.microsoftonline.com", "https://accounts.google.com:4000", etc.
|
|
1524
|
+
var domainRe = "(https?:\\/\\/)?([\\w-]+\\.)*([\\w-]{1,63})(\\.(\\w{2,3}))(\\:[0-9]{4,5})?";
|
|
1525
|
+
for (var _i = 0, _a = Object.keys(exports.CredentialType); _i < _a.length; _i++) {
|
|
1526
|
+
var credKey = _a[_i];
|
|
1527
|
+
var credVal = exports.CredentialType[credKey].toLowerCase();
|
|
1528
|
+
// Verify credential type is preceded by a valid host name (environment)
|
|
1529
|
+
if (key.toLowerCase().search("(?<=" + separator + domainRe + ")" + separator + credVal + separator) !== -1) {
|
|
1530
|
+
return exports.CredentialType[credKey];
|
|
1515
1531
|
}
|
|
1516
|
-
return exports.CredentialType.ACCESS_TOKEN;
|
|
1517
|
-
}
|
|
1518
|
-
else if (key.indexOf(exports.CredentialType.ID_TOKEN.toLowerCase()) !== -1) {
|
|
1519
|
-
return exports.CredentialType.ID_TOKEN;
|
|
1520
|
-
}
|
|
1521
|
-
else if (key.indexOf(exports.CredentialType.REFRESH_TOKEN.toLowerCase()) !== -1) {
|
|
1522
|
-
return exports.CredentialType.REFRESH_TOKEN;
|
|
1523
1532
|
}
|
|
1524
1533
|
return Constants.NOT_DEFINED;
|
|
1525
1534
|
};
|
|
@@ -5196,7 +5205,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5196
5205
|
cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
|
|
5197
5206
|
msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
|
|
5198
5207
|
code: code,
|
|
5199
|
-
fromNativeBroker: false
|
|
5208
|
+
fromNativeBroker: false,
|
|
5200
5209
|
}];
|
|
5201
5210
|
}
|
|
5202
5211
|
});
|
|
@@ -5214,8 +5223,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5214
5223
|
*/
|
|
5215
5224
|
var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
5216
5225
|
__extends(AuthorizationCodeClient, _super);
|
|
5217
|
-
function AuthorizationCodeClient(configuration) {
|
|
5218
|
-
var _this = _super.call(this, configuration) || this;
|
|
5226
|
+
function AuthorizationCodeClient(configuration, performanceClient) {
|
|
5227
|
+
var _this = _super.call(this, configuration, performanceClient) || this;
|
|
5219
5228
|
// Flag to indicate if client is for hybrid spa auth code redemption
|
|
5220
5229
|
_this.includeRedirectUri = true;
|
|
5221
5230
|
return _this;
|
|
@@ -5249,26 +5258,47 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5249
5258
|
* @param request
|
|
5250
5259
|
*/
|
|
5251
5260
|
AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {
|
|
5252
|
-
var _a;
|
|
5261
|
+
var _a, _b, _c;
|
|
5253
5262
|
return __awaiter(this, void 0, void 0, function () {
|
|
5254
|
-
var reqTimestamp, response, requestId, responseHandler;
|
|
5255
|
-
|
|
5256
|
-
|
|
5263
|
+
var atsMeasurement, reqTimestamp, response, requestId, httpVerAuthority, responseHandler;
|
|
5264
|
+
var _this = this;
|
|
5265
|
+
return __generator(this, function (_d) {
|
|
5266
|
+
switch (_d.label) {
|
|
5257
5267
|
case 0:
|
|
5258
|
-
this.
|
|
5268
|
+
atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement("AuthCodeClientAcquireToken", request.correlationId);
|
|
5269
|
+
this.logger.info("in acquireToken call in auth-code client");
|
|
5259
5270
|
if (!request || StringUtils.isEmpty(request.code)) {
|
|
5260
5271
|
throw ClientAuthError.createTokenRequestCannotBeMadeError();
|
|
5261
5272
|
}
|
|
5262
5273
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
5263
5274
|
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
5264
5275
|
case 1:
|
|
5265
|
-
response =
|
|
5266
|
-
requestId = (
|
|
5276
|
+
response = _d.sent();
|
|
5277
|
+
requestId = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[exports.HeaderNames.X_MS_REQUEST_ID];
|
|
5278
|
+
httpVerAuthority = (_c = response.headers) === null || _c === void 0 ? void 0 : _c[exports.HeaderNames.X_MS_HTTP_VERSION];
|
|
5279
|
+
if (httpVerAuthority) {
|
|
5280
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
5281
|
+
httpVerAuthority: httpVerAuthority
|
|
5282
|
+
});
|
|
5283
|
+
}
|
|
5267
5284
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
5268
5285
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5269
5286
|
responseHandler.validateTokenResponse(response.body);
|
|
5270
|
-
return [
|
|
5271
|
-
|
|
5287
|
+
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId).then(function (result) {
|
|
5288
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5289
|
+
success: true
|
|
5290
|
+
});
|
|
5291
|
+
return result;
|
|
5292
|
+
})
|
|
5293
|
+
.catch(function (error) {
|
|
5294
|
+
_this.logger.verbose("Error in fetching token in ACC", request.correlationId);
|
|
5295
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5296
|
+
errorCode: error.errorCode,
|
|
5297
|
+
subErrorCode: error.subError,
|
|
5298
|
+
success: false
|
|
5299
|
+
});
|
|
5300
|
+
throw error;
|
|
5301
|
+
})];
|
|
5272
5302
|
}
|
|
5273
5303
|
});
|
|
5274
5304
|
});
|
|
@@ -5984,6 +6014,11 @@ exports.PerformanceEvents = void 0;
|
|
|
5984
6014
|
* Time taken for acquiring cached refresh token
|
|
5985
6015
|
*/
|
|
5986
6016
|
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
6017
|
+
PerformanceEvents["GetEndpointMetadataFromNetwork"] = "getEndpointMetadataFromNetwork";
|
|
6018
|
+
PerformanceEvents["GetCloudDiscoveryMetadataFromNetworkMeasurement"] = "getCloudDiscoveryMetadataFromNetworkMeasurement";
|
|
6019
|
+
PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
|
|
6020
|
+
PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
|
|
6021
|
+
PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
|
|
5987
6022
|
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5988
6023
|
/**
|
|
5989
6024
|
* State of the performance event.
|
|
@@ -6011,23 +6046,29 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6011
6046
|
return _super.call(this, configuration, performanceClient) || this;
|
|
6012
6047
|
}
|
|
6013
6048
|
RefreshTokenClient.prototype.acquireToken = function (request) {
|
|
6014
|
-
var _a, _b, _c;
|
|
6049
|
+
var _a, _b, _c, _d;
|
|
6015
6050
|
return __awaiter(this, void 0, void 0, function () {
|
|
6016
|
-
var atsMeasurement, reqTimestamp, response, requestId, responseHandler;
|
|
6051
|
+
var atsMeasurement, reqTimestamp, response, httpVerToken, requestId, responseHandler;
|
|
6017
6052
|
var _this = this;
|
|
6018
|
-
return __generator(this, function (
|
|
6019
|
-
switch (
|
|
6053
|
+
return __generator(this, function (_e) {
|
|
6054
|
+
switch (_e.label) {
|
|
6020
6055
|
case 0:
|
|
6021
6056
|
atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6022
6057
|
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
6023
6058
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
6024
6059
|
return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
6025
6060
|
case 1:
|
|
6026
|
-
response =
|
|
6061
|
+
response = _e.sent();
|
|
6062
|
+
httpVerToken = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[exports.HeaderNames.X_MS_HTTP_VERSION];
|
|
6027
6063
|
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6028
|
-
refreshTokenSize: ((
|
|
6064
|
+
refreshTokenSize: ((_c = response.body.refresh_token) === null || _c === void 0 ? void 0 : _c.length) || 0,
|
|
6029
6065
|
});
|
|
6030
|
-
|
|
6066
|
+
if (httpVerToken) {
|
|
6067
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6068
|
+
httpVerToken: httpVerToken,
|
|
6069
|
+
});
|
|
6070
|
+
}
|
|
6071
|
+
requestId = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[exports.HeaderNames.X_MS_REQUEST_ID];
|
|
6031
6072
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
6032
6073
|
responseHandler.validateTokenResponse(response.body);
|
|
6033
6074
|
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
|
|
@@ -6820,16 +6861,22 @@ var UsernamePasswordClient = /** @class */ (function (_super) {
|
|
|
6820
6861
|
* @param request
|
|
6821
6862
|
*/
|
|
6822
6863
|
UsernamePasswordClient.prototype.acquireToken = function (request) {
|
|
6864
|
+
var _a, _b;
|
|
6823
6865
|
return __awaiter(this, void 0, void 0, function () {
|
|
6824
|
-
var reqTimestamp, response, responseHandler, tokenResponse;
|
|
6825
|
-
return __generator(this, function (
|
|
6826
|
-
switch (
|
|
6866
|
+
var atsMeasurement, reqTimestamp, response, httpVerToken, responseHandler, tokenResponse;
|
|
6867
|
+
return __generator(this, function (_c) {
|
|
6868
|
+
switch (_c.label) {
|
|
6827
6869
|
case 0:
|
|
6828
|
-
this.
|
|
6870
|
+
atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement("UsernamePasswordClientAcquireToken", request.correlationId);
|
|
6871
|
+
this.logger.info("in acquireToken call in username-password client");
|
|
6829
6872
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
6830
6873
|
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
6831
6874
|
case 1:
|
|
6832
|
-
response =
|
|
6875
|
+
response = _c.sent();
|
|
6876
|
+
httpVerToken = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[exports.HeaderNames.X_MS_HTTP_VERSION];
|
|
6877
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({
|
|
6878
|
+
httpVerToken: httpVerToken
|
|
6879
|
+
});
|
|
6833
6880
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
6834
6881
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
6835
6882
|
responseHandler.validateTokenResponse(response.body);
|
|
@@ -7024,6 +7071,15 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
7024
7071
|
response.hasOwnProperty("metadata"));
|
|
7025
7072
|
}
|
|
7026
7073
|
|
|
7074
|
+
/*
|
|
7075
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7076
|
+
* Licensed under the MIT License.
|
|
7077
|
+
*/
|
|
7078
|
+
function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
7079
|
+
return (response.hasOwnProperty("error") &&
|
|
7080
|
+
response.hasOwnProperty("error_description"));
|
|
7081
|
+
}
|
|
7082
|
+
|
|
7027
7083
|
/*
|
|
7028
7084
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7029
7085
|
* Licensed under the MIT License.
|
|
@@ -7619,7 +7675,7 @@ var Authority = /** @class */ (function () {
|
|
|
7619
7675
|
case 1:
|
|
7620
7676
|
metadata = _a.sent();
|
|
7621
7677
|
if (metadata) {
|
|
7622
|
-
this.logger.verbose("
|
|
7678
|
+
this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
|
|
7623
7679
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
|
|
7624
7680
|
return [2 /*return*/, AuthorityMetadataSource.NETWORK];
|
|
7625
7681
|
}
|
|
@@ -7630,8 +7686,8 @@ var Authority = /** @class */ (function () {
|
|
|
7630
7686
|
metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
|
|
7631
7687
|
return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
|
|
7632
7688
|
}
|
|
7633
|
-
// Metadata could not be obtained from config, cache or
|
|
7634
|
-
this.logger.
|
|
7689
|
+
// Metadata could not be obtained from the config, cache, network or hardcoded values
|
|
7690
|
+
this.logger.error("Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.");
|
|
7635
7691
|
throw ClientConfigurationError.createUntrustedAuthorityError();
|
|
7636
7692
|
}
|
|
7637
7693
|
});
|
|
@@ -7676,7 +7732,7 @@ var Authority = /** @class */ (function () {
|
|
|
7676
7732
|
*/
|
|
7677
7733
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
7678
7734
|
return __awaiter(this, void 0, void 0, function () {
|
|
7679
|
-
var instanceDiscoveryEndpoint, options, match, response, metadata;
|
|
7735
|
+
var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;
|
|
7680
7736
|
return __generator(this, function (_a) {
|
|
7681
7737
|
switch (_a.label) {
|
|
7682
7738
|
case 0:
|
|
@@ -7692,21 +7748,47 @@ var Authority = /** @class */ (function () {
|
|
|
7692
7748
|
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
7693
7749
|
case 2:
|
|
7694
7750
|
response = _a.sent();
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7751
|
+
typedResponseBody = void 0;
|
|
7752
|
+
metadata = void 0;
|
|
7753
|
+
if (isCloudInstanceDiscoveryResponse(response.body)) {
|
|
7754
|
+
typedResponseBody = response.body;
|
|
7755
|
+
metadata = typedResponseBody.metadata;
|
|
7756
|
+
this.logger.verbosePii("tenant_discovery_endpoint is: " + typedResponseBody.tenant_discovery_endpoint);
|
|
7757
|
+
}
|
|
7758
|
+
else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {
|
|
7759
|
+
this.logger.warning("A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: " + response.status);
|
|
7760
|
+
typedResponseBody = response.body;
|
|
7761
|
+
if (typedResponseBody.error === Constants.INVALID_INSTANCE) {
|
|
7762
|
+
this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance.");
|
|
7763
|
+
return [2 /*return*/, null];
|
|
7764
|
+
}
|
|
7765
|
+
this.logger.warning("The CloudInstanceDiscoveryErrorResponse error is " + typedResponseBody.error);
|
|
7766
|
+
this.logger.warning("The CloudInstanceDiscoveryErrorResponse error description is " + typedResponseBody.error_description);
|
|
7767
|
+
this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []");
|
|
7768
|
+
metadata = [];
|
|
7769
|
+
}
|
|
7770
|
+
else {
|
|
7771
|
+
this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse");
|
|
7700
7772
|
return [2 /*return*/, null];
|
|
7701
7773
|
}
|
|
7774
|
+
this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.");
|
|
7702
7775
|
match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);
|
|
7703
7776
|
return [3 /*break*/, 4];
|
|
7704
7777
|
case 3:
|
|
7705
|
-
_a.sent();
|
|
7778
|
+
error_1 = _a.sent();
|
|
7779
|
+
if (error_1 instanceof AuthError) {
|
|
7780
|
+
this.logger.error("There was a network error while attempting to get the cloud discovery instance metadata.\nError: " + error_1.errorCode + "\nError Description: " + error_1.errorMessage);
|
|
7781
|
+
}
|
|
7782
|
+
else {
|
|
7783
|
+
typedError = error_1;
|
|
7784
|
+
this.logger.error("A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: " + typedError.name + "\nError Description: " + typedError.message);
|
|
7785
|
+
}
|
|
7706
7786
|
return [2 /*return*/, null];
|
|
7707
7787
|
case 4:
|
|
7788
|
+
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
7708
7789
|
if (!match) {
|
|
7709
|
-
|
|
7790
|
+
this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.");
|
|
7791
|
+
this.logger.verbose("Creating custom Authority for custom domain scenario.");
|
|
7710
7792
|
match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
|
|
7711
7793
|
}
|
|
7712
7794
|
return [2 /*return*/, match];
|
|
@@ -8309,7 +8391,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
8309
8391
|
this.logger.info("PerformanceClient: No correlation id provided for " + measureName + ", generating", eventCorrelationId);
|
|
8310
8392
|
}
|
|
8311
8393
|
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
|
|
8312
|
-
var performanceMeasurement = this.
|
|
8394
|
+
var performanceMeasurement = this.startPerformanceMeasurement(measureName, eventCorrelationId);
|
|
8313
8395
|
performanceMeasurement.startMeasurement();
|
|
8314
8396
|
var inProgressEvent = {
|
|
8315
8397
|
eventId: this.generateId(),
|
|
@@ -8582,7 +8664,7 @@ var StubPerformanceClient = /** @class */ (function (_super) {
|
|
|
8582
8664
|
StubPerformanceClient.prototype.generateId = function () {
|
|
8583
8665
|
return "callback-id";
|
|
8584
8666
|
};
|
|
8585
|
-
StubPerformanceClient.prototype.
|
|
8667
|
+
StubPerformanceClient.prototype.startPerformanceMeasurement = function () {
|
|
8586
8668
|
return new StubPerformanceMeasurement();
|
|
8587
8669
|
};
|
|
8588
8670
|
return StubPerformanceClient;
|