@azure/msal-common 14.11.0 → 14.12.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 (92) 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.mjs +1 -1
  19. package/dist/cache/entities/CacheRecord.mjs +1 -1
  20. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  21. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  22. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  23. package/dist/client/AuthorizationCodeClient.mjs +20 -6
  24. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  25. package/dist/client/BaseClient.mjs +1 -1
  26. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  27. package/dist/client/RefreshTokenClient.mjs +10 -3
  28. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  29. package/dist/client/SilentFlowClient.mjs +1 -1
  30. package/dist/config/ClientConfiguration.mjs +1 -1
  31. package/dist/constants/AADServerParamKeys.mjs +1 -1
  32. package/dist/crypto/ICrypto.d.ts +10 -0
  33. package/dist/crypto/ICrypto.d.ts.map +1 -1
  34. package/dist/crypto/ICrypto.mjs +7 -1
  35. package/dist/crypto/ICrypto.mjs.map +1 -1
  36. package/dist/crypto/JoseHeader.mjs +1 -1
  37. package/dist/crypto/PopTokenGenerator.d.ts +0 -1
  38. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  39. package/dist/crypto/PopTokenGenerator.mjs +2 -3
  40. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  41. package/dist/error/AuthError.mjs +1 -1
  42. package/dist/error/AuthErrorCodes.mjs +1 -1
  43. package/dist/error/CacheError.mjs +1 -1
  44. package/dist/error/CacheErrorCodes.mjs +1 -1
  45. package/dist/error/ClientAuthError.mjs +1 -1
  46. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  47. package/dist/error/ClientConfigurationError.mjs +1 -1
  48. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  49. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  50. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  51. package/dist/error/JoseHeaderError.mjs +1 -1
  52. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  53. package/dist/error/ServerError.mjs +1 -1
  54. package/dist/index.cjs +45 -13
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.mjs +1 -1
  57. package/dist/logger/Logger.mjs +1 -1
  58. package/dist/network/INetworkModule.mjs +1 -1
  59. package/dist/network/NetworkManager.mjs +1 -1
  60. package/dist/network/ThrottlingUtils.mjs +1 -1
  61. package/dist/packageMetadata.d.ts +1 -1
  62. package/dist/packageMetadata.mjs +2 -2
  63. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  64. package/dist/request/BaseAuthRequest.d.ts +2 -0
  65. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  66. package/dist/request/RequestParameterBuilder.mjs +1 -1
  67. package/dist/request/RequestValidator.mjs +1 -1
  68. package/dist/request/ScopeSet.mjs +1 -1
  69. package/dist/response/ResponseHandler.d.ts.map +1 -1
  70. package/dist/response/ResponseHandler.mjs +8 -2
  71. package/dist/response/ResponseHandler.mjs.map +1 -1
  72. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  73. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  74. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  75. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  76. package/dist/url/UrlString.mjs +1 -1
  77. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  78. package/dist/utils/Constants.mjs +1 -1
  79. package/dist/utils/FunctionWrappers.mjs +1 -1
  80. package/dist/utils/ProtocolUtils.mjs +1 -1
  81. package/dist/utils/StringUtils.mjs +1 -1
  82. package/dist/utils/TimeUtils.mjs +1 -1
  83. package/dist/utils/UrlUtils.mjs +1 -1
  84. package/package.json +1 -1
  85. package/src/cache/CacheManager.ts +1 -1
  86. package/src/client/AuthorizationCodeClient.ts +31 -17
  87. package/src/client/RefreshTokenClient.ts +17 -8
  88. package/src/crypto/ICrypto.ts +16 -0
  89. package/src/crypto/PopTokenGenerator.ts +1 -3
  90. package/src/packageMetadata.ts +1 -1
  91. package/src/request/BaseAuthRequest.ts +2 -0
  92. package/src/response/ResponseHandler.ts +7 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2
2
  'use strict';
3
3
  import { AuthError } from './AuthError.mjs';
4
4
 
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.11.0 2024-06-04 */
1
+ /*! @azure/msal-common v14.12.0 2024-06-10 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -3611,6 +3611,12 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3611
3611
  base64Encode: () => {
3612
3612
  throw createClientAuthError(methodNotImplemented);
3613
3613
  },
3614
+ base64UrlEncode: () => {
3615
+ throw createClientAuthError(methodNotImplemented);
3616
+ },
3617
+ encodeKid: () => {
3618
+ throw createClientAuthError(methodNotImplemented);
3619
+ },
3614
3620
  async getPublicKeyThumbprint() {
3615
3621
  throw createClientAuthError(methodNotImplemented);
3616
3622
  },
@@ -3819,7 +3825,7 @@ class Logger {
3819
3825
 
3820
3826
  /* eslint-disable header/header */
3821
3827
  const name = "@azure/msal-common";
3822
- const version = "14.11.0";
3828
+ const version = "14.12.0";
3823
3829
 
3824
3830
  /*
3825
3831
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5559,7 +5565,7 @@ class CacheManager {
5559
5565
  /**
5560
5566
  * Returns true if the credential's keyId matches the one in the request, false otherwise
5561
5567
  * @param entity
5562
- * @param tokenType
5568
+ * @param keyId
5563
5569
  */
5564
5570
  matchKeyId(entity, keyId) {
5565
5571
  return !!(entity.keyId && entity.keyId === keyId);
@@ -6711,11 +6717,10 @@ class PopTokenGenerator {
6711
6717
  async generateCnf(request, logger) {
6712
6718
  this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6713
6719
  const reqCnf = await invokeAsync(this.generateKid.bind(this), PerformanceEvents.PopTokenGenerateCnf, logger, this.performanceClient, request.correlationId)(request);
6714
- const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
6720
+ const reqCnfString = this.cryptoUtils.base64UrlEncode(JSON.stringify(reqCnf));
6715
6721
  return {
6716
6722
  kid: reqCnf.kid,
6717
6723
  reqCnfString,
6718
- reqCnfHash: await this.cryptoUtils.hashString(reqCnfString),
6719
6724
  };
6720
6725
  }
6721
6726
  /**
@@ -7063,7 +7068,13 @@ class ResponseHandler {
7063
7068
  let refreshOn;
7064
7069
  let familyId = Constants.EMPTY_STRING;
7065
7070
  if (cacheRecord.accessToken) {
7066
- if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
7071
+ /*
7072
+ * if the request object has `popKid` property, `signPopToken` will be set to false and
7073
+ * the token will be returned unsigned
7074
+ */
7075
+ if (cacheRecord.accessToken.tokenType ===
7076
+ AuthenticationScheme.POP &&
7077
+ !request.popKid) {
7067
7078
  const popTokenGenerator = new PopTokenGenerator(cryptoObj);
7068
7079
  const { secret, keyId } = cacheRecord.accessToken;
7069
7080
  if (!keyId) {
@@ -7325,9 +7336,16 @@ class AuthorizationCodeClient extends BaseClient {
7325
7336
  parameterBuilder.addClientInfo();
7326
7337
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7327
7338
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7328
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7339
+ let reqCnfData;
7340
+ if (!request.popKid) {
7341
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7342
+ reqCnfData = generatedReqCnfData.reqCnfString;
7343
+ }
7344
+ else {
7345
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7346
+ }
7329
7347
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7330
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7348
+ parameterBuilder.addPopToken(reqCnfData);
7331
7349
  }
7332
7350
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7333
7351
  if (request.sshJwk) {
@@ -7521,9 +7539,16 @@ class AuthorizationCodeClient extends BaseClient {
7521
7539
  // pass the req_cnf for POP
7522
7540
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7523
7541
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
7524
- // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
7525
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7526
- parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
7542
+ // req_cnf is always sent as a string for SPAs
7543
+ let reqCnfData;
7544
+ if (!request.popKid) {
7545
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7546
+ reqCnfData = generatedReqCnfData.reqCnfString;
7547
+ }
7548
+ else {
7549
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7550
+ }
7551
+ parameterBuilder.addPopToken(reqCnfData);
7527
7552
  }
7528
7553
  }
7529
7554
  return parameterBuilder.createQueryString();
@@ -7729,9 +7754,16 @@ class RefreshTokenClient extends BaseClient {
7729
7754
  }
7730
7755
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7731
7756
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7732
- const reqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7757
+ let reqCnfData;
7758
+ if (!request.popKid) {
7759
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
7760
+ reqCnfData = generatedReqCnfData.reqCnfString;
7761
+ }
7762
+ else {
7763
+ reqCnfData = this.cryptoUtils.encodeKid(request.popKid);
7764
+ }
7733
7765
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
7734
- parameterBuilder.addPopToken(reqCnfData.reqCnfString);
7766
+ parameterBuilder.addPopToken(reqCnfData);
7735
7767
  }
7736
7768
  else if (request.authenticationScheme === AuthenticationScheme.SSH) {
7737
7769
  if (request.sshJwk) {