@azure/msal-common 14.9.0 → 14.9.1-alpha.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/account/AccountInfo.mjs +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientCredentials.d.ts +6 -1
- package/dist/account/ClientCredentials.d.ts.map +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.mjs +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/cache/CacheManager.mjs +1 -1
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +3 -2
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.mjs +1 -1
- package/dist/client/RefreshTokenClient.d.ts.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +3 -2
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.d.ts +5 -1
- package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +3 -2
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/ServerError.d.ts +5 -1
- package/dist/error/ServerError.d.ts.map +1 -1
- package/dist/error/ServerError.mjs +3 -2
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/index.cjs +57 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.d.ts +1 -1
- package/dist/network/INetworkModule.d.ts.map +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.d.ts +2 -0
- package/dist/request/BaseAuthRequest.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +16 -5
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/response/ServerAuthorizationCodeResponse.d.ts +1 -0
- package/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.d.ts +1 -7
- package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +9 -11
- package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.d.ts +6 -0
- package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/ClientAssertionUtils.d.ts +3 -0
- package/dist/utils/ClientAssertionUtils.d.ts.map +1 -0
- package/dist/utils/ClientAssertionUtils.mjs +21 -0
- package/dist/utils/ClientAssertionUtils.mjs.map +1 -0
- package/dist/utils/Constants.d.ts +4 -2
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +5 -3
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/package.json +1 -1
- package/src/account/ClientCredentials.ts +10 -1
- package/src/client/AuthorizationCodeClient.ts +11 -2
- package/src/client/RefreshTokenClient.ts +11 -2
- package/src/error/InteractionRequiredAuthError.ts +8 -1
- package/src/error/ServerError.ts +12 -1
- package/src/index.ts +7 -1
- package/src/network/INetworkModule.ts +1 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +2 -0
- package/src/response/ResponseHandler.ts +25 -4
- package/src/response/ServerAuthorizationCodeResponse.ts +1 -0
- package/src/telemetry/performance/PerformanceClient.ts +10 -11
- package/src/telemetry/performance/PerformanceEvent.ts +10 -0
- package/src/utils/ClientAssertionUtils.ts +25 -0
- package/src/utils/Constants.ts +4 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.9.0 2024-
|
|
1
|
+
/*! @azure/msal-common v14.9.1-alpha.0 2024-05-01 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -65,10 +65,11 @@ const Constants = {
|
|
|
65
65
|
INVALID_INSTANCE: "invalid_instance",
|
|
66
66
|
};
|
|
67
67
|
const HttpStatus = {
|
|
68
|
-
SUCCESS_RANGE_START: 200,
|
|
69
68
|
SUCCESS: 200,
|
|
69
|
+
SUCCESS_RANGE_START: 200,
|
|
70
70
|
SUCCESS_RANGE_END: 299,
|
|
71
71
|
REDIRECT: 302,
|
|
72
|
+
CLIENT_ERROR: 400,
|
|
72
73
|
CLIENT_ERROR_RANGE_START: 400,
|
|
73
74
|
BAD_REQUEST: 400,
|
|
74
75
|
UNAUTHORIZED: 401,
|
|
@@ -76,11 +77,12 @@ const HttpStatus = {
|
|
|
76
77
|
REQUEST_TIMEOUT: 408,
|
|
77
78
|
TOO_MANY_REQUESTS: 429,
|
|
78
79
|
CLIENT_ERROR_RANGE_END: 499,
|
|
80
|
+
SERVER_ERROR: 500,
|
|
79
81
|
SERVER_ERROR_RANGE_START: 500,
|
|
80
|
-
INTERNAL_SERVER_ERROR: 500,
|
|
81
82
|
SERVICE_UNAVAILABLE: 503,
|
|
82
83
|
GATEWAY_TIMEOUT: 504,
|
|
83
84
|
SERVER_ERROR_RANGE_END: 599,
|
|
85
|
+
MULTI_SIDED_ERROR: 600,
|
|
84
86
|
};
|
|
85
87
|
const OIDC_DEFAULT_SCOPES = [
|
|
86
88
|
Constants.OPENID_SCOPE,
|
|
@@ -954,7 +956,7 @@ class Logger {
|
|
|
954
956
|
|
|
955
957
|
/* eslint-disable header/header */
|
|
956
958
|
const name = "@azure/msal-common";
|
|
957
|
-
const version = "14.9.0";
|
|
959
|
+
const version = "14.9.1-alpha.0";
|
|
958
960
|
|
|
959
961
|
/*
|
|
960
962
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4059,9 +4061,10 @@ function isOidcProtocolMode(config) {
|
|
|
4059
4061
|
* Error thrown when there is an error with the server code, for example, unavailability.
|
|
4060
4062
|
*/
|
|
4061
4063
|
class ServerError extends AuthError {
|
|
4062
|
-
constructor(errorCode, errorMessage, subError) {
|
|
4064
|
+
constructor(errorCode, errorMessage, subError, errorNo) {
|
|
4063
4065
|
super(errorCode, errorMessage, subError);
|
|
4064
4066
|
this.name = "ServerError";
|
|
4067
|
+
this.errorNo = errorNo;
|
|
4065
4068
|
Object.setPrototypeOf(this, ServerError.prototype);
|
|
4066
4069
|
}
|
|
4067
4070
|
}
|
|
@@ -6534,7 +6537,7 @@ const InteractionRequiredAuthErrorMessage = {
|
|
|
6534
6537
|
* Error thrown when user interaction is required.
|
|
6535
6538
|
*/
|
|
6536
6539
|
class InteractionRequiredAuthError extends AuthError {
|
|
6537
|
-
constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims) {
|
|
6540
|
+
constructor(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims, errorNo) {
|
|
6538
6541
|
super(errorCode, errorMessage, subError);
|
|
6539
6542
|
Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
|
|
6540
6543
|
this.timestamp = timestamp || Constants.EMPTY_STRING;
|
|
@@ -6542,6 +6545,7 @@ class InteractionRequiredAuthError extends AuthError {
|
|
|
6542
6545
|
this.correlationId = correlationId || Constants.EMPTY_STRING;
|
|
6543
6546
|
this.claims = claims || Constants.EMPTY_STRING;
|
|
6544
6547
|
this.name = "InteractionRequiredAuthError";
|
|
6548
|
+
this.errorNo = errorNo;
|
|
6545
6549
|
}
|
|
6546
6550
|
}
|
|
6547
6551
|
/**
|
|
@@ -6768,6 +6772,13 @@ class PopTokenGenerator {
|
|
|
6768
6772
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6769
6773
|
* Licensed under the MIT License.
|
|
6770
6774
|
*/
|
|
6775
|
+
function parseServerErrorNo(serverResponse) {
|
|
6776
|
+
const errorCodePrefix = "code=";
|
|
6777
|
+
const errorCodePrefixIndex = serverResponse.error_uri?.lastIndexOf(errorCodePrefix);
|
|
6778
|
+
return errorCodePrefixIndex && errorCodePrefixIndex >= 0
|
|
6779
|
+
? serverResponse.error_uri?.substring(errorCodePrefixIndex + errorCodePrefix.length)
|
|
6780
|
+
: undefined;
|
|
6781
|
+
}
|
|
6771
6782
|
/**
|
|
6772
6783
|
* Class that handles response parsing.
|
|
6773
6784
|
* @internal
|
|
@@ -6815,10 +6826,11 @@ class ResponseHandler {
|
|
|
6815
6826
|
if (serverResponse.error ||
|
|
6816
6827
|
serverResponse.error_description ||
|
|
6817
6828
|
serverResponse.suberror) {
|
|
6829
|
+
const serverErrorNo = parseServerErrorNo(serverResponse);
|
|
6818
6830
|
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
6819
|
-
throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "");
|
|
6831
|
+
throw new InteractionRequiredAuthError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || "", serverResponse.trace_id || "", serverResponse.correlation_id || "", serverResponse.claims || "", serverErrorNo);
|
|
6820
6832
|
}
|
|
6821
|
-
throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror);
|
|
6833
|
+
throw new ServerError(serverResponse.error || "", serverResponse.error_description, serverResponse.suberror, serverErrorNo);
|
|
6822
6834
|
}
|
|
6823
6835
|
}
|
|
6824
6836
|
/**
|
|
@@ -6832,7 +6844,10 @@ class ResponseHandler {
|
|
|
6832
6844
|
serverResponse.error_description ||
|
|
6833
6845
|
serverResponse.suberror) {
|
|
6834
6846
|
const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
|
|
6835
|
-
const
|
|
6847
|
+
const serverErrorNo = serverResponse.error_codes?.length
|
|
6848
|
+
? serverResponse.error_codes[0]
|
|
6849
|
+
: undefined;
|
|
6850
|
+
const serverError = new ServerError(serverResponse.error, errString, serverResponse.suberror, serverErrorNo);
|
|
6836
6851
|
// check if 500 error
|
|
6837
6852
|
if (refreshAccessToken &&
|
|
6838
6853
|
serverResponse.status &&
|
|
@@ -6852,7 +6867,7 @@ class ResponseHandler {
|
|
|
6852
6867
|
return;
|
|
6853
6868
|
}
|
|
6854
6869
|
if (isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {
|
|
6855
|
-
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING);
|
|
6870
|
+
throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING, serverErrorNo);
|
|
6856
6871
|
}
|
|
6857
6872
|
throw serverError;
|
|
6858
6873
|
}
|
|
@@ -7115,6 +7130,28 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
|
|
|
7115
7130
|
return baseAccount;
|
|
7116
7131
|
}
|
|
7117
7132
|
|
|
7133
|
+
/*
|
|
7134
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7135
|
+
* Licensed under the MIT License.
|
|
7136
|
+
*/
|
|
7137
|
+
async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
|
|
7138
|
+
if (typeof clientAssertion === "string") {
|
|
7139
|
+
return clientAssertion;
|
|
7140
|
+
}
|
|
7141
|
+
else {
|
|
7142
|
+
const config = {
|
|
7143
|
+
clientId: clientId,
|
|
7144
|
+
tokenEndpoint: tokenEndpoint,
|
|
7145
|
+
};
|
|
7146
|
+
return clientAssertion(config);
|
|
7147
|
+
}
|
|
7148
|
+
}
|
|
7149
|
+
|
|
7150
|
+
var ClientAssertionUtils = /*#__PURE__*/Object.freeze({
|
|
7151
|
+
__proto__: null,
|
|
7152
|
+
getClientAssertion: getClientAssertion
|
|
7153
|
+
});
|
|
7154
|
+
|
|
7118
7155
|
/*
|
|
7119
7156
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7120
7157
|
* Licensed under the MIT License.
|
|
@@ -7274,7 +7311,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7274
7311
|
}
|
|
7275
7312
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7276
7313
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7277
|
-
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
7314
|
+
parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7278
7315
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
7279
7316
|
}
|
|
7280
7317
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
@@ -7680,7 +7717,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7680
7717
|
}
|
|
7681
7718
|
if (this.config.clientCredentials.clientAssertion) {
|
|
7682
7719
|
const clientAssertion = this.config.clientCredentials.clientAssertion;
|
|
7683
|
-
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
7720
|
+
parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));
|
|
7684
7721
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
7685
7722
|
}
|
|
7686
7723
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
@@ -8373,6 +8410,10 @@ function addError(error, logger, event, stackMaxSize = 5) {
|
|
|
8373
8410
|
else if (error instanceof AuthError) {
|
|
8374
8411
|
event.errorCode = error.errorCode;
|
|
8375
8412
|
event.subErrorCode = error.subError;
|
|
8413
|
+
if (error instanceof ServerError ||
|
|
8414
|
+
error instanceof InteractionRequiredAuthError) {
|
|
8415
|
+
event.serverErrorNo = error.errorNo;
|
|
8416
|
+
}
|
|
8376
8417
|
return;
|
|
8377
8418
|
}
|
|
8378
8419
|
else if (error instanceof CacheError) {
|
|
@@ -8655,7 +8696,7 @@ class PerformanceClient {
|
|
|
8655
8696
|
const context = JSON.stringify(endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error));
|
|
8656
8697
|
if (isRoot) {
|
|
8657
8698
|
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8658
|
-
this.
|
|
8699
|
+
this.discardMeasurements(rootEvent.correlationId);
|
|
8659
8700
|
}
|
|
8660
8701
|
else {
|
|
8661
8702
|
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
|
|
@@ -8777,21 +8818,13 @@ class PerformanceClient {
|
|
|
8777
8818
|
};
|
|
8778
8819
|
}
|
|
8779
8820
|
/**
|
|
8780
|
-
* Removes measurements for a given correlation id.
|
|
8821
|
+
* Removes measurements and aux data for a given correlation id.
|
|
8781
8822
|
*
|
|
8782
8823
|
* @param {string} correlationId
|
|
8783
8824
|
*/
|
|
8784
8825
|
discardMeasurements(correlationId) {
|
|
8785
8826
|
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
|
|
8786
8827
|
this.eventsByCorrelationId.delete(correlationId);
|
|
8787
|
-
}
|
|
8788
|
-
/**
|
|
8789
|
-
* Removes cache for a given correlation id.
|
|
8790
|
-
*
|
|
8791
|
-
* @param {string} correlationId correlation identifier
|
|
8792
|
-
*/
|
|
8793
|
-
discardCache(correlationId) {
|
|
8794
|
-
this.discardMeasurements(correlationId);
|
|
8795
8828
|
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
8796
8829
|
this.queueMeasurements.delete(correlationId);
|
|
8797
8830
|
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
@@ -8888,6 +8921,7 @@ exports.CacheRecord = CacheRecord;
|
|
|
8888
8921
|
exports.CacheType = CacheType;
|
|
8889
8922
|
exports.CcsCredentialType = CcsCredentialType;
|
|
8890
8923
|
exports.ClaimsRequestKeys = ClaimsRequestKeys;
|
|
8924
|
+
exports.ClientAssertionUtils = ClientAssertionUtils;
|
|
8891
8925
|
exports.ClientAuthError = ClientAuthError;
|
|
8892
8926
|
exports.ClientAuthErrorCodes = ClientAuthErrorCodes;
|
|
8893
8927
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|
|
@@ -8953,6 +8987,7 @@ exports.createClientAuthError = createClientAuthError;
|
|
|
8953
8987
|
exports.createClientConfigurationError = createClientConfigurationError;
|
|
8954
8988
|
exports.createInteractionRequiredAuthError = createInteractionRequiredAuthError;
|
|
8955
8989
|
exports.formatAuthorityUri = formatAuthorityUri;
|
|
8990
|
+
exports.getClientAssertion = getClientAssertion;
|
|
8956
8991
|
exports.getTenantIdFromIdTokenClaims = getTenantIdFromIdTokenClaims;
|
|
8957
8992
|
exports.invoke = invoke;
|
|
8958
8993
|
exports.invokeAsync = invokeAsync;
|