@azure/msal-node 5.1.3 → 5.1.5

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 (80) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/NodeStorage.d.ts +1 -1
  3. package/dist/cache/NodeStorage.d.ts.map +1 -1
  4. package/dist/cache/NodeStorage.mjs +5 -2
  5. package/dist/cache/NodeStorage.mjs.map +1 -1
  6. package/dist/cache/TokenCache.mjs +1 -1
  7. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  8. package/dist/cache/serializer/Deserializer.mjs +1 -1
  9. package/dist/cache/serializer/Serializer.mjs +1 -1
  10. package/dist/client/BaseClient.mjs +1 -1
  11. package/dist/client/ClientApplication.d.ts +1 -1
  12. package/dist/client/ClientApplication.mjs +2 -2
  13. package/dist/client/ClientAssertion.mjs +1 -1
  14. package/dist/client/ClientCredentialClient.mjs +1 -1
  15. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  16. package/dist/client/DeviceCodeClient.mjs +1 -1
  17. package/dist/client/IConfidentialClientApplication.d.ts +1 -1
  18. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
  19. package/dist/client/IPublicClientApplication.d.ts +1 -1
  20. package/dist/client/IPublicClientApplication.d.ts.map +1 -1
  21. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  22. package/dist/client/ManagedIdentityClient.mjs +1 -1
  23. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  24. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  25. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  26. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  27. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  28. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  29. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  30. package/dist/client/OnBehalfOfClient.mjs +1 -1
  31. package/dist/client/PublicClientApplication.mjs +1 -1
  32. package/dist/client/UsernamePasswordClient.mjs +1 -1
  33. package/dist/config/Configuration.mjs +1 -1
  34. package/dist/config/ManagedIdentityId.mjs +1 -1
  35. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  36. package/dist/crypto/CryptoProvider.mjs +1 -1
  37. package/dist/crypto/GuidGenerator.d.ts +2 -3
  38. package/dist/crypto/GuidGenerator.d.ts.map +1 -1
  39. package/dist/crypto/GuidGenerator.mjs +5 -6
  40. package/dist/crypto/GuidGenerator.mjs.map +1 -1
  41. package/dist/crypto/HashUtils.mjs +1 -1
  42. package/dist/crypto/PkceGenerator.mjs +1 -1
  43. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  44. package/dist/error/ManagedIdentityError.mjs +1 -1
  45. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  46. package/dist/error/NodeAuthError.mjs +1 -1
  47. package/dist/index.mjs +1 -1
  48. package/dist/internals.mjs +1 -1
  49. package/dist/network/HttpClient.mjs +1 -1
  50. package/dist/network/HttpClientWithRetries.mjs +1 -1
  51. package/dist/network/LoopbackClient.mjs +1 -1
  52. package/dist/packageMetadata.d.ts +1 -1
  53. package/dist/packageMetadata.mjs +2 -2
  54. package/dist/protocol/Authorize.mjs +1 -1
  55. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  56. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  57. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  58. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  59. package/dist/utils/Constants.mjs +1 -1
  60. package/dist/utils/EncodingUtils.mjs +1 -1
  61. package/dist/utils/TimeUtils.mjs +1 -1
  62. package/lib/msal-node.cjs +114 -81
  63. package/lib/msal-node.cjs.map +1 -1
  64. package/lib/types/cache/NodeStorage.d.ts +1 -1
  65. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  66. package/lib/types/client/ClientApplication.d.ts +1 -1
  67. package/lib/types/client/IConfidentialClientApplication.d.ts +1 -1
  68. package/lib/types/client/IConfidentialClientApplication.d.ts.map +1 -1
  69. package/lib/types/client/IPublicClientApplication.d.ts +1 -1
  70. package/lib/types/client/IPublicClientApplication.d.ts.map +1 -1
  71. package/lib/types/crypto/GuidGenerator.d.ts +2 -3
  72. package/lib/types/crypto/GuidGenerator.d.ts.map +1 -1
  73. package/lib/types/packageMetadata.d.ts +1 -1
  74. package/package.json +3 -5
  75. package/src/cache/NodeStorage.ts +4 -1
  76. package/src/client/ClientApplication.ts +1 -1
  77. package/src/client/IConfidentialClientApplication.ts +1 -1
  78. package/src/client/IPublicClientApplication.ts +1 -1
  79. package/src/crypto/GuidGenerator.ts +4 -5
  80. package/src/packageMetadata.ts +1 -1
package/lib/msal-node.cjs CHANGED
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-node v5.1.3 2026-04-16 */
1
+ /*! @azure/msal-node v5.1.5 2026-04-28 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- var uuid = require('uuid');
5
+ var node_crypto = require('node:crypto');
6
6
  var crypto = require('crypto');
7
7
  var jwt = require('jsonwebtoken');
8
8
  var http = require('http');
@@ -150,7 +150,7 @@ class Serializer {
150
150
  }
151
151
  }
152
152
 
153
- /*! @azure/msal-common v16.5.0 2026-04-16 */
153
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
154
154
  /*
155
155
  * Copyright (c) Microsoft Corporation. All rights reserved.
156
156
  * Licensed under the MIT License.
@@ -398,7 +398,7 @@ const EncodingTypes = {
398
398
  UTF8: "utf-8",
399
399
  };
400
400
 
401
- /*! @azure/msal-common v16.5.0 2026-04-16 */
401
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
402
402
  /*
403
403
  * Copyright (c) Microsoft Corporation. All rights reserved.
404
404
  * Licensed under the MIT License.
@@ -451,7 +451,7 @@ const INSTANCE_AWARE = "instance_aware";
451
451
  const RESOURCE = "resource";
452
452
  const CLI_DATA = "clidata";
453
453
 
454
- /*! @azure/msal-common v16.5.0 2026-04-16 */
454
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
455
455
  /*
456
456
  * Copyright (c) Microsoft Corporation. All rights reserved.
457
457
  * Licensed under the MIT License.
@@ -482,7 +482,7 @@ function createAuthError(code, additionalMessage) {
482
482
  return new AuthError(code, additionalMessage || getDefaultErrorMessage(code));
483
483
  }
484
484
 
485
- /*! @azure/msal-common v16.5.0 2026-04-16 */
485
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
486
486
 
487
487
  /*
488
488
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -502,7 +502,7 @@ function createClientConfigurationError(errorCode) {
502
502
  return new ClientConfigurationError(errorCode);
503
503
  }
504
504
 
505
- /*! @azure/msal-common v16.5.0 2026-04-16 */
505
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
506
506
  /*
507
507
  * Copyright (c) Microsoft Corporation. All rights reserved.
508
508
  * Licensed under the MIT License.
@@ -582,7 +582,7 @@ class StringUtils {
582
582
  }
583
583
  }
584
584
 
585
- /*! @azure/msal-common v16.5.0 2026-04-16 */
585
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
586
586
 
587
587
  /*
588
588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -605,7 +605,7 @@ function createClientAuthError(errorCode, additionalMessage) {
605
605
  return new ClientAuthError(errorCode, additionalMessage);
606
606
  }
607
607
 
608
- /*! @azure/msal-common v16.5.0 2026-04-16 */
608
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
609
609
  /*
610
610
  * Copyright (c) Microsoft Corporation. All rights reserved.
611
611
  * Licensed under the MIT License.
@@ -659,7 +659,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
659
659
  urlParseError: urlParseError
660
660
  });
661
661
 
662
- /*! @azure/msal-common v16.5.0 2026-04-16 */
662
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
663
663
  /*
664
664
  * Copyright (c) Microsoft Corporation. All rights reserved.
665
665
  * Licensed under the MIT License.
@@ -747,7 +747,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
747
747
  userCanceled: userCanceled
748
748
  });
749
749
 
750
- /*! @azure/msal-common v16.5.0 2026-04-16 */
750
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
751
751
 
752
752
  /*
753
753
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -942,7 +942,7 @@ class ScopeSet {
942
942
  }
943
943
  }
944
944
 
945
- /*! @azure/msal-common v16.5.0 2026-04-16 */
945
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
946
946
 
947
947
  /*
948
948
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1349,7 +1349,7 @@ function addResource(parameters, resource) {
1349
1349
  }
1350
1350
  }
1351
1351
 
1352
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1352
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1353
1353
  /**
1354
1354
  * Parses hash string from given string. Returns empty string if no hash symbol is found.
1355
1355
  * @param hashString
@@ -1402,7 +1402,7 @@ function mapToQueryString(parameters) {
1402
1402
  return queryParameterArray.join("&");
1403
1403
  }
1404
1404
 
1405
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1405
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1406
1406
 
1407
1407
  /*
1408
1408
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1441,7 +1441,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
1441
1441
  },
1442
1442
  };
1443
1443
 
1444
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1444
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1445
1445
  /*
1446
1446
  * Copyright (c) Microsoft Corporation. All rights reserved.
1447
1447
  * Licensed under the MIT License.
@@ -1702,12 +1702,12 @@ class Logger {
1702
1702
  }
1703
1703
  }
1704
1704
 
1705
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1705
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1706
1706
  /* eslint-disable header/header */
1707
1707
  const name$1 = "@azure/msal-common";
1708
- const version$1 = "16.5.0";
1708
+ const version$1 = "16.5.2";
1709
1709
 
1710
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1710
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1711
1711
  /*
1712
1712
  * Copyright (c) Microsoft Corporation. All rights reserved.
1713
1713
  * Licensed under the MIT License.
@@ -1727,7 +1727,7 @@ const AzureCloudInstance = {
1727
1727
  AzureUsGovernment: "https://login.microsoftonline.us",
1728
1728
  };
1729
1729
 
1730
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1730
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1731
1731
  /*
1732
1732
  * Copyright (c) Microsoft Corporation. All rights reserved.
1733
1733
  * Licensed under the MIT License.
@@ -1768,6 +1768,7 @@ function buildTenantProfile(homeAccountId, localAccountId, tenantId, idTokenClai
1768
1768
  username: preferred_username || upn || "",
1769
1769
  loginHint: login_hint,
1770
1770
  isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
1771
+ upn: upn,
1771
1772
  };
1772
1773
  }
1773
1774
  else {
@@ -1795,7 +1796,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1795
1796
  }
1796
1797
  // ID token claims override passed in account info and tenant profile
1797
1798
  if (idTokenClaims) {
1798
- // Ignore isHomeTenant, loginHint, and sid which are part of tenant profile but not base account info
1799
+ // Ignore isHomeTenant which is a utility property of tenant profile but not required in base account info
1799
1800
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1800
1801
  const { isHomeTenant, ...claimsSourcedTenantProfile } = buildTenantProfile(baseAccountInfo.homeAccountId, baseAccountInfo.localAccountId, baseAccountInfo.tenantId, idTokenClaims);
1801
1802
  updatedAccountInfo = {
@@ -1809,7 +1810,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
1809
1810
  return updatedAccountInfo;
1810
1811
  }
1811
1812
 
1812
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1813
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1813
1814
 
1814
1815
  /*
1815
1816
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1889,7 +1890,7 @@ function checkMaxAge(authTime, maxAge) {
1889
1890
  }
1890
1891
  }
1891
1892
 
1892
- /*! @azure/msal-common v16.5.0 2026-04-16 */
1893
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
1893
1894
 
1894
1895
  /*
1895
1896
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2046,7 +2047,7 @@ class UrlString {
2046
2047
  }
2047
2048
  }
2048
2049
 
2049
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2050
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2050
2051
 
2051
2052
  /*
2052
2053
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2203,7 +2204,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2203
2204
  return null;
2204
2205
  }
2205
2206
 
2206
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2207
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2207
2208
  /*
2208
2209
  * Copyright (c) Microsoft Corporation. All rights reserved.
2209
2210
  * Licensed under the MIT License.
@@ -2211,7 +2212,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2211
2212
  const cacheQuotaExceeded = "cache_quota_exceeded";
2212
2213
  const cacheErrorUnknown = "cache_error_unknown";
2213
2214
 
2214
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2215
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2215
2216
 
2216
2217
  /*
2217
2218
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2249,7 +2250,7 @@ function createCacheError(e) {
2249
2250
  }
2250
2251
  }
2251
2252
 
2252
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2253
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2253
2254
 
2254
2255
  /*
2255
2256
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2287,7 +2288,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2287
2288
  };
2288
2289
  }
2289
2290
 
2290
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2291
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2291
2292
  /*
2292
2293
  * Copyright (c) Microsoft Corporation. All rights reserved.
2293
2294
  * Licensed under the MIT License.
@@ -2302,7 +2303,7 @@ const AuthorityType = {
2302
2303
  Ciam: 3,
2303
2304
  };
2304
2305
 
2305
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2306
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2306
2307
  /*
2307
2308
  * Copyright (c) Microsoft Corporation. All rights reserved.
2308
2309
  * Licensed under the MIT License.
@@ -2324,7 +2325,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2324
2325
  return null;
2325
2326
  }
2326
2327
 
2327
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2328
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2328
2329
  /*
2329
2330
  * Copyright (c) Microsoft Corporation. All rights reserved.
2330
2331
  * Licensed under the MIT License.
@@ -2348,7 +2349,7 @@ const ProtocolMode = {
2348
2349
  EAR: "EAR",
2349
2350
  };
2350
2351
 
2351
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2352
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2352
2353
  /**
2353
2354
  * Returns the AccountInfo interface for this account.
2354
2355
  */
@@ -2491,7 +2492,7 @@ function isAccountEntity(entity) {
2491
2492
  entity.hasOwnProperty("authorityType"));
2492
2493
  }
2493
2494
 
2494
- /*! @azure/msal-common v16.5.0 2026-04-16 */
2495
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
2495
2496
 
2496
2497
  /*
2497
2498
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2529,8 +2530,10 @@ class CacheManager {
2529
2530
  const allAccounts = this.getAllAccounts(accountFilter, correlationId);
2530
2531
  if (allAccounts.length > 1) {
2531
2532
  // If one or more accounts are found, prioritize accounts that have an ID token
2532
- const sortedAccounts = allAccounts.sort((account) => {
2533
- return account.idTokenClaims ? -1 : 1;
2533
+ const sortedAccounts = allAccounts.sort((a, b) => {
2534
+ const aHasClaims = a.idTokenClaims ? 1 : 0;
2535
+ const bHasClaims = b.idTokenClaims ? 1 : 0;
2536
+ return bHasClaims - aHasClaims;
2534
2537
  });
2535
2538
  return sortedAccounts[0];
2536
2539
  }
@@ -2628,6 +2631,19 @@ class CacheManager {
2628
2631
  !(tenantProfile.isHomeTenant === tenantProfileFilter.isHomeTenant)) {
2629
2632
  return false;
2630
2633
  }
2634
+ if (!!tenantProfileFilter.username &&
2635
+ !(this.matchUsername(tenantProfile.username, tenantProfileFilter.username) ||
2636
+ !this.matchUsername(tenantProfile.upn, tenantProfileFilter.username))) {
2637
+ return false;
2638
+ }
2639
+ if (!!tenantProfileFilter.loginHint &&
2640
+ !this.matchLoginHintWithTenantProfile(tenantProfile, tenantProfileFilter.loginHint)) {
2641
+ return false;
2642
+ }
2643
+ if (!!tenantProfileFilter.upn &&
2644
+ !(tenantProfile.upn === tenantProfileFilter.upn)) {
2645
+ return false;
2646
+ }
2631
2647
  return true;
2632
2648
  }
2633
2649
  idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter) {
@@ -2642,7 +2658,8 @@ class CacheManager {
2642
2658
  return false;
2643
2659
  }
2644
2660
  if (!!tenantProfileFilter.username &&
2645
- !this.matchUsername(idTokenClaims.preferred_username, tenantProfileFilter.username)) {
2661
+ !this.matchUsername(idTokenClaims.preferred_username, tenantProfileFilter.username) &&
2662
+ !this.matchUsername(idTokenClaims.upn, tenantProfileFilter.username)) {
2646
2663
  return false;
2647
2664
  }
2648
2665
  if (!!tenantProfileFilter.name &&
@@ -2743,10 +2760,6 @@ class CacheManager {
2743
2760
  !this.matchHomeAccountId(entity, accountFilter.homeAccountId)) {
2744
2761
  return;
2745
2762
  }
2746
- if (!!accountFilter.username &&
2747
- !this.matchUsername(entity.username, accountFilter.username)) {
2748
- return;
2749
- }
2750
2763
  if (!!accountFilter.environment &&
2751
2764
  !this.matchEnvironment(entity, accountFilter.environment, correlationId)) {
2752
2765
  return;
@@ -2767,6 +2780,9 @@ class CacheManager {
2767
2780
  const tenantProfileFilter = {
2768
2781
  localAccountId: accountFilter?.localAccountId,
2769
2782
  name: accountFilter?.name,
2783
+ username: accountFilter?.username,
2784
+ loginHint: accountFilter?.loginHint,
2785
+ upn: accountFilter?.upn,
2770
2786
  };
2771
2787
  const matchingTenantProfiles = entity.tenantProfiles?.filter((tenantProfile) => {
2772
2788
  return this.tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter);
@@ -3017,11 +3033,11 @@ class CacheManager {
3017
3033
  const numHomeIdTokens = homeIdTokenMap.size;
3018
3034
  if (numHomeIdTokens < 1) {
3019
3035
  this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result", correlationId);
3020
- return idTokenMap.values().next().value;
3036
+ return idTokenMap.values().next().value ?? null;
3021
3037
  }
3022
3038
  else if (numHomeIdTokens === 1) {
3023
3039
  this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile", correlationId);
3024
- return homeIdTokenMap.values().next().value;
3040
+ return homeIdTokenMap.values().next().value ?? null;
3025
3041
  }
3026
3042
  else {
3027
3043
  // Multiple ID tokens for home tenant profile, remove all and return null
@@ -3037,7 +3053,7 @@ class CacheManager {
3037
3053
  return null;
3038
3054
  }
3039
3055
  this.commonLogger.info("CacheManager:getIdToken - Returning ID token", correlationId);
3040
- return idTokenMap.values().next().value;
3056
+ return idTokenMap.values().next().value ?? null;
3041
3057
  }
3042
3058
  /**
3043
3059
  * Gets all idTokens matching the given filter
@@ -3349,6 +3365,17 @@ class CacheManager {
3349
3365
  typeof cachedUsername === "string" &&
3350
3366
  filterUsername?.toLowerCase() === cachedUsername.toLowerCase());
3351
3367
  }
3368
+ /**
3369
+ * helper to match loginhints
3370
+ * @param entity
3371
+ * @param loginHint
3372
+ * @returns
3373
+ */
3374
+ matchLoginHintWithTenantProfile(tenantProfile, loginHintFilter) {
3375
+ return (tenantProfile.loginHint === loginHintFilter ||
3376
+ tenantProfile.username === loginHintFilter ||
3377
+ tenantProfile.upn === loginHintFilter);
3378
+ }
3352
3379
  /**
3353
3380
  * helper to match assertion
3354
3381
  * @param value
@@ -3441,6 +3468,10 @@ class CacheManager {
3441
3468
  if (tokenClaims.upn === loginHint) {
3442
3469
  return true;
3443
3470
  }
3471
+ // check login hint against list of emails in token claims
3472
+ if (tokenClaims.emails && tokenClaims.emails.includes(loginHint)) {
3473
+ return true;
3474
+ }
3444
3475
  return false;
3445
3476
  }
3446
3477
  /**
@@ -3592,7 +3623,7 @@ class DefaultStorageClass extends CacheManager {
3592
3623
  }
3593
3624
  }
3594
3625
 
3595
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3626
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3596
3627
  /*
3597
3628
  * Copyright (c) Microsoft Corporation. All rights reserved.
3598
3629
  * Licensed under the MIT License.
@@ -3606,7 +3637,7 @@ class DefaultStorageClass extends CacheManager {
3606
3637
  const PerformanceEventStatus = {
3607
3638
  InProgress: 1};
3608
3639
 
3609
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3640
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3610
3641
 
3611
3642
  /*
3612
3643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3661,7 +3692,7 @@ class StubPerformanceClient {
3661
3692
  }
3662
3693
  }
3663
3694
 
3664
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3695
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3665
3696
 
3666
3697
  /*
3667
3698
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3756,7 +3787,7 @@ function isOidcProtocolMode(config) {
3756
3787
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
3757
3788
  }
3758
3789
 
3759
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3790
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3760
3791
  /*
3761
3792
  * Copyright (c) Microsoft Corporation. All rights reserved.
3762
3793
  * Licensed under the MIT License.
@@ -3783,7 +3814,7 @@ function isOidcProtocolMode(config) {
3783
3814
  }
3784
3815
  }
3785
3816
 
3786
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3817
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3787
3818
  /*
3788
3819
  * Copyright (c) Microsoft Corporation. All rights reserved.
3789
3820
  * Licensed under the MIT License.
@@ -3838,7 +3869,7 @@ function delay(t, value) {
3838
3869
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
3839
3870
  }
3840
3871
 
3841
- /*! @azure/msal-common v16.5.0 2026-04-16 */
3872
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
3842
3873
 
3843
3874
  /*
3844
3875
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4097,7 +4128,7 @@ function isAuthorityMetadataExpired(metadata) {
4097
4128
  return metadata.expiresAt <= nowSeconds();
4098
4129
  }
4099
4130
 
4100
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4131
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4101
4132
  /*
4102
4133
  * Copyright (c) Microsoft Corporation. All rights reserved.
4103
4134
  * Licensed under the MIT License.
@@ -4159,7 +4190,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
4159
4190
  */
4160
4191
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
4161
4192
 
4162
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4193
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4163
4194
  /*
4164
4195
  * Copyright (c) Microsoft Corporation. All rights reserved.
4165
4196
  * Licensed under the MIT License.
@@ -4252,7 +4283,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4252
4283
  };
4253
4284
  };
4254
4285
 
4255
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4286
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4256
4287
 
4257
4288
  /*
4258
4289
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4332,7 +4363,7 @@ class PopTokenGenerator {
4332
4363
  }
4333
4364
  }
4334
4365
 
4335
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4366
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4336
4367
  /*
4337
4368
  * Copyright (c) Microsoft Corporation. All rights reserved.
4338
4369
  * Licensed under the MIT License.
@@ -4396,7 +4427,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
4396
4427
  uxNotAllowed: uxNotAllowed
4397
4428
  });
4398
4429
 
4399
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4430
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4400
4431
 
4401
4432
  /*
4402
4433
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4464,7 +4495,7 @@ function createInteractionRequiredAuthError(errorCode, errorMessage) {
4464
4495
  return new InteractionRequiredAuthError(errorCode, errorMessage);
4465
4496
  }
4466
4497
 
4467
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4498
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4468
4499
 
4469
4500
  /*
4470
4501
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4483,7 +4514,7 @@ class ServerError extends AuthError {
4483
4514
  }
4484
4515
  }
4485
4516
 
4486
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4517
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4487
4518
  /**
4488
4519
  * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.
4489
4520
  * @param base64Decode
@@ -4515,7 +4546,7 @@ function parseRequestState(base64Decode, state) {
4515
4546
  }
4516
4547
  }
4517
4548
 
4518
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4549
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4519
4550
 
4520
4551
  /*
4521
4552
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4863,7 +4894,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
4863
4894
  return baseAccount;
4864
4895
  }
4865
4896
 
4866
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4897
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4867
4898
  /*
4868
4899
  * Copyright (c) Microsoft Corporation. All rights reserved.
4869
4900
  * Licensed under the MIT License.
@@ -4873,7 +4904,7 @@ const CcsCredentialType = {
4873
4904
  UPN: "UPN",
4874
4905
  };
4875
4906
 
4876
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4907
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4877
4908
  /*
4878
4909
  * Copyright (c) Microsoft Corporation. All rights reserved.
4879
4910
  * Licensed under the MIT License.
@@ -4891,7 +4922,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
4891
4922
  }
4892
4923
  }
4893
4924
 
4894
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4925
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4895
4926
  /*
4896
4927
  * Copyright (c) Microsoft Corporation. All rights reserved.
4897
4928
  * Licensed under the MIT License.
@@ -4912,7 +4943,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
4912
4943
  };
4913
4944
  }
4914
4945
 
4915
- /*! @azure/msal-common v16.5.0 2026-04-16 */
4946
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
4916
4947
 
4917
4948
  /*
4918
4949
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4998,7 +5029,7 @@ class ThrottlingUtils {
4998
5029
  }
4999
5030
  }
5000
5031
 
5001
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5032
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5002
5033
 
5003
5034
  /*
5004
5035
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5029,7 +5060,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
5029
5060
  return new NetworkError(error, httpStatus, responseHeaders);
5030
5061
  }
5031
5062
 
5032
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5063
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5033
5064
 
5034
5065
  /*
5035
5066
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5143,7 +5174,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
5143
5174
  return response;
5144
5175
  }
5145
5176
 
5146
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5177
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5147
5178
  /*
5148
5179
  * Copyright (c) Microsoft Corporation. All rights reserved.
5149
5180
  * Licensed under the MIT License.
@@ -5155,7 +5186,7 @@ function isOpenIdConfigResponse(response) {
5155
5186
  response.hasOwnProperty("jwks_uri"));
5156
5187
  }
5157
5188
 
5158
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5189
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5159
5190
  /*
5160
5191
  * Copyright (c) Microsoft Corporation. All rights reserved.
5161
5192
  * Licensed under the MIT License.
@@ -5165,7 +5196,7 @@ function isCloudInstanceDiscoveryResponse(response) {
5165
5196
  response.hasOwnProperty("metadata"));
5166
5197
  }
5167
5198
 
5168
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5199
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5169
5200
  /*
5170
5201
  * Copyright (c) Microsoft Corporation. All rights reserved.
5171
5202
  * Licensed under the MIT License.
@@ -5175,7 +5206,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
5175
5206
  response.hasOwnProperty("error_description"));
5176
5207
  }
5177
5208
 
5178
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5209
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5179
5210
 
5180
5211
  /*
5181
5212
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5280,7 +5311,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5280
5311
  },
5281
5312
  };
5282
5313
 
5283
- /*! @azure/msal-common v16.5.0 2026-04-16 */
5314
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
5284
5315
 
5285
5316
  /*
5286
5317
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6103,7 +6134,7 @@ function buildStaticAuthorityOptions(authOptions) {
6103
6134
  };
6104
6135
  }
6105
6136
 
6106
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6137
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6107
6138
 
6108
6139
  /*
6109
6140
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6137,7 +6168,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
6137
6168
  }
6138
6169
  }
6139
6170
 
6140
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6171
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6141
6172
 
6142
6173
  /*
6143
6174
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6394,7 +6425,7 @@ class AuthorizationCodeClient {
6394
6425
  }
6395
6426
  }
6396
6427
 
6397
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6428
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6398
6429
 
6399
6430
  /*
6400
6431
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6615,7 +6646,7 @@ class RefreshTokenClient {
6615
6646
  }
6616
6647
  }
6617
6648
 
6618
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6649
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6619
6650
 
6620
6651
  /*
6621
6652
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6731,7 +6762,7 @@ class SilentFlowClient {
6731
6762
  }
6732
6763
  }
6733
6764
 
6734
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6765
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6735
6766
 
6736
6767
  /*
6737
6768
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6880,7 +6911,7 @@ function extractLoginHint(account) {
6880
6911
  return account.loginHint || account.idTokenClaims?.login_hint || null;
6881
6912
  }
6882
6913
 
6883
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6914
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6884
6915
 
6885
6916
  /*
6886
6917
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6913,7 +6944,7 @@ function containsResourceParam(params) {
6913
6944
  return Object.prototype.hasOwnProperty.call(params, "resource");
6914
6945
  }
6915
6946
 
6916
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6947
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6917
6948
  /*
6918
6949
  * Copyright (c) Microsoft Corporation. All rights reserved.
6919
6950
  * Licensed under the MIT License.
@@ -6930,7 +6961,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
6930
6961
  unexpectedError: unexpectedError
6931
6962
  });
6932
6963
 
6933
- /*! @azure/msal-common v16.5.0 2026-04-16 */
6964
+ /*! @azure/msal-common v16.5.2 2026-04-28 */
6934
6965
 
6935
6966
  /*
6936
6967
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8013,12 +8044,11 @@ function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentity
8013
8044
  */
8014
8045
  class GuidGenerator {
8015
8046
  /**
8016
- *
8017
- * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
8018
- * uuidv4 generates guids from cryprtographically-string random
8047
+ * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
8048
+ * cryptographic pseudorandom number generator.
8019
8049
  */
8020
8050
  generateGuid() {
8021
- return uuid.v4();
8051
+ return node_crypto.randomUUID();
8022
8052
  }
8023
8053
  /**
8024
8054
  * verifies if a string is GUID
@@ -8639,7 +8669,7 @@ class NodeStorage extends CacheManager {
8639
8669
  return [...Object.keys(cache)];
8640
8670
  }
8641
8671
  /**
8642
- * Clears all cache entries created by MSAL (except tokens).
8672
+ * Clears all cache entries created by MSAL except authority metadata..
8643
8673
  */
8644
8674
  clear() {
8645
8675
  this.logger.trace("Clearing cache entries created by MSAL", "");
@@ -8647,6 +8677,9 @@ class NodeStorage extends CacheManager {
8647
8677
  const cacheKeys = this.getKeys();
8648
8678
  // delete each element
8649
8679
  cacheKeys.forEach((key) => {
8680
+ if (this.isAuthorityMetadata(key)) {
8681
+ return;
8682
+ }
8650
8683
  this.removeItem(key);
8651
8684
  });
8652
8685
  this.emitChange();
@@ -9133,7 +9166,7 @@ class ClientAssertion {
9133
9166
 
9134
9167
  /* eslint-disable header/header */
9135
9168
  const name = "@azure/msal-node";
9136
- const version = "5.1.3";
9169
+ const version = "5.1.5";
9137
9170
 
9138
9171
  /*
9139
9172
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9682,7 +9715,7 @@ class ClientApplication {
9682
9715
  return createDiscoveredInstance(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger, requestCorrelationId, new StubPerformanceClient());
9683
9716
  }
9684
9717
  /**
9685
- * Clear the cache
9718
+ * Clear the cache except for authority metadata.
9686
9719
  */
9687
9720
  clearCache() {
9688
9721
  this.storage.clear();