@azure/identity 4.14.0-beta.1 → 4.14.0-beta.3

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 (571) hide show
  1. package/README.md +4 -40
  2. package/dist/browser/client/identityClient.d.ts +5 -4
  3. package/dist/browser/client/identityClient.d.ts.map +1 -1
  4. package/dist/browser/client/identityClient.js +56 -18
  5. package/dist/browser/client/identityClient.js.map +1 -1
  6. package/dist/browser/constants.d.ts +1 -1
  7. package/dist/browser/constants.js +1 -1
  8. package/dist/browser/constants.js.map +1 -1
  9. package/dist/browser/credentials/authorizationCodeCredential.d.ts +3 -3
  10. package/dist/browser/credentials/authorizationCodeCredential.d.ts.map +1 -0
  11. package/dist/browser/credentials/authorizationCodeCredential.js +2 -2
  12. package/dist/browser/credentials/authorizationCodeCredential.js.map +1 -0
  13. package/dist/browser/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  14. package/dist/browser/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  15. package/dist/browser/credentials/azureCliCredential.d.ts +5 -4
  16. package/dist/browser/credentials/azureCliCredential.d.ts.map +1 -0
  17. package/dist/browser/credentials/azureCliCredential.js +3 -3
  18. package/dist/browser/credentials/azureCliCredential.js.map +1 -0
  19. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +5 -4
  20. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts.map +1 -0
  21. package/dist/browser/credentials/azureDeveloperCliCredential.js +3 -3
  22. package/dist/browser/credentials/azureDeveloperCliCredential.js.map +1 -0
  23. package/dist/browser/credentials/azurePipelinesCredential.d.ts +5 -4
  24. package/dist/browser/credentials/azurePipelinesCredential.d.ts.map +1 -0
  25. package/dist/browser/credentials/azurePipelinesCredential.js +3 -3
  26. package/dist/browser/credentials/azurePipelinesCredential.js.map +1 -0
  27. package/dist/browser/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  28. package/dist/browser/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  29. package/dist/browser/credentials/azurePowerShellCredential.d.ts +5 -4
  30. package/dist/browser/credentials/azurePowerShellCredential.d.ts.map +1 -0
  31. package/dist/browser/credentials/azurePowerShellCredential.js +3 -3
  32. package/dist/browser/credentials/azurePowerShellCredential.js.map +1 -0
  33. package/dist/browser/credentials/brokerCredential.d.ts +2 -2
  34. package/dist/browser/credentials/brokerCredential.d.ts.map +1 -1
  35. package/dist/browser/credentials/brokerCredential.js +0 -1
  36. package/dist/browser/credentials/brokerCredential.js.map +1 -1
  37. package/dist/browser/credentials/clientAssertionCredential.d.ts +5 -4
  38. package/dist/browser/credentials/clientAssertionCredential.d.ts.map +1 -0
  39. package/dist/browser/credentials/clientAssertionCredential.js +3 -3
  40. package/dist/browser/credentials/clientAssertionCredential.js.map +1 -0
  41. package/dist/browser/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  42. package/dist/browser/credentials/clientAssertionCredentialOptions.js.map +1 -1
  43. package/dist/browser/credentials/clientCertificateCredential.d.ts +6 -4
  44. package/dist/browser/credentials/clientCertificateCredential.d.ts.map +1 -0
  45. package/dist/browser/credentials/clientCertificateCredential.js +3 -3
  46. package/dist/browser/credentials/clientCertificateCredential.js.map +1 -0
  47. package/dist/browser/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  48. package/dist/browser/credentials/clientCertificateCredentialOptions.js.map +1 -1
  49. package/dist/browser/credentials/clientSecretCredential.d.ts +1 -1
  50. package/dist/browser/credentials/clientSecretCredential.d.ts.map +1 -0
  51. package/dist/browser/credentials/clientSecretCredential.js +1 -1
  52. package/dist/browser/credentials/clientSecretCredential.js.map +1 -0
  53. package/dist/browser/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  54. package/dist/browser/credentials/clientSecretCredentialOptions.js.map +1 -1
  55. package/dist/browser/credentials/defaultAzureCredential.d.ts +3 -3
  56. package/dist/browser/credentials/defaultAzureCredential.d.ts.map +1 -0
  57. package/dist/browser/credentials/defaultAzureCredential.js +2 -2
  58. package/dist/browser/credentials/defaultAzureCredential.js.map +1 -0
  59. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  60. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  61. package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
  62. package/dist/browser/credentials/deviceCodeCredential.d.ts +5 -4
  63. package/dist/browser/credentials/deviceCodeCredential.d.ts.map +1 -0
  64. package/dist/browser/credentials/deviceCodeCredential.js +3 -3
  65. package/dist/browser/credentials/deviceCodeCredential.js.map +1 -0
  66. package/dist/browser/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  67. package/dist/browser/credentials/deviceCodeCredentialOptions.js.map +1 -1
  68. package/dist/browser/credentials/environmentCredential.d.ts +5 -4
  69. package/dist/browser/credentials/environmentCredential.d.ts.map +1 -0
  70. package/dist/browser/credentials/environmentCredential.js +3 -3
  71. package/dist/browser/credentials/environmentCredential.js.map +1 -0
  72. package/dist/browser/credentials/environmentCredentialOptions.d.ts.map +1 -1
  73. package/dist/browser/credentials/environmentCredentialOptions.js.map +1 -1
  74. package/dist/browser/credentials/interactiveBrowserCredential.d.ts +1 -1
  75. package/dist/browser/credentials/interactiveBrowserCredential.d.ts.map +1 -0
  76. package/dist/browser/credentials/interactiveBrowserCredential.js +1 -1
  77. package/dist/browser/credentials/interactiveBrowserCredential.js.map +1 -0
  78. package/dist/browser/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  79. package/dist/browser/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  80. package/dist/browser/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  81. package/dist/browser/credentials/interactiveCredentialOptions.js.map +1 -1
  82. package/dist/browser/credentials/managedIdentityCredential/index.d.ts +9 -4
  83. package/dist/browser/credentials/managedIdentityCredential/index.d.ts.map +1 -0
  84. package/dist/browser/credentials/managedIdentityCredential/index.js +3 -3
  85. package/dist/browser/credentials/managedIdentityCredential/index.js.map +1 -0
  86. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  87. package/dist/browser/credentials/onBehalfOfCredential.d.ts +5 -4
  88. package/dist/browser/credentials/onBehalfOfCredential.d.ts.map +1 -0
  89. package/dist/browser/credentials/onBehalfOfCredential.js +3 -3
  90. package/dist/browser/credentials/onBehalfOfCredential.js.map +1 -0
  91. package/dist/browser/credentials/usernamePasswordCredential.d.ts +1 -1
  92. package/dist/browser/credentials/usernamePasswordCredential.d.ts.map +1 -0
  93. package/dist/browser/credentials/usernamePasswordCredential.js +1 -1
  94. package/dist/browser/credentials/usernamePasswordCredential.js.map +1 -0
  95. package/dist/browser/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  96. package/dist/browser/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  97. package/dist/browser/credentials/visualStudioCodeCredential.d.ts +5 -4
  98. package/dist/browser/credentials/visualStudioCodeCredential.d.ts.map +1 -0
  99. package/dist/browser/credentials/visualStudioCodeCredential.js +3 -3
  100. package/dist/browser/credentials/visualStudioCodeCredential.js.map +1 -0
  101. package/dist/browser/credentials/workloadIdentityCredential.d.ts +5 -4
  102. package/dist/browser/credentials/workloadIdentityCredential.d.ts.map +1 -0
  103. package/dist/browser/credentials/workloadIdentityCredential.js +3 -3
  104. package/dist/browser/credentials/workloadIdentityCredential.js.map +1 -0
  105. package/dist/browser/credentials/workloadIdentityCredentialOptions.d.ts +2 -2
  106. package/dist/browser/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  107. package/dist/browser/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  108. package/dist/browser/index.d.ts +33 -33
  109. package/dist/browser/index.d.ts.map +1 -1
  110. package/dist/browser/index.js.map +1 -1
  111. package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  112. package/dist/browser/msal/browserFlows/msalBrowserCommon.js +2 -3
  113. package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  114. package/dist/browser/msal/msal.d.ts +2 -3
  115. package/dist/browser/msal/msal.d.ts.map +1 -0
  116. package/dist/browser/msal/msal.js +2 -3
  117. package/dist/browser/msal/msal.js.map +1 -0
  118. package/dist/browser/msal/nodeFlows/msalClient.d.ts +14 -8
  119. package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +1 -1
  120. package/dist/browser/msal/nodeFlows/msalClient.js +6 -6
  121. package/dist/browser/msal/nodeFlows/msalClient.js.map +1 -1
  122. package/dist/browser/msal/utils.d.ts +5 -13
  123. package/dist/browser/msal/utils.d.ts.map +1 -1
  124. package/dist/browser/msal/utils.js +12 -25
  125. package/dist/browser/msal/utils.js.map +1 -1
  126. package/dist/browser/plugins/consumer.d.ts +1 -1
  127. package/dist/browser/plugins/consumer.d.ts.map +1 -0
  128. package/dist/browser/plugins/consumer.js +1 -1
  129. package/dist/browser/plugins/consumer.js.map +1 -0
  130. package/dist/browser/util/authorityHost.d.ts +10 -0
  131. package/dist/browser/util/authorityHost.d.ts.map +1 -0
  132. package/dist/browser/util/authorityHost.js +18 -0
  133. package/dist/browser/util/authorityHost.js.map +1 -0
  134. package/dist/browser/util/processMultiTenantRequest.d.ts +3 -2
  135. package/dist/browser/util/processMultiTenantRequest.d.ts.map +1 -0
  136. package/dist/browser/util/processMultiTenantRequest.js +2 -2
  137. package/dist/browser/util/processMultiTenantRequest.js.map +1 -0
  138. package/dist/commonjs/client/identityClient.d.ts +5 -4
  139. package/dist/commonjs/client/identityClient.d.ts.map +1 -1
  140. package/dist/commonjs/client/identityClient.js +295 -252
  141. package/dist/commonjs/client/identityClient.js.map +7 -1
  142. package/dist/commonjs/constants.d.ts +1 -1
  143. package/dist/commonjs/constants.js +61 -78
  144. package/dist/commonjs/constants.js.map +7 -1
  145. package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
  146. package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
  147. package/dist/commonjs/credentials/authorizationCodeCredential.d.ts.map +1 -1
  148. package/dist/commonjs/credentials/authorizationCodeCredential.js +98 -75
  149. package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
  150. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  151. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
  152. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
  153. package/dist/commonjs/credentials/azureCliCredential.js +245 -214
  154. package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
  155. package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
  156. package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
  157. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts +10 -0
  158. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  159. package/dist/commonjs/credentials/azureDeveloperCliCredential.js +237 -202
  160. package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
  161. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
  162. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
  163. package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
  164. package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
  165. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  166. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
  167. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
  168. package/dist/commonjs/credentials/azurePowerShellCredential.js +201 -205
  169. package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
  170. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
  171. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
  172. package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
  173. package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
  174. package/dist/commonjs/credentials/brokerCredential.d.ts +2 -2
  175. package/dist/commonjs/credentials/brokerCredential.d.ts.map +1 -1
  176. package/dist/commonjs/credentials/brokerCredential.js +103 -71
  177. package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
  178. package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
  179. package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
  180. package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
  181. package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
  182. package/dist/commonjs/credentials/clientAssertionCredential.d.ts.map +1 -1
  183. package/dist/commonjs/credentials/clientAssertionCredential.js +101 -64
  184. package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
  185. package/dist/commonjs/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  186. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
  187. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
  188. package/dist/commonjs/credentials/clientCertificateCredential.d.ts.map +1 -1
  189. package/dist/commonjs/credentials/clientCertificateCredential.js +129 -124
  190. package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
  191. package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
  192. package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
  193. package/dist/commonjs/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  194. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
  195. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
  196. package/dist/commonjs/credentials/clientSecretCredential.d.ts.map +1 -1
  197. package/dist/commonjs/credentials/clientSecretCredential.js +96 -68
  198. package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
  199. package/dist/commonjs/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  200. package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
  201. package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
  202. package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
  203. package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
  204. package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
  205. package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
  206. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
  207. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
  208. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  209. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  210. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
  211. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
  212. package/dist/commonjs/credentials/deviceCodeCredential.d.ts.map +1 -1
  213. package/dist/commonjs/credentials/deviceCodeCredential.js +132 -104
  214. package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
  215. package/dist/commonjs/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  216. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
  217. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
  218. package/dist/commonjs/credentials/environmentCredential.js +157 -123
  219. package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
  220. package/dist/commonjs/credentials/environmentCredentialOptions.d.ts.map +1 -1
  221. package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
  222. package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
  223. package/dist/commonjs/credentials/interactiveBrowserCredential.d.ts.map +1 -1
  224. package/dist/commonjs/credentials/interactiveBrowserCredential.js +144 -108
  225. package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
  226. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  227. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
  228. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
  229. package/dist/commonjs/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  230. package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
  231. package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
  232. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
  233. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
  234. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
  235. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
  236. package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
  237. package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
  238. package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
  239. package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
  240. package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
  241. package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
  242. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
  243. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
  244. package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
  245. package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
  246. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
  247. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
  248. package/dist/commonjs/credentials/onBehalfOfCredential.d.ts.map +1 -1
  249. package/dist/commonjs/credentials/onBehalfOfCredential.js +168 -127
  250. package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
  251. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
  252. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
  253. package/dist/commonjs/credentials/usernamePasswordCredential.d.ts.map +1 -1
  254. package/dist/commonjs/credentials/usernamePasswordCredential.js +112 -76
  255. package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
  256. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  257. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
  258. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
  259. package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
  260. package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
  261. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
  262. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
  263. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +16 -5
  264. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +7 -1
  265. package/dist/commonjs/credentials/workloadIdentityCredential.js +284 -274
  266. package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
  267. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.d.ts +2 -2
  268. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  269. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
  270. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
  271. package/dist/commonjs/errors.js +131 -132
  272. package/dist/commonjs/errors.js.map +7 -1
  273. package/dist/commonjs/index.d.ts +33 -33
  274. package/dist/commonjs/index.d.ts.map +1 -1
  275. package/dist/commonjs/index.js +115 -67
  276. package/dist/commonjs/index.js.map +7 -1
  277. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  278. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +226 -249
  279. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +7 -1
  280. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +16 -5
  281. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +7 -1
  282. package/dist/commonjs/msal/credentials.js +16 -5
  283. package/dist/commonjs/msal/credentials.js.map +7 -1
  284. package/dist/commonjs/msal/msal.d.ts +1 -2
  285. package/dist/commonjs/msal/msal.d.ts.map +1 -1
  286. package/dist/commonjs/msal/msal.js +30 -9
  287. package/dist/commonjs/msal/msal.js.map +7 -1
  288. package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
  289. package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
  290. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts +14 -8
  291. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts.map +1 -1
  292. package/dist/commonjs/msal/nodeFlows/msalClient.js +450 -478
  293. package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
  294. package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
  295. package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
  296. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
  297. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
  298. package/dist/commonjs/msal/types.js +16 -5
  299. package/dist/commonjs/msal/types.js.map +7 -1
  300. package/dist/commonjs/msal/utils.d.ts +5 -13
  301. package/dist/commonjs/msal/utils.d.ts.map +1 -1
  302. package/dist/commonjs/msal/utils.js +172 -226
  303. package/dist/commonjs/msal/utils.js.map +7 -1
  304. package/dist/commonjs/plugins/consumer.js +32 -40
  305. package/dist/commonjs/plugins/consumer.js.map +7 -1
  306. package/dist/commonjs/plugins/provider.js +16 -5
  307. package/dist/commonjs/plugins/provider.js.map +7 -1
  308. package/dist/commonjs/regionalAuthority.js +93 -141
  309. package/dist/commonjs/regionalAuthority.js.map +7 -1
  310. package/dist/commonjs/tokenCredentialOptions.js +16 -5
  311. package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
  312. package/dist/commonjs/tokenProvider.js +52 -52
  313. package/dist/commonjs/tokenProvider.js.map +7 -1
  314. package/dist/commonjs/tsdoc-metadata.json +1 -1
  315. package/dist/commonjs/util/authorityHost.d.ts +10 -0
  316. package/dist/commonjs/util/authorityHost.d.ts.map +1 -0
  317. package/dist/commonjs/util/authorityHost.js +36 -0
  318. package/dist/commonjs/util/authorityHost.js.map +7 -0
  319. package/dist/commonjs/util/certificatesUtils.js +54 -45
  320. package/dist/commonjs/util/certificatesUtils.js.map +7 -1
  321. package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
  322. package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
  323. package/dist/commonjs/util/logging.js +91 -97
  324. package/dist/commonjs/util/logging.js.map +7 -1
  325. package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
  326. package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
  327. package/dist/commonjs/util/processUtils.js +60 -35
  328. package/dist/commonjs/util/processUtils.js.map +7 -1
  329. package/dist/commonjs/util/scopeUtils.js +39 -28
  330. package/dist/commonjs/util/scopeUtils.js.map +7 -1
  331. package/dist/commonjs/util/subscriptionUtils.js +35 -17
  332. package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
  333. package/dist/commonjs/util/tenantIdUtils.js +61 -45
  334. package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
  335. package/dist/commonjs/util/tracing.js +33 -16
  336. package/dist/commonjs/util/tracing.js.map +7 -1
  337. package/dist/esm/client/identityClient.d.ts +5 -4
  338. package/dist/esm/client/identityClient.d.ts.map +1 -1
  339. package/dist/esm/client/identityClient.js +56 -18
  340. package/dist/esm/client/identityClient.js.map +1 -1
  341. package/dist/esm/constants.d.ts +1 -1
  342. package/dist/esm/constants.js +1 -1
  343. package/dist/esm/constants.js.map +1 -1
  344. package/dist/esm/credentials/authorizationCodeCredential.d.ts.map +1 -1
  345. package/dist/esm/credentials/authorizationCodeCredential.js +0 -1
  346. package/dist/esm/credentials/authorizationCodeCredential.js.map +1 -1
  347. package/dist/esm/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  348. package/dist/esm/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  349. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts +10 -0
  350. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  351. package/dist/esm/credentials/azureDeveloperCliCredential.js +24 -1
  352. package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
  353. package/dist/esm/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  354. package/dist/esm/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  355. package/dist/esm/credentials/brokerCredential.d.ts +2 -2
  356. package/dist/esm/credentials/brokerCredential.d.ts.map +1 -1
  357. package/dist/esm/credentials/brokerCredential.js +0 -1
  358. package/dist/esm/credentials/brokerCredential.js.map +1 -1
  359. package/dist/esm/credentials/clientAssertionCredential.d.ts.map +1 -1
  360. package/dist/esm/credentials/clientAssertionCredential.js +1 -2
  361. package/dist/esm/credentials/clientAssertionCredential.js.map +1 -1
  362. package/dist/esm/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  363. package/dist/esm/credentials/clientAssertionCredentialOptions.js.map +1 -1
  364. package/dist/esm/credentials/clientCertificateCredential.d.ts.map +1 -1
  365. package/dist/esm/credentials/clientCertificateCredential.js +0 -1
  366. package/dist/esm/credentials/clientCertificateCredential.js.map +1 -1
  367. package/dist/esm/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  368. package/dist/esm/credentials/clientCertificateCredentialOptions.js.map +1 -1
  369. package/dist/esm/credentials/clientSecretCredential.d.ts.map +1 -1
  370. package/dist/esm/credentials/clientSecretCredential.js +0 -1
  371. package/dist/esm/credentials/clientSecretCredential.js.map +1 -1
  372. package/dist/esm/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  373. package/dist/esm/credentials/clientSecretCredentialOptions.js.map +1 -1
  374. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  375. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  376. package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
  377. package/dist/esm/credentials/deviceCodeCredential.d.ts.map +1 -1
  378. package/dist/esm/credentials/deviceCodeCredential.js +0 -1
  379. package/dist/esm/credentials/deviceCodeCredential.js.map +1 -1
  380. package/dist/esm/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  381. package/dist/esm/credentials/deviceCodeCredentialOptions.js.map +1 -1
  382. package/dist/esm/credentials/environmentCredentialOptions.d.ts.map +1 -1
  383. package/dist/esm/credentials/environmentCredentialOptions.js.map +1 -1
  384. package/dist/esm/credentials/interactiveBrowserCredential.d.ts.map +1 -1
  385. package/dist/esm/credentials/interactiveBrowserCredential.js +0 -1
  386. package/dist/esm/credentials/interactiveBrowserCredential.js.map +1 -1
  387. package/dist/esm/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  388. package/dist/esm/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  389. package/dist/esm/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  390. package/dist/esm/credentials/interactiveCredentialOptions.js.map +1 -1
  391. package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  392. package/dist/esm/credentials/onBehalfOfCredential.d.ts.map +1 -1
  393. package/dist/esm/credentials/onBehalfOfCredential.js +0 -1
  394. package/dist/esm/credentials/onBehalfOfCredential.js.map +1 -1
  395. package/dist/esm/credentials/usernamePasswordCredential.d.ts.map +1 -1
  396. package/dist/esm/credentials/usernamePasswordCredential.js +0 -1
  397. package/dist/esm/credentials/usernamePasswordCredential.js.map +1 -1
  398. package/dist/esm/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  399. package/dist/esm/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  400. package/dist/esm/credentials/visualStudioCodeCredential.js.map +1 -1
  401. package/dist/esm/credentials/workloadIdentityCredential.js +3 -3
  402. package/dist/esm/credentials/workloadIdentityCredential.js.map +1 -1
  403. package/dist/esm/credentials/workloadIdentityCredentialOptions.d.ts +2 -2
  404. package/dist/esm/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  405. package/dist/esm/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  406. package/dist/esm/index.d.ts +33 -33
  407. package/dist/esm/index.d.ts.map +1 -1
  408. package/dist/esm/index.js.map +1 -1
  409. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  410. package/dist/esm/msal/browserFlows/msalBrowserCommon.js +2 -3
  411. package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  412. package/dist/esm/msal/msal.d.ts +1 -2
  413. package/dist/esm/msal/msal.d.ts.map +1 -1
  414. package/dist/esm/msal/msal.js +1 -2
  415. package/dist/esm/msal/msal.js.map +1 -1
  416. package/dist/esm/msal/nodeFlows/msalClient.d.ts +14 -8
  417. package/dist/esm/msal/nodeFlows/msalClient.d.ts.map +1 -1
  418. package/dist/esm/msal/nodeFlows/msalClient.js +6 -6
  419. package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
  420. package/dist/esm/msal/utils.d.ts +5 -13
  421. package/dist/esm/msal/utils.d.ts.map +1 -1
  422. package/dist/esm/msal/utils.js +12 -25
  423. package/dist/esm/msal/utils.js.map +1 -1
  424. package/dist/esm/util/authorityHost.d.ts +10 -0
  425. package/dist/esm/util/authorityHost.d.ts.map +1 -0
  426. package/dist/esm/util/authorityHost.js +18 -0
  427. package/dist/esm/util/authorityHost.js.map +1 -0
  428. package/dist/workerd/client/identityClient.d.ts +5 -4
  429. package/dist/workerd/client/identityClient.d.ts.map +1 -1
  430. package/dist/workerd/client/identityClient.js +56 -18
  431. package/dist/workerd/client/identityClient.js.map +1 -1
  432. package/dist/workerd/constants.d.ts +1 -1
  433. package/dist/workerd/constants.js +1 -1
  434. package/dist/workerd/constants.js.map +1 -1
  435. package/dist/workerd/credentials/authorizationCodeCredential.d.ts.map +1 -1
  436. package/dist/workerd/credentials/authorizationCodeCredential.js +0 -1
  437. package/dist/workerd/credentials/authorizationCodeCredential.js.map +1 -1
  438. package/dist/workerd/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  439. package/dist/workerd/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  440. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts +10 -0
  441. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  442. package/dist/workerd/credentials/azureDeveloperCliCredential.js +24 -1
  443. package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
  444. package/dist/workerd/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  445. package/dist/workerd/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  446. package/dist/workerd/credentials/brokerCredential.d.ts +2 -2
  447. package/dist/workerd/credentials/brokerCredential.d.ts.map +1 -1
  448. package/dist/workerd/credentials/brokerCredential.js +0 -1
  449. package/dist/workerd/credentials/brokerCredential.js.map +1 -1
  450. package/dist/workerd/credentials/clientAssertionCredential.d.ts.map +1 -1
  451. package/dist/workerd/credentials/clientAssertionCredential.js +1 -2
  452. package/dist/workerd/credentials/clientAssertionCredential.js.map +1 -1
  453. package/dist/workerd/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  454. package/dist/workerd/credentials/clientAssertionCredentialOptions.js.map +1 -1
  455. package/dist/workerd/credentials/clientCertificateCredential.d.ts.map +1 -1
  456. package/dist/workerd/credentials/clientCertificateCredential.js +0 -1
  457. package/dist/workerd/credentials/clientCertificateCredential.js.map +1 -1
  458. package/dist/workerd/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  459. package/dist/workerd/credentials/clientCertificateCredentialOptions.js.map +1 -1
  460. package/dist/workerd/credentials/clientSecretCredential.d.ts.map +1 -1
  461. package/dist/workerd/credentials/clientSecretCredential.js +0 -1
  462. package/dist/workerd/credentials/clientSecretCredential.js.map +1 -1
  463. package/dist/workerd/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  464. package/dist/workerd/credentials/clientSecretCredentialOptions.js.map +1 -1
  465. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  466. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  467. package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
  468. package/dist/workerd/credentials/deviceCodeCredential.d.ts.map +1 -1
  469. package/dist/workerd/credentials/deviceCodeCredential.js +0 -1
  470. package/dist/workerd/credentials/deviceCodeCredential.js.map +1 -1
  471. package/dist/workerd/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  472. package/dist/workerd/credentials/deviceCodeCredentialOptions.js.map +1 -1
  473. package/dist/workerd/credentials/environmentCredentialOptions.d.ts.map +1 -1
  474. package/dist/workerd/credentials/environmentCredentialOptions.js.map +1 -1
  475. package/dist/workerd/credentials/interactiveBrowserCredential.d.ts.map +1 -1
  476. package/dist/workerd/credentials/interactiveBrowserCredential.js +0 -1
  477. package/dist/workerd/credentials/interactiveBrowserCredential.js.map +1 -1
  478. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  479. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  480. package/dist/workerd/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  481. package/dist/workerd/credentials/interactiveCredentialOptions.js.map +1 -1
  482. package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  483. package/dist/workerd/credentials/onBehalfOfCredential.d.ts.map +1 -1
  484. package/dist/workerd/credentials/onBehalfOfCredential.js +0 -1
  485. package/dist/workerd/credentials/onBehalfOfCredential.js.map +1 -1
  486. package/dist/workerd/credentials/usernamePasswordCredential.d.ts.map +1 -1
  487. package/dist/workerd/credentials/usernamePasswordCredential.js +0 -1
  488. package/dist/workerd/credentials/usernamePasswordCredential.js.map +1 -1
  489. package/dist/workerd/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  490. package/dist/workerd/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  491. package/dist/workerd/credentials/visualStudioCodeCredential.js.map +1 -1
  492. package/dist/workerd/credentials/workloadIdentityCredential.js +3 -3
  493. package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -1
  494. package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts +2 -2
  495. package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  496. package/dist/workerd/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  497. package/dist/workerd/index.d.ts +33 -33
  498. package/dist/workerd/index.d.ts.map +1 -1
  499. package/dist/workerd/index.js.map +1 -1
  500. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  501. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +2 -3
  502. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  503. package/dist/workerd/msal/msal.d.ts +1 -2
  504. package/dist/workerd/msal/msal.d.ts.map +1 -1
  505. package/dist/workerd/msal/msal.js +1 -2
  506. package/dist/workerd/msal/msal.js.map +1 -1
  507. package/dist/workerd/msal/nodeFlows/msalClient.d.ts +14 -8
  508. package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -1
  509. package/dist/workerd/msal/nodeFlows/msalClient.js +6 -6
  510. package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
  511. package/dist/workerd/msal/utils.d.ts +5 -13
  512. package/dist/workerd/msal/utils.d.ts.map +1 -1
  513. package/dist/workerd/msal/utils.js +12 -25
  514. package/dist/workerd/msal/utils.js.map +1 -1
  515. package/dist/workerd/util/authorityHost.d.ts +10 -0
  516. package/dist/workerd/util/authorityHost.d.ts.map +1 -0
  517. package/dist/workerd/util/authorityHost.js +18 -0
  518. package/dist/workerd/util/authorityHost.js.map +1 -0
  519. package/package.json +17 -34
  520. package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +0 -1
  521. package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +0 -1
  522. package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +0 -1
  523. package/dist/browser/credentials/azureCliCredential-browser.mjs.map +0 -1
  524. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +0 -1
  525. package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +0 -1
  526. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +0 -1
  527. package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +0 -1
  528. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +0 -1
  529. package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +0 -1
  530. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +0 -1
  531. package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +0 -1
  532. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +0 -1
  533. package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +0 -1
  534. package/dist/browser/credentials/clientSecretCredential-browser.d.mts.map +0 -1
  535. package/dist/browser/credentials/clientSecretCredential-browser.mjs.map +0 -1
  536. package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +0 -1
  537. package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +0 -1
  538. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +0 -1
  539. package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +0 -1
  540. package/dist/browser/credentials/environmentCredential-browser.d.mts.map +0 -1
  541. package/dist/browser/credentials/environmentCredential-browser.mjs.map +0 -1
  542. package/dist/browser/credentials/interactiveBrowserCredential-browser.d.mts.map +0 -1
  543. package/dist/browser/credentials/interactiveBrowserCredential-browser.mjs.map +0 -1
  544. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +0 -1
  545. package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +0 -1
  546. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +0 -1
  547. package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +0 -1
  548. package/dist/browser/credentials/usernamePasswordCredential-browser.d.mts.map +0 -1
  549. package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +0 -1
  550. package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +0 -1
  551. package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +0 -1
  552. package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +0 -1
  553. package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +0 -1
  554. package/dist/browser/msal/msal-browser.d.mts.map +0 -1
  555. package/dist/browser/msal/msal-browser.mjs.map +0 -1
  556. package/dist/browser/plugins/consumer-browser.d.mts.map +0 -1
  557. package/dist/browser/plugins/consumer-browser.mjs.map +0 -1
  558. package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
  559. package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
  560. package/dist/browser/util/authHostEnv-browser.mjs +0 -7
  561. package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
  562. package/dist/browser/util/processMultiTenantRequest-browser.d.mts.map +0 -1
  563. package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +0 -1
  564. package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
  565. package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
  566. package/dist/esm/util/authHostEnv-browser.mjs +0 -7
  567. package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
  568. package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
  569. package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
  570. package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
  571. package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
@@ -1,257 +1,271 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ManagedIdentityCredential = void 0;
6
- const logger_1 = require("@azure/logger");
7
- const msal_node_1 = require("@azure/msal-node");
8
- const identityClient_js_1 = require("../../client/identityClient.js");
9
- const errors_js_1 = require("../../errors.js");
10
- const utils_js_1 = require("../../msal/utils.js");
11
- const imdsRetryPolicy_js_1 = require("./imdsRetryPolicy.js");
12
- const logging_js_1 = require("../../util/logging.js");
13
- const tracing_js_1 = require("../../util/tracing.js");
14
- const imdsMsi_js_1 = require("./imdsMsi.js");
15
- const tokenExchangeMsi_js_1 = require("./tokenExchangeMsi.js");
16
- const utils_js_2 = require("./utils.js");
17
- const logger = (0, logging_js_1.credentialLogger)("ManagedIdentityCredential");
18
- /**
19
- * Attempts authentication using a managed identity available at the deployment environment.
20
- * This authentication type works in Azure VMs, App Service instances, Azure Functions applications,
21
- * Azure Kubernetes Services, Azure Service Fabric instances and inside of the Azure Cloud Shell.
22
- *
23
- * More information about configuring managed identities can be found here:
24
- * https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview
25
- */
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var managedIdentityCredential_exports = {};
19
+ __export(managedIdentityCredential_exports, {
20
+ ManagedIdentityCredential: () => ManagedIdentityCredential
21
+ });
22
+ module.exports = __toCommonJS(managedIdentityCredential_exports);
23
+ var import_logger = require("@azure/logger");
24
+ var import_msal_node = require("@azure/msal-node");
25
+ var import_identityClient = require("../../client/identityClient.js");
26
+ var import_errors = require("../../errors.js");
27
+ var import_utils = require("../../msal/utils.js");
28
+ var import_imdsRetryPolicy = require("./imdsRetryPolicy.js");
29
+ var import_logging = require("../../util/logging.js");
30
+ var import_tracing = require("../../util/tracing.js");
31
+ var import_imdsMsi = require("./imdsMsi.js");
32
+ var import_tokenExchangeMsi = require("./tokenExchangeMsi.js");
33
+ var import_utils2 = require("./utils.js");
34
+ const logger = (0, import_logging.credentialLogger)("ManagedIdentityCredential");
26
35
  class ManagedIdentityCredential {
27
- managedIdentityApp;
28
- identityClient;
29
- clientId;
30
- resourceId;
31
- objectId;
32
- msiRetryConfig = {
33
- maxRetries: 5,
34
- startDelayInMs: 800,
35
- intervalIncrement: 2,
36
- };
37
- isAvailableIdentityClient;
38
- sendProbeRequest;
39
- /**
40
- * @internal
41
- * @hidden
42
- */
43
- constructor(clientIdOrOptions, options) {
44
- let _options;
45
- if (typeof clientIdOrOptions === "string") {
46
- this.clientId = clientIdOrOptions;
47
- _options = options ?? {};
48
- }
49
- else {
50
- this.clientId = clientIdOrOptions?.clientId;
51
- _options = clientIdOrOptions ?? {};
52
- }
53
- this.resourceId = _options?.resourceId;
54
- this.objectId = _options?.objectId;
55
- this.sendProbeRequest =
56
- _options?.sendProbeRequest ?? false;
57
- // For JavaScript users.
58
- const providedIds = [
59
- { key: "clientId", value: this.clientId },
60
- { key: "resourceId", value: this.resourceId },
61
- { key: "objectId", value: this.objectId },
62
- ].filter((id) => id.value);
63
- if (providedIds.length > 1) {
64
- throw new Error(`ManagedIdentityCredential: only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify({ clientId: this.clientId, resourceId: this.resourceId, objectId: this.objectId })}`);
65
- }
66
- // ManagedIdentity uses http for local requests
67
- _options.allowInsecureConnection = true;
68
- if (_options.retryOptions?.maxRetries !== undefined) {
69
- this.msiRetryConfig.maxRetries = _options.retryOptions.maxRetries;
36
+ managedIdentityApp;
37
+ identityClient;
38
+ clientId;
39
+ resourceId;
40
+ objectId;
41
+ msiRetryConfig = {
42
+ maxRetries: 5,
43
+ startDelayInMs: 800,
44
+ intervalIncrement: 2
45
+ };
46
+ isAvailableIdentityClient;
47
+ sendProbeRequest;
48
+ /**
49
+ * @internal
50
+ * @hidden
51
+ */
52
+ constructor(clientIdOrOptions, options) {
53
+ let _options;
54
+ if (typeof clientIdOrOptions === "string") {
55
+ this.clientId = clientIdOrOptions;
56
+ _options = options ?? {};
57
+ } else {
58
+ this.clientId = clientIdOrOptions?.clientId;
59
+ _options = clientIdOrOptions ?? {};
60
+ }
61
+ this.resourceId = _options?.resourceId;
62
+ this.objectId = _options?.objectId;
63
+ this.sendProbeRequest = _options?.sendProbeRequest ?? false;
64
+ const providedIds = [
65
+ { key: "clientId", value: this.clientId },
66
+ { key: "resourceId", value: this.resourceId },
67
+ { key: "objectId", value: this.objectId }
68
+ ].filter((id) => id.value);
69
+ if (providedIds.length > 1) {
70
+ throw new Error(
71
+ `ManagedIdentityCredential: only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify(
72
+ { clientId: this.clientId, resourceId: this.resourceId, objectId: this.objectId }
73
+ )}`
74
+ );
75
+ }
76
+ _options.allowInsecureConnection = true;
77
+ if (_options.retryOptions?.maxRetries !== void 0) {
78
+ this.msiRetryConfig.maxRetries = _options.retryOptions.maxRetries;
79
+ }
80
+ this.identityClient = new import_identityClient.IdentityClient({
81
+ ..._options,
82
+ additionalPolicies: [{ policy: (0, import_imdsRetryPolicy.imdsRetryPolicy)(this.msiRetryConfig), position: "perCall" }]
83
+ });
84
+ this.managedIdentityApp = new import_msal_node.ManagedIdentityApplication({
85
+ managedIdentityIdParams: {
86
+ userAssignedClientId: this.clientId,
87
+ userAssignedResourceId: this.resourceId,
88
+ userAssignedObjectId: this.objectId
89
+ },
90
+ system: {
91
+ disableInternalRetries: true,
92
+ networkClient: this.identityClient,
93
+ loggerOptions: {
94
+ logLevel: (0, import_utils.getMSALLogLevel)((0, import_logger.getLogLevel)()),
95
+ piiLoggingEnabled: _options.loggingOptions?.enableUnsafeSupportLogging,
96
+ loggerCallback: (0, import_utils.defaultLoggerCallback)(logger)
70
97
  }
71
- this.identityClient = new identityClient_js_1.IdentityClient({
72
- ..._options,
73
- additionalPolicies: [{ policy: (0, imdsRetryPolicy_js_1.imdsRetryPolicy)(this.msiRetryConfig), position: "perCall" }],
74
- });
75
- this.managedIdentityApp = new msal_node_1.ManagedIdentityApplication({
76
- managedIdentityIdParams: {
77
- userAssignedClientId: this.clientId,
78
- userAssignedResourceId: this.resourceId,
79
- userAssignedObjectId: this.objectId,
80
- },
81
- system: {
82
- disableInternalRetries: true,
83
- networkClient: this.identityClient,
84
- loggerOptions: {
85
- logLevel: (0, utils_js_1.getMSALLogLevel)((0, logger_1.getLogLevel)()),
86
- piiLoggingEnabled: _options.loggingOptions?.enableUnsafeSupportLogging,
87
- loggerCallback: (0, utils_js_1.defaultLoggerCallback)(logger),
88
- },
89
- },
90
- });
91
- this.isAvailableIdentityClient = new identityClient_js_1.IdentityClient({
92
- ..._options,
93
- retryOptions: {
94
- maxRetries: 0,
95
- },
96
- });
97
- const managedIdentitySource = this.managedIdentityApp.getManagedIdentitySource();
98
- // CloudShell MSI will ignore any user-assigned identity passed as parameters. To avoid confusion, we prevent this from happening as early as possible.
99
- if (managedIdentitySource === "CloudShell") {
100
- if (this.clientId || this.resourceId || this.objectId) {
101
- logger.warning(`CloudShell MSI detected with user-provided IDs - throwing. Received values: ${JSON.stringify({
102
- clientId: this.clientId,
103
- resourceId: this.resourceId,
104
- objectId: this.objectId,
105
- })}.`);
106
- throw new errors_js_1.CredentialUnavailableError("ManagedIdentityCredential: Specifying a user-assigned managed identity is not supported for CloudShell at runtime. When using Managed Identity in CloudShell, omit the clientId, resourceId, and objectId parameters.");
98
+ }
99
+ });
100
+ this.isAvailableIdentityClient = new import_identityClient.IdentityClient({
101
+ ..._options,
102
+ retryOptions: {
103
+ maxRetries: 0
104
+ }
105
+ });
106
+ const managedIdentitySource = this.managedIdentityApp.getManagedIdentitySource();
107
+ if (managedIdentitySource === "CloudShell") {
108
+ if (this.clientId || this.resourceId || this.objectId) {
109
+ logger.warning(
110
+ `CloudShell MSI detected with user-provided IDs - throwing. Received values: ${JSON.stringify(
111
+ {
112
+ clientId: this.clientId,
113
+ resourceId: this.resourceId,
114
+ objectId: this.objectId
107
115
  }
108
- }
109
- // ServiceFabric does not support specifying user-assigned managed identity by client ID or resource ID. The managed identity selected is based on the resource configuration.
110
- if (managedIdentitySource === "ServiceFabric") {
111
- if (this.clientId || this.resourceId || this.objectId) {
112
- logger.warning(`Service Fabric detected with user-provided IDs - throwing. Received values: ${JSON.stringify({
113
- clientId: this.clientId,
114
- resourceId: this.resourceId,
115
- objectId: this.objectId,
116
- })}.`);
117
- throw new errors_js_1.CredentialUnavailableError(`ManagedIdentityCredential: ${utils_js_2.serviceFabricErrorMessage}`);
116
+ )}.`
117
+ );
118
+ throw new import_errors.CredentialUnavailableError(
119
+ "ManagedIdentityCredential: Specifying a user-assigned managed identity is not supported for CloudShell at runtime. When using Managed Identity in CloudShell, omit the clientId, resourceId, and objectId parameters."
120
+ );
121
+ }
122
+ }
123
+ if (managedIdentitySource === "ServiceFabric") {
124
+ if (this.clientId || this.resourceId || this.objectId) {
125
+ logger.warning(
126
+ `Service Fabric detected with user-provided IDs - throwing. Received values: ${JSON.stringify(
127
+ {
128
+ clientId: this.clientId,
129
+ resourceId: this.resourceId,
130
+ objectId: this.objectId
118
131
  }
119
- }
120
- logger.info(`Using ${managedIdentitySource} managed identity.`);
121
- // Check if either clientId, resourceId or objectId was provided and log the value used
122
- if (providedIds.length === 1) {
123
- const { key, value } = providedIds[0];
124
- logger.info(`${managedIdentitySource} with ${key}: ${value}`);
125
- }
132
+ )}.`
133
+ );
134
+ throw new import_errors.CredentialUnavailableError(
135
+ `ManagedIdentityCredential: ${import_utils2.serviceFabricErrorMessage}`
136
+ );
137
+ }
138
+ }
139
+ logger.info(`Using ${managedIdentitySource} managed identity.`);
140
+ if (providedIds.length === 1) {
141
+ const { key, value } = providedIds[0];
142
+ logger.info(`${managedIdentitySource} with ${key}: ${value}`);
126
143
  }
127
- /**
128
- * Authenticates with Microsoft Entra ID and returns an access token if successful.
129
- * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
130
- * If an unexpected error occurs, an {@link AuthenticationError} will be thrown with the details of the failure.
131
- *
132
- * @param scopes - The list of scopes for which the token will have access.
133
- * @param options - The options used to configure any requests this
134
- * TokenCredential implementation might make.
135
- */
136
- async getToken(scopes, options = {}) {
137
- logger.getToken.info("Using the MSAL provider for Managed Identity.");
138
- const resource = (0, utils_js_2.mapScopesToResource)(scopes);
139
- if (!resource) {
140
- throw new errors_js_1.CredentialUnavailableError(`ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(scopes)}`);
144
+ }
145
+ /**
146
+ * Authenticates with Microsoft Entra ID and returns an access token if successful.
147
+ * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
148
+ * If an unexpected error occurs, an {@link AuthenticationError} will be thrown with the details of the failure.
149
+ *
150
+ * @param scopes - The list of scopes for which the token will have access.
151
+ * @param options - The options used to configure any requests this
152
+ * TokenCredential implementation might make.
153
+ */
154
+ async getToken(scopes, options = {}) {
155
+ logger.getToken.info("Using the MSAL provider for Managed Identity.");
156
+ const resource = (0, import_utils2.mapScopesToResource)(scopes);
157
+ if (!resource) {
158
+ throw new import_errors.CredentialUnavailableError(
159
+ `ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(
160
+ scopes
161
+ )}`
162
+ );
163
+ }
164
+ return import_tracing.tracingClient.withSpan("ManagedIdentityCredential.getToken", options, async () => {
165
+ try {
166
+ const isTokenExchangeMsi = await import_tokenExchangeMsi.tokenExchangeMsi.isAvailable(this.clientId);
167
+ const identitySource = this.managedIdentityApp.getManagedIdentitySource();
168
+ const isImdsMsi = identitySource === "DefaultToImds" || identitySource === "Imds";
169
+ logger.getToken.info(`MSAL Identity source: ${identitySource}`);
170
+ if (isTokenExchangeMsi) {
171
+ logger.getToken.info("Using the token exchange managed identity.");
172
+ const result = await import_tokenExchangeMsi.tokenExchangeMsi.getToken({
173
+ scopes,
174
+ clientId: this.clientId,
175
+ identityClient: this.identityClient,
176
+ retryConfig: this.msiRetryConfig,
177
+ resourceId: this.resourceId
178
+ });
179
+ if (result === null) {
180
+ throw new import_errors.CredentialUnavailableError(
181
+ "Attempted to use the token exchange managed identity, but received a null response."
182
+ );
183
+ }
184
+ return result;
185
+ } else if (isImdsMsi && this.sendProbeRequest) {
186
+ logger.getToken.info("Using the IMDS endpoint to probe for availability.");
187
+ const isAvailable = await import_imdsMsi.imdsMsi.isAvailable({
188
+ scopes,
189
+ clientId: this.clientId,
190
+ getTokenOptions: options,
191
+ identityClient: this.isAvailableIdentityClient,
192
+ resourceId: this.resourceId
193
+ });
194
+ if (!isAvailable) {
195
+ throw new import_errors.CredentialUnavailableError(
196
+ `Attempted to use the IMDS endpoint, but it is not available.`
197
+ );
198
+ }
141
199
  }
142
- return tracing_js_1.tracingClient.withSpan("ManagedIdentityCredential.getToken", options, async () => {
143
- try {
144
- const isTokenExchangeMsi = await tokenExchangeMsi_js_1.tokenExchangeMsi.isAvailable(this.clientId);
145
- // Most scenarios are handled by MSAL except for two:
146
- // AKS pod identity - MSAL does not implement the token exchange flow.
147
- // IMDS Endpoint probing - MSAL does not do any probing before trying to get a token.
148
- // As a DefaultAzureCredential optimization we probe the IMDS endpoint with a short timeout and no retries before actually trying to get a token
149
- // We will continue to implement these features in the Identity library.
150
- const identitySource = this.managedIdentityApp.getManagedIdentitySource();
151
- const isImdsMsi = identitySource === "DefaultToImds" || identitySource === "Imds"; // Neither actually checks that IMDS endpoint is available, just that it's the source the MSAL _would_ try to use.
152
- logger.getToken.info(`MSAL Identity source: ${identitySource}`);
153
- if (isTokenExchangeMsi) {
154
- // In the AKS scenario we will use the existing tokenExchangeMsi indefinitely.
155
- logger.getToken.info("Using the token exchange managed identity.");
156
- const result = await tokenExchangeMsi_js_1.tokenExchangeMsi.getToken({
157
- scopes,
158
- clientId: this.clientId,
159
- identityClient: this.identityClient,
160
- retryConfig: this.msiRetryConfig,
161
- resourceId: this.resourceId,
162
- });
163
- if (result === null) {
164
- throw new errors_js_1.CredentialUnavailableError("Attempted to use the token exchange managed identity, but received a null response.");
165
- }
166
- return result;
167
- }
168
- else if (isImdsMsi && this.sendProbeRequest) {
169
- // In the IMDS scenario we will probe the IMDS endpoint to ensure it's available before trying to get a token.
170
- // If the IMDS endpoint is not available and this is the source that MSAL will use, we will fail-fast with an error that tells DAC to move to the next credential.
171
- logger.getToken.info("Using the IMDS endpoint to probe for availability.");
172
- const isAvailable = await imdsMsi_js_1.imdsMsi.isAvailable({
173
- scopes,
174
- clientId: this.clientId,
175
- getTokenOptions: options,
176
- identityClient: this.isAvailableIdentityClient,
177
- resourceId: this.resourceId,
178
- });
179
- if (!isAvailable) {
180
- throw new errors_js_1.CredentialUnavailableError(`Attempted to use the IMDS endpoint, but it is not available.`);
181
- }
182
- }
183
- // If we got this far, it means:
184
- // - This is not a tokenExchangeMsi,
185
- // - We already probed for IMDS endpoint availability and failed-fast if it's unreachable,
186
- // or we skip probing because the credential is set in DAC.
187
- // We can proceed normally by calling MSAL for a token.
188
- logger.getToken.info("Calling into MSAL for managed identity token.");
189
- const token = await this.managedIdentityApp.acquireToken({
190
- resource,
191
- });
192
- this.ensureValidMsalToken(scopes, token, options);
193
- logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
194
- return {
195
- expiresOnTimestamp: token.expiresOn.getTime(),
196
- token: token.accessToken,
197
- refreshAfterTimestamp: token.refreshOn?.getTime(),
198
- tokenType: "Bearer",
199
- };
200
- }
201
- catch (err) {
202
- logger.getToken.error((0, logging_js_1.formatError)(scopes, err));
203
- // AuthenticationRequiredError described as Error to enforce authentication after trying to retrieve a token silently.
204
- // TODO: why would this _ever_ happen considering we're not trying the silent request in this flow?
205
- if (err.name === "AuthenticationRequiredError") {
206
- throw err;
207
- }
208
- if (isNetworkError(err)) {
209
- throw new errors_js_1.CredentialUnavailableError(`ManagedIdentityCredential: Network unreachable. Message: ${err.message}`, { cause: err });
210
- }
211
- throw new errors_js_1.CredentialUnavailableError(`ManagedIdentityCredential: Authentication failed. Message ${err.message}`, { cause: err });
212
- }
200
+ logger.getToken.info("Calling into MSAL for managed identity token.");
201
+ const token = await this.managedIdentityApp.acquireToken({
202
+ resource
213
203
  });
214
- }
215
- /**
216
- * Ensures the validity of the MSAL token
217
- */
218
- ensureValidMsalToken(scopes, msalToken, getTokenOptions) {
219
- const createError = (message) => {
220
- logger.getToken.info(message);
221
- return new errors_js_1.AuthenticationRequiredError({
222
- scopes: Array.isArray(scopes) ? scopes : [scopes],
223
- getTokenOptions,
224
- message,
225
- });
204
+ this.ensureValidMsalToken(scopes, token, options);
205
+ logger.getToken.info((0, import_logging.formatSuccess)(scopes));
206
+ return {
207
+ expiresOnTimestamp: token.expiresOn.getTime(),
208
+ token: token.accessToken,
209
+ refreshAfterTimestamp: token.refreshOn?.getTime(),
210
+ tokenType: "Bearer"
226
211
  };
227
- if (!msalToken) {
228
- throw createError("No response.");
229
- }
230
- if (!msalToken.expiresOn) {
231
- throw createError(`Response had no "expiresOn" property.`);
212
+ } catch (err) {
213
+ logger.getToken.error((0, import_logging.formatError)(scopes, err));
214
+ if (err.name === "AuthenticationRequiredError") {
215
+ throw err;
232
216
  }
233
- if (!msalToken.accessToken) {
234
- throw createError(`Response had no "accessToken" property.`);
217
+ if (isNetworkError(err)) {
218
+ throw new import_errors.CredentialUnavailableError(
219
+ `ManagedIdentityCredential: Network unreachable. Message: ${err.message}`,
220
+ { cause: err }
221
+ );
235
222
  }
223
+ throw new import_errors.CredentialUnavailableError(
224
+ `ManagedIdentityCredential: Authentication failed. Message ${err.message}`,
225
+ { cause: err }
226
+ );
227
+ }
228
+ });
229
+ }
230
+ /**
231
+ * Ensures the validity of the MSAL token
232
+ */
233
+ ensureValidMsalToken(scopes, msalToken, getTokenOptions) {
234
+ const createError = (message) => {
235
+ logger.getToken.info(message);
236
+ return new import_errors.AuthenticationRequiredError({
237
+ scopes: Array.isArray(scopes) ? scopes : [scopes],
238
+ getTokenOptions,
239
+ message
240
+ });
241
+ };
242
+ if (!msalToken) {
243
+ throw createError("No response.");
236
244
  }
237
- }
238
- exports.ManagedIdentityCredential = ManagedIdentityCredential;
239
- function isNetworkError(err) {
240
- // MSAL error
241
- if (err.errorCode === "network_error") {
242
- return true;
245
+ if (!msalToken.expiresOn) {
246
+ throw createError(`Response had no "expiresOn" property.`);
243
247
  }
244
- // Probe errors
245
- if (err.code === "ENETUNREACH" || err.code === "EHOSTUNREACH") {
246
- return true;
248
+ if (!msalToken.accessToken) {
249
+ throw createError(`Response had no "accessToken" property.`);
247
250
  }
248
- // This is a special case for Docker Desktop which responds with a 403 with a message that contains "A socket operation was attempted to an unreachable network" or "A socket operation was attempted to an unreachable host"
249
- // rather than just timing out, as expected.
250
- if (err.statusCode === 403 || err.code === 403) {
251
- if (err.message.includes("unreachable")) {
252
- return true;
253
- }
251
+ }
252
+ }
253
+ function isNetworkError(err) {
254
+ if (err.errorCode === "network_error") {
255
+ return true;
256
+ }
257
+ if (err.code === "ENETUNREACH" || err.code === "EHOSTUNREACH") {
258
+ return true;
259
+ }
260
+ if (err.statusCode === 403 || err.code === 403) {
261
+ if (err.message.includes("unreachable")) {
262
+ return true;
254
263
  }
255
- return false;
264
+ }
265
+ return false;
256
266
  }
257
- //# sourceMappingURL=index.js.map
267
+ // Annotate the CommonJS export names for ESM import in node:
268
+ 0 && (module.exports = {
269
+ ManagedIdentityCredential
270
+ });
271
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/credentials/managedIdentityCredential/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAKlC,0CAA4C;AAC5C,gDAA8D;AAC9D,sEAAgE;AAChE,+CAA0F;AAC1F,kDAA6E;AAC7E,6DAAuD;AAEvD,sDAAqF;AACrF,sDAAsD;AACtD,6CAAuC;AACvC,+DAAyD;AACzD,yC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,CAAC;YACf,MAAM,WAAW,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;YACzB,MAAM,WAAW,CAAC,uCAAuC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;YAC3B,MAAM,WAAW,CAAC,yCAAyC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF;AAhTD,8DAgTC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC9B,aAAa;IACb,IAAI,GAAG,CAAC,SAAS,KAAK,eAAe,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,eAAe;IACf,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6NAA6N;IAC7N,4CAA4C;IAC5C,IAAI,GAAG,CAAC,UAAU,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;QAC/C,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\n\nimport type { TokenCredentialOptions } from \"../../tokenCredentialOptions.js\";\nimport { getLogLevel } from \"@azure/logger\";\nimport { ManagedIdentityApplication } from \"@azure/msal-node\";\nimport { IdentityClient } from \"../../client/identityClient.js\";\nimport { AuthenticationRequiredError, CredentialUnavailableError } from \"../../errors.js\";\nimport { getMSALLogLevel, defaultLoggerCallback } from \"../../msal/utils.js\";\nimport { imdsRetryPolicy } from \"./imdsRetryPolicy.js\";\nimport type { MSIConfiguration } from \"./models.js\";\nimport { formatSuccess, formatError, credentialLogger } from \"../../util/logging.js\";\nimport { tracingClient } from \"../../util/tracing.js\";\nimport { imdsMsi } from \"./imdsMsi.js\";\nimport { tokenExchangeMsi } from \"./tokenExchangeMsi.js\";\nimport { mapScopesToResource, serviceFabricErrorMessage } from \"./utils.js\";\nimport type { MsalToken, ValidMsalToken } from \"../../msal/types.js\";\nimport type {\n InternalManagedIdentityCredentialOptions,\n ManagedIdentityCredentialClientIdOptions,\n ManagedIdentityCredentialObjectIdOptions,\n ManagedIdentityCredentialResourceIdOptions,\n} from \"./options.js\";\n\nconst logger = credentialLogger(\"ManagedIdentityCredential\");\n\n/**\n * Attempts authentication using a managed identity available at the deployment environment.\n * This authentication type works in Azure VMs, App Service instances, Azure Functions applications,\n * Azure Kubernetes Services, Azure Service Fabric instances and inside of the Azure Cloud Shell.\n *\n * More information about configuring managed identities can be found here:\n * https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview\n */\nexport class ManagedIdentityCredential implements TokenCredential {\n private managedIdentityApp: ManagedIdentityApplication;\n private identityClient: IdentityClient;\n private clientId?: string;\n private resourceId?: string;\n private objectId?: string;\n private msiRetryConfig: MSIConfiguration[\"retryConfig\"] = {\n maxRetries: 5,\n startDelayInMs: 800,\n intervalIncrement: 2,\n };\n private isAvailableIdentityClient: IdentityClient;\n private sendProbeRequest: boolean;\n\n /**\n * Creates an instance of ManagedIdentityCredential with the client ID of a\n * user-assigned identity, or app registration (when working with AKS pod-identity).\n *\n * @param clientId - The client ID of the user-assigned identity, or app registration (when working with AKS pod-identity).\n * @param options - Options for configuring the client which makes the access token request.\n */\n constructor(clientId: string, options?: TokenCredentialOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with a client ID\n *\n * @param options - Options for configuring the client which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialClientIdOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with a resource ID\n *\n * @param options - Options for configuring the resource which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialResourceIdOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with an object ID\n *\n * @param options - Options for configuring the resource which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialObjectIdOptions);\n /**\n * @internal\n * @hidden\n */\n constructor(\n clientIdOrOptions?:\n | string\n | ManagedIdentityCredentialClientIdOptions\n | ManagedIdentityCredentialResourceIdOptions\n | ManagedIdentityCredentialObjectIdOptions,\n options?: TokenCredentialOptions,\n ) {\n let _options: TokenCredentialOptions;\n if (typeof clientIdOrOptions === \"string\") {\n this.clientId = clientIdOrOptions;\n _options = options ?? {};\n } else {\n this.clientId = (clientIdOrOptions as ManagedIdentityCredentialClientIdOptions)?.clientId;\n _options = clientIdOrOptions ?? {};\n }\n this.resourceId = (_options as ManagedIdentityCredentialResourceIdOptions)?.resourceId;\n this.objectId = (_options as ManagedIdentityCredentialObjectIdOptions)?.objectId;\n this.sendProbeRequest =\n (_options as InternalManagedIdentityCredentialOptions)?.sendProbeRequest ?? false;\n // For JavaScript users.\n const providedIds = [\n { key: \"clientId\", value: this.clientId },\n { key: \"resourceId\", value: this.resourceId },\n { key: \"objectId\", value: this.objectId },\n ].filter((id) => id.value);\n if (providedIds.length > 1) {\n throw new Error(\n `ManagedIdentityCredential: only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify(\n { clientId: this.clientId, resourceId: this.resourceId, objectId: this.objectId },\n )}`,\n );\n }\n\n // ManagedIdentity uses http for local requests\n _options.allowInsecureConnection = true;\n\n if (_options.retryOptions?.maxRetries !== undefined) {\n this.msiRetryConfig.maxRetries = _options.retryOptions.maxRetries;\n }\n\n this.identityClient = new IdentityClient({\n ..._options,\n additionalPolicies: [{ policy: imdsRetryPolicy(this.msiRetryConfig), position: \"perCall\" }],\n });\n\n this.managedIdentityApp = new ManagedIdentityApplication({\n managedIdentityIdParams: {\n userAssignedClientId: this.clientId,\n userAssignedResourceId: this.resourceId,\n userAssignedObjectId: this.objectId,\n },\n system: {\n disableInternalRetries: true,\n networkClient: this.identityClient,\n loggerOptions: {\n logLevel: getMSALLogLevel(getLogLevel()),\n piiLoggingEnabled: _options.loggingOptions?.enableUnsafeSupportLogging,\n loggerCallback: defaultLoggerCallback(logger),\n },\n },\n });\n\n this.isAvailableIdentityClient = new IdentityClient({\n ..._options,\n retryOptions: {\n maxRetries: 0,\n },\n });\n\n const managedIdentitySource = this.managedIdentityApp.getManagedIdentitySource();\n // CloudShell MSI will ignore any user-assigned identity passed as parameters. To avoid confusion, we prevent this from happening as early as possible.\n if (managedIdentitySource === \"CloudShell\") {\n if (this.clientId || this.resourceId || this.objectId) {\n logger.warning(\n `CloudShell MSI detected with user-provided IDs - throwing. Received values: ${JSON.stringify(\n {\n clientId: this.clientId,\n resourceId: this.resourceId,\n objectId: this.objectId,\n },\n )}.`,\n );\n throw new CredentialUnavailableError(\n \"ManagedIdentityCredential: Specifying a user-assigned managed identity is not supported for CloudShell at runtime. When using Managed Identity in CloudShell, omit the clientId, resourceId, and objectId parameters.\",\n );\n }\n }\n\n // ServiceFabric does not support specifying user-assigned managed identity by client ID or resource ID. The managed identity selected is based on the resource configuration.\n if (managedIdentitySource === \"ServiceFabric\") {\n if (this.clientId || this.resourceId || this.objectId) {\n logger.warning(\n `Service Fabric detected with user-provided IDs - throwing. Received values: ${JSON.stringify(\n {\n clientId: this.clientId,\n resourceId: this.resourceId,\n objectId: this.objectId,\n },\n )}.`,\n );\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: ${serviceFabricErrorMessage}`,\n );\n }\n }\n\n logger.info(`Using ${managedIdentitySource} managed identity.`);\n\n // Check if either clientId, resourceId or objectId was provided and log the value used\n if (providedIds.length === 1) {\n const { key, value } = providedIds[0];\n logger.info(`${managedIdentitySource} with ${key}: ${value}`);\n }\n }\n\n /**\n * Authenticates with Microsoft Entra ID and returns an access token if successful.\n * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.\n * If an unexpected error occurs, an {@link AuthenticationError} will be thrown with the details of the failure.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n public async getToken(\n scopes: string | string[],\n options: GetTokenOptions = {},\n ): Promise<AccessToken> {\n logger.getToken.info(\"Using the MSAL provider for Managed Identity.\");\n const resource = mapScopesToResource(scopes);\n if (!resource) {\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(\n scopes,\n )}`,\n );\n }\n\n return tracingClient.withSpan(\"ManagedIdentityCredential.getToken\", options, async () => {\n try {\n const isTokenExchangeMsi = await tokenExchangeMsi.isAvailable(this.clientId);\n\n // Most scenarios are handled by MSAL except for two:\n // AKS pod identity - MSAL does not implement the token exchange flow.\n // IMDS Endpoint probing - MSAL does not do any probing before trying to get a token.\n // As a DefaultAzureCredential optimization we probe the IMDS endpoint with a short timeout and no retries before actually trying to get a token\n // We will continue to implement these features in the Identity library.\n\n const identitySource = this.managedIdentityApp.getManagedIdentitySource();\n const isImdsMsi = identitySource === \"DefaultToImds\" || identitySource === \"Imds\"; // Neither actually checks that IMDS endpoint is available, just that it's the source the MSAL _would_ try to use.\n\n logger.getToken.info(`MSAL Identity source: ${identitySource}`);\n\n if (isTokenExchangeMsi) {\n // In the AKS scenario we will use the existing tokenExchangeMsi indefinitely.\n logger.getToken.info(\"Using the token exchange managed identity.\");\n const result = await tokenExchangeMsi.getToken({\n scopes,\n clientId: this.clientId,\n identityClient: this.identityClient,\n retryConfig: this.msiRetryConfig,\n resourceId: this.resourceId,\n });\n\n if (result === null) {\n throw new CredentialUnavailableError(\n \"Attempted to use the token exchange managed identity, but received a null response.\",\n );\n }\n\n return result;\n } else if (isImdsMsi && this.sendProbeRequest) {\n // In the IMDS scenario we will probe the IMDS endpoint to ensure it's available before trying to get a token.\n // If the IMDS endpoint is not available and this is the source that MSAL will use, we will fail-fast with an error that tells DAC to move to the next credential.\n logger.getToken.info(\"Using the IMDS endpoint to probe for availability.\");\n const isAvailable = await imdsMsi.isAvailable({\n scopes,\n clientId: this.clientId,\n getTokenOptions: options,\n identityClient: this.isAvailableIdentityClient,\n resourceId: this.resourceId,\n });\n\n if (!isAvailable) {\n throw new CredentialUnavailableError(\n `Attempted to use the IMDS endpoint, but it is not available.`,\n );\n }\n }\n\n // If we got this far, it means:\n // - This is not a tokenExchangeMsi,\n // - We already probed for IMDS endpoint availability and failed-fast if it's unreachable,\n // or we skip probing because the credential is set in DAC.\n // We can proceed normally by calling MSAL for a token.\n logger.getToken.info(\"Calling into MSAL for managed identity token.\");\n const token = await this.managedIdentityApp.acquireToken({\n resource,\n });\n\n this.ensureValidMsalToken(scopes, token, options);\n logger.getToken.info(formatSuccess(scopes));\n\n return {\n expiresOnTimestamp: token.expiresOn.getTime(),\n token: token.accessToken,\n refreshAfterTimestamp: token.refreshOn?.getTime(),\n tokenType: \"Bearer\",\n } as AccessToken;\n } catch (err: any) {\n logger.getToken.error(formatError(scopes, err));\n\n // AuthenticationRequiredError described as Error to enforce authentication after trying to retrieve a token silently.\n // TODO: why would this _ever_ happen considering we're not trying the silent request in this flow?\n if (err.name === \"AuthenticationRequiredError\") {\n throw err;\n }\n\n if (isNetworkError(err)) {\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Network unreachable. Message: ${err.message}`,\n { cause: err },\n );\n }\n\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Authentication failed. Message ${err.message}`,\n { cause: err },\n );\n }\n });\n }\n\n /**\n * Ensures the validity of the MSAL token\n */\n private ensureValidMsalToken(\n scopes: string | string[],\n msalToken?: MsalToken,\n getTokenOptions?: GetTokenOptions,\n ): asserts msalToken is ValidMsalToken {\n const createError = (message: string): Error => {\n logger.getToken.info(message);\n return new AuthenticationRequiredError({\n scopes: Array.isArray(scopes) ? scopes : [scopes],\n getTokenOptions,\n message,\n });\n };\n if (!msalToken) {\n throw createError(\"No response.\");\n }\n if (!msalToken.expiresOn) {\n throw createError(`Response had no \"expiresOn\" property.`);\n }\n if (!msalToken.accessToken) {\n throw createError(`Response had no \"accessToken\" property.`);\n }\n }\n}\n\nfunction isNetworkError(err: any): boolean {\n // MSAL error\n if (err.errorCode === \"network_error\") {\n return true;\n }\n\n // Probe errors\n if (err.code === \"ENETUNREACH\" || err.code === \"EHOSTUNREACH\") {\n return true;\n }\n\n // This is a special case for Docker Desktop which responds with a 403 with a message that contains \"A socket operation was attempted to an unreachable network\" or \"A socket operation was attempted to an unreachable host\"\n // rather than just timing out, as expected.\n if (err.statusCode === 403 || err.code === 403) {\n if (err.message.includes(\"unreachable\")) {\n return true;\n }\n }\n\n return false;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/credentials/managedIdentityCredential/index.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\n\nimport type { TokenCredentialOptions } from \"../../tokenCredentialOptions.js\";\nimport { getLogLevel } from \"@azure/logger\";\nimport { ManagedIdentityApplication } from \"@azure/msal-node\";\nimport { IdentityClient } from \"../../client/identityClient.js\";\nimport { AuthenticationRequiredError, CredentialUnavailableError } from \"../../errors.js\";\nimport { getMSALLogLevel, defaultLoggerCallback } from \"../../msal/utils.js\";\nimport { imdsRetryPolicy } from \"./imdsRetryPolicy.js\";\nimport type { MSIConfiguration } from \"./models.js\";\nimport { formatSuccess, formatError, credentialLogger } from \"../../util/logging.js\";\nimport { tracingClient } from \"../../util/tracing.js\";\nimport { imdsMsi } from \"./imdsMsi.js\";\nimport { tokenExchangeMsi } from \"./tokenExchangeMsi.js\";\nimport { mapScopesToResource, serviceFabricErrorMessage } from \"./utils.js\";\nimport type { MsalToken, ValidMsalToken } from \"../../msal/types.js\";\nimport type {\n InternalManagedIdentityCredentialOptions,\n ManagedIdentityCredentialClientIdOptions,\n ManagedIdentityCredentialObjectIdOptions,\n ManagedIdentityCredentialResourceIdOptions,\n} from \"./options.js\";\n\nconst logger = credentialLogger(\"ManagedIdentityCredential\");\n\n/**\n * Attempts authentication using a managed identity available at the deployment environment.\n * This authentication type works in Azure VMs, App Service instances, Azure Functions applications,\n * Azure Kubernetes Services, Azure Service Fabric instances and inside of the Azure Cloud Shell.\n *\n * More information about configuring managed identities can be found here:\n * https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview\n */\nexport class ManagedIdentityCredential implements TokenCredential {\n private managedIdentityApp: ManagedIdentityApplication;\n private identityClient: IdentityClient;\n private clientId?: string;\n private resourceId?: string;\n private objectId?: string;\n private msiRetryConfig: MSIConfiguration[\"retryConfig\"] = {\n maxRetries: 5,\n startDelayInMs: 800,\n intervalIncrement: 2,\n };\n private isAvailableIdentityClient: IdentityClient;\n private sendProbeRequest: boolean;\n\n /**\n * Creates an instance of ManagedIdentityCredential with the client ID of a\n * user-assigned identity, or app registration (when working with AKS pod-identity).\n *\n * @param clientId - The client ID of the user-assigned identity, or app registration (when working with AKS pod-identity).\n * @param options - Options for configuring the client which makes the access token request.\n */\n constructor(clientId: string, options?: TokenCredentialOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with a client ID\n *\n * @param options - Options for configuring the client which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialClientIdOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with a resource ID\n *\n * @param options - Options for configuring the resource which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialResourceIdOptions);\n /**\n * Creates an instance of ManagedIdentityCredential with an object ID\n *\n * @param options - Options for configuring the resource which makes the access token request.\n */\n constructor(options?: ManagedIdentityCredentialObjectIdOptions);\n /**\n * @internal\n * @hidden\n */\n constructor(\n clientIdOrOptions?:\n | string\n | ManagedIdentityCredentialClientIdOptions\n | ManagedIdentityCredentialResourceIdOptions\n | ManagedIdentityCredentialObjectIdOptions,\n options?: TokenCredentialOptions,\n ) {\n let _options: TokenCredentialOptions;\n if (typeof clientIdOrOptions === \"string\") {\n this.clientId = clientIdOrOptions;\n _options = options ?? {};\n } else {\n this.clientId = (clientIdOrOptions as ManagedIdentityCredentialClientIdOptions)?.clientId;\n _options = clientIdOrOptions ?? {};\n }\n this.resourceId = (_options as ManagedIdentityCredentialResourceIdOptions)?.resourceId;\n this.objectId = (_options as ManagedIdentityCredentialObjectIdOptions)?.objectId;\n this.sendProbeRequest =\n (_options as InternalManagedIdentityCredentialOptions)?.sendProbeRequest ?? false;\n // For JavaScript users.\n const providedIds = [\n { key: \"clientId\", value: this.clientId },\n { key: \"resourceId\", value: this.resourceId },\n { key: \"objectId\", value: this.objectId },\n ].filter((id) => id.value);\n if (providedIds.length > 1) {\n throw new Error(\n `ManagedIdentityCredential: only one of 'clientId', 'resourceId', or 'objectId' can be provided. Received values: ${JSON.stringify(\n { clientId: this.clientId, resourceId: this.resourceId, objectId: this.objectId },\n )}`,\n );\n }\n\n // ManagedIdentity uses http for local requests\n _options.allowInsecureConnection = true;\n\n if (_options.retryOptions?.maxRetries !== undefined) {\n this.msiRetryConfig.maxRetries = _options.retryOptions.maxRetries;\n }\n\n this.identityClient = new IdentityClient({\n ..._options,\n additionalPolicies: [{ policy: imdsRetryPolicy(this.msiRetryConfig), position: \"perCall\" }],\n });\n\n this.managedIdentityApp = new ManagedIdentityApplication({\n managedIdentityIdParams: {\n userAssignedClientId: this.clientId,\n userAssignedResourceId: this.resourceId,\n userAssignedObjectId: this.objectId,\n },\n system: {\n disableInternalRetries: true,\n networkClient: this.identityClient,\n loggerOptions: {\n logLevel: getMSALLogLevel(getLogLevel()),\n piiLoggingEnabled: _options.loggingOptions?.enableUnsafeSupportLogging,\n loggerCallback: defaultLoggerCallback(logger),\n },\n },\n });\n\n this.isAvailableIdentityClient = new IdentityClient({\n ..._options,\n retryOptions: {\n maxRetries: 0,\n },\n });\n\n const managedIdentitySource = this.managedIdentityApp.getManagedIdentitySource();\n // CloudShell MSI will ignore any user-assigned identity passed as parameters. To avoid confusion, we prevent this from happening as early as possible.\n if (managedIdentitySource === \"CloudShell\") {\n if (this.clientId || this.resourceId || this.objectId) {\n logger.warning(\n `CloudShell MSI detected with user-provided IDs - throwing. Received values: ${JSON.stringify(\n {\n clientId: this.clientId,\n resourceId: this.resourceId,\n objectId: this.objectId,\n },\n )}.`,\n );\n throw new CredentialUnavailableError(\n \"ManagedIdentityCredential: Specifying a user-assigned managed identity is not supported for CloudShell at runtime. When using Managed Identity in CloudShell, omit the clientId, resourceId, and objectId parameters.\",\n );\n }\n }\n\n // ServiceFabric does not support specifying user-assigned managed identity by client ID or resource ID. The managed identity selected is based on the resource configuration.\n if (managedIdentitySource === \"ServiceFabric\") {\n if (this.clientId || this.resourceId || this.objectId) {\n logger.warning(\n `Service Fabric detected with user-provided IDs - throwing. Received values: ${JSON.stringify(\n {\n clientId: this.clientId,\n resourceId: this.resourceId,\n objectId: this.objectId,\n },\n )}.`,\n );\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: ${serviceFabricErrorMessage}`,\n );\n }\n }\n\n logger.info(`Using ${managedIdentitySource} managed identity.`);\n\n // Check if either clientId, resourceId or objectId was provided and log the value used\n if (providedIds.length === 1) {\n const { key, value } = providedIds[0];\n logger.info(`${managedIdentitySource} with ${key}: ${value}`);\n }\n }\n\n /**\n * Authenticates with Microsoft Entra ID and returns an access token if successful.\n * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.\n * If an unexpected error occurs, an {@link AuthenticationError} will be thrown with the details of the failure.\n *\n * @param scopes - The list of scopes for which the token will have access.\n * @param options - The options used to configure any requests this\n * TokenCredential implementation might make.\n */\n public async getToken(\n scopes: string | string[],\n options: GetTokenOptions = {},\n ): Promise<AccessToken> {\n logger.getToken.info(\"Using the MSAL provider for Managed Identity.\");\n const resource = mapScopesToResource(scopes);\n if (!resource) {\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Multiple scopes are not supported. Scopes: ${JSON.stringify(\n scopes,\n )}`,\n );\n }\n\n return tracingClient.withSpan(\"ManagedIdentityCredential.getToken\", options, async () => {\n try {\n const isTokenExchangeMsi = await tokenExchangeMsi.isAvailable(this.clientId);\n\n // Most scenarios are handled by MSAL except for two:\n // AKS pod identity - MSAL does not implement the token exchange flow.\n // IMDS Endpoint probing - MSAL does not do any probing before trying to get a token.\n // As a DefaultAzureCredential optimization we probe the IMDS endpoint with a short timeout and no retries before actually trying to get a token\n // We will continue to implement these features in the Identity library.\n\n const identitySource = this.managedIdentityApp.getManagedIdentitySource();\n const isImdsMsi = identitySource === \"DefaultToImds\" || identitySource === \"Imds\"; // Neither actually checks that IMDS endpoint is available, just that it's the source the MSAL _would_ try to use.\n\n logger.getToken.info(`MSAL Identity source: ${identitySource}`);\n\n if (isTokenExchangeMsi) {\n // In the AKS scenario we will use the existing tokenExchangeMsi indefinitely.\n logger.getToken.info(\"Using the token exchange managed identity.\");\n const result = await tokenExchangeMsi.getToken({\n scopes,\n clientId: this.clientId,\n identityClient: this.identityClient,\n retryConfig: this.msiRetryConfig,\n resourceId: this.resourceId,\n });\n\n if (result === null) {\n throw new CredentialUnavailableError(\n \"Attempted to use the token exchange managed identity, but received a null response.\",\n );\n }\n\n return result;\n } else if (isImdsMsi && this.sendProbeRequest) {\n // In the IMDS scenario we will probe the IMDS endpoint to ensure it's available before trying to get a token.\n // If the IMDS endpoint is not available and this is the source that MSAL will use, we will fail-fast with an error that tells DAC to move to the next credential.\n logger.getToken.info(\"Using the IMDS endpoint to probe for availability.\");\n const isAvailable = await imdsMsi.isAvailable({\n scopes,\n clientId: this.clientId,\n getTokenOptions: options,\n identityClient: this.isAvailableIdentityClient,\n resourceId: this.resourceId,\n });\n\n if (!isAvailable) {\n throw new CredentialUnavailableError(\n `Attempted to use the IMDS endpoint, but it is not available.`,\n );\n }\n }\n\n // If we got this far, it means:\n // - This is not a tokenExchangeMsi,\n // - We already probed for IMDS endpoint availability and failed-fast if it's unreachable,\n // or we skip probing because the credential is set in DAC.\n // We can proceed normally by calling MSAL for a token.\n logger.getToken.info(\"Calling into MSAL for managed identity token.\");\n const token = await this.managedIdentityApp.acquireToken({\n resource,\n });\n\n this.ensureValidMsalToken(scopes, token, options);\n logger.getToken.info(formatSuccess(scopes));\n\n return {\n expiresOnTimestamp: token.expiresOn.getTime(),\n token: token.accessToken,\n refreshAfterTimestamp: token.refreshOn?.getTime(),\n tokenType: \"Bearer\",\n } as AccessToken;\n } catch (err: any) {\n logger.getToken.error(formatError(scopes, err));\n\n // AuthenticationRequiredError described as Error to enforce authentication after trying to retrieve a token silently.\n // TODO: why would this _ever_ happen considering we're not trying the silent request in this flow?\n if (err.name === \"AuthenticationRequiredError\") {\n throw err;\n }\n\n if (isNetworkError(err)) {\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Network unreachable. Message: ${err.message}`,\n { cause: err },\n );\n }\n\n throw new CredentialUnavailableError(\n `ManagedIdentityCredential: Authentication failed. Message ${err.message}`,\n { cause: err },\n );\n }\n });\n }\n\n /**\n * Ensures the validity of the MSAL token\n */\n private ensureValidMsalToken(\n scopes: string | string[],\n msalToken?: MsalToken,\n getTokenOptions?: GetTokenOptions,\n ): asserts msalToken is ValidMsalToken {\n const createError = (message: string): Error => {\n logger.getToken.info(message);\n return new AuthenticationRequiredError({\n scopes: Array.isArray(scopes) ? scopes : [scopes],\n getTokenOptions,\n message,\n });\n };\n if (!msalToken) {\n throw createError(\"No response.\");\n }\n if (!msalToken.expiresOn) {\n throw createError(`Response had no \"expiresOn\" property.`);\n }\n if (!msalToken.accessToken) {\n throw createError(`Response had no \"accessToken\" property.`);\n }\n }\n}\n\nfunction isNetworkError(err: any): boolean {\n // MSAL error\n if (err.errorCode === \"network_error\") {\n return true;\n }\n\n // Probe errors\n if (err.code === \"ENETUNREACH\" || err.code === \"EHOSTUNREACH\") {\n return true;\n }\n\n // This is a special case for Docker Desktop which responds with a 403 with a message that contains \"A socket operation was attempted to an unreachable network\" or \"A socket operation was attempted to an unreachable host\"\n // rather than just timing out, as expected.\n if (err.statusCode === 403 || err.code === 403) {\n if (err.message.includes(\"unreachable\")) {\n return true;\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