@azure/msal-common 12.1.0 → 13.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/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 +13 -0
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.js +66 -31
- 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.js +1 -1
- 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.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.js +2 -2
- package/dist/client/AuthorizationCodeClient.js.map +1 -1
- package/dist/client/BaseClient.js +1 -1
- package/dist/client/ClientCredentialClient.js +1 -1
- package/dist/client/DeviceCodeClient.js +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.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.d.ts +8 -0
- package/dist/error/ClientConfigurationError.d.ts.map +1 -1
- package/dist/error/ClientConfigurationError.js +11 -1
- package/dist/error/ClientConfigurationError.js.map +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 +77 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/Logger.js +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 +1 -1
- package/dist/telemetry/performance/PerformanceClient.js +1 -1
- package/dist/telemetry/performance/PerformanceEvent.js +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.js +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
- package/dist/url/UrlString.js +1 -1
- package/dist/utils/Constants.js +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
|
|
1
|
+
/*! @azure/msal-common v13.1.0 2023-06-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -1423,7 +1423,7 @@ var Logger = /** @class */ (function () {
|
|
|
1423
1423
|
|
|
1424
1424
|
/* eslint-disable header/header */
|
|
1425
1425
|
var name = "@azure/msal-common";
|
|
1426
|
-
var version = "
|
|
1426
|
+
var version = "13.1.0";
|
|
1427
1427
|
|
|
1428
1428
|
/*
|
|
1429
1429
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1544,6 +1544,10 @@ var ClientConfigurationErrorMessage = {
|
|
|
1544
1544
|
invalidAuthenticationHeader: {
|
|
1545
1545
|
code: "invalid_authentication_header",
|
|
1546
1546
|
desc: "Invalid authentication header provided"
|
|
1547
|
+
},
|
|
1548
|
+
authorityMismatch: {
|
|
1549
|
+
code: "authority_mismatch",
|
|
1550
|
+
desc: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."
|
|
1547
1551
|
}
|
|
1548
1552
|
};
|
|
1549
1553
|
/**
|
|
@@ -1695,6 +1699,12 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1695
1699
|
ClientConfigurationError.createInvalidAuthenticationHeaderError = function (invalidHeaderName, details) {
|
|
1696
1700
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc + ". Invalid header: " + invalidHeaderName + ". Details: " + details);
|
|
1697
1701
|
};
|
|
1702
|
+
/**
|
|
1703
|
+
* Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
|
|
1704
|
+
*/
|
|
1705
|
+
ClientConfigurationError.createAuthorityMismatchError = function () {
|
|
1706
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
|
|
1707
|
+
};
|
|
1698
1708
|
return ClientConfigurationError;
|
|
1699
1709
|
}(ClientAuthError));
|
|
1700
1710
|
|
|
@@ -6072,7 +6082,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
6072
6082
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
6073
6083
|
case 1:
|
|
6074
6084
|
reqCnfData = _b.sent();
|
|
6075
|
-
parameterBuilder.addPopToken(reqCnfData.
|
|
6085
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
6076
6086
|
_b.label = 2;
|
|
6077
6087
|
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
6078
6088
|
}
|
|
@@ -7561,23 +7571,31 @@ var Authority = /** @class */ (function () {
|
|
|
7561
7571
|
this.correlationId = correlationId;
|
|
7562
7572
|
this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);
|
|
7563
7573
|
}
|
|
7574
|
+
/**
|
|
7575
|
+
* Get {@link AuthorityType}
|
|
7576
|
+
* @param authorityUri {@link IUri}
|
|
7577
|
+
* @private
|
|
7578
|
+
*/
|
|
7579
|
+
Authority.prototype.getAuthorityType = function (authorityUri) {
|
|
7580
|
+
// CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
|
|
7581
|
+
if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
|
|
7582
|
+
return exports.AuthorityType.Ciam;
|
|
7583
|
+
}
|
|
7584
|
+
var pathSegments = authorityUri.PathSegments;
|
|
7585
|
+
if (pathSegments.length) {
|
|
7586
|
+
switch (pathSegments[0].toLowerCase()) {
|
|
7587
|
+
case Constants.ADFS:
|
|
7588
|
+
return exports.AuthorityType.Adfs;
|
|
7589
|
+
case Constants.DSTS:
|
|
7590
|
+
return exports.AuthorityType.Dsts;
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7593
|
+
return exports.AuthorityType.Default;
|
|
7594
|
+
};
|
|
7564
7595
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
7565
7596
|
// See above for AuthorityType
|
|
7566
7597
|
get: function () {
|
|
7567
|
-
|
|
7568
|
-
if (this.canonicalAuthorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
|
|
7569
|
-
return exports.AuthorityType.Ciam;
|
|
7570
|
-
}
|
|
7571
|
-
var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
|
|
7572
|
-
if (pathSegments.length) {
|
|
7573
|
-
switch (pathSegments[0].toLowerCase()) {
|
|
7574
|
-
case Constants.ADFS:
|
|
7575
|
-
return exports.AuthorityType.Adfs;
|
|
7576
|
-
case Constants.DSTS:
|
|
7577
|
-
return exports.AuthorityType.Dsts;
|
|
7578
|
-
}
|
|
7579
|
-
}
|
|
7580
|
-
return exports.AuthorityType.Default;
|
|
7598
|
+
return this.getAuthorityType(this.canonicalAuthorityUrlComponents);
|
|
7581
7599
|
},
|
|
7582
7600
|
enumerable: false,
|
|
7583
7601
|
configurable: true
|
|
@@ -7659,8 +7677,7 @@ var Authority = /** @class */ (function () {
|
|
|
7659
7677
|
*/
|
|
7660
7678
|
get: function () {
|
|
7661
7679
|
if (this.discoveryComplete()) {
|
|
7662
|
-
|
|
7663
|
-
return this.replaceTenant(endpoint);
|
|
7680
|
+
return this.replacePath(this.metadata.authorization_endpoint);
|
|
7664
7681
|
}
|
|
7665
7682
|
else {
|
|
7666
7683
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7675,8 +7692,7 @@ var Authority = /** @class */ (function () {
|
|
|
7675
7692
|
*/
|
|
7676
7693
|
get: function () {
|
|
7677
7694
|
if (this.discoveryComplete()) {
|
|
7678
|
-
|
|
7679
|
-
return this.replaceTenant(endpoint);
|
|
7695
|
+
return this.replacePath(this.metadata.token_endpoint);
|
|
7680
7696
|
}
|
|
7681
7697
|
else {
|
|
7682
7698
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7688,8 +7704,7 @@ var Authority = /** @class */ (function () {
|
|
|
7688
7704
|
Object.defineProperty(Authority.prototype, "deviceCodeEndpoint", {
|
|
7689
7705
|
get: function () {
|
|
7690
7706
|
if (this.discoveryComplete()) {
|
|
7691
|
-
|
|
7692
|
-
return this.replaceTenant(endpoint);
|
|
7707
|
+
return this.replacePath(this.metadata.token_endpoint.replace("/token", "/devicecode"));
|
|
7693
7708
|
}
|
|
7694
7709
|
else {
|
|
7695
7710
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7708,8 +7723,7 @@ var Authority = /** @class */ (function () {
|
|
|
7708
7723
|
if (!this.metadata.end_session_endpoint) {
|
|
7709
7724
|
throw ClientAuthError.createLogoutNotSupportedError();
|
|
7710
7725
|
}
|
|
7711
|
-
|
|
7712
|
-
return this.replaceTenant(endpoint);
|
|
7726
|
+
return this.replacePath(this.metadata.end_session_endpoint);
|
|
7713
7727
|
}
|
|
7714
7728
|
else {
|
|
7715
7729
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7724,8 +7738,7 @@ var Authority = /** @class */ (function () {
|
|
|
7724
7738
|
*/
|
|
7725
7739
|
get: function () {
|
|
7726
7740
|
if (this.discoveryComplete()) {
|
|
7727
|
-
|
|
7728
|
-
return this.replaceTenant(endpoint);
|
|
7741
|
+
return this.replacePath(this.metadata.issuer);
|
|
7729
7742
|
}
|
|
7730
7743
|
else {
|
|
7731
7744
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7740,8 +7753,7 @@ var Authority = /** @class */ (function () {
|
|
|
7740
7753
|
*/
|
|
7741
7754
|
get: function () {
|
|
7742
7755
|
if (this.discoveryComplete()) {
|
|
7743
|
-
|
|
7744
|
-
return this.replaceTenant(endpoint);
|
|
7756
|
+
return this.replacePath(this.metadata.jwks_uri);
|
|
7745
7757
|
}
|
|
7746
7758
|
else {
|
|
7747
7759
|
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
@@ -7750,6 +7762,17 @@ var Authority = /** @class */ (function () {
|
|
|
7750
7762
|
enumerable: false,
|
|
7751
7763
|
configurable: true
|
|
7752
7764
|
});
|
|
7765
|
+
/**
|
|
7766
|
+
* Returns a flag indicating that tenant name can be replaced in authority {@link IUri}
|
|
7767
|
+
* @param authorityUri {@link IUri}
|
|
7768
|
+
* @private
|
|
7769
|
+
*/
|
|
7770
|
+
Authority.prototype.canReplaceTenant = function (authorityUri) {
|
|
7771
|
+
return authorityUri.PathSegments.length === 1
|
|
7772
|
+
&& !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
|
|
7773
|
+
&& this.getAuthorityType(authorityUri) === exports.AuthorityType.Default
|
|
7774
|
+
&& this.protocolMode === exports.ProtocolMode.AAD;
|
|
7775
|
+
};
|
|
7753
7776
|
/**
|
|
7754
7777
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
|
7755
7778
|
* @param urlString
|
|
@@ -7762,17 +7785,31 @@ var Authority = /** @class */ (function () {
|
|
|
7762
7785
|
* @param urlString
|
|
7763
7786
|
*/
|
|
7764
7787
|
Authority.prototype.replacePath = function (urlString) {
|
|
7788
|
+
var _this = this;
|
|
7765
7789
|
var endpoint = urlString;
|
|
7766
7790
|
var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);
|
|
7767
|
-
var
|
|
7791
|
+
var cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();
|
|
7792
|
+
var cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;
|
|
7768
7793
|
var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;
|
|
7769
7794
|
currentAuthorityParts.forEach(function (currentPart, index) {
|
|
7770
7795
|
var cachedPart = cachedAuthorityParts[index];
|
|
7796
|
+
if (index === 0 && _this.canReplaceTenant(cachedAuthorityUrlComponents)) {
|
|
7797
|
+
var tenantId = (new UrlString(_this.metadata.authorization_endpoint)).getUrlComponents().PathSegments[0];
|
|
7798
|
+
/**
|
|
7799
|
+
* Check if AAD canonical authority contains tenant domain name, for example "testdomain.onmicrosoft.com",
|
|
7800
|
+
* by comparing its first path segment to the corresponding authorization endpoint path segment, which is
|
|
7801
|
+
* always resolved with tenant id by OIDC.
|
|
7802
|
+
*/
|
|
7803
|
+
if (cachedPart !== tenantId) {
|
|
7804
|
+
_this.logger.verbose("Replacing tenant domain name " + cachedPart + " with id " + tenantId);
|
|
7805
|
+
cachedPart = tenantId;
|
|
7806
|
+
}
|
|
7807
|
+
}
|
|
7771
7808
|
if (currentPart !== cachedPart) {
|
|
7772
7809
|
endpoint = endpoint.replace("/" + cachedPart + "/", "/" + currentPart + "/");
|
|
7773
7810
|
}
|
|
7774
7811
|
});
|
|
7775
|
-
return endpoint;
|
|
7812
|
+
return this.replaceTenant(endpoint);
|
|
7776
7813
|
};
|
|
7777
7814
|
Object.defineProperty(Authority.prototype, "defaultOpenIdConfigurationEndpoint", {
|
|
7778
7815
|
/**
|
|
@@ -8290,7 +8327,7 @@ var Authority = /** @class */ (function () {
|
|
|
8290
8327
|
* @param authority
|
|
8291
8328
|
*/
|
|
8292
8329
|
Authority.transformCIAMAuthority = function (authority) {
|
|
8293
|
-
var ciamAuthority = authority;
|
|
8330
|
+
var ciamAuthority = authority.endsWith(Constants.FORWARD_SLASH) ? authority : "" + authority + Constants.FORWARD_SLASH;
|
|
8294
8331
|
var authorityUrl = new UrlString(authority);
|
|
8295
8332
|
var authorityUrlComponents = authorityUrl.getUrlComponents();
|
|
8296
8333
|
// check if transformation is needed
|
|
@@ -8300,6 +8337,14 @@ var Authority = /** @class */ (function () {
|
|
|
8300
8337
|
}
|
|
8301
8338
|
return ciamAuthority;
|
|
8302
8339
|
};
|
|
8340
|
+
// Reserved tenant domain names that will not be replaced with tenant id
|
|
8341
|
+
Authority.reservedTenantDomains = (new Set([
|
|
8342
|
+
"{tenant}",
|
|
8343
|
+
"{tenantid}",
|
|
8344
|
+
AADAuthorityConstants.COMMON,
|
|
8345
|
+
AADAuthorityConstants.CONSUMERS,
|
|
8346
|
+
AADAuthorityConstants.ORGANIZATIONS
|
|
8347
|
+
]));
|
|
8303
8348
|
return Authority;
|
|
8304
8349
|
}());
|
|
8305
8350
|
|