@azure/msal-common 14.16.0 → 15.0.0-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 (101) 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/broker/nativeBroker/INativeBrokerPlugin.d.ts +1 -0
  17. package/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
  18. package/dist/cache/CacheManager.d.ts +8 -32
  19. package/dist/cache/CacheManager.d.ts.map +1 -1
  20. package/dist/cache/CacheManager.mjs +10 -74
  21. package/dist/cache/CacheManager.mjs.map +1 -1
  22. package/dist/cache/entities/AccountEntity.mjs +1 -1
  23. package/dist/cache/interface/ICacheManager.d.ts +4 -4
  24. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  25. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  26. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  27. package/dist/client/AuthorizationCodeClient.mjs +1 -1
  28. package/dist/client/BaseClient.mjs +1 -1
  29. package/dist/client/RefreshTokenClient.mjs +1 -1
  30. package/dist/client/SilentFlowClient.mjs +1 -1
  31. package/dist/config/ClientConfiguration.mjs +1 -1
  32. package/dist/constants/AADServerParamKeys.mjs +1 -1
  33. package/dist/crypto/ICrypto.mjs +1 -1
  34. package/dist/crypto/JoseHeader.mjs +1 -1
  35. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  36. package/dist/error/AuthError.mjs +1 -1
  37. package/dist/error/AuthErrorCodes.mjs +1 -1
  38. package/dist/error/CacheError.mjs +1 -1
  39. package/dist/error/CacheErrorCodes.mjs +1 -1
  40. package/dist/error/ClientAuthError.mjs +1 -1
  41. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  42. package/dist/error/ClientConfigurationError.mjs +1 -1
  43. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  44. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  45. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  46. package/dist/error/JoseHeaderError.mjs +1 -1
  47. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  48. package/dist/error/NetworkError.mjs +1 -1
  49. package/dist/error/ServerError.mjs +1 -1
  50. package/dist/index-browser.mjs +1 -1
  51. package/dist/index-node.mjs +1 -1
  52. package/dist/index.mjs +1 -1
  53. package/dist/logger/Logger.mjs +1 -1
  54. package/dist/network/INetworkModule.mjs +1 -1
  55. package/dist/network/ThrottlingUtils.mjs +1 -1
  56. package/dist/packageMetadata.d.ts +1 -1
  57. package/dist/packageMetadata.d.ts.map +1 -1
  58. package/dist/packageMetadata.mjs +2 -2
  59. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  60. package/dist/request/RequestParameterBuilder.mjs +1 -1
  61. package/dist/request/RequestValidator.mjs +1 -1
  62. package/dist/request/ScopeSet.mjs +1 -1
  63. package/dist/response/ResponseHandler.mjs +3 -3
  64. package/dist/response/ResponseHandler.mjs.map +1 -1
  65. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  66. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  67. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  68. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  69. package/dist/url/UrlString.mjs +1 -1
  70. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  71. package/dist/utils/Constants.d.ts +0 -6
  72. package/dist/utils/Constants.d.ts.map +1 -1
  73. package/dist/utils/Constants.mjs +1 -7
  74. package/dist/utils/Constants.mjs.map +1 -1
  75. package/dist/utils/FunctionWrappers.mjs +1 -1
  76. package/dist/utils/ProtocolUtils.mjs +1 -1
  77. package/dist/utils/StringUtils.mjs +1 -1
  78. package/dist/utils/TimeUtils.mjs +1 -1
  79. package/dist/utils/UrlUtils.mjs +1 -1
  80. package/lib/index-browser.cjs +2 -2
  81. package/lib/{index-node-C9XsExml.js → index-node-DDJMpU-A.js} +13 -83
  82. package/lib/index-node-DDJMpU-A.js.map +1 -0
  83. package/lib/index-node.cjs +2 -2
  84. package/lib/index.cjs +2 -2
  85. package/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts +1 -0
  86. package/lib/types/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -1
  87. package/lib/types/cache/CacheManager.d.ts +8 -32
  88. package/lib/types/cache/CacheManager.d.ts.map +1 -1
  89. package/lib/types/cache/interface/ICacheManager.d.ts +4 -4
  90. package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
  91. package/lib/types/packageMetadata.d.ts +1 -1
  92. package/lib/types/packageMetadata.d.ts.map +1 -1
  93. package/lib/types/utils/Constants.d.ts +0 -6
  94. package/lib/types/utils/Constants.d.ts.map +1 -1
  95. package/package.json +1 -1
  96. package/src/cache/CacheManager.ts +16 -122
  97. package/src/cache/interface/ICacheManager.ts +4 -4
  98. package/src/packageMetadata.ts +1 -1
  99. package/src/response/ResponseHandler.ts +2 -2
  100. package/src/utils/Constants.ts +0 -6
  101. package/lib/index-node-C9XsExml.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.16.0 2024-11-05 */
1
+ /*! @azure/msal-common v15.0.0-alpha.0 2024-12-18 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -108,12 +108,6 @@ const HeaderNames = {
108
108
  * Persistent cache keys MSAL which stay while user is logged in.
109
109
  */
110
110
  const PersistentCacheKeys = {
111
- ID_TOKEN: "idtoken",
112
- CLIENT_INFO: "client.info",
113
- ADAL_ID_TOKEN: "adal.idtoken",
114
- ERROR: "error",
115
- ERROR_DESC: "error.description",
116
- ACTIVE_ACCOUNT: "active-account",
117
111
  ACTIVE_ACCOUNT_FILTERS: "active-account-filters", // new cache entry for active_account for a more robust version for browser
118
112
  };
119
113
  /**
@@ -3816,7 +3810,7 @@ class Logger {
3816
3810
 
3817
3811
  /* eslint-disable header/header */
3818
3812
  const name = "@azure/msal-common";
3819
- const version = "14.16.0";
3813
+ const version = "15.0.0-alpha.0";
3820
3814
 
3821
3815
  /*
3822
3816
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4601,10 +4595,10 @@ class CacheManager {
4601
4595
  }
4602
4596
  try {
4603
4597
  if (!!cacheRecord.account) {
4604
- this.setAccount(cacheRecord.account);
4598
+ await this.setAccount(cacheRecord.account);
4605
4599
  }
4606
4600
  if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {
4607
- this.setIdTokenCredential(cacheRecord.idToken);
4601
+ await this.setIdTokenCredential(cacheRecord.idToken);
4608
4602
  }
4609
4603
  if (!!cacheRecord.accessToken &&
4610
4604
  storeInCache?.accessToken !== false) {
@@ -4612,7 +4606,7 @@ class CacheManager {
4612
4606
  }
4613
4607
  if (!!cacheRecord.refreshToken &&
4614
4608
  storeInCache?.refreshToken !== false) {
4615
- this.setRefreshTokenCredential(cacheRecord.refreshToken);
4609
+ await this.setRefreshTokenCredential(cacheRecord.refreshToken);
4616
4610
  }
4617
4611
  if (!!cacheRecord.appMetadata) {
4618
4612
  this.setAppMetadata(cacheRecord.appMetadata);
@@ -4669,7 +4663,7 @@ class CacheManager {
4669
4663
  }
4670
4664
  });
4671
4665
  await Promise.all(removedAccessTokens);
4672
- this.setAccessTokenCredential(credential);
4666
+ await this.setAccessTokenCredential(credential);
4673
4667
  }
4674
4668
  /**
4675
4669
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -4955,61 +4949,6 @@ class CacheManager {
4955
4949
  });
4956
4950
  await Promise.all(removedCredentials);
4957
4951
  }
4958
- /**
4959
- * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the
4960
- * cache into a condensed multi-tenant account object with tenant profiles.
4961
- * @param accountKey
4962
- * @param accountEntity
4963
- * @param logger
4964
- * @returns
4965
- */
4966
- updateOutdatedCachedAccount(accountKey, accountEntity, logger) {
4967
- // Only update if account entity is defined and has no tenantProfiles object (is outdated)
4968
- if (accountEntity && accountEntity.isSingleTenant()) {
4969
- this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");
4970
- // Get keys of all accounts belonging to user
4971
- const matchingAccountKeys = this.getAccountKeys().filter((key) => {
4972
- return key.startsWith(accountEntity.homeAccountId);
4973
- });
4974
- // Get all account entities belonging to user
4975
- const accountsToMerge = [];
4976
- matchingAccountKeys.forEach((key) => {
4977
- const account = this.getCachedAccountEntity(key);
4978
- if (account) {
4979
- accountsToMerge.push(account);
4980
- }
4981
- });
4982
- // Set base account to home account if available, any account if not
4983
- const baseAccount = accountsToMerge.find((account) => {
4984
- return tenantIdMatchesHomeTenant(account.realm, account.homeAccountId);
4985
- }) || accountsToMerge[0];
4986
- // Populate tenant profiles built from each account entity belonging to the user
4987
- baseAccount.tenantProfiles = accountsToMerge.map((account) => {
4988
- return {
4989
- tenantId: account.realm,
4990
- localAccountId: account.localAccountId,
4991
- name: account.name,
4992
- isHomeTenant: tenantIdMatchesHomeTenant(account.realm, account.homeAccountId),
4993
- };
4994
- });
4995
- const updatedAccount = CacheManager.toObject(new AccountEntity(), {
4996
- ...baseAccount,
4997
- });
4998
- const newAccountKey = updatedAccount.generateAccountKey();
4999
- // Clear cache of legacy account objects that have been collpsed into tenant profiles
5000
- matchingAccountKeys.forEach((key) => {
5001
- if (key !== newAccountKey) {
5002
- this.removeOutdatedAccount(accountKey);
5003
- }
5004
- });
5005
- // Cache updated account object
5006
- this.setAccount(updatedAccount);
5007
- logger?.verbose("Updated an outdated account entity in the cache");
5008
- return updatedAccount;
5009
- }
5010
- // No update is necessary
5011
- return accountEntity;
5012
- }
5013
4952
  /**
5014
4953
  * returns a boolean if the given credential is removed
5015
4954
  * @param credential
@@ -5605,28 +5544,25 @@ class CacheManager {
5605
5544
  }
5606
5545
  /** @internal */
5607
5546
  class DefaultStorageClass extends CacheManager {
5608
- setAccount() {
5547
+ async setAccount() {
5609
5548
  throw createClientAuthError(methodNotImplemented);
5610
5549
  }
5611
5550
  getAccount() {
5612
5551
  throw createClientAuthError(methodNotImplemented);
5613
5552
  }
5614
- getCachedAccountEntity() {
5615
- throw createClientAuthError(methodNotImplemented);
5616
- }
5617
- setIdTokenCredential() {
5553
+ async setIdTokenCredential() {
5618
5554
  throw createClientAuthError(methodNotImplemented);
5619
5555
  }
5620
5556
  getIdTokenCredential() {
5621
5557
  throw createClientAuthError(methodNotImplemented);
5622
5558
  }
5623
- setAccessTokenCredential() {
5559
+ async setAccessTokenCredential() {
5624
5560
  throw createClientAuthError(methodNotImplemented);
5625
5561
  }
5626
5562
  getAccessTokenCredential() {
5627
5563
  throw createClientAuthError(methodNotImplemented);
5628
5564
  }
5629
- setRefreshTokenCredential() {
5565
+ async setRefreshTokenCredential() {
5630
5566
  throw createClientAuthError(methodNotImplemented);
5631
5567
  }
5632
5568
  getRefreshTokenCredential() {
@@ -5671,12 +5607,6 @@ class DefaultStorageClass extends CacheManager {
5671
5607
  getTokenKeys() {
5672
5608
  throw createClientAuthError(methodNotImplemented);
5673
5609
  }
5674
- updateCredentialCacheKey() {
5675
- throw createClientAuthError(methodNotImplemented);
5676
- }
5677
- removeOutdatedAccount() {
5678
- throw createClientAuthError(methodNotImplemented);
5679
- }
5680
5610
  }
5681
5611
 
5682
5612
  /*
@@ -6992,7 +6922,7 @@ class ResponseHandler {
6992
6922
  !forceCacheRefreshTokenResponse &&
6993
6923
  cacheRecord.account) {
6994
6924
  const key = cacheRecord.account.generateAccountKey();
6995
- const account = this.cacheStorage.getAccount(key, this.logger);
6925
+ const account = this.cacheStorage.getAccount(key);
6996
6926
  if (!account) {
6997
6927
  this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
6998
6928
  return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenClaims, requestStateObj, undefined, serverRequestId);
@@ -7184,7 +7114,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7184
7114
  });
7185
7115
  let cachedAccount = null;
7186
7116
  if (baseAccountKey) {
7187
- cachedAccount = cacheStorage.getAccount(baseAccountKey, logger);
7117
+ cachedAccount = cacheStorage.getAccount(baseAccountKey);
7188
7118
  }
7189
7119
  const baseAccount = cachedAccount ||
7190
7120
  AccountEntity.createAccount({
@@ -8449,4 +8379,4 @@ exports.invokeAsync = invokeAsync;
8449
8379
  exports.tenantIdMatchesHomeTenant = tenantIdMatchesHomeTenant;
8450
8380
  exports.updateAccountTenantProfileData = updateAccountTenantProfileData;
8451
8381
  exports.version = version;
8452
- //# sourceMappingURL=index-node-C9XsExml.js.map
8382
+ //# sourceMappingURL=index-node-DDJMpU-A.js.map