@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
package/dist/utils/UrlUtils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1905,7 +1905,7 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1905
1905
|
/**
|
|
1906
1906
|
* Returns true if the credential's keyId matches the one in the request, false otherwise
|
|
1907
1907
|
* @param entity
|
|
1908
|
-
* @param
|
|
1908
|
+
* @param keyId
|
|
1909
1909
|
*/
|
|
1910
1910
|
private matchKeyId(entity: CredentialEntity, keyId: string): boolean {
|
|
1911
1911
|
return !!(entity.keyId && entity.keyId === keyId);
|
|
@@ -135,7 +135,7 @@ export class AccountEntity {
|
|
|
135
135
|
static createAccount(
|
|
136
136
|
accountDetails: {
|
|
137
137
|
homeAccountId: string;
|
|
138
|
-
idTokenClaims
|
|
138
|
+
idTokenClaims?: TokenClaims;
|
|
139
139
|
clientInfo?: string;
|
|
140
140
|
cloudGraphHostName?: string;
|
|
141
141
|
msGraphHost?: string;
|
|
@@ -189,8 +189,8 @@ export class AccountEntity {
|
|
|
189
189
|
// How do you account for MSA CID here?
|
|
190
190
|
account.localAccountId =
|
|
191
191
|
clientInfo?.uid ||
|
|
192
|
-
accountDetails.idTokenClaims
|
|
193
|
-
accountDetails.idTokenClaims
|
|
192
|
+
accountDetails.idTokenClaims?.oid ||
|
|
193
|
+
accountDetails.idTokenClaims?.sub ||
|
|
194
194
|
"";
|
|
195
195
|
|
|
196
196
|
/*
|
|
@@ -199,14 +199,14 @@ export class AccountEntity {
|
|
|
199
199
|
* policy is configured to return more than 1 email.
|
|
200
200
|
*/
|
|
201
201
|
const preferredUsername =
|
|
202
|
-
accountDetails.idTokenClaims
|
|
203
|
-
accountDetails.idTokenClaims
|
|
204
|
-
const email = accountDetails.idTokenClaims
|
|
202
|
+
accountDetails.idTokenClaims?.preferred_username ||
|
|
203
|
+
accountDetails.idTokenClaims?.upn;
|
|
204
|
+
const email = accountDetails.idTokenClaims?.emails
|
|
205
205
|
? accountDetails.idTokenClaims.emails[0]
|
|
206
206
|
: null;
|
|
207
207
|
|
|
208
208
|
account.username = preferredUsername || email || "";
|
|
209
|
-
account.name = accountDetails.idTokenClaims
|
|
209
|
+
account.name = accountDetails.idTokenClaims?.name || "";
|
|
210
210
|
|
|
211
211
|
account.cloudGraphHostName = accountDetails.cloudGraphHostName;
|
|
212
212
|
account.msGraphHost = accountDetails.msGraphHost;
|
|
@@ -10,24 +10,10 @@ import { AccountEntity } from "./AccountEntity";
|
|
|
10
10
|
import { AppMetadataEntity } from "./AppMetadataEntity";
|
|
11
11
|
|
|
12
12
|
/** @internal */
|
|
13
|
-
export
|
|
14
|
-
account
|
|
15
|
-
idToken
|
|
16
|
-
accessToken
|
|
17
|
-
refreshToken
|
|
18
|
-
appMetadata
|
|
19
|
-
|
|
20
|
-
constructor(
|
|
21
|
-
accountEntity?: AccountEntity | null,
|
|
22
|
-
idTokenEntity?: IdTokenEntity | null,
|
|
23
|
-
accessTokenEntity?: AccessTokenEntity | null,
|
|
24
|
-
refreshTokenEntity?: RefreshTokenEntity | null,
|
|
25
|
-
appMetadataEntity?: AppMetadataEntity | null
|
|
26
|
-
) {
|
|
27
|
-
this.account = accountEntity || null;
|
|
28
|
-
this.idToken = idTokenEntity || null;
|
|
29
|
-
this.accessToken = accessTokenEntity || null;
|
|
30
|
-
this.refreshToken = refreshTokenEntity || null;
|
|
31
|
-
this.appMetadata = appMetadataEntity || null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
13
|
+
export type CacheRecord = {
|
|
14
|
+
account?: AccountEntity | null;
|
|
15
|
+
idToken?: IdTokenEntity | null;
|
|
16
|
+
accessToken?: AccessTokenEntity | null;
|
|
17
|
+
refreshToken?: RefreshTokenEntity | null;
|
|
18
|
+
appMetadata?: AppMetadataEntity | null;
|
|
19
|
+
};
|
|
@@ -390,15 +390,22 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
390
390
|
this.performanceClient
|
|
391
391
|
);
|
|
392
392
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
393
|
+
let reqCnfData;
|
|
394
|
+
if (!request.popKid) {
|
|
395
|
+
const generatedReqCnfData = await invokeAsync(
|
|
396
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
397
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
398
|
+
this.logger,
|
|
399
|
+
this.performanceClient,
|
|
400
|
+
request.correlationId
|
|
401
|
+
)(request, this.logger);
|
|
402
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
403
|
+
} else {
|
|
404
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
405
|
+
}
|
|
406
|
+
|
|
400
407
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
401
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
408
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
402
409
|
} else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
403
410
|
if (request.sshJwk) {
|
|
404
411
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
@@ -682,15 +689,22 @@ export class AuthorizationCodeClient extends BaseClient {
|
|
|
682
689
|
const popTokenGenerator = new PopTokenGenerator(
|
|
683
690
|
this.cryptoUtils
|
|
684
691
|
);
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
|
|
693
|
+
// req_cnf is always sent as a string for SPAs
|
|
694
|
+
let reqCnfData;
|
|
695
|
+
if (!request.popKid) {
|
|
696
|
+
const generatedReqCnfData = await invokeAsync(
|
|
697
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
698
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
699
|
+
this.logger,
|
|
700
|
+
this.performanceClient,
|
|
701
|
+
request.correlationId
|
|
702
|
+
)(request, this.logger);
|
|
703
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
704
|
+
} else {
|
|
705
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
706
|
+
}
|
|
707
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
694
708
|
}
|
|
695
709
|
}
|
|
696
710
|
|
|
@@ -407,15 +407,24 @@ export class RefreshTokenClient extends BaseClient {
|
|
|
407
407
|
this.cryptoUtils,
|
|
408
408
|
this.performanceClient
|
|
409
409
|
);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
410
|
+
|
|
411
|
+
let reqCnfData;
|
|
412
|
+
if (!request.popKid) {
|
|
413
|
+
const generatedReqCnfData = await invokeAsync(
|
|
414
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
415
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
416
|
+
this.logger,
|
|
417
|
+
this.performanceClient,
|
|
418
|
+
request.correlationId
|
|
419
|
+
)(request, this.logger);
|
|
420
|
+
|
|
421
|
+
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
422
|
+
} else {
|
|
423
|
+
reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
|
|
424
|
+
}
|
|
425
|
+
|
|
417
426
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
418
|
-
parameterBuilder.addPopToken(reqCnfData
|
|
427
|
+
parameterBuilder.addPopToken(reqCnfData);
|
|
419
428
|
} else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
420
429
|
if (request.sshJwk) {
|
|
421
430
|
parameterBuilder.addSshJwk(request.sshJwk);
|
package/src/crypto/ICrypto.ts
CHANGED
|
@@ -49,6 +49,16 @@ export interface ICrypto {
|
|
|
49
49
|
* @param input
|
|
50
50
|
*/
|
|
51
51
|
base64Decode(input: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* base64 URL safe encoded string
|
|
54
|
+
*/
|
|
55
|
+
base64UrlEncode(input: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Stringifies and base64Url encodes input public key
|
|
58
|
+
* @param inputKid
|
|
59
|
+
* @returns Base64Url encoded public key
|
|
60
|
+
*/
|
|
61
|
+
encodeKid(inputKid: string): string;
|
|
52
62
|
/**
|
|
53
63
|
* Generates an JWK RSA S256 Thumbprint
|
|
54
64
|
* @param request
|
|
@@ -92,6 +102,12 @@ export const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {
|
|
|
92
102
|
base64Encode: (): string => {
|
|
93
103
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
94
104
|
},
|
|
105
|
+
base64UrlEncode: (): string => {
|
|
106
|
+
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
107
|
+
},
|
|
108
|
+
encodeKid: (): string => {
|
|
109
|
+
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
110
|
+
},
|
|
95
111
|
async getPublicKeyThumbprint(): Promise<string> {
|
|
96
112
|
throw createClientAuthError(ClientAuthErrorCodes.methodNotImplemented);
|
|
97
113
|
},
|
|
@@ -26,7 +26,6 @@ type ReqCnf = {
|
|
|
26
26
|
export type ReqCnfData = {
|
|
27
27
|
kid: string;
|
|
28
28
|
reqCnfString: string;
|
|
29
|
-
reqCnfHash: string;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
const KeyLocation = {
|
|
@@ -67,14 +66,13 @@ export class PopTokenGenerator {
|
|
|
67
66
|
this.performanceClient,
|
|
68
67
|
request.correlationId
|
|
69
68
|
)(request);
|
|
70
|
-
const reqCnfString: string = this.cryptoUtils.
|
|
69
|
+
const reqCnfString: string = this.cryptoUtils.base64UrlEncode(
|
|
71
70
|
JSON.stringify(reqCnf)
|
|
72
71
|
);
|
|
73
72
|
|
|
74
73
|
return {
|
|
75
74
|
kid: reqCnf.kid,
|
|
76
75
|
reqCnfString,
|
|
77
|
-
reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
|
|
78
76
|
};
|
|
79
77
|
}
|
|
80
78
|
|
package/src/packageMetadata.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { ShrOptions } from "../crypto/SignedHttpRequest";
|
|
|
28
28
|
* - tokenQueryParameters - String to string map of custom query parameters added to the /token call
|
|
29
29
|
* - storeInCache - Object containing boolean values indicating whether to store tokens in the cache or not (default is true)
|
|
30
30
|
* - scenarioId - Scenario id to track custom user prompts
|
|
31
|
+
* - popKid - Key ID to identify the public key for PoP token request
|
|
31
32
|
*/
|
|
32
33
|
export type BaseAuthRequest = {
|
|
33
34
|
authority: string;
|
|
@@ -48,4 +49,5 @@ export type BaseAuthRequest = {
|
|
|
48
49
|
tokenQueryParameters?: StringDict;
|
|
49
50
|
storeInCache?: StoreInCache;
|
|
50
51
|
scenarioId?: string;
|
|
52
|
+
popKid?: string;
|
|
51
53
|
};
|
|
@@ -465,12 +465,10 @@ export class RequestParameterBuilder {
|
|
|
465
465
|
* @param eQParams
|
|
466
466
|
*/
|
|
467
467
|
addExtraQueryParameters(eQParams: StringDict): void {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
Object.keys(sanitizedEQParams).forEach((key) => {
|
|
473
|
-
this.parameters.set(key, eQParams[key]);
|
|
468
|
+
Object.entries(eQParams).forEach(([key, value]) => {
|
|
469
|
+
if (!this.parameters.has(key) && value) {
|
|
470
|
+
this.parameters.set(key, value);
|
|
471
|
+
}
|
|
474
472
|
});
|
|
475
473
|
}
|
|
476
474
|
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
ClientConfigurationErrorCodes,
|
|
9
9
|
} from "../error/ClientConfigurationError";
|
|
10
10
|
import { PromptValue, CodeChallengeMethodValues } from "../utils/Constants";
|
|
11
|
-
import { StringDict } from "../utils/MsalTypes";
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Validates server consumable params from the "request" objects
|
|
@@ -88,29 +87,4 @@ export class RequestValidator {
|
|
|
88
87
|
);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters
|
|
94
|
-
* @param request
|
|
95
|
-
*/
|
|
96
|
-
static sanitizeEQParams(
|
|
97
|
-
eQParams: StringDict,
|
|
98
|
-
queryParams: Map<string, string>
|
|
99
|
-
): StringDict {
|
|
100
|
-
if (!eQParams) {
|
|
101
|
-
return {};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Remove any query parameters already included in SSO params
|
|
105
|
-
queryParams.forEach((_value, key) => {
|
|
106
|
-
if (eQParams[key]) {
|
|
107
|
-
delete eQParams[key];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// remove empty string parameters
|
|
112
|
-
return Object.fromEntries(
|
|
113
|
-
Object.entries(eQParams).filter((kv) => kv[1] !== "")
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
90
|
}
|
|
@@ -17,7 +17,14 @@ import { ServerAuthorizationTokenResponse } from "./ServerAuthorizationTokenResp
|
|
|
17
17
|
*/
|
|
18
18
|
export type ExternalTokenResponse = Pick<
|
|
19
19
|
ServerAuthorizationTokenResponse,
|
|
20
|
-
|
|
20
|
+
| "token_type"
|
|
21
|
+
| "scope"
|
|
22
|
+
| "expires_in"
|
|
23
|
+
| "ext_expires_in"
|
|
24
|
+
| "id_token"
|
|
25
|
+
| "refresh_token"
|
|
26
|
+
| "refresh_token_expires_in"
|
|
27
|
+
| "foci"
|
|
21
28
|
> & {
|
|
22
29
|
access_token?: string;
|
|
23
30
|
client_info?: string;
|
|
@@ -197,7 +197,17 @@ export class ResponseHandler {
|
|
|
197
197
|
serverResponse.error_description ||
|
|
198
198
|
serverResponse.suberror
|
|
199
199
|
) {
|
|
200
|
-
const errString =
|
|
200
|
+
const errString = `Error(s): ${
|
|
201
|
+
serverResponse.error_codes || Constants.NOT_AVAILABLE
|
|
202
|
+
} - Timestamp: ${
|
|
203
|
+
serverResponse.timestamp || Constants.NOT_AVAILABLE
|
|
204
|
+
} - Description: ${
|
|
205
|
+
serverResponse.error_description || Constants.NOT_AVAILABLE
|
|
206
|
+
} - Correlation ID: ${
|
|
207
|
+
serverResponse.correlation_id || Constants.NOT_AVAILABLE
|
|
208
|
+
} - Trace ID: ${
|
|
209
|
+
serverResponse.trace_id || Constants.NOT_AVAILABLE
|
|
210
|
+
}`;
|
|
201
211
|
const serverErrorNo = serverResponse.error_codes?.length
|
|
202
212
|
? serverResponse.error_codes[0]
|
|
203
213
|
: undefined;
|
|
@@ -454,8 +464,8 @@ export class ResponseHandler {
|
|
|
454
464
|
this.cacheStorage,
|
|
455
465
|
authority,
|
|
456
466
|
this.homeAccountIdentifier,
|
|
457
|
-
idTokenClaims,
|
|
458
467
|
this.cryptoObj.base64Decode,
|
|
468
|
+
idTokenClaims,
|
|
459
469
|
serverTokenResponse.client_info,
|
|
460
470
|
env,
|
|
461
471
|
claimsTenantId,
|
|
@@ -553,13 +563,13 @@ export class ResponseHandler {
|
|
|
553
563
|
};
|
|
554
564
|
}
|
|
555
565
|
|
|
556
|
-
return
|
|
557
|
-
cachedAccount,
|
|
558
|
-
cachedIdToken,
|
|
559
|
-
cachedAccessToken,
|
|
560
|
-
cachedRefreshToken,
|
|
561
|
-
cachedAppMetadata
|
|
562
|
-
|
|
566
|
+
return {
|
|
567
|
+
account: cachedAccount,
|
|
568
|
+
idToken: cachedIdToken,
|
|
569
|
+
accessToken: cachedAccessToken,
|
|
570
|
+
refreshToken: cachedRefreshToken,
|
|
571
|
+
appMetadata: cachedAppMetadata,
|
|
572
|
+
};
|
|
563
573
|
}
|
|
564
574
|
|
|
565
575
|
/**
|
|
@@ -591,8 +601,14 @@ export class ResponseHandler {
|
|
|
591
601
|
let familyId: string = Constants.EMPTY_STRING;
|
|
592
602
|
|
|
593
603
|
if (cacheRecord.accessToken) {
|
|
604
|
+
/*
|
|
605
|
+
* if the request object has `popKid` property, `signPopToken` will be set to false and
|
|
606
|
+
* the token will be returned unsigned
|
|
607
|
+
*/
|
|
594
608
|
if (
|
|
595
|
-
cacheRecord.accessToken.tokenType ===
|
|
609
|
+
cacheRecord.accessToken.tokenType ===
|
|
610
|
+
AuthenticationScheme.POP &&
|
|
611
|
+
!request.popKid
|
|
596
612
|
) {
|
|
597
613
|
const popTokenGenerator: PopTokenGenerator =
|
|
598
614
|
new PopTokenGenerator(cryptoObj);
|
|
@@ -688,8 +704,8 @@ export function buildAccountToCache(
|
|
|
688
704
|
cacheStorage: CacheManager,
|
|
689
705
|
authority: Authority,
|
|
690
706
|
homeAccountId: string,
|
|
691
|
-
idTokenClaims: TokenClaims,
|
|
692
707
|
base64Decode: (input: string) => string,
|
|
708
|
+
idTokenClaims?: TokenClaims,
|
|
693
709
|
clientInfo?: string,
|
|
694
710
|
environment?: string,
|
|
695
711
|
claimsTenantId?: string | null,
|
|
@@ -730,6 +746,7 @@ export function buildAccountToCache(
|
|
|
730
746
|
|
|
731
747
|
if (
|
|
732
748
|
claimsTenantId &&
|
|
749
|
+
idTokenClaims &&
|
|
733
750
|
!tenantProfiles.find((tenantProfile) => {
|
|
734
751
|
return tenantProfile.tenantId === claimsTenantId;
|
|
735
752
|
})
|
package/src/utils/Constants.ts
CHANGED
|
@@ -45,6 +45,7 @@ export const Constants = {
|
|
|
45
45
|
NOT_DEFINED: "not_defined",
|
|
46
46
|
EMPTY_STRING: "",
|
|
47
47
|
NOT_APPLICABLE: "N/A",
|
|
48
|
+
NOT_AVAILABLE: "Not Available",
|
|
48
49
|
FORWARD_SLASH: "/",
|
|
49
50
|
IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
|
|
50
51
|
IMDS_VERSION: "2020-06-01",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.11.0 2024-06-04 */
|
|
2
|
-
'use strict';
|
|
3
|
-
/*
|
|
4
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
* Licensed under the MIT License.
|
|
6
|
-
*/
|
|
7
|
-
/** @internal */
|
|
8
|
-
class CacheRecord {
|
|
9
|
-
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
10
|
-
this.account = accountEntity || null;
|
|
11
|
-
this.idToken = idTokenEntity || null;
|
|
12
|
-
this.accessToken = accessTokenEntity || null;
|
|
13
|
-
this.refreshToken = refreshTokenEntity || null;
|
|
14
|
-
this.appMetadata = appMetadataEntity || null;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { CacheRecord };
|
|
19
|
-
//# sourceMappingURL=CacheRecord.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CacheRecord.mjs","sources":["../../../src/cache/entities/CacheRecord.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAQH;MACa,WAAW,CAAA;IAOpB,WACI,CAAA,aAAoC,EACpC,aAAoC,EACpC,iBAA4C,EAC5C,kBAA8C,EAC9C,iBAA4C,EAAA;AAE5C,QAAA,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;AACrC,QAAA,IAAI,CAAC,OAAO,GAAG,aAAa,IAAI,IAAI,CAAC;AACrC,QAAA,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;AAC7C,QAAA,IAAI,CAAC,YAAY,GAAG,kBAAkB,IAAI,IAAI,CAAC;AAC/C,QAAA,IAAI,CAAC,WAAW,GAAG,iBAAiB,IAAI,IAAI,CAAC;KAChD;AACJ;;;;"}
|