@azure/identity 4.13.0 → 4.13.2

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 (540) hide show
  1. package/dist/browser/constants.d.ts +1 -1
  2. package/dist/browser/constants.js +1 -1
  3. package/dist/browser/constants.js.map +1 -1
  4. package/dist/browser/credentials/{authorizationCodeCredential.d.ts → authorizationCodeCredential-browser.d.mts} +2 -2
  5. package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +1 -1
  6. package/dist/browser/credentials/{authorizationCodeCredential.js → authorizationCodeCredential-browser.mjs} +1 -1
  7. package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +1 -1
  8. package/dist/browser/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  9. package/dist/browser/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  10. package/dist/browser/credentials/azureCliCredential-browser.d.mts +14 -0
  11. package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +1 -1
  12. package/dist/browser/credentials/{azureCliCredential.js → azureCliCredential-browser.mjs} +2 -2
  13. package/dist/browser/credentials/azureCliCredential-browser.mjs.map +1 -1
  14. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts +14 -0
  15. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +1 -1
  16. package/dist/browser/credentials/{azureDeveloperCliCredential.js → azureDeveloperCliCredential-browser.mjs} +2 -2
  17. package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +1 -1
  18. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts +14 -0
  19. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +1 -1
  20. package/dist/browser/credentials/{azurePipelinesCredential.js → azurePipelinesCredential-browser.mjs} +2 -2
  21. package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +1 -1
  22. package/dist/browser/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  23. package/dist/browser/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  24. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts +13 -0
  25. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +1 -1
  26. package/dist/browser/credentials/{azurePowerShellCredential.js → azurePowerShellCredential-browser.mjs} +2 -2
  27. package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +1 -1
  28. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts +13 -0
  29. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +1 -1
  30. package/dist/browser/credentials/{clientAssertionCredential.js → clientAssertionCredential-browser.mjs} +2 -2
  31. package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +1 -1
  32. package/dist/browser/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  33. package/dist/browser/credentials/clientAssertionCredentialOptions.js.map +1 -1
  34. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts +15 -0
  35. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +1 -1
  36. package/dist/browser/credentials/{clientCertificateCredential.js → clientCertificateCredential-browser.mjs} +2 -2
  37. package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +1 -1
  38. package/dist/browser/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  39. package/dist/browser/credentials/clientCertificateCredentialModels.js.map +1 -1
  40. package/dist/browser/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  41. package/dist/browser/credentials/clientCertificateCredentialOptions.js.map +1 -1
  42. package/dist/browser/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  43. package/dist/browser/credentials/clientSecretCredentialOptions.js.map +1 -1
  44. package/dist/browser/credentials/{defaultAzureCredential.d.ts → defaultAzureCredential-browser.d.mts} +2 -2
  45. package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +1 -1
  46. package/dist/browser/credentials/{defaultAzureCredential.js → defaultAzureCredential-browser.mjs} +1 -1
  47. package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +1 -1
  48. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  49. package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
  50. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts +14 -0
  51. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +1 -1
  52. package/dist/browser/credentials/{deviceCodeCredential.js → deviceCodeCredential-browser.mjs} +2 -2
  53. package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +1 -1
  54. package/dist/browser/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  55. package/dist/browser/credentials/deviceCodeCredentialOptions.js.map +1 -1
  56. package/dist/browser/credentials/environmentCredential-browser.d.mts +14 -0
  57. package/dist/browser/credentials/environmentCredential-browser.d.mts.map +1 -1
  58. package/dist/browser/credentials/{environmentCredential.js → environmentCredential-browser.mjs} +2 -2
  59. package/dist/browser/credentials/environmentCredential-browser.mjs.map +1 -1
  60. package/dist/browser/credentials/environmentCredentialOptions.d.ts.map +1 -1
  61. package/dist/browser/credentials/environmentCredentialOptions.js.map +1 -1
  62. package/dist/browser/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  63. package/dist/browser/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  64. package/dist/browser/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  65. package/dist/browser/credentials/interactiveCredentialOptions.js.map +1 -1
  66. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts +11 -0
  67. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +1 -1
  68. package/dist/browser/credentials/managedIdentityCredential/{index.js → index-browser.mjs} +2 -2
  69. package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +1 -1
  70. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts +13 -0
  71. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +1 -1
  72. package/dist/browser/credentials/{onBehalfOfCredential.js → onBehalfOfCredential-browser.mjs} +2 -2
  73. package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +1 -1
  74. package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +1 -1
  75. package/dist/browser/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  76. package/dist/browser/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  77. package/dist/browser/credentials/{visualStudioCodeCredential.d.ts → visualStudioCodeCredential-browser.d.mts} +4 -3
  78. package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +1 -1
  79. package/dist/browser/credentials/{visualStudioCodeCredential.js → visualStudioCodeCredential-browser.mjs} +2 -2
  80. package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +1 -1
  81. package/dist/browser/credentials/{workloadIdentityCredential.d.ts → workloadIdentityCredential-browser.d.mts} +4 -3
  82. package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +1 -1
  83. package/dist/browser/credentials/{workloadIdentityCredential.js → workloadIdentityCredential-browser.mjs} +2 -2
  84. package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +1 -1
  85. package/dist/browser/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  86. package/dist/browser/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  87. package/dist/browser/index.d.ts +51 -51
  88. package/dist/browser/index.d.ts.map +1 -1
  89. package/dist/browser/index.js +19 -19
  90. package/dist/browser/index.js.map +1 -1
  91. package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  92. package/dist/browser/msal/browserFlows/msalBrowserCommon.js +4 -4
  93. package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  94. package/dist/browser/msal/utils.d.ts +1 -1
  95. package/dist/browser/msal/utils.d.ts.map +1 -1
  96. package/dist/browser/msal/utils.js +1 -1
  97. package/dist/browser/msal/utils.js.map +1 -1
  98. package/dist/browser/util/tenantIdUtils.d.ts +1 -1
  99. package/dist/browser/util/tenantIdUtils.d.ts.map +1 -1
  100. package/dist/browser/util/tenantIdUtils.js +1 -1
  101. package/dist/browser/util/tenantIdUtils.js.map +1 -1
  102. package/dist/commonjs/client/identityClient.js +263 -252
  103. package/dist/commonjs/client/identityClient.js.map +7 -1
  104. package/dist/commonjs/constants.d.ts +1 -1
  105. package/dist/commonjs/constants.js +61 -78
  106. package/dist/commonjs/constants.js.map +7 -1
  107. package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
  108. package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
  109. package/dist/commonjs/credentials/authorizationCodeCredential.js +99 -75
  110. package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
  111. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  112. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
  113. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
  114. package/dist/commonjs/credentials/azureCliCredential.d.ts.map +1 -1
  115. package/dist/commonjs/credentials/azureCliCredential.js +228 -214
  116. package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
  117. package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
  118. package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
  119. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  120. package/dist/commonjs/credentials/azureDeveloperCliCredential.js +192 -202
  121. package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
  122. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
  123. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
  124. package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
  125. package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
  126. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  127. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
  128. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
  129. package/dist/commonjs/credentials/azurePowerShellCredential.d.ts +10 -0
  130. package/dist/commonjs/credentials/azurePowerShellCredential.d.ts.map +1 -1
  131. package/dist/commonjs/credentials/azurePowerShellCredential.js +229 -208
  132. package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
  133. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
  134. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
  135. package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
  136. package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
  137. package/dist/commonjs/credentials/brokerCredential.d.ts +2 -2
  138. package/dist/commonjs/credentials/brokerCredential.d.ts.map +1 -1
  139. package/dist/commonjs/credentials/brokerCredential.js +104 -71
  140. package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
  141. package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
  142. package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
  143. package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
  144. package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
  145. package/dist/commonjs/credentials/clientAssertionCredential.js +102 -64
  146. package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
  147. package/dist/commonjs/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  148. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
  149. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
  150. package/dist/commonjs/credentials/clientCertificateCredential.js +139 -134
  151. package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
  152. package/dist/commonjs/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  153. package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
  154. package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
  155. package/dist/commonjs/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  156. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
  157. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
  158. package/dist/commonjs/credentials/clientSecretCredential.js +97 -68
  159. package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
  160. package/dist/commonjs/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  161. package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
  162. package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
  163. package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
  164. package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
  165. package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
  166. package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
  167. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
  168. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
  169. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  170. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
  171. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
  172. package/dist/commonjs/credentials/deviceCodeCredential.js +133 -104
  173. package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
  174. package/dist/commonjs/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  175. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
  176. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
  177. package/dist/commonjs/credentials/environmentCredential.d.ts.map +1 -1
  178. package/dist/commonjs/credentials/environmentCredential.js +157 -123
  179. package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
  180. package/dist/commonjs/credentials/environmentCredentialOptions.d.ts.map +1 -1
  181. package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
  182. package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
  183. package/dist/commonjs/credentials/interactiveBrowserCredential.js +145 -108
  184. package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
  185. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  186. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
  187. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
  188. package/dist/commonjs/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  189. package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
  190. package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
  191. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
  192. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
  193. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
  194. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
  195. package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
  196. package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
  197. package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
  198. package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
  199. package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
  200. package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
  201. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
  202. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
  203. package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
  204. package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
  205. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
  206. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
  207. package/dist/commonjs/credentials/onBehalfOfCredential.js +169 -127
  208. package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
  209. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
  210. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
  211. package/dist/commonjs/credentials/usernamePasswordCredential.js +113 -76
  212. package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
  213. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  214. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
  215. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
  216. package/dist/commonjs/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  217. package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
  218. package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
  219. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
  220. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
  221. package/dist/commonjs/credentials/workloadIdentityCredential.js +123 -109
  222. package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
  223. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  224. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
  225. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
  226. package/dist/commonjs/errors.js +131 -132
  227. package/dist/commonjs/errors.js.map +7 -1
  228. package/dist/commonjs/index.d.ts +33 -33
  229. package/dist/commonjs/index.d.ts.map +1 -1
  230. package/dist/commonjs/index.js +115 -67
  231. package/dist/commonjs/index.js.map +7 -1
  232. package/dist/commonjs/msal/msal.js +38 -9
  233. package/dist/commonjs/msal/msal.js.map +7 -1
  234. package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
  235. package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
  236. package/dist/commonjs/msal/nodeFlows/msalClient.js +449 -478
  237. package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
  238. package/dist/commonjs/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  239. package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
  240. package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
  241. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
  242. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
  243. package/dist/commonjs/msal/types.js +16 -5
  244. package/dist/commonjs/msal/types.js.map +7 -1
  245. package/dist/commonjs/msal/utils.d.ts.map +1 -1
  246. package/dist/commonjs/msal/utils.js +179 -224
  247. package/dist/commonjs/msal/utils.js.map +7 -1
  248. package/dist/commonjs/plugins/consumer.js +32 -40
  249. package/dist/commonjs/plugins/consumer.js.map +7 -1
  250. package/dist/commonjs/plugins/provider.js +16 -5
  251. package/dist/commonjs/plugins/provider.js.map +7 -1
  252. package/dist/commonjs/regionalAuthority.js +93 -141
  253. package/dist/commonjs/regionalAuthority.js.map +7 -1
  254. package/dist/commonjs/tokenCredentialOptions.js +16 -5
  255. package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
  256. package/dist/commonjs/tokenProvider.js +52 -52
  257. package/dist/commonjs/tokenProvider.js.map +7 -1
  258. package/dist/commonjs/tsdoc-metadata.json +1 -1
  259. package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
  260. package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
  261. package/dist/commonjs/util/logging.js +91 -97
  262. package/dist/commonjs/util/logging.js.map +7 -1
  263. package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
  264. package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
  265. package/dist/commonjs/util/processUtils.d.ts +14 -3
  266. package/dist/commonjs/util/processUtils.d.ts.map +1 -1
  267. package/dist/commonjs/util/processUtils.js +67 -35
  268. package/dist/commonjs/util/processUtils.js.map +7 -1
  269. package/dist/commonjs/util/scopeUtils.js +39 -28
  270. package/dist/commonjs/util/scopeUtils.js.map +7 -1
  271. package/dist/commonjs/util/subscriptionUtils.js +35 -17
  272. package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
  273. package/dist/commonjs/util/tenantIdUtils.d.ts.map +1 -1
  274. package/dist/commonjs/util/tenantIdUtils.js +61 -45
  275. package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
  276. package/dist/commonjs/util/tracing.js +33 -16
  277. package/dist/commonjs/util/tracing.js.map +7 -1
  278. package/dist/esm/constants.d.ts +1 -1
  279. package/dist/esm/constants.js +1 -1
  280. package/dist/esm/constants.js.map +1 -1
  281. package/dist/esm/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  282. package/dist/esm/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  283. package/dist/esm/credentials/azureCliCredential.d.ts.map +1 -1
  284. package/dist/esm/credentials/azureCliCredential.js +21 -24
  285. package/dist/esm/credentials/azureCliCredential.js.map +1 -1
  286. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  287. package/dist/esm/credentials/azureDeveloperCliCredential.js +16 -24
  288. package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
  289. package/dist/esm/credentials/azurePipelinesCredential.js.map +1 -1
  290. package/dist/esm/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  291. package/dist/esm/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  292. package/dist/esm/credentials/azurePowerShellCredential.d.ts +10 -0
  293. package/dist/esm/credentials/azurePowerShellCredential.d.ts.map +1 -1
  294. package/dist/esm/credentials/azurePowerShellCredential.js +26 -6
  295. package/dist/esm/credentials/azurePowerShellCredential.js.map +1 -1
  296. package/dist/esm/credentials/brokerCredential.d.ts +2 -2
  297. package/dist/esm/credentials/brokerCredential.d.ts.map +1 -1
  298. package/dist/esm/credentials/brokerCredential.js.map +1 -1
  299. package/dist/esm/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  300. package/dist/esm/credentials/clientAssertionCredentialOptions.js.map +1 -1
  301. package/dist/esm/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  302. package/dist/esm/credentials/clientCertificateCredentialModels.js.map +1 -1
  303. package/dist/esm/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  304. package/dist/esm/credentials/clientCertificateCredentialOptions.js.map +1 -1
  305. package/dist/esm/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  306. package/dist/esm/credentials/clientSecretCredentialOptions.js.map +1 -1
  307. package/dist/esm/credentials/defaultAzureCredential.js.map +1 -1
  308. package/dist/esm/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  309. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  310. package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
  311. package/dist/esm/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  312. package/dist/esm/credentials/deviceCodeCredentialOptions.js.map +1 -1
  313. package/dist/esm/credentials/environmentCredential.d.ts.map +1 -1
  314. package/dist/esm/credentials/environmentCredential.js.map +1 -1
  315. package/dist/esm/credentials/environmentCredentialOptions.d.ts.map +1 -1
  316. package/dist/esm/credentials/environmentCredentialOptions.js.map +1 -1
  317. package/dist/esm/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  318. package/dist/esm/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  319. package/dist/esm/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  320. package/dist/esm/credentials/interactiveCredentialOptions.js.map +1 -1
  321. package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  322. package/dist/esm/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  323. package/dist/esm/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  324. package/dist/esm/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  325. package/dist/esm/credentials/visualStudioCodeCredential.js.map +1 -1
  326. package/dist/esm/credentials/workloadIdentityCredential.js.map +1 -1
  327. package/dist/esm/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  328. package/dist/esm/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  329. package/dist/esm/index.d.ts +33 -33
  330. package/dist/esm/index.d.ts.map +1 -1
  331. package/dist/esm/index.js.map +1 -1
  332. package/dist/esm/msal/nodeFlows/msalClient.js +3 -3
  333. package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
  334. package/dist/esm/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  335. package/dist/esm/msal/nodeFlows/msalPlugins.js.map +1 -1
  336. package/dist/esm/msal/utils.d.ts.map +1 -1
  337. package/dist/esm/msal/utils.js.map +1 -1
  338. package/dist/esm/util/processUtils.d.ts +14 -3
  339. package/dist/esm/util/processUtils.d.ts.map +1 -1
  340. package/dist/esm/util/processUtils.js +36 -19
  341. package/dist/esm/util/processUtils.js.map +1 -1
  342. package/dist/esm/util/tenantIdUtils.d.ts.map +1 -1
  343. package/dist/esm/util/tenantIdUtils.js.map +1 -1
  344. package/dist/workerd/constants.d.ts +1 -1
  345. package/dist/workerd/constants.js +1 -1
  346. package/dist/workerd/constants.js.map +1 -1
  347. package/dist/workerd/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  348. package/dist/workerd/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  349. package/dist/workerd/credentials/azureCliCredential.d.ts.map +1 -1
  350. package/dist/workerd/credentials/azureCliCredential.js +21 -24
  351. package/dist/workerd/credentials/azureCliCredential.js.map +1 -1
  352. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  353. package/dist/workerd/credentials/azureDeveloperCliCredential.js +16 -24
  354. package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
  355. package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -1
  356. package/dist/workerd/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  357. package/dist/workerd/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  358. package/dist/workerd/credentials/azurePowerShellCredential.d.ts +10 -0
  359. package/dist/workerd/credentials/azurePowerShellCredential.d.ts.map +1 -1
  360. package/dist/workerd/credentials/azurePowerShellCredential.js +26 -6
  361. package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -1
  362. package/dist/workerd/credentials/brokerCredential.d.ts +2 -2
  363. package/dist/workerd/credentials/brokerCredential.d.ts.map +1 -1
  364. package/dist/workerd/credentials/brokerCredential.js.map +1 -1
  365. package/dist/workerd/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  366. package/dist/workerd/credentials/clientAssertionCredentialOptions.js.map +1 -1
  367. package/dist/workerd/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  368. package/dist/workerd/credentials/clientCertificateCredentialModels.js.map +1 -1
  369. package/dist/workerd/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  370. package/dist/workerd/credentials/clientCertificateCredentialOptions.js.map +1 -1
  371. package/dist/workerd/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  372. package/dist/workerd/credentials/clientSecretCredentialOptions.js.map +1 -1
  373. package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -1
  374. package/dist/workerd/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  375. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  376. package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
  377. package/dist/workerd/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  378. package/dist/workerd/credentials/deviceCodeCredentialOptions.js.map +1 -1
  379. package/dist/workerd/credentials/environmentCredential.d.ts.map +1 -1
  380. package/dist/workerd/credentials/environmentCredential.js.map +1 -1
  381. package/dist/workerd/credentials/environmentCredentialOptions.d.ts.map +1 -1
  382. package/dist/workerd/credentials/environmentCredentialOptions.js.map +1 -1
  383. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  384. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  385. package/dist/workerd/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  386. package/dist/workerd/credentials/interactiveCredentialOptions.js.map +1 -1
  387. package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  388. package/dist/workerd/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  389. package/dist/workerd/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  390. package/dist/workerd/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  391. package/dist/workerd/credentials/visualStudioCodeCredential.js.map +1 -1
  392. package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -1
  393. package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  394. package/dist/workerd/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  395. package/dist/workerd/index.d.ts +33 -33
  396. package/dist/workerd/index.d.ts.map +1 -1
  397. package/dist/workerd/index.js.map +1 -1
  398. package/dist/workerd/msal/nodeFlows/msalClient.js +3 -3
  399. package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
  400. package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  401. package/dist/workerd/msal/nodeFlows/msalPlugins.js.map +1 -1
  402. package/dist/workerd/msal/utils.d.ts.map +1 -1
  403. package/dist/workerd/msal/utils.js.map +1 -1
  404. package/dist/workerd/util/processUtils.d.ts +14 -3
  405. package/dist/workerd/util/processUtils.d.ts.map +1 -1
  406. package/dist/workerd/util/processUtils.js +36 -19
  407. package/dist/workerd/util/processUtils.js.map +1 -1
  408. package/dist/workerd/util/tenantIdUtils.d.ts.map +1 -1
  409. package/dist/workerd/util/tenantIdUtils.js.map +1 -1
  410. package/package.json +36 -38
  411. package/dist/browser/credentials/azureCliCredential.d.ts +0 -13
  412. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +0 -13
  413. package/dist/browser/credentials/azurePipelinesCredential.d.ts +0 -13
  414. package/dist/browser/credentials/azurePowerShellCredential.d.ts +0 -12
  415. package/dist/browser/credentials/brokerCredential.d.ts +0 -35
  416. package/dist/browser/credentials/brokerCredential.d.ts.map +0 -1
  417. package/dist/browser/credentials/brokerCredential.js +0 -69
  418. package/dist/browser/credentials/brokerCredential.js.map +0 -1
  419. package/dist/browser/credentials/clientAssertionCredential.d.ts +0 -12
  420. package/dist/browser/credentials/clientCertificateCredential.d.ts +0 -13
  421. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts +0 -64
  422. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts.map +0 -1
  423. package/dist/browser/credentials/defaultAzureCredentialFunctions.js +0 -147
  424. package/dist/browser/credentials/defaultAzureCredentialFunctions.js.map +0 -1
  425. package/dist/browser/credentials/deviceCodeCredential.d.ts +0 -13
  426. package/dist/browser/credentials/environmentCredential.d.ts +0 -13
  427. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts +0 -18
  428. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts.map +0 -1
  429. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js +0 -97
  430. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js.map +0 -1
  431. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +0 -13
  432. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +0 -1
  433. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +0 -43
  434. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +0 -1
  435. package/dist/browser/credentials/managedIdentityCredential/index.d.ts +0 -6
  436. package/dist/browser/credentials/managedIdentityCredential/models.d.ts +0 -24
  437. package/dist/browser/credentials/managedIdentityCredential/models.d.ts.map +0 -1
  438. package/dist/browser/credentials/managedIdentityCredential/models.js +0 -4
  439. package/dist/browser/credentials/managedIdentityCredential/models.js.map +0 -1
  440. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts +0 -14
  441. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts.map +0 -1
  442. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js +0 -38
  443. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +0 -1
  444. package/dist/browser/credentials/onBehalfOfCredential.d.ts +0 -12
  445. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  446. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  447. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  448. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  449. package/dist/browser/msal/nodeFlows/msalClient.d.ts +0 -199
  450. package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +0 -1
  451. package/dist/browser/msal/nodeFlows/msalClient.js +0 -499
  452. package/dist/browser/msal/nodeFlows/msalClient.js.map +0 -1
  453. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts +0 -109
  454. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts.map +0 -1
  455. package/dist/browser/msal/nodeFlows/msalPlugins.js +0 -160
  456. package/dist/browser/msal/nodeFlows/msalPlugins.js.map +0 -1
  457. package/dist/browser/regionalAuthority.d.ts +0 -122
  458. package/dist/browser/regionalAuthority.d.ts.map +0 -1
  459. package/dist/browser/regionalAuthority.js +0 -139
  460. package/dist/browser/regionalAuthority.js.map +0 -1
  461. package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
  462. package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
  463. package/dist/browser/util/authHostEnv-browser.mjs +0 -7
  464. package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
  465. package/dist/browser/util/processUtils.d.ts +0 -13
  466. package/dist/browser/util/processUtils.d.ts.map +0 -1
  467. package/dist/browser/util/processUtils.js +0 -32
  468. package/dist/browser/util/processUtils.js.map +0 -1
  469. package/dist/browser/util/subscriptionUtils.d.ts +0 -6
  470. package/dist/browser/util/subscriptionUtils.d.ts.map +0 -1
  471. package/dist/browser/util/subscriptionUtils.js +0 -16
  472. package/dist/browser/util/subscriptionUtils.js.map +0 -1
  473. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  474. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  475. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +0 -5
  476. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  477. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  478. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  479. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +0 -265
  480. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  481. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  482. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  483. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +0 -5
  484. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  485. package/dist/commonjs/msal/credentials.d.ts +0 -52
  486. package/dist/commonjs/msal/credentials.d.ts.map +0 -1
  487. package/dist/commonjs/msal/credentials.js +0 -5
  488. package/dist/commonjs/msal/credentials.js.map +0 -1
  489. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  490. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  491. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  492. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  493. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  494. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  495. package/dist/esm/msal/browserFlows/msalBrowserCommon.js +0 -261
  496. package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  497. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  498. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  499. package/dist/esm/msal/browserFlows/msalBrowserOptions.js +0 -4
  500. package/dist/esm/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  501. package/dist/esm/msal/credentials.d.ts +0 -52
  502. package/dist/esm/msal/credentials.d.ts.map +0 -1
  503. package/dist/esm/msal/credentials.js +0 -4
  504. package/dist/esm/msal/credentials.js.map +0 -1
  505. package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
  506. package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
  507. package/dist/esm/util/authHostEnv-browser.mjs +0 -7
  508. package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
  509. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  510. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  511. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  512. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  513. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  514. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  515. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +0 -261
  516. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  517. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  518. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  519. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js +0 -4
  520. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  521. package/dist/workerd/msal/credentials.d.ts +0 -52
  522. package/dist/workerd/msal/credentials.d.ts.map +0 -1
  523. package/dist/workerd/msal/credentials.js +0 -4
  524. package/dist/workerd/msal/credentials.js.map +0 -1
  525. package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
  526. package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
  527. package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
  528. package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
  529. /package/dist/browser/credentials/{clientSecretCredential.d.ts → clientSecretCredential-browser.d.mts} +0 -0
  530. /package/dist/browser/credentials/{clientSecretCredential.js → clientSecretCredential-browser.mjs} +0 -0
  531. /package/dist/browser/credentials/{interactiveBrowserCredential.d.ts → interactiveBrowserCredential-browser.d.mts} +0 -0
  532. /package/dist/browser/credentials/{interactiveBrowserCredential.js → interactiveBrowserCredential-browser.mjs} +0 -0
  533. /package/dist/browser/credentials/{usernamePasswordCredential.d.ts → usernamePasswordCredential-browser.d.mts} +0 -0
  534. /package/dist/browser/credentials/{usernamePasswordCredential.js → usernamePasswordCredential-browser.mjs} +0 -0
  535. /package/dist/browser/msal/{msal.d.ts → msal-browser.d.mts} +0 -0
  536. /package/dist/browser/msal/{msal.js → msal-browser.mjs} +0 -0
  537. /package/dist/browser/plugins/{consumer.d.ts → consumer-browser.d.mts} +0 -0
  538. /package/dist/browser/plugins/{consumer.js → consumer-browser.mjs} +0 -0
  539. /package/dist/browser/util/{processMultiTenantRequest.d.ts → processMultiTenantRequest-browser.d.mts} +0 -0
  540. /package/dist/browser/util/{processMultiTenantRequest.js → processMultiTenantRequest-browser.mjs} +0 -0
@@ -1,120 +1,134 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.WorkloadIdentityCredential = exports.SupportedWorkloadEnvironmentVariables = void 0;
6
- const logging_js_1 = require("../util/logging.js");
7
- const clientAssertionCredential_js_1 = require("./clientAssertionCredential.js");
8
- const errors_js_1 = require("../errors.js");
9
- const tenantIdUtils_js_1 = require("../util/tenantIdUtils.js");
10
- const promises_1 = require("node:fs/promises");
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 workloadIdentityCredential_exports = {};
19
+ __export(workloadIdentityCredential_exports, {
20
+ SupportedWorkloadEnvironmentVariables: () => SupportedWorkloadEnvironmentVariables,
21
+ WorkloadIdentityCredential: () => WorkloadIdentityCredential
22
+ });
23
+ module.exports = __toCommonJS(workloadIdentityCredential_exports);
24
+ var import_logging = require("../util/logging.js");
25
+ var import_clientAssertionCredential = require("./clientAssertionCredential.js");
26
+ var import_errors = require("../errors.js");
27
+ var import_tenantIdUtils = require("../util/tenantIdUtils.js");
28
+ var import_promises = require("node:fs/promises");
11
29
  const credentialName = "WorkloadIdentityCredential";
12
- /**
13
- * Contains the list of all supported environment variable names so that an
14
- * appropriate error message can be generated when no credentials can be
15
- * configured.
16
- *
17
- * @internal
18
- */
19
- exports.SupportedWorkloadEnvironmentVariables = [
20
- "AZURE_TENANT_ID",
21
- "AZURE_CLIENT_ID",
22
- "AZURE_FEDERATED_TOKEN_FILE",
30
+ const SupportedWorkloadEnvironmentVariables = [
31
+ "AZURE_TENANT_ID",
32
+ "AZURE_CLIENT_ID",
33
+ "AZURE_FEDERATED_TOKEN_FILE"
23
34
  ];
24
- const logger = (0, logging_js_1.credentialLogger)(credentialName);
25
- /**
26
- * Workload Identity authentication is a feature in Azure that allows applications running on virtual machines (VMs)
27
- * to access other Azure resources without the need for a service principal or managed identity. With Workload Identity
28
- * authentication, applications authenticate themselves using their own identity, rather than using a shared service
29
- * principal or managed identity. Under the hood, Workload Identity authentication uses the concept of Service Account
30
- * Credentials (SACs), which are automatically created by Azure and stored securely in the VM. By using Workload
31
- * Identity authentication, you can avoid the need to manage and rotate service principals or managed identities for
32
- * each application on each VM. Additionally, because SACs are created automatically and managed by Azure, you don't
33
- * need to worry about storing and securing sensitive credentials themselves.
34
- * The WorkloadIdentityCredential supports Microsoft Entra Workload ID authentication on Azure Kubernetes and acquires
35
- * a token using the SACs available in the Azure Kubernetes environment.
36
- * Refer to <a href="https://learn.microsoft.com/azure/aks/workload-identity-overview">Microsoft Entra
37
- * Workload ID</a> for more information.
38
- */
35
+ const logger = (0, import_logging.credentialLogger)(credentialName);
39
36
  class WorkloadIdentityCredential {
40
- client;
41
- azureFederatedTokenFileContent = undefined;
42
- cacheDate = undefined;
43
- federatedTokenFilePath;
44
- /**
45
- * WorkloadIdentityCredential supports Microsoft Entra Workload ID on Kubernetes.
46
- *
47
- * @param options - The identity client options to use for authentication.
48
- */
49
- constructor(options) {
50
- // Logging environment variables for error details
51
- const assignedEnv = (0, logging_js_1.processEnvVars)(exports.SupportedWorkloadEnvironmentVariables).assigned.join(", ");
52
- logger.info(`Found the following environment variables: ${assignedEnv}`);
53
- const workloadIdentityCredentialOptions = options ?? {};
54
- const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;
55
- const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;
56
- this.federatedTokenFilePath =
57
- workloadIdentityCredentialOptions.tokenFilePath || process.env.AZURE_FEDERATED_TOKEN_FILE;
58
- if (tenantId) {
59
- (0, tenantIdUtils_js_1.checkTenantId)(logger, tenantId);
60
- }
61
- if (!clientId) {
62
- throw new errors_js_1.CredentialUnavailableError(`${credentialName}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_CLIENT_ID".
63
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);
64
- }
65
- if (!tenantId) {
66
- throw new errors_js_1.CredentialUnavailableError(`${credentialName}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_TENANT_ID".
67
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);
68
- }
69
- if (!this.federatedTokenFilePath) {
70
- throw new errors_js_1.CredentialUnavailableError(`${credentialName}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_FEDERATED_TOKEN_FILE".
71
- See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`);
72
- }
73
- logger.info(`Invoking ClientAssertionCredential with tenant ID: ${tenantId}, clientId: ${workloadIdentityCredentialOptions.clientId} and federated token path: [REDACTED]`);
74
- this.client = new clientAssertionCredential_js_1.ClientAssertionCredential(tenantId, clientId, this.readFileContents.bind(this), options);
37
+ client;
38
+ azureFederatedTokenFileContent = void 0;
39
+ cacheDate = void 0;
40
+ federatedTokenFilePath;
41
+ /**
42
+ * WorkloadIdentityCredential supports Microsoft Entra Workload ID on Kubernetes.
43
+ *
44
+ * @param options - The identity client options to use for authentication.
45
+ */
46
+ constructor(options) {
47
+ const assignedEnv = (0, import_logging.processEnvVars)(SupportedWorkloadEnvironmentVariables).assigned.join(", ");
48
+ logger.info(`Found the following environment variables: ${assignedEnv}`);
49
+ const workloadIdentityCredentialOptions = options ?? {};
50
+ const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;
51
+ const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;
52
+ this.federatedTokenFilePath = workloadIdentityCredentialOptions.tokenFilePath || process.env.AZURE_FEDERATED_TOKEN_FILE;
53
+ if (tenantId) {
54
+ (0, import_tenantIdUtils.checkTenantId)(logger, tenantId);
75
55
  }
76
- /**
77
- * Authenticates with Microsoft Entra ID and returns an access token if successful.
78
- * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
79
- *
80
- * @param scopes - The list of scopes for which the token will have access.
81
- * @param options - The options used to configure any requests this
82
- * TokenCredential implementation might make.
83
- */
84
- async getToken(scopes, options) {
85
- if (!this.client) {
86
- const errorMessage = `${credentialName}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters.
56
+ if (!clientId) {
57
+ throw new import_errors.CredentialUnavailableError(
58
+ `${credentialName}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_CLIENT_ID".
59
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
60
+ );
61
+ }
62
+ if (!tenantId) {
63
+ throw new import_errors.CredentialUnavailableError(
64
+ `${credentialName}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_TENANT_ID".
65
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
66
+ );
67
+ }
68
+ if (!this.federatedTokenFilePath) {
69
+ throw new import_errors.CredentialUnavailableError(
70
+ `${credentialName}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - "AZURE_FEDERATED_TOKEN_FILE".
71
+ See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`
72
+ );
73
+ }
74
+ logger.info(
75
+ `Invoking ClientAssertionCredential with tenant ID: ${tenantId}, clientId: ${workloadIdentityCredentialOptions.clientId} and federated token path: [REDACTED]`
76
+ );
77
+ this.client = new import_clientAssertionCredential.ClientAssertionCredential(
78
+ tenantId,
79
+ clientId,
80
+ this.readFileContents.bind(this),
81
+ options
82
+ );
83
+ }
84
+ /**
85
+ * Authenticates with Microsoft Entra ID and returns an access token if successful.
86
+ * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
87
+ *
88
+ * @param scopes - The list of scopes for which the token will have access.
89
+ * @param options - The options used to configure any requests this
90
+ * TokenCredential implementation might make.
91
+ */
92
+ async getToken(scopes, options) {
93
+ if (!this.client) {
94
+ const errorMessage = `${credentialName}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters.
87
95
  In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables -
88
96
  "AZURE_TENANT_ID",
89
97
  "AZURE_CLIENT_ID",
90
98
  "AZURE_FEDERATED_TOKEN_FILE". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`;
91
- logger.info(errorMessage);
92
- throw new errors_js_1.CredentialUnavailableError(errorMessage);
93
- }
94
- logger.info("Invoking getToken() of Client Assertion Credential");
95
- return this.client.getToken(scopes, options);
99
+ logger.info(errorMessage);
100
+ throw new import_errors.CredentialUnavailableError(errorMessage);
101
+ }
102
+ logger.info("Invoking getToken() of Client Assertion Credential");
103
+ return this.client.getToken(scopes, options);
104
+ }
105
+ async readFileContents() {
106
+ if (this.cacheDate !== void 0 && Date.now() - this.cacheDate >= 1e3 * 60 * 5) {
107
+ this.azureFederatedTokenFileContent = void 0;
108
+ }
109
+ if (!this.federatedTokenFilePath) {
110
+ throw new import_errors.CredentialUnavailableError(
111
+ `${credentialName}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`
112
+ );
96
113
  }
97
- async readFileContents() {
98
- // Cached assertions expire after 5 minutes
99
- if (this.cacheDate !== undefined && Date.now() - this.cacheDate >= 1000 * 60 * 5) {
100
- this.azureFederatedTokenFileContent = undefined;
101
- }
102
- if (!this.federatedTokenFilePath) {
103
- throw new errors_js_1.CredentialUnavailableError(`${credentialName}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`);
104
- }
105
- if (!this.azureFederatedTokenFileContent) {
106
- const file = await (0, promises_1.readFile)(this.federatedTokenFilePath, "utf8");
107
- const value = file.trim();
108
- if (!value) {
109
- throw new errors_js_1.CredentialUnavailableError(`${credentialName}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`);
110
- }
111
- else {
112
- this.azureFederatedTokenFileContent = value;
113
- this.cacheDate = Date.now();
114
- }
115
- }
116
- return this.azureFederatedTokenFileContent;
114
+ if (!this.azureFederatedTokenFileContent) {
115
+ const file = await (0, import_promises.readFile)(this.federatedTokenFilePath, "utf8");
116
+ const value = file.trim();
117
+ if (!value) {
118
+ throw new import_errors.CredentialUnavailableError(
119
+ `${credentialName}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`
120
+ );
121
+ } else {
122
+ this.azureFederatedTokenFileContent = value;
123
+ this.cacheDate = Date.now();
124
+ }
117
125
  }
126
+ return this.azureFederatedTokenFileContent;
127
+ }
118
128
  }
119
- exports.WorkloadIdentityCredential = WorkloadIdentityCredential;
120
- //# sourceMappingURL=workloadIdentityCredential.js.map
129
+ // Annotate the CommonJS export names for ESM import in node:
130
+ 0 && (module.exports = {
131
+ SupportedWorkloadEnvironmentVariables,
132
+ WorkloadIdentityCredential
133
+ });
134
+ //# sourceMappingURL=workloadIdentityCredential.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"workloadIdentityCredential.js","sourceRoot":"","sources":["../../../src/credentials/workloadIdentityCredential.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,mDAAsE;AAEtE,iFAA2E;AAC3E,4CAA0D;AAE1D,+DAAyD;AACzD,+CAA4C;AAE5C,MAAM,cAAc,GAAG,4BAA4B,CAAC;AACpD;;;;;;GAMG;AACU,QAAA,qCAAqC,GAAG;IACnD,iBAAiB;IACjB,iBAAiB;IACjB,4BAA4B;CAC7B,CAAC;AACF,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,cAAc,CAAC,CAAC;AAChD;;;;;;;;;;;;;GAaG;AACH,MAAa,0BAA0B;IAC7B,MAAM,CAAwC;IAC9C,8BAA8B,GAAuB,SAAS,CAAC;IAC/D,SAAS,GAAuB,SAAS,CAAC;IAC1C,sBAAsB,CAAqB;IAEnD;;;;OAIG;IACH,YAAY,OAA2C;QACrD,kDAAkD;QAClD,MAAM,WAAW,GAAG,IAAA,2BAAc,EAAC,6CAAqC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9F,MAAM,CAAC,IAAI,CAAC,8CAA8C,WAAW,EAAE,CAAC,CAAC;QAEzE,MAAM,iCAAiC,GAAG,OAAO,IAAI,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAG,iCAAiC,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC3F,MAAM,QAAQ,GAAG,iCAAiC,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC3F,IAAI,CAAC,sBAAsB;YACzB,iCAAiC,CAAC,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;QAC5F,IAAI,QAAQ,EAAE,CAAC;YACb,IAAA,gCAAa,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,sCAA0B,CAClC,GAAG,cAAc;qIAC4G,CAC9H,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,sCAA0B,CAClC,GAAG,cAAc;qIAC4G,CAC9H,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACjC,MAAM,IAAI,sCAA0B,CAClC,GAAG,cAAc;qIAC4G,CAC9H,CAAC;QACJ,CAAC;QAED,MAAM,CAAC,IAAI,CACT,sDAAsD,QAAQ,eAAe,iCAAiC,CAAC,QAAQ,uCAAuC,CAC/J,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,wDAAyB,CACzC,QAAQ,EACR,QAAQ,EACR,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAChC,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,QAAQ,CACnB,MAAyB,EACzB,OAAyB;QAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,GAAG,cAAc;;;;iKAIqH,CAAC;YAC5J,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC1B,MAAM,IAAI,sCAA0B,CAAC,YAAY,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,2CAA2C;QAC3C,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;YACjF,IAAI,CAAC,8BAA8B,GAAG,SAAS,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACjC,MAAM,IAAI,sCAA0B,CAClC,GAAG,cAAc,gDAAgD,IAAI,CAAC,sBAAsB,GAAG,CAChG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAQ,EAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;YACjE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,sCAA0B,CAClC,GAAG,cAAc,4CAA4C,IAAI,CAAC,sBAAsB,GAAG,CAC5F,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,8BAA8B,GAAG,KAAK,CAAC;gBAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAzGD,gEAyGC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\nimport { credentialLogger, processEnvVars } from \"../util/logging.js\";\n\nimport { ClientAssertionCredential } from \"./clientAssertionCredential.js\";\nimport { CredentialUnavailableError } from \"../errors.js\";\nimport type { WorkloadIdentityCredentialOptions } from \"./workloadIdentityCredentialOptions.js\";\nimport { checkTenantId } from \"../util/tenantIdUtils.js\";\nimport { readFile } from \"node:fs/promises\";\n\nconst credentialName = \"WorkloadIdentityCredential\";\n/**\n * Contains the list of all supported environment variable names so that an\n * appropriate error message can be generated when no credentials can be\n * configured.\n *\n * @internal\n */\nexport const SupportedWorkloadEnvironmentVariables = [\n \"AZURE_TENANT_ID\",\n \"AZURE_CLIENT_ID\",\n \"AZURE_FEDERATED_TOKEN_FILE\",\n];\nconst logger = credentialLogger(credentialName);\n/**\n * Workload Identity authentication is a feature in Azure that allows applications running on virtual machines (VMs)\n * to access other Azure resources without the need for a service principal or managed identity. With Workload Identity\n * authentication, applications authenticate themselves using their own identity, rather than using a shared service\n * principal or managed identity. Under the hood, Workload Identity authentication uses the concept of Service Account\n * Credentials (SACs), which are automatically created by Azure and stored securely in the VM. By using Workload\n * Identity authentication, you can avoid the need to manage and rotate service principals or managed identities for\n * each application on each VM. Additionally, because SACs are created automatically and managed by Azure, you don't\n * need to worry about storing and securing sensitive credentials themselves.\n * The WorkloadIdentityCredential supports Microsoft Entra Workload ID authentication on Azure Kubernetes and acquires\n * a token using the SACs available in the Azure Kubernetes environment.\n * Refer to <a href=\"https://learn.microsoft.com/azure/aks/workload-identity-overview\">Microsoft Entra\n * Workload ID</a> for more information.\n */\nexport class WorkloadIdentityCredential implements TokenCredential {\n private client: ClientAssertionCredential | undefined;\n private azureFederatedTokenFileContent: string | undefined = undefined;\n private cacheDate: number | undefined = undefined;\n private federatedTokenFilePath: string | undefined;\n\n /**\n * WorkloadIdentityCredential supports Microsoft Entra Workload ID on Kubernetes.\n *\n * @param options - The identity client options to use for authentication.\n */\n constructor(options?: WorkloadIdentityCredentialOptions) {\n // Logging environment variables for error details\n const assignedEnv = processEnvVars(SupportedWorkloadEnvironmentVariables).assigned.join(\", \");\n logger.info(`Found the following environment variables: ${assignedEnv}`);\n\n const workloadIdentityCredentialOptions = options ?? {};\n const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;\n const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;\n this.federatedTokenFilePath =\n workloadIdentityCredentialOptions.tokenFilePath || process.env.AZURE_FEDERATED_TOKEN_FILE;\n if (tenantId) {\n checkTenantId(logger, tenantId);\n }\n if (!clientId) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_CLIENT_ID\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n if (!tenantId) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_TENANT_ID\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n if (!this.federatedTokenFilePath) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_FEDERATED_TOKEN_FILE\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n logger.info(\n `Invoking ClientAssertionCredential with tenant ID: ${tenantId}, clientId: ${workloadIdentityCredentialOptions.clientId} and federated token path: [REDACTED]`,\n );\n this.client = new ClientAssertionCredential(\n tenantId,\n clientId,\n this.readFileContents.bind(this),\n options,\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 *\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 if (!this.client) {\n const errorMessage = `${credentialName}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters. \n In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables - \n \"AZURE_TENANT_ID\",\n \"AZURE_CLIENT_ID\",\n \"AZURE_FEDERATED_TOKEN_FILE\". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`;\n logger.info(errorMessage);\n throw new CredentialUnavailableError(errorMessage);\n }\n logger.info(\"Invoking getToken() of Client Assertion Credential\");\n return this.client.getToken(scopes, options);\n }\n\n private async readFileContents(): Promise<string> {\n // Cached assertions expire after 5 minutes\n if (this.cacheDate !== undefined && Date.now() - this.cacheDate >= 1000 * 60 * 5) {\n this.azureFederatedTokenFileContent = undefined;\n }\n if (!this.federatedTokenFilePath) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`,\n );\n }\n if (!this.azureFederatedTokenFileContent) {\n const file = await readFile(this.federatedTokenFilePath, \"utf8\");\n const value = file.trim();\n if (!value) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`,\n );\n } else {\n this.azureFederatedTokenFileContent = value;\n this.cacheDate = Date.now();\n }\n }\n return this.azureFederatedTokenFileContent;\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/workloadIdentityCredential.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\nimport { credentialLogger, processEnvVars } from \"../util/logging.js\";\n\nimport { ClientAssertionCredential } from \"#platform/credentials/clientAssertionCredential\";\nimport { CredentialUnavailableError } from \"../errors.js\";\nimport type { WorkloadIdentityCredentialOptions } from \"./workloadIdentityCredentialOptions.js\";\nimport { checkTenantId } from \"../util/tenantIdUtils.js\";\nimport { readFile } from \"node:fs/promises\";\n\nconst credentialName = \"WorkloadIdentityCredential\";\n/**\n * Contains the list of all supported environment variable names so that an\n * appropriate error message can be generated when no credentials can be\n * configured.\n *\n * @internal\n */\nexport const SupportedWorkloadEnvironmentVariables = [\n \"AZURE_TENANT_ID\",\n \"AZURE_CLIENT_ID\",\n \"AZURE_FEDERATED_TOKEN_FILE\",\n];\nconst logger = credentialLogger(credentialName);\n/**\n * Workload Identity authentication is a feature in Azure that allows applications running on virtual machines (VMs)\n * to access other Azure resources without the need for a service principal or managed identity. With Workload Identity\n * authentication, applications authenticate themselves using their own identity, rather than using a shared service\n * principal or managed identity. Under the hood, Workload Identity authentication uses the concept of Service Account\n * Credentials (SACs), which are automatically created by Azure and stored securely in the VM. By using Workload\n * Identity authentication, you can avoid the need to manage and rotate service principals or managed identities for\n * each application on each VM. Additionally, because SACs are created automatically and managed by Azure, you don't\n * need to worry about storing and securing sensitive credentials themselves.\n * The WorkloadIdentityCredential supports Microsoft Entra Workload ID authentication on Azure Kubernetes and acquires\n * a token using the SACs available in the Azure Kubernetes environment.\n * Refer to <a href=\"https://learn.microsoft.com/azure/aks/workload-identity-overview\">Microsoft Entra\n * Workload ID</a> for more information.\n */\nexport class WorkloadIdentityCredential implements TokenCredential {\n private client: ClientAssertionCredential | undefined;\n private azureFederatedTokenFileContent: string | undefined = undefined;\n private cacheDate: number | undefined = undefined;\n private federatedTokenFilePath: string | undefined;\n\n /**\n * WorkloadIdentityCredential supports Microsoft Entra Workload ID on Kubernetes.\n *\n * @param options - The identity client options to use for authentication.\n */\n constructor(options?: WorkloadIdentityCredentialOptions) {\n // Logging environment variables for error details\n const assignedEnv = processEnvVars(SupportedWorkloadEnvironmentVariables).assigned.join(\", \");\n logger.info(`Found the following environment variables: ${assignedEnv}`);\n\n const workloadIdentityCredentialOptions = options ?? {};\n const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;\n const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;\n this.federatedTokenFilePath =\n workloadIdentityCredentialOptions.tokenFilePath || process.env.AZURE_FEDERATED_TOKEN_FILE;\n if (tenantId) {\n checkTenantId(logger, tenantId);\n }\n if (!clientId) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. clientId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_CLIENT_ID\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n if (!tenantId) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. tenantId is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_TENANT_ID\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n if (!this.federatedTokenFilePath) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. federatedTokenFilePath is a required parameter. In DefaultAzureCredential and ManagedIdentityCredential, this can be provided as an environment variable - \"AZURE_FEDERATED_TOKEN_FILE\".\n See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`,\n );\n }\n\n logger.info(\n `Invoking ClientAssertionCredential with tenant ID: ${tenantId}, clientId: ${workloadIdentityCredentialOptions.clientId} and federated token path: [REDACTED]`,\n );\n this.client = new ClientAssertionCredential(\n tenantId,\n clientId,\n this.readFileContents.bind(this),\n options,\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 *\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 if (!this.client) {\n const errorMessage = `${credentialName}: is unavailable. tenantId, clientId, and federatedTokenFilePath are required parameters. \n In DefaultAzureCredential and ManagedIdentityCredential, these can be provided as environment variables - \n \"AZURE_TENANT_ID\",\n \"AZURE_CLIENT_ID\",\n \"AZURE_FEDERATED_TOKEN_FILE\". See the troubleshooting guide for more information: https://aka.ms/azsdk/js/identity/workloadidentitycredential/troubleshoot`;\n logger.info(errorMessage);\n throw new CredentialUnavailableError(errorMessage);\n }\n logger.info(\"Invoking getToken() of Client Assertion Credential\");\n return this.client.getToken(scopes, options);\n }\n\n private async readFileContents(): Promise<string> {\n // Cached assertions expire after 5 minutes\n if (this.cacheDate !== undefined && Date.now() - this.cacheDate >= 1000 * 60 * 5) {\n this.azureFederatedTokenFileContent = undefined;\n }\n if (!this.federatedTokenFilePath) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. Invalid file path provided ${this.federatedTokenFilePath}.`,\n );\n }\n if (!this.azureFederatedTokenFileContent) {\n const file = await readFile(this.federatedTokenFilePath, \"utf8\");\n const value = file.trim();\n if (!value) {\n throw new CredentialUnavailableError(\n `${credentialName}: is unavailable. No content on the file ${this.federatedTokenFilePath}.`,\n );\n } else {\n this.azureFederatedTokenFileContent = value;\n this.cacheDate = Date.now();\n }\n }\n return this.azureFederatedTokenFileContent;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAAiD;AAEjD,uCAA0C;AAC1C,oBAA2C;AAE3C,2BAA8B;AAC9B,sBAAyB;AAEzB,MAAM,iBAAiB;AAQhB,MAAM,wCAAwC;AAAA,EACnD;AAAA,EACA;AAAA,EACA;AACF;AACA,MAAM,aAAS,iCAAiB,cAAc;AAevC,MAAM,2BAAsD;AAAA,EACzD;AAAA,EACA,iCAAqD;AAAA,EACrD,YAAgC;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAY,SAA6C;AAEvD,UAAM,kBAAc,+BAAe,qCAAqC,EAAE,SAAS,KAAK,IAAI;AAC5F,WAAO,KAAK,8CAA8C,WAAW,EAAE;AAEvE,UAAM,oCAAoC,WAAW,CAAC;AACtD,UAAM,WAAW,kCAAkC,YAAY,QAAQ,IAAI;AAC3E,UAAM,WAAW,kCAAkC,YAAY,QAAQ,IAAI;AAC3E,SAAK,yBACH,kCAAkC,iBAAiB,QAAQ,IAAI;AACjE,QAAI,UAAU;AACZ,8CAAc,QAAQ,QAAQ;AAAA,IAChC;AACA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI;AAAA,QACR,GAAG,cAAc;AAAA;AAAA,MAEnB;AAAA,IACF;AAEA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI;AAAA,QACR,GAAG,cAAc;AAAA;AAAA,MAEnB;AAAA,IACF;AAEA,QAAI,CAAC,KAAK,wBAAwB;AAChC,YAAM,IAAI;AAAA,QACR,GAAG,cAAc;AAAA;AAAA,MAEnB;AAAA,IACF;AAEA,WAAO;AAAA,MACL,sDAAsD,QAAQ,eAAe,kCAAkC,QAAQ;AAAA,IACzH;AACA,SAAK,SAAS,IAAI;AAAA,MAChB;AAAA,MACA;AAAA,MACA,KAAK,iBAAiB,KAAK,IAAI;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,SACX,QACA,SACsB;AACtB,QAAI,CAAC,KAAK,QAAQ;AAChB,YAAM,eAAe,GAAG,cAAc;AAAA;AAAA;AAAA;AAAA;AAKtC,aAAO,KAAK,YAAY;AACxB,YAAM,IAAI,yCAA2B,YAAY;AAAA,IACnD;AACA,WAAO,KAAK,oDAAoD;AAChE,WAAO,KAAK,OAAO,SAAS,QAAQ,OAAO;AAAA,EAC7C;AAAA,EAEA,MAAc,mBAAoC;AAEhD,QAAI,KAAK,cAAc,UAAa,KAAK,IAAI,IAAI,KAAK,aAAa,MAAO,KAAK,GAAG;AAChF,WAAK,iCAAiC;AAAA,IACxC;AACA,QAAI,CAAC,KAAK,wBAAwB;AAChC,YAAM,IAAI;AAAA,QACR,GAAG,cAAc,gDAAgD,KAAK,sBAAsB;AAAA,MAC9F;AAAA,IACF;AACA,QAAI,CAAC,KAAK,gCAAgC;AACxC,YAAM,OAAO,UAAM,0BAAS,KAAK,wBAAwB,MAAM;AAC/D,YAAM,QAAQ,KAAK,KAAK;AACxB,UAAI,CAAC,OAAO;AACV,cAAM,IAAI;AAAA,UACR,GAAG,cAAc,4CAA4C,KAAK,sBAAsB;AAAA,QAC1F;AAAA,MACF,OAAO;AACL,aAAK,iCAAiC;AACtC,aAAK,YAAY,KAAK,IAAI;AAAA,MAC5B;AAAA,IACF;AACA,WAAO,KAAK;AAAA,EACd;AACF;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"workloadIdentityCredentialOptions.d.ts","sourceRoot":"","sources":["../../../src/credentials/workloadIdentityCredentialOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,iCAAiC,EACvC,0BAA0B;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"workloadIdentityCredentialOptions.d.ts","sourceRoot":"","sources":["../../../src/credentials/workloadIdentityCredentialOptions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,iCACf,SAAQ,iCAAiC,EAAE,0BAA0B;IACrE;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -1,5 +1,16 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=workloadIdentityCredentialOptions.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var workloadIdentityCredentialOptions_exports = {};
15
+ module.exports = __toCommonJS(workloadIdentityCredentialOptions_exports);
16
+ //# sourceMappingURL=workloadIdentityCredentialOptions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"workloadIdentityCredentialOptions.js","sourceRoot":"","sources":["../../../src/credentials/workloadIdentityCredentialOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthorityValidationOptions } from \"./authorityValidationOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Options for the {@link WorkloadIdentityCredential}\n */\nexport interface WorkloadIdentityCredentialOptions\n extends MultiTenantTokenCredentialOptions,\n AuthorityValidationOptions {\n /**\n * ID of the application's Microsoft Entra tenant. Also called its directory ID.\n */\n tenantId?: string;\n /**\n * The client ID of a Microsoft Entra app registration.\n */\n clientId?: string;\n /**\n * The path to a file containing a Kubernetes service account token that authenticates the identity.\n */\n tokenFilePath?: string;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/workloadIdentityCredentialOptions.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthorityValidationOptions } from \"./authorityValidationOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Options for the {@link WorkloadIdentityCredential}\n */\nexport interface WorkloadIdentityCredentialOptions\n extends MultiTenantTokenCredentialOptions, AuthorityValidationOptions {\n /**\n * ID of the application's Microsoft Entra tenant. Also called its directory ID.\n */\n tenantId?: string;\n /**\n * The client ID of a Microsoft Entra app registration.\n */\n clientId?: string;\n /**\n * The path to a file containing a Kubernetes service account token that authenticates the identity.\n */\n tokenFilePath?: string;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,146 +1,145 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.AuthenticationRequiredError = exports.AggregateAuthenticationError = exports.AggregateAuthenticationErrorName = exports.AuthenticationError = exports.AuthenticationErrorName = exports.CredentialUnavailableError = exports.CredentialUnavailableErrorName = void 0;
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 errors_exports = {};
19
+ __export(errors_exports, {
20
+ AggregateAuthenticationError: () => AggregateAuthenticationError,
21
+ AggregateAuthenticationErrorName: () => AggregateAuthenticationErrorName,
22
+ AuthenticationError: () => AuthenticationError,
23
+ AuthenticationErrorName: () => AuthenticationErrorName,
24
+ AuthenticationRequiredError: () => AuthenticationRequiredError,
25
+ CredentialUnavailableError: () => CredentialUnavailableError,
26
+ CredentialUnavailableErrorName: () => CredentialUnavailableErrorName
27
+ });
28
+ module.exports = __toCommonJS(errors_exports);
6
29
  function isErrorResponse(errorResponse) {
7
- return (errorResponse &&
8
- typeof errorResponse.error === "string" &&
9
- typeof errorResponse.error_description === "string");
30
+ return errorResponse && typeof errorResponse.error === "string" && typeof errorResponse.error_description === "string";
10
31
  }
11
- /**
12
- * The Error.name value of an CredentialUnavailable
13
- */
14
- exports.CredentialUnavailableErrorName = "CredentialUnavailableError";
15
- /**
16
- * This signifies that the credential that was tried in a chained credential
17
- * was not available to be used as the credential. Rather than treating this as
18
- * an error that should halt the chain, it's caught and the chain continues
19
- */
32
+ const CredentialUnavailableErrorName = "CredentialUnavailableError";
20
33
  class CredentialUnavailableError extends Error {
21
- constructor(message, options) {
22
- super(message, options);
23
- this.name = exports.CredentialUnavailableErrorName;
24
- }
34
+ constructor(message, options) {
35
+ super(message, options);
36
+ this.name = CredentialUnavailableErrorName;
37
+ }
25
38
  }
26
- exports.CredentialUnavailableError = CredentialUnavailableError;
27
- /**
28
- * The Error.name value of an AuthenticationError
29
- */
30
- exports.AuthenticationErrorName = "AuthenticationError";
31
- /**
32
- * Provides details about a failure to authenticate with Azure Active
33
- * Directory. The `errorResponse` field contains more details about
34
- * the specific failure.
35
- */
39
+ const AuthenticationErrorName = "AuthenticationError";
36
40
  class AuthenticationError extends Error {
37
- /**
38
- * The HTTP status code returned from the authentication request.
39
- */
40
- statusCode;
41
- /**
42
- * The error response details.
43
- */
44
- errorResponse;
45
- constructor(statusCode, errorBody, options) {
46
- let errorResponse = {
47
- error: "unknown",
48
- errorDescription: "An unknown error occurred and no additional details are available.",
49
- };
50
- if (isErrorResponse(errorBody)) {
51
- errorResponse = convertOAuthErrorResponseToErrorResponse(errorBody);
52
- }
53
- else if (typeof errorBody === "string") {
54
- try {
55
- // Most error responses will contain JSON-formatted error details
56
- // in the response body
57
- const oauthErrorResponse = JSON.parse(errorBody);
58
- errorResponse = convertOAuthErrorResponseToErrorResponse(oauthErrorResponse);
59
- }
60
- catch (e) {
61
- if (statusCode === 400) {
62
- errorResponse = {
63
- error: "invalid_request",
64
- errorDescription: `The service indicated that the request was invalid.\n\n${errorBody}`,
65
- };
66
- }
67
- else {
68
- errorResponse = {
69
- error: "unknown_error",
70
- errorDescription: `An unknown error has occurred. Response body:\n\n${errorBody}`,
71
- };
72
- }
73
- }
74
- }
75
- else {
76
- errorResponse = {
77
- error: "unknown_error",
78
- errorDescription: "An unknown error occurred and no additional details are available.",
79
- };
41
+ /**
42
+ * The HTTP status code returned from the authentication request.
43
+ */
44
+ statusCode;
45
+ /**
46
+ * The error response details.
47
+ */
48
+ errorResponse;
49
+ constructor(statusCode, errorBody, options) {
50
+ let errorResponse = {
51
+ error: "unknown",
52
+ errorDescription: "An unknown error occurred and no additional details are available."
53
+ };
54
+ if (isErrorResponse(errorBody)) {
55
+ errorResponse = convertOAuthErrorResponseToErrorResponse(errorBody);
56
+ } else if (typeof errorBody === "string") {
57
+ try {
58
+ const oauthErrorResponse = JSON.parse(errorBody);
59
+ errorResponse = convertOAuthErrorResponseToErrorResponse(oauthErrorResponse);
60
+ } catch (e) {
61
+ if (statusCode === 400) {
62
+ errorResponse = {
63
+ error: "invalid_request",
64
+ errorDescription: `The service indicated that the request was invalid.
65
+
66
+ ${errorBody}`
67
+ };
68
+ } else {
69
+ errorResponse = {
70
+ error: "unknown_error",
71
+ errorDescription: `An unknown error has occurred. Response body:
72
+
73
+ ${errorBody}`
74
+ };
80
75
  }
81
- super(`${errorResponse.error} Status code: ${statusCode}\nMore details:\n${errorResponse.errorDescription},`, options);
82
- this.statusCode = statusCode;
83
- this.errorResponse = errorResponse;
84
- // Ensure that this type reports the correct name
85
- this.name = exports.AuthenticationErrorName;
76
+ }
77
+ } else {
78
+ errorResponse = {
79
+ error: "unknown_error",
80
+ errorDescription: "An unknown error occurred and no additional details are available."
81
+ };
86
82
  }
83
+ super(
84
+ `${errorResponse.error} Status code: ${statusCode}
85
+ More details:
86
+ ${errorResponse.errorDescription},`,
87
+ options
88
+ );
89
+ this.statusCode = statusCode;
90
+ this.errorResponse = errorResponse;
91
+ this.name = AuthenticationErrorName;
92
+ }
87
93
  }
88
- exports.AuthenticationError = AuthenticationError;
89
- /**
90
- * The Error.name value of an AggregateAuthenticationError
91
- */
92
- exports.AggregateAuthenticationErrorName = "AggregateAuthenticationError";
93
- /**
94
- * Provides an `errors` array containing {@link AuthenticationError} instance
95
- * for authentication failures from credentials in a {@link ChainedTokenCredential}.
96
- */
94
+ const AggregateAuthenticationErrorName = "AggregateAuthenticationError";
97
95
  class AggregateAuthenticationError extends Error {
98
- /**
99
- * The array of error objects that were thrown while trying to authenticate
100
- * with the credentials in a {@link ChainedTokenCredential}.
101
- */
102
- errors;
103
- constructor(errors, errorMessage) {
104
- const errorDetail = errors.join("\n");
105
- super(`${errorMessage}\n${errorDetail}`);
106
- this.errors = errors;
107
- // Ensure that this type reports the correct name
108
- this.name = exports.AggregateAuthenticationErrorName;
109
- }
96
+ /**
97
+ * The array of error objects that were thrown while trying to authenticate
98
+ * with the credentials in a {@link ChainedTokenCredential}.
99
+ */
100
+ errors;
101
+ constructor(errors, errorMessage) {
102
+ const errorDetail = errors.join("\n");
103
+ super(`${errorMessage}
104
+ ${errorDetail}`);
105
+ this.errors = errors;
106
+ this.name = AggregateAuthenticationErrorName;
107
+ }
110
108
  }
111
- exports.AggregateAuthenticationError = AggregateAuthenticationError;
112
109
  function convertOAuthErrorResponseToErrorResponse(errorBody) {
113
- return {
114
- error: errorBody.error,
115
- errorDescription: errorBody.error_description,
116
- correlationId: errorBody.correlation_id,
117
- errorCodes: errorBody.error_codes,
118
- timestamp: errorBody.timestamp,
119
- traceId: errorBody.trace_id,
120
- };
110
+ return {
111
+ error: errorBody.error,
112
+ errorDescription: errorBody.error_description,
113
+ correlationId: errorBody.correlation_id,
114
+ errorCodes: errorBody.error_codes,
115
+ timestamp: errorBody.timestamp,
116
+ traceId: errorBody.trace_id
117
+ };
121
118
  }
122
- /**
123
- * Error used to enforce authentication after trying to retrieve a token silently.
124
- */
125
119
  class AuthenticationRequiredError extends Error {
126
- /**
127
- * The list of scopes for which the token will have access.
128
- */
129
- scopes;
130
- /**
131
- * The options passed to the getToken request.
132
- */
133
- getTokenOptions;
134
- constructor(
135
- /**
136
- * Optional parameters. A message can be specified. The {@link GetTokenOptions} of the request can also be specified to more easily associate the error with the received parameters.
137
- */
138
- options) {
139
- super(options.message, options.cause ? { cause: options.cause } : undefined);
140
- this.scopes = options.scopes;
141
- this.getTokenOptions = options.getTokenOptions;
142
- this.name = "AuthenticationRequiredError";
143
- }
120
+ /**
121
+ * The list of scopes for which the token will have access.
122
+ */
123
+ scopes;
124
+ /**
125
+ * The options passed to the getToken request.
126
+ */
127
+ getTokenOptions;
128
+ constructor(options) {
129
+ super(options.message, options.cause ? { cause: options.cause } : void 0);
130
+ this.scopes = options.scopes;
131
+ this.getTokenOptions = options.getTokenOptions;
132
+ this.name = "AuthenticationRequiredError";
133
+ }
144
134
  }
145
- exports.AuthenticationRequiredError = AuthenticationRequiredError;
146
- //# sourceMappingURL=errors.js.map
135
+ // Annotate the CommonJS export names for ESM import in node:
136
+ 0 && (module.exports = {
137
+ AggregateAuthenticationError,
138
+ AggregateAuthenticationErrorName,
139
+ AuthenticationError,
140
+ AuthenticationErrorName,
141
+ AuthenticationRequiredError,
142
+ CredentialUnavailableError,
143
+ CredentialUnavailableErrorName
144
+ });
145
+ //# sourceMappingURL=errors.js.map