@azure/msal-common 14.13.0 → 14.13.1

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 (86) hide show
  1. package/dist/account/AccountInfo.d.ts +9 -1
  2. package/dist/account/AccountInfo.d.ts.map +1 -1
  3. package/dist/account/AccountInfo.mjs +35 -18
  4. package/dist/account/AccountInfo.mjs.map +1 -1
  5. package/dist/account/AuthToken.mjs +1 -1
  6. package/dist/account/CcsCredential.mjs +1 -1
  7. package/dist/account/ClientInfo.mjs +1 -1
  8. package/dist/account/TokenClaims.mjs +1 -1
  9. package/dist/authority/Authority.mjs +1 -1
  10. package/dist/authority/AuthorityFactory.mjs +1 -1
  11. package/dist/authority/AuthorityMetadata.mjs +1 -1
  12. package/dist/authority/AuthorityOptions.mjs +1 -1
  13. package/dist/authority/AuthorityType.mjs +1 -1
  14. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  15. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  16. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  17. package/dist/authority/ProtocolMode.mjs +1 -1
  18. package/dist/authority/RegionDiscovery.mjs +1 -1
  19. package/dist/cache/CacheManager.d.ts +0 -1
  20. package/dist/cache/CacheManager.d.ts.map +1 -1
  21. package/dist/cache/CacheManager.mjs +2 -5
  22. package/dist/cache/CacheManager.mjs.map +1 -1
  23. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  24. package/dist/cache/entities/AccountEntity.mjs +4 -8
  25. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  26. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  27. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  28. package/dist/client/AuthorizationCodeClient.mjs +1 -1
  29. package/dist/client/BaseClient.mjs +1 -1
  30. package/dist/client/RefreshTokenClient.mjs +1 -1
  31. package/dist/client/SilentFlowClient.mjs +1 -1
  32. package/dist/config/ClientConfiguration.mjs +1 -1
  33. package/dist/constants/AADServerParamKeys.mjs +1 -1
  34. package/dist/crypto/ICrypto.mjs +1 -1
  35. package/dist/crypto/JoseHeader.mjs +1 -1
  36. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  37. package/dist/error/AuthError.mjs +1 -1
  38. package/dist/error/AuthErrorCodes.mjs +1 -1
  39. package/dist/error/CacheError.mjs +1 -1
  40. package/dist/error/CacheErrorCodes.mjs +1 -1
  41. package/dist/error/ClientAuthError.mjs +1 -1
  42. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  43. package/dist/error/ClientConfigurationError.mjs +1 -1
  44. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  45. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  46. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  47. package/dist/error/JoseHeaderError.mjs +1 -1
  48. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  49. package/dist/error/ServerError.mjs +1 -1
  50. package/dist/index.cjs +43 -33
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.mjs +2 -2
  55. package/dist/logger/Logger.mjs +1 -1
  56. package/dist/network/INetworkModule.mjs +1 -1
  57. package/dist/network/NetworkManager.mjs +1 -1
  58. package/dist/network/ThrottlingUtils.mjs +1 -1
  59. package/dist/packageMetadata.d.ts +1 -1
  60. package/dist/packageMetadata.mjs +2 -2
  61. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  62. package/dist/request/RequestParameterBuilder.mjs +1 -1
  63. package/dist/request/RequestValidator.mjs +1 -1
  64. package/dist/request/ScopeSet.mjs +1 -1
  65. package/dist/response/ResponseHandler.d.ts.map +1 -1
  66. package/dist/response/ResponseHandler.mjs +6 -6
  67. package/dist/response/ResponseHandler.mjs.map +1 -1
  68. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  69. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  70. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  71. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  72. package/dist/url/UrlString.mjs +1 -1
  73. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  74. package/dist/utils/Constants.mjs +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/package.json +1 -1
  81. package/src/account/AccountInfo.ts +37 -17
  82. package/src/cache/CacheManager.ts +2 -12
  83. package/src/cache/entities/AccountEntity.ts +8 -10
  84. package/src/index.ts +1 -1
  85. package/src/packageMetadata.ts +1 -1
  86. package/src/response/ResponseHandler.ts +7 -6
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  import { Constants } from '../utils/Constants.mjs';
4
4
  import { unexpectedError, postRequestFailed } from './AuthErrorCodes.mjs';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  import { cacheUnknownErrorCode, cacheQuotaExceededErrorCode } from './CacheErrorCodes.mjs';
4
4
  import * as CacheErrorCodes from './CacheErrorCodes.mjs';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
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.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
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';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  import { Constants } from '../utils/Constants.mjs';
4
4
  import { AuthError } from './AuthError.mjs';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  import { AuthError } from './AuthError.mjs';
4
4
  import { missingKidError, missingAlgError } from './JoseHeaderErrorCodes.mjs';
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
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.13.0 2024-07-01 */
1
+ /*! @azure/msal-common v14.13.1 2024-07-16 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -3826,7 +3826,7 @@ class Logger {
3826
3826
 
3827
3827
  /* eslint-disable header/header */
3828
3828
  const name = "@azure/msal-common";
3829
- const version = "14.13.0";
3829
+ const version = "14.13.1";
3830
3830
 
3831
3831
  /*
3832
3832
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4079,21 +4079,38 @@ function tenantIdMatchesHomeTenant(tenantId, homeAccountId) {
4079
4079
  !!homeAccountId &&
4080
4080
  tenantId === homeAccountId.split(".")[1]);
4081
4081
  }
4082
- function buildTenantProfileFromIdTokenClaims(homeAccountId, idTokenClaims) {
4083
- const { oid, sub, tid, name, tfp, acr } = idTokenClaims;
4084
- /**
4085
- * Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence:
4086
- * tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens.
4087
- * tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios.
4088
- * acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway.
4089
- */
4090
- const tenantId = tid || tfp || acr || "";
4091
- return {
4092
- tenantId: tenantId,
4093
- localAccountId: oid || sub || "",
4094
- name: name,
4095
- isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
4096
- };
4082
+ /**
4083
+ * Build tenant profile
4084
+ * @param homeAccountId - Home account identifier for this account object
4085
+ * @param localAccountId - Local account identifer for this account object
4086
+ * @param tenantId - Full tenant or organizational id that this account belongs to
4087
+ * @param idTokenClaims - Claims from the ID token
4088
+ * @returns
4089
+ */
4090
+ function buildTenantProfile(homeAccountId, localAccountId, tenantId, idTokenClaims) {
4091
+ if (idTokenClaims) {
4092
+ const { oid, sub, tid, name, tfp, acr } = idTokenClaims;
4093
+ /**
4094
+ * Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence:
4095
+ * tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens.
4096
+ * tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios.
4097
+ * acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway.
4098
+ */
4099
+ const tenantId = tid || tfp || acr || "";
4100
+ return {
4101
+ tenantId: tenantId,
4102
+ localAccountId: oid || sub || "",
4103
+ name: name,
4104
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
4105
+ };
4106
+ }
4107
+ else {
4108
+ return {
4109
+ tenantId,
4110
+ localAccountId,
4111
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
4112
+ };
4113
+ }
4097
4114
  }
4098
4115
  /**
4099
4116
  * Replaces account info that varies by tenant profile sourced from the ID token claims passed in with the tenant-specific account info
@@ -4113,7 +4130,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
4113
4130
  if (idTokenClaims) {
4114
4131
  // Ignore isHomeTenant, loginHint, and sid which are part of tenant profile but not base account info
4115
4132
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
4116
- const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfileFromIdTokenClaims(baseAccountInfo.homeAccountId, idTokenClaims);
4133
+ const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, idTokenClaims);
4117
4134
  updatedAccountInfo = {
4118
4135
  ...updatedAccountInfo,
4119
4136
  ...claimsSourcedTenantProfile,
@@ -4288,12 +4305,8 @@ class AccountEntity {
4288
4305
  account.tenantProfiles = accountDetails.tenantProfiles;
4289
4306
  }
4290
4307
  else {
4291
- const tenantProfiles = [];
4292
- if (accountDetails.idTokenClaims) {
4293
- const tenantProfile = buildTenantProfileFromIdTokenClaims(accountDetails.homeAccountId, accountDetails.idTokenClaims);
4294
- tenantProfiles.push(tenantProfile);
4295
- }
4296
- account.tenantProfiles = tenantProfiles;
4308
+ const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, account.localAccountId, account.realm, accountDetails.idTokenClaims);
4309
+ account.tenantProfiles = [tenantProfile];
4297
4310
  }
4298
4311
  return account;
4299
4312
  }
@@ -4495,12 +4508,9 @@ class CacheManager {
4495
4508
  */
4496
4509
  buildTenantProfiles(cachedAccounts, accountFilter) {
4497
4510
  return cachedAccounts.flatMap((accountEntity) => {
4498
- return this.getAccountInfoForTenantProfiles(accountEntity, accountFilter);
4511
+ return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);
4499
4512
  });
4500
4513
  }
4501
- getAccountInfoForTenantProfiles(accountEntity, accountFilter) {
4502
- return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);
4503
- }
4504
4514
  getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter) {
4505
4515
  let tenantedAccountInfo = null;
4506
4516
  let idTokenClaims;
@@ -7136,12 +7146,12 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
7136
7146
  nativeAccountId: nativeAccountId,
7137
7147
  }, authority, base64Decode);
7138
7148
  const tenantProfiles = baseAccount.tenantProfiles || [];
7139
- if (claimsTenantId &&
7140
- idTokenClaims &&
7149
+ const tenantId = claimsTenantId || baseAccount.realm;
7150
+ if (tenantId &&
7141
7151
  !tenantProfiles.find((tenantProfile) => {
7142
- return tenantProfile.tenantId === claimsTenantId;
7152
+ return tenantProfile.tenantId === tenantId;
7143
7153
  })) {
7144
- const newTenantProfile = buildTenantProfileFromIdTokenClaims(homeAccountId, idTokenClaims);
7154
+ const newTenantProfile = buildTenantProfile(homeAccountId, baseAccount.localAccountId, tenantId, idTokenClaims);
7145
7155
  tenantProfiles.push(newTenantProfile);
7146
7156
  }
7147
7157
  baseAccount.tenantProfiles = tenantProfiles;
@@ -9003,7 +9013,7 @@ exports.buildAccountToCache = buildAccountToCache;
9003
9013
  exports.buildClientInfo = buildClientInfo;
9004
9014
  exports.buildClientInfoFromHomeAccountId = buildClientInfoFromHomeAccountId;
9005
9015
  exports.buildStaticAuthorityOptions = buildStaticAuthorityOptions;
9006
- exports.buildTenantProfileFromIdTokenClaims = buildTenantProfileFromIdTokenClaims;
9016
+ exports.buildTenantProfile = buildTenantProfile;
9007
9017
  exports.createAuthError = createAuthError;
9008
9018
  exports.createClientAuthError = createClientAuthError;
9009
9019
  exports.createClientConfigurationError = createClientConfigurationError;