@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.
Files changed (117) hide show
  1. package/dist/account/AccountInfo.mjs +1 -1
  2. package/dist/account/AuthToken.mjs +1 -1
  3. package/dist/account/CcsCredential.mjs +1 -1
  4. package/dist/account/ClientInfo.mjs +1 -1
  5. package/dist/account/TokenClaims.mjs +1 -1
  6. package/dist/authority/Authority.mjs +1 -1
  7. package/dist/authority/AuthorityFactory.mjs +1 -1
  8. package/dist/authority/AuthorityMetadata.mjs +1 -1
  9. package/dist/authority/AuthorityOptions.mjs +1 -1
  10. package/dist/authority/AuthorityType.mjs +1 -1
  11. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  12. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  13. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  14. package/dist/authority/ProtocolMode.mjs +1 -1
  15. package/dist/authority/RegionDiscovery.mjs +1 -1
  16. package/dist/cache/CacheManager.d.ts +1 -1
  17. package/dist/cache/CacheManager.mjs +2 -2
  18. package/dist/cache/entities/AccountEntity.d.ts +1 -1
  19. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  20. package/dist/cache/entities/AccountEntity.mjs +7 -7
  21. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  22. package/dist/cache/entities/CacheRecord.d.ts +7 -8
  23. package/dist/cache/entities/CacheRecord.d.ts.map +1 -1
  24. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  25. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  26. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  27. package/dist/client/AuthorizationCodeClient.mjs +20 -6
  28. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  29. package/dist/client/BaseClient.mjs +1 -1
  30. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  31. package/dist/client/RefreshTokenClient.mjs +10 -3
  32. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  33. package/dist/client/SilentFlowClient.mjs +1 -1
  34. package/dist/config/ClientConfiguration.mjs +1 -1
  35. package/dist/constants/AADServerParamKeys.mjs +1 -1
  36. package/dist/crypto/ICrypto.d.ts +10 -0
  37. package/dist/crypto/ICrypto.d.ts.map +1 -1
  38. package/dist/crypto/ICrypto.mjs +7 -1
  39. package/dist/crypto/ICrypto.mjs.map +1 -1
  40. package/dist/crypto/JoseHeader.mjs +1 -1
  41. package/dist/crypto/PopTokenGenerator.d.ts +0 -1
  42. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  43. package/dist/crypto/PopTokenGenerator.mjs +2 -3
  44. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  45. package/dist/error/AuthError.mjs +1 -1
  46. package/dist/error/AuthErrorCodes.mjs +1 -1
  47. package/dist/error/CacheError.mjs +1 -1
  48. package/dist/error/CacheErrorCodes.mjs +1 -1
  49. package/dist/error/ClientAuthError.mjs +1 -1
  50. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  51. package/dist/error/ClientConfigurationError.mjs +1 -1
  52. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  53. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  54. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  55. package/dist/error/JoseHeaderError.mjs +1 -1
  56. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  57. package/dist/error/ServerError.mjs +1 -1
  58. package/dist/index.cjs +67 -59
  59. package/dist/index.cjs.map +1 -1
  60. package/dist/index.mjs +1 -2
  61. package/dist/index.mjs.map +1 -1
  62. package/dist/logger/Logger.mjs +1 -1
  63. package/dist/network/INetworkModule.mjs +1 -1
  64. package/dist/network/NetworkManager.mjs +1 -1
  65. package/dist/network/ThrottlingUtils.mjs +1 -1
  66. package/dist/packageMetadata.d.ts +1 -1
  67. package/dist/packageMetadata.d.ts.map +1 -1
  68. package/dist/packageMetadata.mjs +2 -2
  69. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  70. package/dist/request/BaseAuthRequest.d.ts +2 -0
  71. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  72. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  73. package/dist/request/RequestParameterBuilder.mjs +5 -4
  74. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  75. package/dist/request/RequestValidator.d.ts +0 -6
  76. package/dist/request/RequestValidator.d.ts.map +1 -1
  77. package/dist/request/RequestValidator.mjs +1 -18
  78. package/dist/request/RequestValidator.mjs.map +1 -1
  79. package/dist/request/ScopeSet.mjs +1 -1
  80. package/dist/response/ExternalTokenResponse.d.ts +1 -1
  81. package/dist/response/ExternalTokenResponse.d.ts.map +1 -1
  82. package/dist/response/ResponseHandler.d.ts +1 -1
  83. package/dist/response/ResponseHandler.d.ts.map +1 -1
  84. package/dist/response/ResponseHandler.mjs +19 -7
  85. package/dist/response/ResponseHandler.mjs.map +1 -1
  86. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  87. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  88. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  89. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  90. package/dist/url/UrlString.mjs +1 -1
  91. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  92. package/dist/utils/Constants.d.ts +1 -0
  93. package/dist/utils/Constants.d.ts.map +1 -1
  94. package/dist/utils/Constants.mjs +2 -1
  95. package/dist/utils/Constants.mjs.map +1 -1
  96. package/dist/utils/FunctionWrappers.mjs +1 -1
  97. package/dist/utils/ProtocolUtils.mjs +1 -1
  98. package/dist/utils/StringUtils.mjs +1 -1
  99. package/dist/utils/TimeUtils.mjs +1 -1
  100. package/dist/utils/UrlUtils.mjs +1 -1
  101. package/package.json +1 -1
  102. package/src/cache/CacheManager.ts +1 -1
  103. package/src/cache/entities/AccountEntity.ts +7 -7
  104. package/src/cache/entities/CacheRecord.ts +7 -21
  105. package/src/client/AuthorizationCodeClient.ts +31 -17
  106. package/src/client/RefreshTokenClient.ts +17 -8
  107. package/src/crypto/ICrypto.ts +16 -0
  108. package/src/crypto/PopTokenGenerator.ts +1 -3
  109. package/src/packageMetadata.ts +1 -1
  110. package/src/request/BaseAuthRequest.ts +2 -0
  111. package/src/request/RequestParameterBuilder.ts +4 -6
  112. package/src/request/RequestValidator.ts +0 -26
  113. package/src/response/ExternalTokenResponse.ts +8 -1
  114. package/src/response/ResponseHandler.ts +28 -11
  115. package/src/utils/Constants.ts +1 -0
  116. package/dist/cache/entities/CacheRecord.mjs +0 -19
  117. package/dist/cache/entities/CacheRecord.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1
+ /*! @azure/msal-common v14.12.1-alpha.0 2024-06-19 */
2
2
  'use strict';
3
3
  import { createClientAuthError } from '../error/ClientAuthError.mjs';
4
4
  import { hashNotDeserialized } from '../error/ClientAuthErrorCodes.mjs';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
12
12
  },
13
- "version": "14.11.0",
13
+ "version": "14.12.1-alpha.0",
14
14
  "description": "Microsoft Authentication Library for js",
15
15
  "keywords": [
16
16
  "implicit",
@@ -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 tokenType
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: TokenClaims;
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.oid ||
193
- accountDetails.idTokenClaims.sub ||
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.preferred_username ||
203
- accountDetails.idTokenClaims.upn;
204
- const email = accountDetails.idTokenClaims.emails
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.name;
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 class CacheRecord {
14
- account: AccountEntity | null;
15
- idToken: IdTokenEntity | null;
16
- accessToken: AccessTokenEntity | null;
17
- refreshToken: RefreshTokenEntity | null;
18
- appMetadata: AppMetadataEntity | null;
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
- const reqCnfData = await invokeAsync(
394
- popTokenGenerator.generateCnf.bind(popTokenGenerator),
395
- PerformanceEvents.PopTokenGenerateCnf,
396
- this.logger,
397
- this.performanceClient,
398
- request.correlationId
399
- )(request, this.logger);
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.reqCnfString);
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
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
686
- const reqCnfData = await invokeAsync(
687
- popTokenGenerator.generateCnf.bind(popTokenGenerator),
688
- PerformanceEvents.PopTokenGenerateCnf,
689
- this.logger,
690
- this.performanceClient,
691
- request.correlationId
692
- )(request, this.logger);
693
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
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
- const reqCnfData = await invokeAsync(
411
- popTokenGenerator.generateCnf.bind(popTokenGenerator),
412
- PerformanceEvents.PopTokenGenerateCnf,
413
- this.logger,
414
- this.performanceClient,
415
- request.correlationId
416
- )(request, this.logger);
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.reqCnfString);
427
+ parameterBuilder.addPopToken(reqCnfData);
419
428
  } else if (request.authenticationScheme === AuthenticationScheme.SSH) {
420
429
  if (request.sshJwk) {
421
430
  parameterBuilder.addSshJwk(request.sshJwk);
@@ -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.base64Encode(
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
 
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-common";
3
- export const version = "14.11.0";
3
+ export const version = "14.12.1-alpha.0";
@@ -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
- const sanitizedEQParams = RequestValidator.sanitizeEQParams(
469
- eQParams,
470
- this.parameters
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
- "token_type" | "scope" | "expires_in" | "id_token" | "refresh_token"
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 = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;
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 new CacheRecord(
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 === AuthenticationScheme.POP
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
  })
@@ -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;;;;"}