@azure/msal-node 3.5.2 → 3.6.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 (126) hide show
  1. package/dist/cache/NodeStorage.mjs +1 -1
  2. package/dist/cache/TokenCache.mjs +1 -1
  3. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  4. package/dist/cache/serializer/Deserializer.mjs +1 -1
  5. package/dist/cache/serializer/Serializer.mjs +1 -1
  6. package/dist/client/ClientApplication.mjs +1 -1
  7. package/dist/client/ClientAssertion.d.ts.map +1 -1
  8. package/dist/client/ClientAssertion.mjs +3 -3
  9. package/dist/client/ClientAssertion.mjs.map +1 -1
  10. package/dist/client/ClientCredentialClient.mjs +1 -1
  11. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  12. package/dist/client/DeviceCodeClient.mjs +1 -1
  13. package/dist/client/ManagedIdentityApplication.d.ts +11 -0
  14. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  15. package/dist/client/ManagedIdentityApplication.mjs +46 -11
  16. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  17. package/dist/client/ManagedIdentityClient.mjs +1 -1
  18. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  19. package/dist/client/ManagedIdentitySources/AppService.mjs +6 -5
  20. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  21. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  22. package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
  23. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  24. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  25. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +11 -2
  26. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  27. package/dist/client/ManagedIdentitySources/CloudShell.mjs +4 -4
  28. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  29. package/dist/client/ManagedIdentitySources/Imds.d.ts +32 -0
  30. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  31. package/dist/client/ManagedIdentitySources/Imds.mjs +39 -8
  32. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  33. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  34. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +7 -6
  35. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  36. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
  37. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  38. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +36 -10
  39. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  40. package/dist/client/OnBehalfOfClient.mjs +1 -1
  41. package/dist/client/PublicClientApplication.mjs +1 -1
  42. package/dist/client/UsernamePasswordClient.mjs +1 -1
  43. package/dist/config/Configuration.d.ts +4 -2
  44. package/dist/config/Configuration.d.ts.map +1 -1
  45. package/dist/config/Configuration.mjs +3 -2
  46. package/dist/config/Configuration.mjs.map +1 -1
  47. package/dist/config/ManagedIdentityId.mjs +1 -1
  48. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  49. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  50. package/dist/crypto/CryptoProvider.mjs +3 -2
  51. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  52. package/dist/crypto/GuidGenerator.mjs +1 -1
  53. package/dist/crypto/HashUtils.mjs +1 -1
  54. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  55. package/dist/crypto/PkceGenerator.mjs +3 -3
  56. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  57. package/dist/error/ManagedIdentityError.mjs +1 -1
  58. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  59. package/dist/error/NodeAuthError.mjs +1 -1
  60. package/dist/index.mjs +1 -1
  61. package/dist/internals.mjs +1 -1
  62. package/dist/network/HttpClient.mjs +1 -1
  63. package/dist/network/HttpClientWithRetries.mjs +1 -1
  64. package/dist/network/LoopbackClient.mjs +1 -1
  65. package/dist/packageMetadata.d.ts +1 -1
  66. package/dist/packageMetadata.mjs +2 -2
  67. package/dist/protocol/Authorize.mjs +1 -1
  68. package/dist/request/ManagedIdentityRequest.d.ts +6 -3
  69. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
  70. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -0
  71. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  72. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +3 -3
  73. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  74. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  75. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  76. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  77. package/dist/utils/Constants.d.ts +20 -6
  78. package/dist/utils/Constants.d.ts.map +1 -1
  79. package/dist/utils/Constants.mjs +20 -8
  80. package/dist/utils/Constants.mjs.map +1 -1
  81. package/dist/utils/EncodingUtils.mjs +4 -4
  82. package/dist/utils/EncodingUtils.mjs.map +1 -1
  83. package/dist/utils/NetworkUtils.mjs +1 -1
  84. package/dist/utils/TimeUtils.mjs +1 -1
  85. package/lib/msal-node.cjs +235 -125
  86. package/lib/msal-node.cjs.map +1 -1
  87. package/lib/types/client/ClientAssertion.d.ts.map +1 -1
  88. package/lib/types/client/ManagedIdentityApplication.d.ts +11 -0
  89. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  90. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  91. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  92. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  93. package/lib/types/client/ManagedIdentitySources/Imds.d.ts +32 -0
  94. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  95. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  96. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
  97. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  98. package/lib/types/config/Configuration.d.ts +4 -2
  99. package/lib/types/config/Configuration.d.ts.map +1 -1
  100. package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
  101. package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
  102. package/lib/types/packageMetadata.d.ts +1 -1
  103. package/lib/types/request/ManagedIdentityRequest.d.ts +6 -3
  104. package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
  105. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -0
  106. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  107. package/lib/types/utils/Constants.d.ts +20 -6
  108. package/lib/types/utils/Constants.d.ts.map +1 -1
  109. package/package.json +3 -2
  110. package/src/client/ClientAssertion.ts +2 -1
  111. package/src/client/ManagedIdentityApplication.ts +71 -10
  112. package/src/client/ManagedIdentitySources/AppService.ts +6 -6
  113. package/src/client/ManagedIdentitySources/AzureArc.ts +10 -9
  114. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +28 -1
  115. package/src/client/ManagedIdentitySources/CloudShell.ts +4 -4
  116. package/src/client/ManagedIdentitySources/Imds.ts +40 -10
  117. package/src/client/ManagedIdentitySources/MachineLearning.ts +7 -8
  118. package/src/client/ManagedIdentitySources/ServiceFabric.ts +36 -11
  119. package/src/config/Configuration.ts +5 -1
  120. package/src/crypto/CryptoProvider.ts +3 -3
  121. package/src/crypto/PkceGenerator.ts +3 -3
  122. package/src/packageMetadata.ts +1 -1
  123. package/src/request/ManagedIdentityRequest.ts +6 -3
  124. package/src/retry/DefaultManagedIdentityRetryPolicy.ts +1 -1
  125. package/src/utils/Constants.ts +24 -6
  126. package/src/utils/EncodingUtils.ts +3 -3
package/lib/msal-node.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v3.5.2 2025-04-29 */
1
+ /*! @azure/msal-node v3.6.0 2025-05-30 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -153,7 +153,7 @@ class Serializer {
153
153
  }
154
154
  }
155
155
 
156
- /*! @azure/msal-common v15.5.2 2025-04-29 */
156
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
157
157
  /*
158
158
  * Copyright (c) Microsoft Corporation. All rights reserved.
159
159
  * Licensed under the MIT License.
@@ -400,13 +400,6 @@ const PasswordGrantConstants = {
400
400
  username: "username",
401
401
  password: "password",
402
402
  };
403
- /**
404
- * Response codes
405
- */
406
- const ResponseCodes = {
407
- httpSuccess: 200,
408
- httpBadRequest: 400,
409
- };
410
403
  /**
411
404
  * Region Discovery Sources
412
405
  */
@@ -442,9 +435,14 @@ const CacheOutcome = {
442
435
  PROACTIVELY_REFRESHED: "4",
443
436
  };
444
437
  // Token renewal offset default in seconds
445
- const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
438
+ const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
439
+ const EncodingTypes = {
440
+ BASE64: "base64",
441
+ HEX: "hex",
442
+ UTF8: "utf-8",
443
+ };
446
444
 
447
- /*! @azure/msal-common v15.5.2 2025-04-29 */
445
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
448
446
  /*
449
447
  * Copyright (c) Microsoft Corporation. All rights reserved.
450
448
  * Licensed under the MIT License.
@@ -461,7 +459,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
461
459
  unexpectedError: unexpectedError
462
460
  });
463
461
 
464
- /*! @azure/msal-common v15.5.2 2025-04-29 */
462
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
465
463
 
466
464
  /*
467
465
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -510,7 +508,7 @@ function createAuthError(code, additionalMessage) {
510
508
  : AuthErrorMessages[code]);
511
509
  }
512
510
 
513
- /*! @azure/msal-common v15.5.2 2025-04-29 */
511
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
514
512
  /*
515
513
  * Copyright (c) Microsoft Corporation. All rights reserved.
516
514
  * Licensed under the MIT License.
@@ -608,7 +606,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
608
606
  userTimeoutReached: userTimeoutReached
609
607
  });
610
608
 
611
- /*! @azure/msal-common v15.5.2 2025-04-29 */
609
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
612
610
 
613
611
  /*
614
612
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -860,7 +858,7 @@ function createClientAuthError(errorCode, additionalMessage) {
860
858
  return new ClientAuthError(errorCode, additionalMessage);
861
859
  }
862
860
 
863
- /*! @azure/msal-common v15.5.2 2025-04-29 */
861
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
864
862
 
865
863
  /*
866
864
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -899,7 +897,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
899
897
  },
900
898
  };
901
899
 
902
- /*! @azure/msal-common v15.5.2 2025-04-29 */
900
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
903
901
 
904
902
  /*
905
903
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1090,12 +1088,12 @@ class Logger {
1090
1088
  }
1091
1089
  }
1092
1090
 
1093
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1091
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1094
1092
  /* eslint-disable header/header */
1095
1093
  const name$1 = "@azure/msal-common";
1096
- const version$1 = "15.5.2";
1094
+ const version$1 = "15.7.0";
1097
1095
 
1098
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1096
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1099
1097
  /*
1100
1098
  * Copyright (c) Microsoft Corporation. All rights reserved.
1101
1099
  * Licensed under the MIT License.
@@ -1115,7 +1113,7 @@ const AzureCloudInstance = {
1115
1113
  AzureUsGovernment: "https://login.microsoftonline.us",
1116
1114
  };
1117
1115
 
1118
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1116
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1119
1117
 
1120
1118
  /*
1121
1119
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1176,7 +1174,7 @@ function checkMaxAge(authTime, maxAge) {
1176
1174
  }
1177
1175
  }
1178
1176
 
1179
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1177
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1180
1178
  /*
1181
1179
  * Copyright (c) Microsoft Corporation. All rights reserved.
1182
1180
  * Licensed under the MIT License.
@@ -1231,7 +1229,7 @@ function delay(t, value) {
1231
1229
  return new Promise((resolve) => setTimeout(() => resolve(value), t));
1232
1230
  }
1233
1231
 
1234
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1232
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1235
1233
 
1236
1234
  /*
1237
1235
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1558,7 +1556,7 @@ function isAuthorityMetadataExpired(metadata) {
1558
1556
  return metadata.expiresAt <= nowSeconds();
1559
1557
  }
1560
1558
 
1561
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1559
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1562
1560
  /*
1563
1561
  * Copyright (c) Microsoft Corporation. All rights reserved.
1564
1562
  * Licensed under the MIT License.
@@ -1612,7 +1610,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1612
1610
  urlParseError: urlParseError
1613
1611
  });
1614
1612
 
1615
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1613
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1616
1614
 
1617
1615
  /*
1618
1616
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1750,7 +1748,7 @@ function createClientConfigurationError(errorCode) {
1750
1748
  return new ClientConfigurationError(errorCode);
1751
1749
  }
1752
1750
 
1753
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1751
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1754
1752
  /*
1755
1753
  * Copyright (c) Microsoft Corporation. All rights reserved.
1756
1754
  * Licensed under the MIT License.
@@ -1847,7 +1845,7 @@ class StringUtils {
1847
1845
  }
1848
1846
  }
1849
1847
 
1850
- /*! @azure/msal-common v15.5.2 2025-04-29 */
1848
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
1851
1849
 
1852
1850
  /*
1853
1851
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2038,7 +2036,7 @@ class ScopeSet {
2038
2036
  }
2039
2037
  }
2040
2038
 
2041
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2039
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2042
2040
 
2043
2041
  /*
2044
2042
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2078,7 +2076,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
2078
2076
  };
2079
2077
  }
2080
2078
 
2081
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2079
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2082
2080
  /*
2083
2081
  * Copyright (c) Microsoft Corporation. All rights reserved.
2084
2082
  * Licensed under the MIT License.
@@ -2157,7 +2155,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
2157
2155
  return updatedAccountInfo;
2158
2156
  }
2159
2157
 
2160
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2158
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2161
2159
  /*
2162
2160
  * Copyright (c) Microsoft Corporation. All rights reserved.
2163
2161
  * Licensed under the MIT License.
@@ -2172,7 +2170,7 @@ const AuthorityType = {
2172
2170
  Ciam: 3,
2173
2171
  };
2174
2172
 
2175
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2173
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2176
2174
  /*
2177
2175
  * Copyright (c) Microsoft Corporation. All rights reserved.
2178
2176
  * Licensed under the MIT License.
@@ -2194,7 +2192,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
2194
2192
  return null;
2195
2193
  }
2196
2194
 
2197
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2195
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2198
2196
  /*
2199
2197
  * Copyright (c) Microsoft Corporation. All rights reserved.
2200
2198
  * Licensed under the MIT License.
@@ -2218,7 +2216,7 @@ const ProtocolMode = {
2218
2216
  EAR: "EAR",
2219
2217
  };
2220
2218
 
2221
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2219
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2222
2220
 
2223
2221
  /*
2224
2222
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2461,7 +2459,7 @@ class AccountEntity {
2461
2459
  }
2462
2460
  }
2463
2461
 
2464
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2462
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2465
2463
 
2466
2464
  /*
2467
2465
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2526,7 +2524,7 @@ function mapToQueryString(parameters, encodeExtraParams = true, extraQueryParame
2526
2524
  return queryParameterArray.join("&");
2527
2525
  }
2528
2526
 
2529
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2527
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2530
2528
 
2531
2529
  /*
2532
2530
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2690,7 +2688,7 @@ class UrlString {
2690
2688
  }
2691
2689
  }
2692
2690
 
2693
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2691
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2694
2692
 
2695
2693
  /*
2696
2694
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2830,7 +2828,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2830
2828
  return null;
2831
2829
  }
2832
2830
 
2833
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2831
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2834
2832
  /*
2835
2833
  * Copyright (c) Microsoft Corporation. All rights reserved.
2836
2834
  * Licensed under the MIT License.
@@ -2838,7 +2836,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
2838
2836
  const cacheQuotaExceededErrorCode = "cache_quota_exceeded";
2839
2837
  const cacheUnknownErrorCode = "cache_error_unknown";
2840
2838
 
2841
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2839
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2842
2840
 
2843
2841
  /*
2844
2842
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2865,7 +2863,7 @@ class CacheError extends Error {
2865
2863
  }
2866
2864
  }
2867
2865
 
2868
- /*! @azure/msal-common v15.5.2 2025-04-29 */
2866
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
2869
2867
 
2870
2868
  /*
2871
2869
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4049,7 +4047,7 @@ class DefaultStorageClass extends CacheManager {
4049
4047
  }
4050
4048
  }
4051
4049
 
4052
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4050
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4053
4051
 
4054
4052
  /*
4055
4053
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4149,7 +4147,7 @@ function isOidcProtocolMode(config) {
4149
4147
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
4150
4148
  }
4151
4149
 
4152
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4150
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4153
4151
  /*
4154
4152
  * Copyright (c) Microsoft Corporation. All rights reserved.
4155
4153
  * Licensed under the MIT License.
@@ -4159,7 +4157,7 @@ const CcsCredentialType = {
4159
4157
  UPN: "UPN",
4160
4158
  };
4161
4159
 
4162
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4160
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4163
4161
  /*
4164
4162
  * Copyright (c) Microsoft Corporation. All rights reserved.
4165
4163
  * Licensed under the MIT License.
@@ -4210,7 +4208,7 @@ const BROKER_CLIENT_ID = "brk_client_id";
4210
4208
  const BROKER_REDIRECT_URI = "brk_redirect_uri";
4211
4209
  const INSTANCE_AWARE = "instance_aware";
4212
4210
 
4213
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4211
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4214
4212
 
4215
4213
  /*
4216
4214
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4596,7 +4594,7 @@ function addBrokerParameters(parameters, brokerClientId, brokerRedirectUri) {
4596
4594
  }
4597
4595
  }
4598
4596
 
4599
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4597
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4600
4598
  /*
4601
4599
  * Copyright (c) Microsoft Corporation. All rights reserved.
4602
4600
  * Licensed under the MIT License.
@@ -4608,7 +4606,7 @@ function isOpenIdConfigResponse(response) {
4608
4606
  response.hasOwnProperty("jwks_uri"));
4609
4607
  }
4610
4608
 
4611
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4609
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4612
4610
  /*
4613
4611
  * Copyright (c) Microsoft Corporation. All rights reserved.
4614
4612
  * Licensed under the MIT License.
@@ -4618,7 +4616,7 @@ function isCloudInstanceDiscoveryResponse(response) {
4618
4616
  response.hasOwnProperty("metadata"));
4619
4617
  }
4620
4618
 
4621
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4619
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4622
4620
  /*
4623
4621
  * Copyright (c) Microsoft Corporation. All rights reserved.
4624
4622
  * Licensed under the MIT License.
@@ -4628,7 +4626,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
4628
4626
  response.hasOwnProperty("error_description"));
4629
4627
  }
4630
4628
 
4631
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4629
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4632
4630
  /*
4633
4631
  * Copyright (c) Microsoft Corporation. All rights reserved.
4634
4632
  * Licensed under the MIT License.
@@ -4887,7 +4885,7 @@ const PerformanceEvents = {
4887
4885
  DecryptEarResponse: "decryptEarResponse",
4888
4886
  };
4889
4887
 
4890
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4888
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4891
4889
  /*
4892
4890
  * Copyright (c) Microsoft Corporation. All rights reserved.
4893
4891
  * Licensed under the MIT License.
@@ -4983,7 +4981,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
4983
4981
  };
4984
4982
  };
4985
4983
 
4986
- /*! @azure/msal-common v15.5.2 2025-04-29 */
4984
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
4987
4985
 
4988
4986
  /*
4989
4987
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5010,15 +5008,13 @@ class RegionDiscovery {
5010
5008
  const options = RegionDiscovery.IMDS_OPTIONS;
5011
5009
  try {
5012
5010
  const localIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(Constants$1.IMDS_VERSION, options);
5013
- if (localIMDSVersionResponse.status ===
5014
- ResponseCodes.httpSuccess) {
5011
+ if (localIMDSVersionResponse.status === HttpStatus.SUCCESS) {
5015
5012
  autodetectedRegionName = localIMDSVersionResponse.body;
5016
5013
  regionDiscoveryMetadata.region_source =
5017
5014
  RegionDiscoverySources.IMDS;
5018
5015
  }
5019
5016
  // If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
5020
- if (localIMDSVersionResponse.status ===
5021
- ResponseCodes.httpBadRequest) {
5017
+ if (localIMDSVersionResponse.status === HttpStatus.BAD_REQUEST) {
5022
5018
  const currentIMDSVersion = await invokeAsync(this.getCurrentVersion.bind(this), PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.logger, this.performanceClient, this.correlationId)(options);
5023
5019
  if (!currentIMDSVersion) {
5024
5020
  regionDiscoveryMetadata.region_source =
@@ -5026,8 +5022,7 @@ class RegionDiscovery {
5026
5022
  return null;
5027
5023
  }
5028
5024
  const currentIMDSVersionResponse = await invokeAsync(this.getRegionFromIMDS.bind(this), PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.logger, this.performanceClient, this.correlationId)(currentIMDSVersion, options);
5029
- if (currentIMDSVersionResponse.status ===
5030
- ResponseCodes.httpSuccess) {
5025
+ if (currentIMDSVersionResponse.status === HttpStatus.SUCCESS) {
5031
5026
  autodetectedRegionName =
5032
5027
  currentIMDSVersionResponse.body;
5033
5028
  regionDiscoveryMetadata.region_source =
@@ -5072,7 +5067,7 @@ class RegionDiscovery {
5072
5067
  try {
5073
5068
  const response = await this.networkInterface.sendGetRequestAsync(`${Constants$1.IMDS_ENDPOINT}?format=json`, options);
5074
5069
  // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
5075
- if (response.status === ResponseCodes.httpBadRequest &&
5070
+ if (response.status === HttpStatus.BAD_REQUEST &&
5076
5071
  response.body &&
5077
5072
  response.body["newest-versions"] &&
5078
5073
  response.body["newest-versions"].length > 0) {
@@ -5092,7 +5087,7 @@ RegionDiscovery.IMDS_OPTIONS = {
5092
5087
  },
5093
5088
  };
5094
5089
 
5095
- /*! @azure/msal-common v15.5.2 2025-04-29 */
5090
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
5096
5091
 
5097
5092
  /*
5098
5093
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5931,7 +5926,7 @@ function buildStaticAuthorityOptions(authOptions) {
5931
5926
  };
5932
5927
  }
5933
5928
 
5934
- /*! @azure/msal-common v15.5.2 2025-04-29 */
5929
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
5935
5930
 
5936
5931
  /*
5937
5932
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5962,7 +5957,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
5962
5957
  }
5963
5958
  }
5964
5959
 
5965
- /*! @azure/msal-common v15.5.2 2025-04-29 */
5960
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
5966
5961
 
5967
5962
  /*
5968
5963
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5981,7 +5976,7 @@ class ServerError extends AuthError {
5981
5976
  }
5982
5977
  }
5983
5978
 
5984
- /*! @azure/msal-common v15.5.2 2025-04-29 */
5979
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
5985
5980
  /*
5986
5981
  * Copyright (c) Microsoft Corporation. All rights reserved.
5987
5982
  * Licensed under the MIT License.
@@ -6002,7 +5997,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6002
5997
  };
6003
5998
  }
6004
5999
 
6005
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6000
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6006
6001
 
6007
6002
  /*
6008
6003
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6089,7 +6084,7 @@ class ThrottlingUtils {
6089
6084
  }
6090
6085
  }
6091
6086
 
6092
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6087
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6093
6088
 
6094
6089
  /*
6095
6090
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6109,7 +6104,7 @@ class NetworkError extends AuthError {
6109
6104
  }
6110
6105
  }
6111
6106
 
6112
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6107
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6113
6108
 
6114
6109
  /*
6115
6110
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6257,7 +6252,7 @@ class BaseClient {
6257
6252
  }
6258
6253
  }
6259
6254
 
6260
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6255
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6261
6256
  /*
6262
6257
  * Copyright (c) Microsoft Corporation. All rights reserved.
6263
6258
  * Licensed under the MIT License.
@@ -6283,7 +6278,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6283
6278
  refreshTokenExpired: refreshTokenExpired
6284
6279
  });
6285
6280
 
6286
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6281
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6287
6282
 
6288
6283
  /*
6289
6284
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6371,7 +6366,7 @@ function createInteractionRequiredAuthError(errorCode) {
6371
6366
  return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
6372
6367
  }
6373
6368
 
6374
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6369
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6375
6370
 
6376
6371
  /*
6377
6372
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6443,7 +6438,7 @@ class ProtocolUtils {
6443
6438
  }
6444
6439
  }
6445
6440
 
6446
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6441
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6447
6442
 
6448
6443
  /*
6449
6444
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6527,7 +6522,7 @@ class PopTokenGenerator {
6527
6522
  }
6528
6523
  }
6529
6524
 
6530
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6525
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6531
6526
  /*
6532
6527
  * Copyright (c) Microsoft Corporation. All rights reserved.
6533
6528
  * Licensed under the MIT License.
@@ -6554,7 +6549,7 @@ class PopTokenGenerator {
6554
6549
  }
6555
6550
  }
6556
6551
 
6557
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6552
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6558
6553
 
6559
6554
  /*
6560
6555
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6885,7 +6880,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6885
6880
  return baseAccount;
6886
6881
  }
6887
6882
 
6888
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6883
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6889
6884
 
6890
6885
  /*
6891
6886
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6952,7 +6947,7 @@ class RequestValidator {
6952
6947
  }
6953
6948
  }
6954
6949
 
6955
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6950
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6956
6951
  /*
6957
6952
  * Copyright (c) Microsoft Corporation. All rights reserved.
6958
6953
  * Licensed under the MIT License.
@@ -6970,7 +6965,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint) {
6970
6965
  }
6971
6966
  }
6972
6967
 
6973
- /*! @azure/msal-common v15.5.2 2025-04-29 */
6968
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
6974
6969
 
6975
6970
  /*
6976
6971
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7203,7 +7198,7 @@ class AuthorizationCodeClient extends BaseClient {
7203
7198
  }
7204
7199
  }
7205
7200
 
7206
- /*! @azure/msal-common v15.5.2 2025-04-29 */
7201
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
7207
7202
 
7208
7203
  /*
7209
7204
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7412,7 +7407,7 @@ class RefreshTokenClient extends BaseClient {
7412
7407
  }
7413
7408
  }
7414
7409
 
7415
- /*! @azure/msal-common v15.5.2 2025-04-29 */
7410
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
7416
7411
 
7417
7412
  /*
7418
7413
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7510,7 +7505,7 @@ class SilentFlowClient extends BaseClient {
7510
7505
  }
7511
7506
  }
7512
7507
 
7513
- /*! @azure/msal-common v15.5.2 2025-04-29 */
7508
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
7514
7509
 
7515
7510
  /*
7516
7511
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7660,7 +7655,7 @@ function extractLoginHint(account) {
7660
7655
  return account.idTokenClaims?.login_hint || null;
7661
7656
  }
7662
7657
 
7663
- /*! @azure/msal-common v15.5.2 2025-04-29 */
7658
+ /*! @azure/msal-common v15.7.0 2025-05-30 */
7664
7659
 
7665
7660
  /*
7666
7661
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8112,15 +8107,27 @@ var internals = /*#__PURE__*/Object.freeze({
8112
8107
  * Licensed under the MIT License.
8113
8108
  */
8114
8109
  // MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
8115
- const AUTHORIZATION_HEADER_NAME = "Authorization";
8116
- const METADATA_HEADER_NAME = "Metadata";
8117
- const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
8118
- const ML_AND_SF_SECRET_HEADER_NAME = "secret";
8119
- const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
8120
- const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
8121
8110
  const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
8122
8111
  const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
8123
8112
  const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
8113
+ /**
8114
+ * Managed Identity Headers - used in network requests
8115
+ */
8116
+ const ManagedIdentityHeaders = {
8117
+ AUTHORIZATION_HEADER_NAME: "Authorization",
8118
+ METADATA_HEADER_NAME: "Metadata",
8119
+ APP_SERVICE_SECRET_HEADER_NAME: "X-IDENTITY-HEADER",
8120
+ ML_AND_SF_SECRET_HEADER_NAME: "secret",
8121
+ };
8122
+ /**
8123
+ * Managed Identity Query Parameters - used in network requests
8124
+ */
8125
+ const ManagedIdentityQueryParameters = {
8126
+ API_VERSION: "api-version",
8127
+ RESOURCE: "resource",
8128
+ SHA256_TOKEN_TO_REFRESH: "token_sha256_to_refresh",
8129
+ XMS_CC: "xms_cc",
8130
+ };
8124
8131
  /**
8125
8132
  * Managed Identity Environment Variable Names
8126
8133
  */
@@ -8852,7 +8859,7 @@ function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
8852
8859
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
8853
8860
  };
8854
8861
  }
8855
- function buildManagedIdentityConfiguration({ managedIdentityIdParams, system, }) {
8862
+ function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentityIdParams, system, }) {
8856
8863
  const managedIdentityId = new ManagedIdentityId(managedIdentityIdParams);
8857
8864
  const loggerOptions = system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
8858
8865
  let networkClient;
@@ -8865,6 +8872,7 @@ function buildManagedIdentityConfiguration({ managedIdentityIdParams, system, })
8865
8872
  networkClient = new HttpClient(system?.proxyUrl, system?.customAgentOptions);
8866
8873
  }
8867
8874
  return {
8875
+ clientCapabilities: clientCapabilities || [],
8868
8876
  managedIdentityId: managedIdentityId,
8869
8877
  system: {
8870
8878
  loggerOptions,
@@ -8909,7 +8917,7 @@ class EncodingUtils {
8909
8917
  * @param str text
8910
8918
  */
8911
8919
  static base64Encode(str, encoding) {
8912
- return Buffer.from(str, encoding).toString("base64");
8920
+ return Buffer.from(str, encoding).toString(EncodingTypes.BASE64);
8913
8921
  }
8914
8922
  /**
8915
8923
  * encode a URL
@@ -8928,7 +8936,7 @@ class EncodingUtils {
8928
8936
  * @param base64Str Base64 encoded text
8929
8937
  */
8930
8938
  static base64Decode(base64Str) {
8931
- return Buffer.from(base64Str, "base64").toString("utf8");
8939
+ return Buffer.from(base64Str, EncodingTypes.BASE64).toString("utf8");
8932
8940
  }
8933
8941
  /**
8934
8942
  * @param base64Str Base64 encoded Url
@@ -9002,7 +9010,7 @@ class PkceGenerator {
9002
9010
  * @param codeVerifier
9003
9011
  */
9004
9012
  generateCodeChallengeFromVerifier(codeVerifier) {
9005
- return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString("base64"), "base64");
9013
+ return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString(EncodingTypes.BASE64), EncodingTypes.BASE64);
9006
9014
  }
9007
9015
  }
9008
9016
 
@@ -9092,7 +9100,7 @@ class CryptoProvider {
9092
9100
  * Returns the SHA-256 hash of an input string
9093
9101
  */
9094
9102
  async hashString(plainText) {
9095
- return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
9103
+ return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString(EncodingTypes.BASE64), EncodingTypes.BASE64);
9096
9104
  }
9097
9105
  }
9098
9106
 
@@ -9895,7 +9903,7 @@ class ClientAssertion {
9895
9903
  ? JwtConstants.X5T_256
9896
9904
  : JwtConstants.X5T;
9897
9905
  Object.assign(header, {
9898
- [thumbprintHeader]: EncodingUtils.base64EncodeUrl(this.thumbprint, "hex"),
9906
+ [thumbprintHeader]: EncodingUtils.base64EncodeUrl(this.thumbprint, EncodingTypes.HEX),
9899
9907
  });
9900
9908
  if (this.publicCertificate) {
9901
9909
  Object.assign(header, {
@@ -9944,7 +9952,7 @@ class ClientAssertion {
9944
9952
 
9945
9953
  /* eslint-disable header/header */
9946
9954
  const name = "@azure/msal-node";
9947
- const version = "3.5.2";
9955
+ const version = "3.6.0";
9948
9956
 
9949
9957
  /*
9950
9958
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11691,6 +11699,15 @@ class BaseManagedIdentitySource {
11691
11699
  }
11692
11700
  async acquireTokenWithManagedIdentity(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken) {
11693
11701
  const networkRequest = this.createRequest(managedIdentityRequest.resource, managedIdentityId);
11702
+ if (managedIdentityRequest.revokedTokenSha256Hash) {
11703
+ this.logger.info(`[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`);
11704
+ networkRequest.queryParameters[ManagedIdentityQueryParameters.SHA256_TOKEN_TO_REFRESH] = managedIdentityRequest.revokedTokenSha256Hash;
11705
+ }
11706
+ if (managedIdentityRequest.clientCapabilities?.length) {
11707
+ const clientCapabilities = managedIdentityRequest.clientCapabilities.toString();
11708
+ this.logger.info(`[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`);
11709
+ networkRequest.queryParameters[ManagedIdentityQueryParameters.XMS_CC] = clientCapabilities;
11710
+ }
11694
11711
  const headers = networkRequest.headers;
11695
11712
  headers[HeaderNames.CONTENT_TYPE] = Constants$1.URL_FORM_CONTENT_TYPE;
11696
11713
  const networkRequestOptions = { headers };
@@ -11801,7 +11818,7 @@ class LinearRetryStrategy {
11801
11818
  * Copyright (c) Microsoft Corporation. All rights reserved.
11802
11819
  * Licensed under the MIT License.
11803
11820
  */
11804
- const DEFAULT_MANAGED_IDENTITY_MAX_RETRIES = 3;
11821
+ const DEFAULT_MANAGED_IDENTITY_MAX_RETRIES = 3; // referenced in unit test
11805
11822
  const DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS = 1000;
11806
11823
  const DEFAULT_MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
11807
11824
  msalCommon.HttpStatus.NOT_FOUND,
@@ -11903,10 +11920,11 @@ class AppService extends BaseManagedIdentitySource {
11903
11920
  }
11904
11921
  createRequest(resource, managedIdentityId) {
11905
11922
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
11906
- request.headers[APP_SERVICE_SECRET_HEADER_NAME] = this.identityHeader;
11907
- request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
11923
+ request.headers[ManagedIdentityHeaders.APP_SERVICE_SECRET_HEADER_NAME] =
11924
+ this.identityHeader;
11925
+ request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
11908
11926
  APP_SERVICE_MSI_API_VERSION;
11909
- request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
11927
+ request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
11910
11928
  resource;
11911
11929
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
11912
11930
  request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
@@ -11992,10 +12010,10 @@ class AzureArc extends BaseManagedIdentitySource {
11992
12010
  }
11993
12011
  createRequest(resource) {
11994
12012
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint.replace("localhost", "127.0.0.1"));
11995
- request.headers[METADATA_HEADER_NAME] = "true";
11996
- request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12013
+ request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
12014
+ request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
11997
12015
  ARC_API_VERSION;
11998
- request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12016
+ request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
11999
12017
  resource;
12000
12018
  // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
12001
12019
  return request;
@@ -12045,14 +12063,14 @@ class AzureArc extends BaseManagedIdentitySource {
12045
12063
  // attempt to read the contents of the secret file
12046
12064
  let secret;
12047
12065
  try {
12048
- secret = fs.readFileSync(secretFilePath, "utf-8");
12066
+ secret = fs.readFileSync(secretFilePath, EncodingTypes.UTF8);
12049
12067
  }
12050
12068
  catch (e) {
12051
12069
  throw createManagedIdentityError(unableToReadSecretFile);
12052
12070
  }
12053
12071
  const authHeaderValue = `Basic ${secret}`;
12054
12072
  this.logger.info(`[Managed Identity] Adding authorization header to the request.`);
12055
- networkRequest.headers[AUTHORIZATION_HEADER_NAME] = authHeaderValue;
12073
+ networkRequest.headers[ManagedIdentityHeaders.AUTHORIZATION_HEADER_NAME] = authHeaderValue;
12056
12074
  try {
12057
12075
  retryResponse =
12058
12076
  await networkClient.sendGetRequestAsync(networkRequest.computeUri(), networkRequestOptions);
@@ -12102,8 +12120,8 @@ class CloudShell extends BaseManagedIdentitySource {
12102
12120
  }
12103
12121
  createRequest(resource) {
12104
12122
  const request = new ManagedIdentityRequestParameters(HttpMethod.POST, this.msiEndpoint);
12105
- request.headers[METADATA_HEADER_NAME] = "true";
12106
- request.bodyParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12123
+ request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
12124
+ request.bodyParameters[ManagedIdentityQueryParameters.RESOURCE] =
12107
12125
  resource;
12108
12126
  return request;
12109
12127
  }
@@ -12232,16 +12250,39 @@ class ImdsRetryPolicy {
12232
12250
  * Copyright (c) Microsoft Corporation. All rights reserved.
12233
12251
  * Licensed under the MIT License.
12234
12252
  */
12235
- // IMDS constants. Docs for IMDS are available here https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http
12253
+ // Documentation for IMDS is available at https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http
12236
12254
  const IMDS_TOKEN_PATH = "/metadata/identity/oauth2/token";
12237
12255
  const DEFAULT_IMDS_ENDPOINT = `http://169.254.169.254${IMDS_TOKEN_PATH}`;
12238
12256
  const IMDS_API_VERSION = "2018-02-01";
12239
- // Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
12257
+ /**
12258
+ * Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
12259
+ */
12240
12260
  class Imds extends BaseManagedIdentitySource {
12261
+ /**
12262
+ * Constructs an Imds instance.
12263
+ * @param logger - Logger instance for logging.
12264
+ * @param nodeStorage - NodeStorage instance for caching.
12265
+ * @param networkClient - Network client for HTTP requests.
12266
+ * @param cryptoProvider - CryptoProvider for cryptographic operations.
12267
+ * @param disableInternalRetries - Whether to disable internal retry logic.
12268
+ * @param identityEndpoint - The IMDS endpoint to use.
12269
+ */
12241
12270
  constructor(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint) {
12242
12271
  super(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
12243
12272
  this.identityEndpoint = identityEndpoint;
12244
12273
  }
12274
+ /**
12275
+ * Attempts to create an Imds instance by determining the correct endpoint.
12276
+ * If the AZURE_POD_IDENTITY_AUTHORITY_HOST environment variable is set, it uses that as the endpoint.
12277
+ * Otherwise, it falls back to the default IMDS endpoint.
12278
+ *
12279
+ * @param logger - Logger instance for logging.
12280
+ * @param nodeStorage - NodeStorage instance for caching.
12281
+ * @param networkClient - Network client for HTTP requests.
12282
+ * @param cryptoProvider - CryptoProvider for cryptographic operations.
12283
+ * @param disableInternalRetries - Whether to disable internal retry logic.
12284
+ * @returns An instance of Imds configured with the appropriate endpoint.
12285
+ */
12245
12286
  static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries) {
12246
12287
  let validatedIdentityEndpoint;
12247
12288
  if (process.env[ManagedIdentityEnvironmentVariableNames
@@ -12257,18 +12298,26 @@ class Imds extends BaseManagedIdentitySource {
12257
12298
  }
12258
12299
  return new Imds(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, validatedIdentityEndpoint);
12259
12300
  }
12301
+ /**
12302
+ * Creates a ManagedIdentityRequestParameters object for acquiring a token from IMDS.
12303
+ * Sets the required headers and query parameters for the IMDS token request.
12304
+ *
12305
+ * @param resource - The resource URI for which the token is requested.
12306
+ * @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
12307
+ * @returns A ManagedIdentityRequestParameters object configured for IMDS.
12308
+ */
12260
12309
  createRequest(resource, managedIdentityId) {
12261
12310
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
12262
- request.headers[METADATA_HEADER_NAME] = "true";
12263
- request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12311
+ request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
12312
+ request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
12264
12313
  IMDS_API_VERSION;
12265
- request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12314
+ request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
12266
12315
  resource;
12267
12316
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12268
12317
  request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, true // indicates source is IMDS
12269
12318
  )] = managedIdentityId.id;
12270
12319
  }
12271
- // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
12320
+ // The bodyParameters are calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity.
12272
12321
  request.retryPolicy = new ImdsRetryPolicy();
12273
12322
  return request;
12274
12323
  }
@@ -12278,17 +12327,30 @@ class Imds extends BaseManagedIdentitySource {
12278
12327
  * Copyright (c) Microsoft Corporation. All rights reserved.
12279
12328
  * Licensed under the MIT License.
12280
12329
  */
12281
- // MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
12282
12330
  const SERVICE_FABRIC_MSI_API_VERSION = "2019-07-01-preview";
12283
12331
  /**
12284
12332
  * Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ServiceFabricManagedIdentitySource.cs
12285
12333
  */
12286
12334
  class ServiceFabric extends BaseManagedIdentitySource {
12335
+ /**
12336
+ * Constructs a new ServiceFabric managed identity source.
12337
+ * @param logger Logger instance for logging
12338
+ * @param nodeStorage NodeStorage instance for caching
12339
+ * @param networkClient Network client for HTTP requests
12340
+ * @param cryptoProvider Crypto provider for cryptographic operations
12341
+ * @param disableInternalRetries Whether to disable internal retry logic
12342
+ * @param identityEndpoint The Service Fabric managed identity endpoint
12343
+ * @param identityHeader The Service Fabric managed identity secret header
12344
+ */
12287
12345
  constructor(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint, identityHeader) {
12288
12346
  super(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries);
12289
12347
  this.identityEndpoint = identityEndpoint;
12290
12348
  this.identityHeader = identityHeader;
12291
12349
  }
12350
+ /**
12351
+ * Retrieves the environment variables required for Service Fabric managed identity.
12352
+ * @returns An array containing the identity endpoint, identity header, and identity server thumbprint.
12353
+ */
12292
12354
  static getEnvironmentVariables() {
12293
12355
  const identityEndpoint = process.env[ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT];
12294
12356
  const identityHeader = process.env[ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER];
@@ -12296,12 +12358,18 @@ class ServiceFabric extends BaseManagedIdentitySource {
12296
12358
  .IDENTITY_SERVER_THUMBPRINT];
12297
12359
  return [identityEndpoint, identityHeader, identityServerThumbprint];
12298
12360
  }
12361
+ /**
12362
+ * Attempts to create a ServiceFabric managed identity source if all required environment variables are present.
12363
+ * @param logger Logger instance for logging
12364
+ * @param nodeStorage NodeStorage instance for caching
12365
+ * @param networkClient Network client for HTTP requests
12366
+ * @param cryptoProvider Crypto provider for cryptographic operations
12367
+ * @param disableInternalRetries Whether to disable internal retry logic
12368
+ * @param managedIdentityId Managed identity identifier
12369
+ * @returns A ServiceFabric instance if environment variables are set, otherwise null
12370
+ */
12299
12371
  static tryCreate(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, managedIdentityId) {
12300
12372
  const [identityEndpoint, identityHeader, identityServerThumbprint] = ServiceFabric.getEnvironmentVariables();
12301
- /*
12302
- * if either of the identity endpoint, identity header, or identity server thumbprint
12303
- * environment variables are undefined, this MSI provider is unavailable.
12304
- */
12305
12373
  if (!identityEndpoint || !identityHeader || !identityServerThumbprint) {
12306
12374
  logger.info(`[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}', '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' or '${ManagedIdentityEnvironmentVariableNames.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined.`);
12307
12375
  return null;
@@ -12313,12 +12381,19 @@ class ServiceFabric extends BaseManagedIdentitySource {
12313
12381
  }
12314
12382
  return new ServiceFabric(logger, nodeStorage, networkClient, cryptoProvider, disableInternalRetries, identityEndpoint, identityHeader);
12315
12383
  }
12384
+ /**
12385
+ * Creates the request parameters for acquiring a token from the Service Fabric cluster.
12386
+ * @param resource - The resource URI for which the token is requested.
12387
+ * @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
12388
+ * @returns A ManagedIdentityRequestParameters object configured for Service Fabric.
12389
+ */
12316
12390
  createRequest(resource, managedIdentityId) {
12317
12391
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.identityEndpoint);
12318
- request.headers[ML_AND_SF_SECRET_HEADER_NAME] = this.identityHeader;
12319
- request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12392
+ request.headers[ManagedIdentityHeaders.ML_AND_SF_SECRET_HEADER_NAME] =
12393
+ this.identityHeader;
12394
+ request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
12320
12395
  SERVICE_FABRIC_MSI_API_VERSION;
12321
- request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12396
+ request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
12322
12397
  resource;
12323
12398
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12324
12399
  request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType)] = managedIdentityId.id;
@@ -12357,11 +12432,12 @@ class MachineLearning extends BaseManagedIdentitySource {
12357
12432
  }
12358
12433
  createRequest(resource, managedIdentityId) {
12359
12434
  const request = new ManagedIdentityRequestParameters(HttpMethod.GET, this.msiEndpoint);
12360
- request.headers[METADATA_HEADER_NAME] = "true";
12361
- request.headers[ML_AND_SF_SECRET_HEADER_NAME] = this.secret;
12362
- request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
12435
+ request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
12436
+ request.headers[ManagedIdentityHeaders.ML_AND_SF_SECRET_HEADER_NAME] =
12437
+ this.secret;
12438
+ request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
12363
12439
  MACHINE_LEARNING_MSI_API_VERSION;
12364
- request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
12440
+ request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
12365
12441
  resource;
12366
12442
  if (managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED) {
12367
12443
  request.queryParameters[this.getManagedIdentityUserAssignedIdQueryParameterKey(managedIdentityId.idType, false, // isIMDS
@@ -12442,6 +12518,7 @@ class ManagedIdentityClient {
12442
12518
  * Copyright (c) Microsoft Corporation. All rights reserved.
12443
12519
  * Licensed under the MIT License.
12444
12520
  */
12521
+ const SOURCES_THAT_SUPPORT_TOKEN_REVOCATION = [ManagedIdentitySourceNames.SERVICE_FABRIC];
12445
12522
  /**
12446
12523
  * Class to initialize a managed identity and identify the service
12447
12524
  * @public
@@ -12474,6 +12551,7 @@ class ManagedIdentityApplication {
12474
12551
  },
12475
12552
  });
12476
12553
  this.managedIdentityClient = new ManagedIdentityClient(this.logger, ManagedIdentityApplication.nodeStorage, this.networkClient, this.cryptoProvider, this.config.disableInternalRetries);
12554
+ this.hashUtils = new HashUtils();
12477
12555
  }
12478
12556
  /**
12479
12557
  * Acquire an access token from the cache or the managed identity
@@ -12492,28 +12570,60 @@ class ManagedIdentityApplication {
12492
12570
  ],
12493
12571
  authority: this.fakeAuthority.canonicalAuthority,
12494
12572
  correlationId: this.cryptoProvider.createNewGuid(),
12573
+ claims: managedIdentityRequestParams.claims,
12574
+ clientCapabilities: this.config.clientCapabilities,
12495
12575
  };
12496
- if (managedIdentityRequestParams.claims ||
12497
- managedIdentityRequest.forceRefresh) {
12498
- // make a network call to the managed identity source
12499
- return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
12576
+ if (managedIdentityRequest.forceRefresh) {
12577
+ return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
12500
12578
  }
12501
12579
  const [cachedAuthenticationResult, lastCacheOutcome] = await this.fakeClientCredentialClient.getCachedAuthenticationResult(managedIdentityRequest, this.config, this.cryptoProvider, this.fakeAuthority, ManagedIdentityApplication.nodeStorage);
12580
+ /*
12581
+ * Check if claims are present in the managed identity request.
12582
+ * If so, the cached token will not be used.
12583
+ */
12584
+ if (managedIdentityRequest.claims) {
12585
+ const sourceName = this.managedIdentityClient.getManagedIdentitySource();
12586
+ /*
12587
+ * Check if there is a cached token and if the Managed Identity source supports token revocation.
12588
+ * If so, hash the cached access token and add it to the request.
12589
+ */
12590
+ if (cachedAuthenticationResult &&
12591
+ SOURCES_THAT_SUPPORT_TOKEN_REVOCATION.includes(sourceName)) {
12592
+ const revokedTokenSha256Hash = this.hashUtils
12593
+ .sha256(cachedAuthenticationResult.accessToken)
12594
+ .toString(EncodingTypes.HEX);
12595
+ managedIdentityRequest.revokedTokenSha256Hash =
12596
+ revokedTokenSha256Hash;
12597
+ }
12598
+ return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
12599
+ }
12502
12600
  if (cachedAuthenticationResult) {
12503
12601
  // if the token is not expired but must be refreshed; get a new one in the background
12504
12602
  if (lastCacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
12505
12603
  this.logger.info("ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.");
12506
- // make a network call to the managed identity source; refresh the access token in the background
12604
+ // force refresh; will run in the background
12507
12605
  const refreshAccessToken = true;
12508
- await this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority, refreshAccessToken);
12606
+ await this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority, refreshAccessToken);
12509
12607
  }
12510
12608
  return cachedAuthenticationResult;
12511
12609
  }
12512
12610
  else {
12513
- // make a network call to the managed identity source
12514
- return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
12611
+ return this.acquireTokenFromManagedIdentity(managedIdentityRequest, this.config.managedIdentityId, this.fakeAuthority);
12515
12612
  }
12516
12613
  }
12614
+ /**
12615
+ * Acquires a token from a managed identity endpoint.
12616
+ *
12617
+ * @param managedIdentityRequest - The request object containing parameters for the managed identity token request.
12618
+ * @param managedIdentityId - The identifier for the managed identity (e.g., client ID or resource ID).
12619
+ * @param fakeAuthority - A placeholder authority used for the token request.
12620
+ * @param refreshAccessToken - Optional flag indicating whether to force a refresh of the access token.
12621
+ * @returns A promise that resolves to an AuthenticationResult containing the acquired token and related information.
12622
+ */
12623
+ async acquireTokenFromManagedIdentity(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken) {
12624
+ // make a network call to the managed identity
12625
+ return this.managedIdentityClient.sendManagedIdentityTokenRequest(managedIdentityRequest, managedIdentityId, fakeAuthority, refreshAccessToken);
12626
+ }
12517
12627
  /**
12518
12628
  * Determine the Managed Identity Source based on available environment variables. This API is consumed by Azure Identity SDK.
12519
12629
  * @returns ManagedIdentitySourceNames - The Managed Identity source's name