@azure/msal-node 3.8.0 → 5.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +2 -1
  2. package/dist/cache/CacheHelpers.d.ts.map +1 -1
  3. package/dist/cache/CacheHelpers.mjs +4 -5
  4. package/dist/cache/CacheHelpers.mjs.map +1 -1
  5. package/dist/cache/NodeStorage.d.ts.map +1 -1
  6. package/dist/cache/NodeStorage.mjs +17 -18
  7. package/dist/cache/NodeStorage.mjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts.map +1 -1
  9. package/dist/cache/TokenCache.mjs +15 -15
  10. package/dist/cache/TokenCache.mjs.map +1 -1
  11. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  12. package/dist/cache/distributed/DistributedCachePlugin.mjs +3 -3
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  14. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  15. package/dist/cache/serializer/Deserializer.mjs +3 -5
  16. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  17. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  18. package/dist/cache/serializer/Serializer.mjs +1 -3
  19. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  20. package/dist/cache/serializer/SerializerTypes.d.ts +0 -2
  21. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
  22. package/dist/client/ClientApplication.d.ts.map +1 -1
  23. package/dist/client/ClientApplication.mjs +33 -43
  24. package/dist/client/ClientApplication.mjs.map +1 -1
  25. package/dist/client/ClientAssertion.d.ts.map +1 -1
  26. package/dist/client/ClientAssertion.mjs +6 -5
  27. package/dist/client/ClientAssertion.mjs.map +1 -1
  28. package/dist/client/ClientCredentialClient.d.ts +3 -2
  29. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  30. package/dist/client/ClientCredentialClient.mjs +23 -22
  31. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  32. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  33. package/dist/client/ConfidentialClientApplication.mjs +10 -9
  34. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  35. package/dist/client/DeviceCodeClient.d.ts +2 -1
  36. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  37. package/dist/client/DeviceCodeClient.mjs +19 -18
  38. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  39. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  40. package/dist/client/ManagedIdentityApplication.mjs +7 -6
  41. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  42. package/dist/client/ManagedIdentityClient.mjs +1 -1
  43. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  44. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  45. package/dist/client/ManagedIdentitySources/AppService.mjs +3 -3
  46. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  47. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  48. package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
  49. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  50. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  51. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +12 -11
  52. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  53. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  54. package/dist/client/ManagedIdentitySources/CloudShell.mjs +3 -3
  55. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  56. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  57. package/dist/client/ManagedIdentitySources/Imds.mjs +3 -3
  58. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  59. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  60. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +3 -3
  61. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  63. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +4 -4
  64. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  65. package/dist/client/OnBehalfOfClient.d.ts +2 -1
  66. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  67. package/dist/client/OnBehalfOfClient.mjs +19 -19
  68. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  69. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  70. package/dist/client/PublicClientApplication.mjs +12 -27
  71. package/dist/client/PublicClientApplication.mjs.map +1 -1
  72. package/dist/client/UsernamePasswordClient.d.ts +2 -1
  73. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  74. package/dist/client/UsernamePasswordClient.mjs +8 -8
  75. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  76. package/dist/config/Configuration.d.ts +2 -13
  77. package/dist/config/Configuration.d.ts.map +1 -1
  78. package/dist/config/Configuration.mjs +17 -22
  79. package/dist/config/Configuration.mjs.map +1 -1
  80. package/dist/config/ManagedIdentityId.mjs +1 -1
  81. package/dist/config/ManagedIdentityId.mjs.map +1 -1
  82. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  83. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  84. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  85. package/dist/crypto/CryptoProvider.mjs +5 -3
  86. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  87. package/dist/crypto/GuidGenerator.mjs +1 -1
  88. package/dist/crypto/GuidGenerator.mjs.map +1 -1
  89. package/dist/crypto/HashUtils.mjs +1 -1
  90. package/dist/crypto/HashUtils.mjs.map +1 -1
  91. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  92. package/dist/crypto/PkceGenerator.mjs +6 -4
  93. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  94. package/dist/error/ClientAuthErrorCodes.d.ts +8 -0
  95. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
  96. package/dist/error/ClientAuthErrorCodes.mjs +16 -0
  97. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
  98. package/dist/error/ManagedIdentityError.mjs +1 -1
  99. package/dist/error/ManagedIdentityError.mjs.map +1 -1
  100. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  101. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
  102. package/dist/error/NodeAuthError.d.ts +0 -8
  103. package/dist/error/NodeAuthError.d.ts.map +1 -1
  104. package/dist/error/NodeAuthError.mjs +1 -11
  105. package/dist/error/NodeAuthError.mjs.map +1 -1
  106. package/dist/index.d.ts +15 -5
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.mjs +20 -2
  109. package/dist/index.mjs.map +1 -1
  110. package/dist/internals.mjs +1 -1
  111. package/dist/network/HttpClient.d.ts.map +1 -1
  112. package/dist/network/HttpClient.mjs +15 -13
  113. package/dist/network/HttpClient.mjs.map +1 -1
  114. package/dist/network/HttpClientWithRetries.mjs +3 -3
  115. package/dist/network/HttpClientWithRetries.mjs.map +1 -1
  116. package/dist/network/LoopbackClient.d.ts.map +1 -1
  117. package/dist/network/LoopbackClient.mjs +3 -3
  118. package/dist/network/LoopbackClient.mjs.map +1 -1
  119. package/dist/packageMetadata.d.ts +1 -1
  120. package/dist/packageMetadata.d.ts.map +1 -1
  121. package/dist/packageMetadata.mjs +2 -2
  122. package/dist/protocol/Authorize.d.ts.map +1 -1
  123. package/dist/protocol/Authorize.mjs +5 -5
  124. package/dist/protocol/Authorize.mjs.map +1 -1
  125. package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
  126. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  127. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  128. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  129. package/dist/request/ClientCredentialRequest.d.ts +4 -3
  130. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  131. package/dist/request/CommonClientCredentialRequest.d.ts +16 -0
  132. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
  133. package/dist/request/CommonDeviceCodeRequest.d.ts +20 -0
  134. package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  135. package/dist/request/CommonOnBehalfOfRequest.d.ts +14 -0
  136. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  137. package/dist/request/CommonUsernamePasswordRequest.d.ts +18 -0
  138. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  139. package/dist/request/DeviceCodeRequest.d.ts +3 -2
  140. package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
  141. package/dist/request/InteractiveRequest.d.ts +1 -1
  142. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  143. package/dist/request/ManagedIdentityRequest.d.ts +1 -1
  144. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
  145. package/dist/request/OnBehalfOfRequest.d.ts +2 -2
  146. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
  147. package/dist/request/RefreshTokenRequest.d.ts +1 -1
  148. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  149. package/dist/request/SilentFlowRequest.d.ts +1 -1
  150. package/dist/request/SilentFlowRequest.d.ts.map +1 -1
  151. package/dist/request/UsernamePasswordRequest.d.ts +2 -2
  152. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
  153. package/dist/response/ManagedIdentityTokenResponse.d.ts +2 -2
  154. package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  155. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  156. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  157. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +9 -9
  158. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  159. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  160. package/dist/retry/ExponentialRetryStrategy.mjs.map +1 -1
  161. package/dist/retry/IHttpRetryPolicy.d.ts +1 -1
  162. package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -1
  163. package/dist/retry/ImdsRetryPolicy.d.ts +1 -1
  164. package/dist/retry/ImdsRetryPolicy.d.ts.map +1 -1
  165. package/dist/retry/ImdsRetryPolicy.mjs +11 -11
  166. package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
  167. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  168. package/dist/retry/LinearRetryStrategy.mjs.map +1 -1
  169. package/dist/utils/Constants.d.ts +4 -4
  170. package/dist/utils/Constants.mjs +5 -5
  171. package/dist/utils/Constants.mjs.map +1 -1
  172. package/dist/utils/EncodingUtils.d.ts.map +1 -1
  173. package/dist/utils/EncodingUtils.mjs +5 -5
  174. package/dist/utils/EncodingUtils.mjs.map +1 -1
  175. package/dist/utils/NetworkUtils.mjs +1 -1
  176. package/dist/utils/NetworkUtils.mjs.map +1 -1
  177. package/dist/utils/TimeUtils.mjs +1 -1
  178. package/dist/utils/TimeUtils.mjs.map +1 -1
  179. package/lib/msal-node.cjs +1396 -2249
  180. package/lib/msal-node.cjs.map +1 -1
  181. package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
  182. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  183. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  184. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  185. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  186. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  187. package/lib/types/cache/serializer/SerializerTypes.d.ts +0 -2
  188. package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  189. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  190. package/lib/types/client/ClientAssertion.d.ts.map +1 -1
  191. package/lib/types/client/ClientCredentialClient.d.ts +3 -2
  192. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  193. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  194. package/lib/types/client/DeviceCodeClient.d.ts +2 -1
  195. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  196. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  197. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  198. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  199. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  200. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  201. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  202. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  203. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  204. package/lib/types/client/OnBehalfOfClient.d.ts +2 -1
  205. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  206. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  207. package/lib/types/client/UsernamePasswordClient.d.ts +2 -1
  208. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  209. package/lib/types/config/Configuration.d.ts +2 -13
  210. package/lib/types/config/Configuration.d.ts.map +1 -1
  211. package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
  212. package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
  213. package/lib/types/error/ClientAuthErrorCodes.d.ts +8 -0
  214. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
  215. package/lib/types/error/NodeAuthError.d.ts +0 -8
  216. package/lib/types/error/NodeAuthError.d.ts.map +1 -1
  217. package/lib/types/index.d.ts +15 -5
  218. package/lib/types/index.d.ts.map +1 -1
  219. package/lib/types/network/HttpClient.d.ts.map +1 -1
  220. package/lib/types/network/LoopbackClient.d.ts.map +1 -1
  221. package/lib/types/packageMetadata.d.ts +1 -1
  222. package/lib/types/packageMetadata.d.ts.map +1 -1
  223. package/lib/types/protocol/Authorize.d.ts.map +1 -1
  224. package/lib/types/request/AuthorizationCodeRequest.d.ts +1 -1
  225. package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
  226. package/lib/types/request/AuthorizationUrlRequest.d.ts +1 -1
  227. package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
  228. package/lib/types/request/ClientCredentialRequest.d.ts +4 -3
  229. package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
  230. package/lib/types/request/CommonClientCredentialRequest.d.ts +16 -0
  231. package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
  232. package/lib/types/request/CommonDeviceCodeRequest.d.ts +20 -0
  233. package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  234. package/lib/types/request/CommonOnBehalfOfRequest.d.ts +14 -0
  235. package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  236. package/lib/types/request/CommonUsernamePasswordRequest.d.ts +18 -0
  237. package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  238. package/lib/types/request/DeviceCodeRequest.d.ts +3 -2
  239. package/lib/types/request/DeviceCodeRequest.d.ts.map +1 -1
  240. package/lib/types/request/InteractiveRequest.d.ts +1 -1
  241. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  242. package/lib/types/request/ManagedIdentityRequest.d.ts +1 -1
  243. package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
  244. package/lib/types/request/OnBehalfOfRequest.d.ts +2 -2
  245. package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
  246. package/lib/types/request/RefreshTokenRequest.d.ts +1 -1
  247. package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
  248. package/lib/types/request/SilentFlowRequest.d.ts +1 -1
  249. package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
  250. package/lib/types/request/UsernamePasswordRequest.d.ts +2 -2
  251. package/lib/types/request/UsernamePasswordRequest.d.ts.map +1 -1
  252. package/lib/types/response/ManagedIdentityTokenResponse.d.ts +2 -2
  253. package/lib/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  254. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  255. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  256. package/lib/types/retry/IHttpRetryPolicy.d.ts +1 -1
  257. package/lib/types/retry/IHttpRetryPolicy.d.ts.map +1 -1
  258. package/lib/types/retry/ImdsRetryPolicy.d.ts +1 -1
  259. package/lib/types/retry/ImdsRetryPolicy.d.ts.map +1 -1
  260. package/lib/types/utils/Constants.d.ts +4 -4
  261. package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
  262. package/package.json +88 -90
  263. package/src/cache/CacheHelpers.ts +3 -5
  264. package/src/cache/NodeStorage.ts +21 -16
  265. package/src/cache/TokenCache.ts +18 -14
  266. package/src/cache/distributed/DistributedCachePlugin.ts +2 -1
  267. package/src/cache/serializer/Deserializer.ts +7 -9
  268. package/src/cache/serializer/Serializer.ts +0 -2
  269. package/src/cache/serializer/SerializerTypes.ts +0 -2
  270. package/src/client/ClientApplication.ts +50 -57
  271. package/src/client/ClientAssertion.ts +5 -6
  272. package/src/client/ClientCredentialClient.ts +33 -25
  273. package/src/client/ConfidentialClientApplication.ts +13 -13
  274. package/src/client/DeviceCodeClient.ts +32 -19
  275. package/src/client/ManagedIdentityApplication.ts +10 -7
  276. package/src/client/ManagedIdentitySources/AppService.ts +4 -2
  277. package/src/client/ManagedIdentitySources/AzureArc.ts +14 -8
  278. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +18 -9
  279. package/src/client/ManagedIdentitySources/CloudShell.ts +4 -2
  280. package/src/client/ManagedIdentitySources/Imds.ts +4 -2
  281. package/src/client/ManagedIdentitySources/MachineLearning.ts +4 -2
  282. package/src/client/ManagedIdentitySources/ServiceFabric.ts +6 -3
  283. package/src/client/OnBehalfOfClient.ts +28 -21
  284. package/src/client/PublicClientApplication.ts +13 -31
  285. package/src/client/UsernamePasswordClient.ts +15 -8
  286. package/src/config/Configuration.ts +18 -35
  287. package/src/crypto/CryptoProvider.ts +5 -3
  288. package/src/crypto/PkceGenerator.ts +6 -4
  289. package/src/error/ClientAuthErrorCodes.ts +12 -0
  290. package/src/error/NodeAuthError.ts +0 -14
  291. package/src/index.ts +5 -11
  292. package/src/network/HttpClient.ts +11 -9
  293. package/src/network/HttpClientWithRetries.ts +2 -2
  294. package/src/network/LoopbackClient.ts +2 -3
  295. package/src/packageMetadata.ts +1 -1
  296. package/src/protocol/Authorize.ts +7 -9
  297. package/src/request/AuthorizationCodeRequest.ts +0 -1
  298. package/src/request/AuthorizationUrlRequest.ts +0 -1
  299. package/src/request/ClientCredentialRequest.ts +3 -6
  300. package/src/request/CommonClientCredentialRequest.ts +25 -0
  301. package/src/request/CommonDeviceCodeRequest.ts +33 -0
  302. package/src/request/CommonOnBehalfOfRequest.ts +19 -0
  303. package/src/request/CommonUsernamePasswordRequest.ts +23 -0
  304. package/src/request/DeviceCodeRequest.ts +2 -5
  305. package/src/request/InteractiveRequest.ts +1 -1
  306. package/src/request/ManagedIdentityRequest.ts +1 -1
  307. package/src/request/OnBehalfOfRequest.ts +1 -2
  308. package/src/request/RefreshTokenRequest.ts +0 -1
  309. package/src/request/SilentFlowRequest.ts +1 -4
  310. package/src/request/UsernamePasswordRequest.ts +1 -2
  311. package/src/response/ManagedIdentityTokenResponse.ts +2 -2
  312. package/src/retry/DefaultManagedIdentityRetryPolicy.ts +9 -8
  313. package/src/retry/IHttpRetryPolicy.ts +1 -1
  314. package/src/retry/ImdsRetryPolicy.ts +11 -10
  315. package/src/utils/Constants.ts +5 -5
  316. package/src/utils/EncodingUtils.ts +8 -4
@@ -6,19 +6,13 @@
6
6
  import {
7
7
  AccessTokenEntity,
8
8
  AuthenticationResult,
9
- AuthenticationScheme,
10
9
  Authority,
11
10
  BaseClient,
12
11
  CacheManager,
13
- CacheOutcome,
14
12
  ClientAuthErrorCodes,
15
13
  ClientConfiguration,
16
- CommonClientCredentialRequest,
17
14
  Constants,
18
15
  CredentialFilter,
19
- CredentialType,
20
- DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
21
- GrantType,
22
16
  IAppTokenProvider,
23
17
  ICrypto,
24
18
  RequestParameterBuilder,
@@ -35,11 +29,13 @@ import {
35
29
  ClientAssertion,
36
30
  getClientAssertion,
37
31
  UrlUtils,
32
+ StubPerformanceClient,
38
33
  } from "@azure/msal-common/node";
39
34
  import {
40
35
  ManagedIdentityConfiguration,
41
36
  ManagedIdentityNodeConfiguration,
42
37
  } from "../config/Configuration.js";
38
+ import { CommonClientCredentialRequest } from "../request/CommonClientCredentialRequest.js";
43
39
 
44
40
  /**
45
41
  * OAuth2.0 client credential grant
@@ -52,7 +48,7 @@ export class ClientCredentialClient extends BaseClient {
52
48
  configuration: ClientConfiguration,
53
49
  appTokenProvider?: IAppTokenProvider
54
50
  ) {
55
- super(configuration);
51
+ super(configuration, new StubPerformanceClient());
56
52
  this.appTokenProvider = appTokenProvider;
57
53
  }
58
54
 
@@ -79,9 +75,13 @@ export class ClientCredentialClient extends BaseClient {
79
75
 
80
76
  if (cachedAuthenticationResult) {
81
77
  // if the token is not expired but must be refreshed; get a new one in the background
82
- if (lastCacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
78
+ if (
79
+ lastCacheOutcome ===
80
+ Constants.CacheOutcome.PROACTIVELY_REFRESHED
81
+ ) {
83
82
  this.logger.info(
84
- "ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
83
+ "ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
84
+ request.correlationId
85
85
  );
86
86
 
87
87
  // refresh the access token in the background
@@ -110,12 +110,13 @@ export class ClientCredentialClient extends BaseClient {
110
110
  authority: Authority,
111
111
  cacheManager: CacheManager,
112
112
  serverTelemetryManager?: ServerTelemetryManager | null
113
- ): Promise<[AuthenticationResult | null, CacheOutcome]> {
113
+ ): Promise<[AuthenticationResult | null, Constants.CacheOutcome]> {
114
114
  const clientConfiguration = config as ClientConfiguration;
115
115
  const managedIdentityConfiguration =
116
116
  config as ManagedIdentityNodeConfiguration;
117
117
 
118
- let lastCacheOutcome: CacheOutcome = CacheOutcome.NOT_APPLICABLE;
118
+ let lastCacheOutcome: Constants.CacheOutcome =
119
+ Constants.CacheOutcome.NOT_APPLICABLE;
119
120
 
120
121
  // read the user-supplied cache into memory, if applicable
121
122
  let cacheContext;
@@ -154,9 +155,9 @@ export class ClientCredentialClient extends BaseClient {
154
155
  // must refresh due to non-existent access_token
155
156
  if (!cachedAccessToken) {
156
157
  serverTelemetryManager?.setCacheOutcome(
157
- CacheOutcome.NO_CACHED_ACCESS_TOKEN
158
+ Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN
158
159
  );
159
- return [null, CacheOutcome.NO_CACHED_ACCESS_TOKEN];
160
+ return [null, Constants.CacheOutcome.NO_CACHED_ACCESS_TOKEN];
160
161
  }
161
162
 
162
163
  // must refresh due to the expires_in value
@@ -164,13 +165,13 @@ export class ClientCredentialClient extends BaseClient {
164
165
  TimeUtils.isTokenExpired(
165
166
  cachedAccessToken.expiresOn,
166
167
  clientConfiguration.systemOptions?.tokenRenewalOffsetSeconds ||
167
- DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
168
+ Constants.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
168
169
  )
169
170
  ) {
170
171
  serverTelemetryManager?.setCacheOutcome(
171
- CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
172
+ Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
172
173
  );
173
- return [null, CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED];
174
+ return [null, Constants.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED];
174
175
  }
175
176
 
176
177
  // must refresh (in the background) due to the refresh_in value
@@ -178,9 +179,9 @@ export class ClientCredentialClient extends BaseClient {
178
179
  cachedAccessToken.refreshOn &&
179
180
  TimeUtils.isTokenExpired(cachedAccessToken.refreshOn.toString(), 0)
180
181
  ) {
181
- lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
182
+ lastCacheOutcome = Constants.CacheOutcome.PROACTIVELY_REFRESHED;
182
183
  serverTelemetryManager?.setCacheOutcome(
183
- CacheOutcome.PROACTIVELY_REFRESHED
184
+ Constants.CacheOutcome.PROACTIVELY_REFRESHED
184
185
  );
185
186
  }
186
187
 
@@ -196,7 +197,8 @@ export class ClientCredentialClient extends BaseClient {
196
197
  appMetadata: null,
197
198
  },
198
199
  true,
199
- request
200
+ request,
201
+ this.performanceClient
200
202
  ),
201
203
  lastCacheOutcome,
202
204
  ];
@@ -213,10 +215,10 @@ export class ClientCredentialClient extends BaseClient {
213
215
  correlationId: string
214
216
  ): AccessTokenEntity | null {
215
217
  const accessTokenFilter: CredentialFilter = {
216
- homeAccountId: Constants.EMPTY_STRING,
218
+ homeAccountId: "",
217
219
  environment:
218
220
  authority.canonicalAuthorityUrlComponents.HostNameAndPort,
219
- credentialType: CredentialType.ACCESS_TOKEN,
221
+ credentialType: Constants.CredentialType.ACCESS_TOKEN,
220
222
  clientId: id,
221
223
  realm: authority.tenant,
222
224
  target: ScopeSet.createSearchScopes(scopeSet.asArray()),
@@ -250,7 +252,10 @@ export class ClientCredentialClient extends BaseClient {
250
252
  let reqTimestamp: number;
251
253
 
252
254
  if (this.appTokenProvider) {
253
- this.logger.info("Using appTokenProvider extensibility.");
255
+ this.logger.info(
256
+ "Using appTokenProvider extensibility.",
257
+ request.correlationId
258
+ );
254
259
 
255
260
  const appTokenPropviderParameters = {
256
261
  correlationId: request.correlationId,
@@ -268,7 +273,7 @@ export class ClientCredentialClient extends BaseClient {
268
273
  access_token: appTokenProviderResult.accessToken,
269
274
  expires_in: appTokenProviderResult.expiresInSeconds,
270
275
  refresh_in: appTokenProviderResult.refreshInSeconds,
271
- token_type: AuthenticationScheme.BEARER,
276
+ token_type: Constants.AuthenticationScheme.BEARER,
272
277
  };
273
278
  } else {
274
279
  const queryParametersString =
@@ -294,7 +299,8 @@ export class ClientCredentialClient extends BaseClient {
294
299
  };
295
300
 
296
301
  this.logger.info(
297
- "Sending token request to endpoint: " + authority.tokenEndpoint
302
+ "Sending token request to endpoint: " + authority.tokenEndpoint,
303
+ request.correlationId
298
304
  );
299
305
 
300
306
  reqTimestamp = TimeUtils.nowSeconds();
@@ -315,12 +321,14 @@ export class ClientCredentialClient extends BaseClient {
315
321
  this.cacheManager,
316
322
  this.cryptoUtils,
317
323
  this.logger,
324
+ this.performanceClient,
318
325
  this.config.serializableCache,
319
326
  this.config.persistencePlugin
320
327
  );
321
328
 
322
329
  responseHandler.validateTokenResponse(
323
330
  serverTokenResponse,
331
+ request.correlationId,
324
332
  refreshAccessToken
325
333
  );
326
334
 
@@ -352,7 +360,7 @@ export class ClientCredentialClient extends BaseClient {
352
360
 
353
361
  RequestParameterBuilder.addGrantType(
354
362
  parameters,
355
- GrantType.CLIENT_CREDENTIALS_GRANT
363
+ Constants.GrantType.CLIENT_CREDENTIALS_GRANT
356
364
  );
357
365
 
358
366
  RequestParameterBuilder.addLibraryInfo(
@@ -15,26 +15,25 @@ import {
15
15
  MSAL_FORCE_REGION,
16
16
  } from "../utils/Constants.js";
17
17
  import {
18
- CommonClientCredentialRequest,
19
- CommonOnBehalfOfRequest,
20
18
  AuthenticationResult,
21
19
  AzureRegionConfiguration,
22
20
  AuthError,
23
21
  IAppTokenProvider,
24
- OIDC_DEFAULT_SCOPES,
22
+ Constants,
25
23
  UrlString,
26
- AADAuthorityConstants,
27
24
  createClientAuthError,
28
- ClientAuthErrorCodes,
29
25
  ClientAssertion as ClientAssertionType,
30
26
  getClientAssertion,
31
27
  AzureRegion,
32
28
  } from "@azure/msal-common/node";
33
29
  import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
34
30
  import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
31
+ import { CommonOnBehalfOfRequest } from "../request/CommonOnBehalfOfRequest.js";
32
+ import { CommonClientCredentialRequest } from "../request/CommonClientCredentialRequest.js";
35
33
  import { ClientCredentialRequest } from "../request/ClientCredentialRequest.js";
36
34
  import { ClientCredentialClient } from "./ClientCredentialClient.js";
37
35
  import { OnBehalfOfClient } from "./OnBehalfOfClient.js";
36
+ import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
38
37
 
39
38
  /**
40
39
  * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
@@ -91,7 +90,7 @@ export class ConfidentialClientApplication
91
90
  (clientSecretNotEmpty && certificateNotEmpty)
92
91
  ) {
93
92
  throw createClientAuthError(
94
- ClientAuthErrorCodes.invalidClientCredential
93
+ NodeClientAuthErrorCodes.invalidClientCredential
95
94
  );
96
95
  }
97
96
 
@@ -108,7 +107,7 @@ export class ConfidentialClientApplication
108
107
 
109
108
  if (!certificateNotEmpty) {
110
109
  throw createClientAuthError(
111
- ClientAuthErrorCodes.invalidClientCredential
110
+ NodeClientAuthErrorCodes.invalidClientCredential
112
111
  );
113
112
  } else {
114
113
  this.clientAssertion = !!this.config.auth.clientCertificate
@@ -146,7 +145,7 @@ export class ConfidentialClientApplication
146
145
  ): Promise<AuthenticationResult | null> {
147
146
  this.logger.info(
148
147
  "acquireTokenByClientCredential called",
149
- request.correlationId
148
+ request.correlationId || ""
150
149
  );
151
150
 
152
151
  // If there is a client assertion present in the request, it overrides the one present in the client configuration
@@ -168,7 +167,8 @@ export class ConfidentialClientApplication
168
167
  const validBaseRequest = {
169
168
  ...baseRequest,
170
169
  scopes: baseRequest.scopes.filter(
171
- (scope: string) => !OIDC_DEFAULT_SCOPES.includes(scope)
170
+ (scope: string) =>
171
+ !Constants.OIDC_DEFAULT_SCOPES.includes(scope)
172
172
  ),
173
173
  };
174
174
 
@@ -185,12 +185,12 @@ export class ConfidentialClientApplication
185
185
  const authority = new UrlString(validRequest.authority);
186
186
  const tenantId = authority.getUrlComponents().PathSegments[0];
187
187
  if (
188
- Object.values(AADAuthorityConstants).includes(
189
- tenantId as AADAuthorityConstants
188
+ Object.values(Constants.AADAuthority).includes(
189
+ tenantId as Constants.AADAuthority
190
190
  )
191
191
  ) {
192
192
  throw createClientAuthError(
193
- ClientAuthErrorCodes.missingTenantIdError
193
+ NodeClientAuthErrorCodes.missingTenantIdError
194
194
  );
195
195
  }
196
196
 
@@ -268,7 +268,7 @@ export class ConfidentialClientApplication
268
268
  ): Promise<AuthenticationResult | null> {
269
269
  this.logger.info(
270
270
  "acquireTokenOnBehalfOf called",
271
- request.correlationId
271
+ request.correlationId || ""
272
272
  );
273
273
  const validRequest: CommonOnBehalfOfRequest = {
274
274
  ...request,
@@ -7,12 +7,8 @@ import {
7
7
  AuthErrorCodes,
8
8
  AuthenticationResult,
9
9
  BaseClient,
10
- ClientAuthErrorCodes,
11
10
  ClientConfiguration,
12
- CommonDeviceCodeRequest,
13
- Constants,
14
11
  DeviceCodeResponse,
15
- GrantType,
16
12
  RequestParameterBuilder,
17
13
  RequestThumbprint,
18
14
  ResponseHandler,
@@ -24,7 +20,11 @@ import {
24
20
  UrlUtils,
25
21
  createAuthError,
26
22
  createClientAuthError,
23
+ Constants,
24
+ StubPerformanceClient,
27
25
  } from "@azure/msal-common/node";
26
+ import { CommonDeviceCodeRequest } from "../request/CommonDeviceCodeRequest.js";
27
+ import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
28
28
 
29
29
  /**
30
30
  * OAuth2.0 Device code client
@@ -32,7 +32,7 @@ import {
32
32
  */
33
33
  export class DeviceCodeClient extends BaseClient {
34
34
  constructor(configuration: ClientConfiguration) {
35
- super(configuration);
35
+ super(configuration, new StubPerformanceClient());
36
36
  }
37
37
 
38
38
  /**
@@ -56,12 +56,13 @@ export class DeviceCodeClient extends BaseClient {
56
56
  this.cacheManager,
57
57
  this.cryptoUtils,
58
58
  this.logger,
59
+ this.performanceClient,
59
60
  this.config.serializableCache,
60
61
  this.config.persistencePlugin
61
62
  );
62
63
 
63
64
  // Validate response. This function throws a server error if an error is returned by the server.
64
- responseHandler.validateTokenResponse(response);
65
+ responseHandler.validateTokenResponse(response, request.correlationId);
65
66
  return responseHandler.handleServerTokenResponse(
66
67
  response,
67
68
  this.authority,
@@ -216,10 +217,11 @@ export class DeviceCodeClient extends BaseClient {
216
217
  ): boolean {
217
218
  if (userSpecifiedCancelFlag) {
218
219
  this.logger.error(
219
- "Token request cancelled by setting DeviceCodeRequest.cancel = true"
220
+ "Token request cancelled by setting DeviceCodeRequest.cancel = true",
221
+ ""
220
222
  );
221
223
  throw createClientAuthError(
222
- ClientAuthErrorCodes.deviceCodePollingCancelled
224
+ NodeClientAuthErrorCodes.deviceCodePollingCancelled
223
225
  );
224
226
  } else if (
225
227
  userSpecifiedTimeout &&
@@ -227,21 +229,26 @@ export class DeviceCodeClient extends BaseClient {
227
229
  TimeUtils.nowSeconds() > userSpecifiedTimeout
228
230
  ) {
229
231
  this.logger.error(
230
- `User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`
232
+ `User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`,
233
+ ""
231
234
  );
232
235
  throw createClientAuthError(
233
- ClientAuthErrorCodes.userTimeoutReached
236
+ NodeClientAuthErrorCodes.userTimeoutReached
234
237
  );
235
238
  } else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {
236
239
  if (userSpecifiedTimeout) {
237
240
  this.logger.verbose(
238
- `User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`
241
+ `User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`,
242
+ ""
239
243
  );
240
244
  }
241
245
  this.logger.error(
242
- `Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`
246
+ `Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`,
247
+ ""
248
+ );
249
+ throw createClientAuthError(
250
+ NodeClientAuthErrorCodes.deviceCodeExpired
243
251
  );
244
- throw createClientAuthError(ClientAuthErrorCodes.deviceCodeExpired);
245
252
  }
246
253
  return true;
247
254
  }
@@ -308,13 +315,15 @@ export class DeviceCodeClient extends BaseClient {
308
315
  // user authorization is pending. Sleep for polling interval and try again
309
316
  if (response.body.error === Constants.AUTHORIZATION_PENDING) {
310
317
  this.logger.info(
311
- "Authorization pending. Continue polling."
318
+ "Authorization pending. Continue polling.",
319
+ request.correlationId
312
320
  );
313
321
  await TimeUtils.delay(pollingIntervalMilli);
314
322
  } else {
315
323
  // for any other error, throw
316
324
  this.logger.info(
317
- "Unexpected error in polling from the server"
325
+ "Unexpected error in polling from the server",
326
+ request.correlationId
318
327
  );
319
328
  throw createAuthError(
320
329
  AuthErrorCodes.postRequestFailed,
@@ -323,7 +332,8 @@ export class DeviceCodeClient extends BaseClient {
323
332
  }
324
333
  } else {
325
334
  this.logger.verbose(
326
- "Authorization completed successfully. Polling stopped."
335
+ "Authorization completed successfully. Polling stopped.",
336
+ request.correlationId
327
337
  );
328
338
  return response.body;
329
339
  }
@@ -333,9 +343,12 @@ export class DeviceCodeClient extends BaseClient {
333
343
  * The above code should've thrown by this point, but to satisfy TypeScript,
334
344
  * and in the rare case the conditionals in continuePolling() may not catch everything...
335
345
  */
336
- this.logger.error("Polling stopped for unknown reasons.");
346
+ this.logger.error(
347
+ "Polling stopped for unknown reasons.",
348
+ request.correlationId
349
+ );
337
350
  throw createClientAuthError(
338
- ClientAuthErrorCodes.deviceCodeUnknownError
351
+ NodeClientAuthErrorCodes.deviceCodeUnknownError
339
352
  );
340
353
  }
341
354
 
@@ -357,7 +370,7 @@ export class DeviceCodeClient extends BaseClient {
357
370
  );
358
371
  RequestParameterBuilder.addGrantType(
359
372
  parameters,
360
- GrantType.DEVICE_CODE_GRANT
373
+ Constants.GrantType.DEVICE_CODE_GRANT
361
374
  );
362
375
  RequestParameterBuilder.addDeviceCode(
363
376
  parameters,
@@ -7,9 +7,7 @@ import {
7
7
  AuthOptions,
8
8
  Authority,
9
9
  AuthorityOptions,
10
- CacheOutcome,
11
10
  ClientConfiguration,
12
- Constants,
13
11
  DEFAULT_CRYPTO_IMPLEMENTATION,
14
12
  INetworkModule,
15
13
  Logger,
@@ -18,7 +16,8 @@ import {
18
16
  AuthenticationResult,
19
17
  createClientConfigurationError,
20
18
  ClientConfigurationErrorCodes,
21
- EncodingTypes,
19
+ Constants,
20
+ StubPerformanceClient,
22
21
  } from "@azure/msal-common/node";
23
22
  import {
24
23
  ManagedIdentityConfiguration,
@@ -104,7 +103,7 @@ export class ManagedIdentityApplication {
104
103
  fakeAuthorityOptions,
105
104
  this.logger,
106
105
  this.cryptoProvider.createNewGuid(), // correlationID
107
- undefined,
106
+ new StubPerformanceClient(),
108
107
  true
109
108
  );
110
109
 
@@ -190,7 +189,7 @@ export class ManagedIdentityApplication {
190
189
  ) {
191
190
  const revokedTokenSha256Hash: string = this.hashUtils
192
191
  .sha256(cachedAuthenticationResult.accessToken)
193
- .toString(EncodingTypes.HEX);
192
+ .toString(Constants.EncodingTypes.HEX);
194
193
  managedIdentityRequest.revokedTokenSha256Hash =
195
194
  revokedTokenSha256Hash;
196
195
  }
@@ -204,9 +203,13 @@ export class ManagedIdentityApplication {
204
203
 
205
204
  if (cachedAuthenticationResult) {
206
205
  // if the token is not expired but must be refreshed; get a new one in the background
207
- if (lastCacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
206
+ if (
207
+ lastCacheOutcome ===
208
+ Constants.CacheOutcome.PROACTIVELY_REFRESHED
209
+ ) {
208
210
  this.logger.info(
209
- "ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
211
+ "ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
212
+ managedIdentityRequest.correlationId
210
213
  );
211
214
 
212
215
  // force refresh; will run in the background
@@ -75,7 +75,8 @@ export class AppService extends BaseManagedIdentitySource {
75
75
  // if either of the identity endpoint or identity header variables are undefined, this MSI provider is unavailable.
76
76
  if (!identityEndpoint || !identityHeader) {
77
77
  logger.info(
78
- `[Managed Identity] ${ManagedIdentitySourceNames.APP_SERVICE} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}' and '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' environment variables are not defined.`
78
+ `[Managed Identity] ${ManagedIdentitySourceNames.APP_SERVICE} managed identity is unavailable because one or both of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}' and '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' environment variables are not defined.`,
79
+ ""
79
80
  );
80
81
  return null;
81
82
  }
@@ -89,7 +90,8 @@ export class AppService extends BaseManagedIdentitySource {
89
90
  );
90
91
 
91
92
  logger.info(
92
- `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.APP_SERVICE} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.APP_SERVICE} managed identity.`
93
+ `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.APP_SERVICE} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.APP_SERVICE} managed identity.`,
94
+ ""
93
95
  );
94
96
 
95
97
  return new AppService(
@@ -7,13 +7,12 @@ import {
7
7
  AuthError,
8
8
  ClientAuthErrorCodes,
9
9
  createClientAuthError,
10
- HttpStatus,
11
10
  INetworkModule,
12
11
  NetworkResponse,
13
12
  NetworkRequestOptions,
14
13
  Logger,
15
14
  ServerAuthorizationTokenResponse,
16
- EncodingTypes,
15
+ Constants,
17
16
  } from "@azure/msal-common/node";
18
17
  import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
19
18
  import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource.js";
@@ -137,7 +136,8 @@ export class AzureArc extends BaseManagedIdentitySource {
137
136
  // if either of the identity or imds endpoints are undefined (even after himds file detection)
138
137
  if (!identityEndpoint || !imdsEndpoint) {
139
138
  logger.info(
140
- `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection.`
139
+ `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is unavailable through environment variables because one or both of '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' and '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' are not defined. ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is also unavailable through file detection.`,
140
+ ""
141
141
  );
142
142
 
143
143
  return null;
@@ -146,7 +146,8 @@ export class AzureArc extends BaseManagedIdentitySource {
146
146
  // check if the imds endpoint is set to the default for file detection
147
147
  if (imdsEndpoint === HIMDS_EXECUTABLE_HELPER_STRING) {
148
148
  logger.info(
149
- `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
149
+ `[Managed Identity] ${ManagedIdentitySourceNames.AZURE_ARC} managed identity is available through file detection. Defaulting to known ${ManagedIdentitySourceNames.AZURE_ARC} endpoint: ${DEFAULT_AZURE_ARC_IDENTITY_ENDPOINT}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`,
150
+ ""
150
151
  );
151
152
  } else {
152
153
  // otherwise, both the identity and imds endpoints are defined without file detection; validate them
@@ -171,7 +172,8 @@ export class AzureArc extends BaseManagedIdentitySource {
171
172
  );
172
173
 
173
174
  logger.info(
174
- `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`
175
+ `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.AZURE_ARC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.AZURE_ARC} managed identity.`,
176
+ ""
175
177
  );
176
178
  }
177
179
 
@@ -222,7 +224,7 @@ export class AzureArc extends BaseManagedIdentitySource {
222
224
  | NetworkResponse<ManagedIdentityTokenResponse>
223
225
  | undefined;
224
226
 
225
- if (originalResponse.status === HttpStatus.UNAUTHORIZED) {
227
+ if (originalResponse.status === Constants.HTTP_UNAUTHORIZED) {
226
228
  const wwwAuthHeader: string =
227
229
  originalResponse.headers["www-authenticate"];
228
230
  if (!wwwAuthHeader) {
@@ -291,7 +293,10 @@ export class AzureArc extends BaseManagedIdentitySource {
291
293
  // attempt to read the contents of the secret file
292
294
  let secret;
293
295
  try {
294
- secret = readFileSync(secretFilePath, EncodingTypes.UTF8);
296
+ secret = readFileSync(
297
+ secretFilePath,
298
+ Constants.EncodingTypes.UTF8
299
+ );
295
300
  } catch (e) {
296
301
  throw createManagedIdentityError(
297
302
  ManagedIdentityErrorCodes.unableToReadSecretFile
@@ -300,7 +305,8 @@ export class AzureArc extends BaseManagedIdentitySource {
300
305
  const authHeaderValue = `Basic ${secret}`;
301
306
 
302
307
  this.logger.info(
303
- `[Managed Identity] Adding authorization header to the request.`
308
+ `[Managed Identity] Adding authorization header to the request.`,
309
+ ""
304
310
  );
305
311
  networkRequest.headers[
306
312
  ManagedIdentityHeaders.AUTHORIZATION_HEADER_NAME
@@ -7,8 +7,6 @@ import {
7
7
  AuthError,
8
8
  Authority,
9
9
  ClientAuthErrorCodes,
10
- Constants,
11
- HeaderNames,
12
10
  INetworkModule,
13
11
  Logger,
14
12
  NetworkRequestOptions,
@@ -19,6 +17,8 @@ import {
19
17
  createClientAuthError,
20
18
  AuthenticationResult,
21
19
  UrlString,
20
+ Constants,
21
+ StubPerformanceClient,
22
22
  } from "@azure/msal-common/node";
23
23
  import { ManagedIdentityId } from "../../config/ManagedIdentityId.js";
24
24
  import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
@@ -152,7 +152,8 @@ export abstract class BaseManagedIdentitySource {
152
152
 
153
153
  if (managedIdentityRequest.revokedTokenSha256Hash) {
154
154
  this.logger.info(
155
- `[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`
155
+ `[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`,
156
+ ""
156
157
  );
157
158
 
158
159
  networkRequest.queryParameters[
@@ -165,7 +166,8 @@ export abstract class BaseManagedIdentitySource {
165
166
  managedIdentityRequest.clientCapabilities.toString();
166
167
 
167
168
  this.logger.info(
168
- `[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`
169
+ `[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`,
170
+ ""
169
171
  );
170
172
 
171
173
  networkRequest.queryParameters[
@@ -174,7 +176,8 @@ export abstract class BaseManagedIdentitySource {
174
176
  }
175
177
 
176
178
  const headers: Record<string, string> = networkRequest.headers;
177
- headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
179
+ headers[Constants.HeaderNames.CONTENT_TYPE] =
180
+ Constants.URL_FORM_CONTENT_TYPE;
178
181
 
179
182
  const networkRequestOptions: NetworkRequestOptions = { headers };
180
183
 
@@ -227,6 +230,7 @@ export abstract class BaseManagedIdentitySource {
227
230
  this.nodeStorage,
228
231
  this.cryptoProvider,
229
232
  this.logger,
233
+ new StubPerformanceClient(),
230
234
  null,
231
235
  null
232
236
  );
@@ -241,6 +245,7 @@ export abstract class BaseManagedIdentitySource {
241
245
 
242
246
  responseHandler.validateTokenResponse(
243
247
  serverTokenResponse,
248
+ serverTokenResponse.correlation_id || "",
244
249
  refreshAccessToken
245
250
  );
246
251
 
@@ -263,7 +268,8 @@ export abstract class BaseManagedIdentitySource {
263
268
  this.logger.info(
264
269
  `[Managed Identity] [API version ${
265
270
  usesApi2017 ? "2017+" : "2019+"
266
- }] Adding user assigned client id to the request.`
271
+ }] Adding user assigned client id to the request.`,
272
+ ""
267
273
  );
268
274
  // The Machine Learning source uses the 2017-09-01 API version, which uses "clientid" instead of "client_id"
269
275
  return usesApi2017
@@ -272,7 +278,8 @@ export abstract class BaseManagedIdentitySource {
272
278
 
273
279
  case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
274
280
  this.logger.info(
275
- "[Managed Identity] Adding user assigned resource id to the request."
281
+ "[Managed Identity] Adding user assigned resource id to the request.",
282
+ ""
276
283
  );
277
284
  return isImds
278
285
  ? ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_RESOURCE_ID_IMDS
@@ -280,7 +287,8 @@ export abstract class BaseManagedIdentitySource {
280
287
 
281
288
  case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
282
289
  this.logger.info(
283
- "[Managed Identity] Adding user assigned object id to the request."
290
+ "[Managed Identity] Adding user assigned object id to the request.",
291
+ ""
284
292
  );
285
293
  return ManagedIdentityUserAssignedIdQueryParameterNames.MANAGED_IDENTITY_OBJECT_ID;
286
294
  default:
@@ -300,7 +308,8 @@ export abstract class BaseManagedIdentitySource {
300
308
  return new UrlString(envVariable).urlString;
301
309
  } catch (error) {
302
310
  logger.info(
303
- `[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed.`
311
+ `[Managed Identity] ${sourceName} managed identity is unavailable because the '${envVariableStringName}' environment variable is malformed.`,
312
+ ""
304
313
  );
305
314
 
306
315
  throw createManagedIdentityError(