@azure/msal-common 14.11.0 → 14.12.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/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.d.ts +1 -1
- package/dist/cache/CacheManager.mjs +2 -2
- package/dist/cache/entities/AccountEntity.d.ts +1 -1
- package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
- package/dist/cache/entities/AccountEntity.mjs +7 -7
- package/dist/cache/entities/AccountEntity.mjs.map +1 -1
- package/dist/cache/entities/CacheRecord.d.ts +7 -8
- package/dist/cache/entities/CacheRecord.d.ts.map +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 +20 -6
- 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 +10 -3
- 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.d.ts +10 -0
- package/dist/crypto/ICrypto.d.ts.map +1 -1
- package/dist/crypto/ICrypto.mjs +7 -1
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.d.ts +0 -1
- package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +2 -3
- package/dist/crypto/PopTokenGenerator.mjs.map +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.mjs +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.mjs +1 -1
- package/dist/index.cjs +67 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +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.d.ts.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +5 -4
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/RequestValidator.d.ts +0 -6
- package/dist/request/RequestValidator.d.ts.map +1 -1
- package/dist/request/RequestValidator.mjs +1 -18
- package/dist/request/RequestValidator.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ExternalTokenResponse.d.ts +1 -1
- package/dist/response/ExternalTokenResponse.d.ts.map +1 -1
- package/dist/response/ResponseHandler.d.ts +1 -1
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +19 -7
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +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.mjs +1 -1
- package/dist/utils/Constants.d.ts +1 -0
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +2 -1
- 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/cache/CacheManager.ts +1 -1
- package/src/cache/entities/AccountEntity.ts +7 -7
- package/src/cache/entities/CacheRecord.ts +7 -21
- package/src/client/AuthorizationCodeClient.ts +31 -17
- package/src/client/RefreshTokenClient.ts +17 -8
- package/src/crypto/ICrypto.ts +16 -0
- package/src/crypto/PopTokenGenerator.ts +1 -3
- package/src/packageMetadata.ts +1 -1
- package/src/request/BaseAuthRequest.ts +2 -0
- package/src/request/RequestParameterBuilder.ts +4 -6
- package/src/request/RequestValidator.ts +0 -26
- package/src/response/ExternalTokenResponse.ts +8 -1
- package/src/response/ResponseHandler.ts +28 -11
- package/src/utils/Constants.ts +1 -0
- package/dist/cache/entities/CacheRecord.mjs +0 -19
- package/dist/cache/entities/CacheRecord.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.
|
|
1
|
+
/*! @azure/msal-common v14.12.1-alpha.0 2024-06-19 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { nowSeconds } from '../utils/TimeUtils.mjs';
|
|
4
4
|
import { UrlString } from '../url/UrlString.mjs';
|
|
@@ -28,11 +28,10 @@ class PopTokenGenerator {
|
|
|
28
28
|
async generateCnf(request, logger) {
|
|
29
29
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
30
30
|
const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
|
|
31
|
-
const reqCnfString = this.cryptoUtils.
|
|
31
|
+
const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
|
|
32
32
|
return {
|
|
33
33
|
kid: reqCnf.kid,
|
|
34
34
|
reqCnfString,
|
|
35
|
-
reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
|
|
36
35
|
};
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopTokenGenerator.mjs","sources":["../../src/crypto/PopTokenGenerator.ts"],"sourcesContent":[null],"names":["TimeUtils.nowSeconds"],"mappings":";;;;;;;AAAA;;;AAGG;
|
|
1
|
+
{"version":3,"file":"PopTokenGenerator.mjs","sources":["../../src/crypto/PopTokenGenerator.ts"],"sourcesContent":[null],"names":["TimeUtils.nowSeconds"],"mappings":";;;;;;;AAAA;;;AAGG;AA2BH,MAAM,WAAW,GAAG;AAChB,IAAA,EAAE,EAAE,IAAI;AACR,IAAA,GAAG,EAAE,KAAK;CACJ,CAAC;AAGX;MACa,iBAAiB,CAAA;IAI1B,WAAY,CAAA,WAAoB,EAAE,iBAAsC,EAAA;AACpE,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;KAC9C;AAED;;;;;AAKG;AACH,IAAA,MAAM,WAAW,CACb,OAAoC,EACpC,MAAc,EAAA;AAEd,QAAA,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CACvC,iBAAiB,CAAC,mBAAmB,EACrC,OAAO,CAAC,aAAa,CACxB,CAAC;AAEF,QAAA,MAAM,MAAM,GAAG,MAAM,WAAW,CAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAC3B,iBAAiB,CAAC,mBAAmB,EACrC,MAAM,EACN,IAAI,CAAC,iBAAiB,EACtB,OAAO,CAAC,aAAa,CACxB,CAAC,OAAO,CAAC,CAAC;AACX,QAAA,MAAM,YAAY,GAAW,IAAI,CAAC,WAAW,CAAC,eAAe,CACzD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACzB,CAAC;QAEF,OAAO;YACH,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,YAAY;SACf,CAAC;KACL;AAED;;;;AAIG;IACH,MAAM,WAAW,CAAC,OAAoC,EAAA;AAClD,QAAA,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CACvC,iBAAiB,CAAC,mBAAmB,EACrC,OAAO,CAAC,aAAa,CACxB,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAC/D,OAAO,CACV,CAAC;QAEF,OAAO;AACH,YAAA,GAAG,EAAE,aAAa;YAClB,OAAO,EAAE,WAAW,CAAC,EAAE;SAC1B,CAAC;KACL;AAED;;;;;AAKG;AACH,IAAA,MAAM,YAAY,CACd,WAAmB,EACnB,KAAa,EACb,OAAoC,EAAA;QAEpC,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;KACxD;AAED;;;;;;;AAOG;IACH,MAAM,WAAW,CACb,OAAe,EACf,KAAa,EACb,OAAoC,EACpC,MAAe,EAAA;;AAGf,QAAA,MAAM,EACF,qBAAqB,EACrB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,UAAU,GACb,GAAG,OAAO,CAAC;QAEZ,MAAM,iBAAiB,GAAG,kBAAkB;AACxC,cAAE,IAAI,SAAS,CAAC,kBAAkB,CAAC;cACjC,SAAS,CAAC;AAChB,QAAA,MAAM,qBAAqB,GAAG,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AACpE,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAC3B;AACI,YAAA,EAAE,EAAE,OAAO;AACX,YAAA,EAAE,EAAEA,UAAoB,EAAE;AAC1B,YAAA,CAAC,EAAE,qBAAqB,EAAE,WAAW,EAAE;YACvC,CAAC,EAAE,qBAAqB,EAAE,eAAe;YACzC,KAAK,EAAE,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;YACnD,CAAC,EAAE,qBAAqB,EAAE,YAAY;YACtC,CAAC,EAAE,qBAAqB,EAAE,WAAW;AACjC,kBAAE,CAAC,EAAE,EAAE,qBAAqB,CAAC,WAAW,CAAC;AACzC,kBAAE,SAAS;YACf,aAAa,EAAE,SAAS,IAAI,SAAS;AACrC,YAAA,GAAG,MAAM;SACZ,EACD,KAAK,EACL,UAAU,EACV,OAAO,CAAC,aAAa,CACxB,CAAC;KACL;AACJ;;;;"}
|
package/dist/error/AuthError.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.
|
|
1
|
+
/*! @azure/msal-common v14.12.1-alpha.0 2024-06-19 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { AuthError } from './AuthError.mjs';
|
|
4
4
|
import { clientInfoDecodingError, clientInfoEmptyError, tokenParsingError, nullOrEmptyToken, endpointResolutionError, networkError, openIdConfigError, hashNotDeserialized, invalidState, stateMismatch, stateNotFound, nonceMismatch, authTimeNotFound, maxAgeTranspired, multipleMatchingTokens, multipleMatchingAccounts, multipleMatchingAppMetadata, requestCannotBeMade, cannotRemoveEmptyScope, cannotAppendScopeSet, emptyInputScopeSet, deviceCodePollingCancelled, deviceCodeExpired, deviceCodeUnknownError, noAccountInSilentRequest, invalidCacheRecord, invalidCacheEnvironment, noAccountFound, noCryptoObject, unexpectedCredentialType, invalidAssertion, invalidClientCredential, tokenRefreshRequired, userTimeoutReached, tokenClaimsCnfRequiredForSignedJwt, authorizationCodeMissingFromServerResponse, bindingKeyNotRemoved, endSessionEndpointNotSupported, keyIdMissing, noNetworkConnectivity, userCanceled, missingTenantIdError, nestedAppAuthBridgeDisabled, methodNotImplemented } from './ClientAuthErrorCodes.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.
|
|
1
|
+
/*! @azure/msal-common v14.12.1-alpha.0 2024-06-19 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { AuthError } from './AuthError.mjs';
|
|
4
4
|
import { redirectUriEmpty, claimsRequestParsingError, authorityUriInsecure, urlParseError, urlEmptyError, emptyInputScopesError, invalidPromptValue, invalidClaims, tokenRequestEmpty, logoutRequestEmpty, invalidCodeChallengeMethod, pkceParamsMissing, invalidCloudDiscoveryMetadata, invalidAuthorityMetadata, untrustedAuthority, missingSshJwk, missingSshKid, missingNonceAuthenticationHeader, invalidAuthenticationHeader, cannotSetOIDCOptions, cannotAllowNativeBroker, authorityMismatch } from './ClientConfigurationErrorCodes.mjs';
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.
|
|
1
|
+
/*! @azure/msal-common v14.12.1-alpha.0 2024-06-19 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -47,6 +47,7 @@ const Constants = {
|
|
|
47
47
|
NOT_DEFINED: "not_defined",
|
|
48
48
|
EMPTY_STRING: "",
|
|
49
49
|
NOT_APPLICABLE: "N/A",
|
|
50
|
+
NOT_AVAILABLE: "Not Available",
|
|
50
51
|
FORWARD_SLASH: "/",
|
|
51
52
|
IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
|
|
52
53
|
IMDS_VERSION: "2020-06-01",
|
|
@@ -3611,6 +3612,12 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3611
3612
|
base64Encode: () => {
|
|
3612
3613
|
throw createClientAuthError(methodNotImplemented);
|
|
3613
3614
|
},
|
|
3615
|
+
base64UrlEncode: () => {
|
|
3616
|
+
throw createClientAuthError(methodNotImplemented);
|
|
3617
|
+
},
|
|
3618
|
+
encodeKid: () => {
|
|
3619
|
+
throw createClientAuthError(methodNotImplemented);
|
|
3620
|
+
},
|
|
3614
3621
|
async getPublicKeyThumbprint() {
|
|
3615
3622
|
throw createClientAuthError(methodNotImplemented);
|
|
3616
3623
|
},
|
|
@@ -3819,7 +3826,7 @@ class Logger {
|
|
|
3819
3826
|
|
|
3820
3827
|
/* eslint-disable header/header */
|
|
3821
3828
|
const name = "@azure/msal-common";
|
|
3822
|
-
const version = "14.
|
|
3829
|
+
const version = "14.12.1-alpha.0";
|
|
3823
3830
|
|
|
3824
3831
|
/*
|
|
3825
3832
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4260,21 +4267,21 @@ class AccountEntity {
|
|
|
4260
4267
|
// How do you account for MSA CID here?
|
|
4261
4268
|
account.localAccountId =
|
|
4262
4269
|
clientInfo?.uid ||
|
|
4263
|
-
accountDetails.idTokenClaims
|
|
4264
|
-
accountDetails.idTokenClaims
|
|
4270
|
+
accountDetails.idTokenClaims?.oid ||
|
|
4271
|
+
accountDetails.idTokenClaims?.sub ||
|
|
4265
4272
|
"";
|
|
4266
4273
|
/*
|
|
4267
4274
|
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
4268
4275
|
* In most cases it will contain a single email. This field should not be relied upon if a custom
|
|
4269
4276
|
* policy is configured to return more than 1 email.
|
|
4270
4277
|
*/
|
|
4271
|
-
const preferredUsername = accountDetails.idTokenClaims
|
|
4272
|
-
accountDetails.idTokenClaims
|
|
4273
|
-
const email = accountDetails.idTokenClaims
|
|
4278
|
+
const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
|
|
4279
|
+
accountDetails.idTokenClaims?.upn;
|
|
4280
|
+
const email = accountDetails.idTokenClaims?.emails
|
|
4274
4281
|
? accountDetails.idTokenClaims.emails[0]
|
|
4275
4282
|
: null;
|
|
4276
4283
|
account.username = preferredUsername || email || "";
|
|
4277
|
-
account.name = accountDetails.idTokenClaims
|
|
4284
|
+
account.name = accountDetails.idTokenClaims?.name || "";
|
|
4278
4285
|
account.cloudGraphHostName = accountDetails.cloudGraphHostName;
|
|
4279
4286
|
account.msGraphHost = accountDetails.msGraphHost;
|
|
4280
4287
|
if (accountDetails.tenantProfiles) {
|
|
@@ -5559,7 +5566,7 @@ class CacheManager {
|
|
|
5559
5566
|
/**
|
|
5560
5567
|
* Returns true if the credential's keyId matches the one in the request, false otherwise
|
|
5561
5568
|
* @param entity
|
|
5562
|
-
* @param
|
|
5569
|
+
* @param keyId
|
|
5563
5570
|
*/
|
|
5564
5571
|
matchKeyId(entity, keyId) {
|
|
5565
5572
|
return !!(entity.keyId && entity.keyId === keyId);
|
|
@@ -5990,23 +5997,6 @@ class RequestValidator {
|
|
|
5990
5997
|
throw createClientConfigurationError(invalidCodeChallengeMethod);
|
|
5991
5998
|
}
|
|
5992
5999
|
}
|
|
5993
|
-
/**
|
|
5994
|
-
* Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
|
|
5995
|
-
* @param request
|
|
5996
|
-
*/
|
|
5997
|
-
static sanitizeEQParams(eQParams, queryParams) {
|
|
5998
|
-
if (!eQParams) {
|
|
5999
|
-
return {};
|
|
6000
|
-
}
|
|
6001
|
-
// Remove any query parameters already included in SSO params
|
|
6002
|
-
queryParams.forEach((_value, key) => {
|
|
6003
|
-
if (eQParams[key]) {
|
|
6004
|
-
delete eQParams[key];
|
|
6005
|
-
}
|
|
6006
|
-
});
|
|
6007
|
-
// remove empty string parameters
|
|
6008
|
-
return Object.fromEntries(Object.entries(eQParams).filter((kv) => kv[1] !== ""));
|
|
6009
|
-
}
|
|
6010
6000
|
}
|
|
6011
6001
|
|
|
6012
6002
|
/*
|
|
@@ -6295,9 +6285,10 @@ class RequestParameterBuilder {
|
|
|
6295
6285
|
* @param eQParams
|
|
6296
6286
|
*/
|
|
6297
6287
|
addExtraQueryParameters(eQParams) {
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6288
|
+
Object.entries(eQParams).forEach(([key, value]) => {
|
|
6289
|
+
if (!this.parameters.has(key) && value) {
|
|
6290
|
+
this.parameters.set(key, value);
|
|
6291
|
+
}
|
|
6301
6292
|
});
|
|
6302
6293
|
}
|
|
6303
6294
|
addClientCapabilitiesToClaims(claims, clientCapabilities) {
|
|
@@ -6603,21 +6594,6 @@ function createInteractionRequiredAuthError(errorCode) {
|
|
|
6603
6594
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6604
6595
|
}
|
|
6605
6596
|
|
|
6606
|
-
/*
|
|
6607
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6608
|
-
* Licensed under the MIT License.
|
|
6609
|
-
*/
|
|
6610
|
-
/** @internal */
|
|
6611
|
-
class CacheRecord {
|
|
6612
|
-
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
6613
|
-
this.account = accountEntity || null;
|
|
6614
|
-
this.idToken = idTokenEntity || null;
|
|
6615
|
-
this.accessToken = accessTokenEntity || null;
|
|
6616
|
-
this.refreshToken = refreshTokenEntity || null;
|
|
6617
|
-
this.appMetadata = appMetadataEntity || null;
|
|
6618
|
-
}
|
|
6619
|
-
}
|
|
6620
|
-
|
|
6621
6597
|
/*
|
|
6622
6598
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6623
6599
|
* Licensed under the MIT License.
|
|
@@ -6711,11 +6687,10 @@ class PopTokenGenerator {
|
|
|
6711
6687
|
async generateCnf(request, logger) {
|
|
6712
6688
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
6713
6689
|
const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
|
|
6714
|
-
const reqCnfString = this.cryptoUtils.
|
|
6690
|
+
const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
|
|
6715
6691
|
return {
|
|
6716
6692
|
kid: reqCnf.kid,
|
|
6717
6693
|
reqCnfString,
|
|
6718
|
-
reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
|
|
6719
6694
|
};
|
|
6720
6695
|
}
|
|
6721
6696
|
/**
|
|
@@ -6872,7 +6847,7 @@ class ResponseHandler {
|
|
|
6872
6847
|
if (serverResponse.error ||
|
|
6873
6848
|
serverResponse.error_description ||
|
|
6874
6849
|
serverResponse.suberror) {
|
|
6875
|
-
const errString =
|
|
6850
|
+
const errString = `Error(s): ${serverResponse.error_codes || Constants.NOT_AVAILABLE} - Timestamp: ${serverResponse.timestamp || Constants.NOT_AVAILABLE} - Description: ${serverResponse.error_description || Constants.NOT_AVAILABLE} - Correlation ID: ${serverResponse.correlation_id || Constants.NOT_AVAILABLE} - Trace ID: ${serverResponse.trace_id || Constants.NOT_AVAILABLE}`;
|
|
6876
6851
|
const serverErrorNo = serverResponse.error_codes?.length
|
|
6877
6852
|
? serverResponse.error_codes[0]
|
|
6878
6853
|
: undefined;
|
|
@@ -6990,7 +6965,7 @@ class ResponseHandler {
|
|
|
6990
6965
|
let cachedAccount;
|
|
6991
6966
|
if (serverTokenResponse.id_token && !!idTokenClaims) {
|
|
6992
6967
|
cachedIdToken = createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token, this.clientId, claimsTenantId || "");
|
|
6993
|
-
cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier,
|
|
6968
|
+
cachedAccount = buildAccountToCache(this.cacheStorage, authority, this.homeAccountIdentifier, this.cryptoObj.base64Decode, idTokenClaims, serverTokenResponse.client_info, env, claimsTenantId, authCodePayload, undefined, // nativeAccountId
|
|
6994
6969
|
this.logger);
|
|
6995
6970
|
}
|
|
6996
6971
|
// AccessToken
|
|
@@ -7043,7 +7018,13 @@ class ResponseHandler {
|
|
|
7043
7018
|
familyId: serverTokenResponse.foci,
|
|
7044
7019
|
};
|
|
7045
7020
|
}
|
|
7046
|
-
return
|
|
7021
|
+
return {
|
|
7022
|
+
account: cachedAccount,
|
|
7023
|
+
idToken: cachedIdToken,
|
|
7024
|
+
accessToken: cachedAccessToken,
|
|
7025
|
+
refreshToken: cachedRefreshToken,
|
|
7026
|
+
appMetadata: cachedAppMetadata,
|
|
7027
|
+
};
|
|
7047
7028
|
}
|
|
7048
7029
|
/**
|
|
7049
7030
|
* Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
|
|
@@ -7063,7 +7044,13 @@ class ResponseHandler {
|
|
|
7063
7044
|
let refreshOn;
|
|
7064
7045
|
let familyId = Constants.EMPTY_STRING;
|
|
7065
7046
|
if (cacheRecord.accessToken) {
|
|
7066
|
-
|
|
7047
|
+
/*
|
|
7048
|
+
* if the request object has `popKid` property, `signPopToken` will be set to false and
|
|
7049
|
+
* the token will be returned unsigned
|
|
7050
|
+
*/
|
|
7051
|
+
if (cacheRecord.accessToken.tokenType ===
|
|
7052
|
+
AuthenticationScheme.POP &&
|
|
7053
|
+
!request.popKid) {
|
|
7067
7054
|
const popTokenGenerator = new PopTokenGenerator(cryptoObj);
|
|
7068
7055
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
7069
7056
|
if (!keyId) {
|
|
@@ -7126,7 +7113,7 @@ class ResponseHandler {
|
|
|
7126
7113
|
};
|
|
7127
7114
|
}
|
|
7128
7115
|
}
|
|
7129
|
-
function buildAccountToCache(cacheStorage, authority, homeAccountId,
|
|
7116
|
+
function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decode, idTokenClaims, clientInfo, environment, claimsTenantId, authCodePayload, nativeAccountId, logger) {
|
|
7130
7117
|
logger?.verbose("setCachedAccount called");
|
|
7131
7118
|
// Check if base account is already cached
|
|
7132
7119
|
const accountKeys = cacheStorage.getAccountKeys();
|
|
@@ -7149,6 +7136,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, idTokenClai
|
|
|
7149
7136
|
}, authority, base64Decode);
|
|
7150
7137
|
const tenantProfiles = baseAccount.tenantProfiles || [];
|
|
7151
7138
|
if (claimsTenantId &&
|
|
7139
|
+
idTokenClaims &&
|
|
7152
7140
|
!tenantProfiles.find((tenantProfile) => {
|
|
7153
7141
|
return tenantProfile.tenantId === claimsTenantId;
|
|
7154
7142
|
})) {
|
|
@@ -7325,9 +7313,16 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7325
7313
|
parameterBuilder.addClientInfo();
|
|
7326
7314
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7327
7315
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
7328
|
-
|
|
7316
|
+
let reqCnfData;
|
|
7317
|
+
if (!request.popKid) {
|
|
7318
|
+
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
7319
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
7320
|
+
}
|
|
7321
|
+
else {
|
|
7322
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7323
|
+
}
|
|
7329
7324
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
7330
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
7325
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
7331
7326
|
}
|
|
7332
7327
|
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
7333
7328
|
if (request.sshJwk) {
|
|
@@ -7521,9 +7516,16 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7521
7516
|
// pass the req_cnf for POP
|
|
7522
7517
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7523
7518
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
7524
|
-
//
|
|
7525
|
-
|
|
7526
|
-
|
|
7519
|
+
// req_cnf is always sent as a string for SPAs
|
|
7520
|
+
let reqCnfData;
|
|
7521
|
+
if (!request.popKid) {
|
|
7522
|
+
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
7523
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
7524
|
+
}
|
|
7525
|
+
else {
|
|
7526
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7527
|
+
}
|
|
7528
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
7527
7529
|
}
|
|
7528
7530
|
}
|
|
7529
7531
|
return parameterBuilder.createQueryString();
|
|
@@ -7729,9 +7731,16 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7729
7731
|
}
|
|
7730
7732
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
7731
7733
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
7732
|
-
|
|
7734
|
+
let reqCnfData;
|
|
7735
|
+
if (!request.popKid) {
|
|
7736
|
+
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
7737
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
7738
|
+
}
|
|
7739
|
+
else {
|
|
7740
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
7741
|
+
}
|
|
7733
7742
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
7734
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
7743
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
7735
7744
|
}
|
|
7736
7745
|
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
7737
7746
|
if (request.sshJwk) {
|
|
@@ -8930,7 +8939,6 @@ exports.CacheErrorCodes = CacheErrorCodes;
|
|
|
8930
8939
|
exports.CacheHelpers = CacheHelpers;
|
|
8931
8940
|
exports.CacheManager = CacheManager;
|
|
8932
8941
|
exports.CacheOutcome = CacheOutcome;
|
|
8933
|
-
exports.CacheRecord = CacheRecord;
|
|
8934
8942
|
exports.CacheType = CacheType;
|
|
8935
8943
|
exports.CcsCredentialType = CcsCredentialType;
|
|
8936
8944
|
exports.ClaimsRequestKeys = ClaimsRequestKeys;
|