@azure/identity 4.14.0-beta.2 → 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 (368) 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 +3 -3
  5. package/dist/browser/credentials/authorizationCodeCredential.d.ts.map +1 -0
  6. package/dist/browser/credentials/authorizationCodeCredential.js +2 -2
  7. package/dist/browser/credentials/authorizationCodeCredential.js.map +1 -0
  8. package/dist/browser/credentials/azureCliCredential.d.ts +5 -4
  9. package/dist/browser/credentials/azureCliCredential.d.ts.map +1 -0
  10. package/dist/browser/credentials/azureCliCredential.js +3 -3
  11. package/dist/browser/credentials/azureCliCredential.js.map +1 -0
  12. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +5 -4
  13. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts.map +1 -0
  14. package/dist/browser/credentials/azureDeveloperCliCredential.js +3 -3
  15. package/dist/browser/credentials/azureDeveloperCliCredential.js.map +1 -0
  16. package/dist/browser/credentials/azurePipelinesCredential.d.ts +5 -4
  17. package/dist/browser/credentials/azurePipelinesCredential.d.ts.map +1 -0
  18. package/dist/browser/credentials/azurePipelinesCredential.js +3 -3
  19. package/dist/browser/credentials/azurePipelinesCredential.js.map +1 -0
  20. package/dist/browser/credentials/azurePowerShellCredential.d.ts +5 -4
  21. package/dist/browser/credentials/azurePowerShellCredential.d.ts.map +1 -0
  22. package/dist/browser/credentials/azurePowerShellCredential.js +3 -3
  23. package/dist/browser/credentials/azurePowerShellCredential.js.map +1 -0
  24. package/dist/browser/credentials/clientAssertionCredential.d.ts +5 -4
  25. package/dist/browser/credentials/clientAssertionCredential.d.ts.map +1 -0
  26. package/dist/browser/credentials/clientAssertionCredential.js +3 -3
  27. package/dist/browser/credentials/clientAssertionCredential.js.map +1 -0
  28. package/dist/browser/credentials/clientCertificateCredential.d.ts +6 -4
  29. package/dist/browser/credentials/clientCertificateCredential.d.ts.map +1 -0
  30. package/dist/browser/credentials/clientCertificateCredential.js +3 -3
  31. package/dist/browser/credentials/clientCertificateCredential.js.map +1 -0
  32. package/dist/browser/credentials/clientSecretCredential.d.ts +1 -1
  33. package/dist/browser/credentials/clientSecretCredential.d.ts.map +1 -0
  34. package/dist/browser/credentials/clientSecretCredential.js +1 -1
  35. package/dist/browser/credentials/clientSecretCredential.js.map +1 -0
  36. package/dist/browser/credentials/defaultAzureCredential.d.ts +3 -3
  37. package/dist/browser/credentials/defaultAzureCredential.d.ts.map +1 -0
  38. package/dist/browser/credentials/defaultAzureCredential.js +2 -2
  39. package/dist/browser/credentials/defaultAzureCredential.js.map +1 -0
  40. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  41. package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
  42. package/dist/browser/credentials/deviceCodeCredential.d.ts +5 -4
  43. package/dist/browser/credentials/deviceCodeCredential.d.ts.map +1 -0
  44. package/dist/browser/credentials/deviceCodeCredential.js +3 -3
  45. package/dist/browser/credentials/deviceCodeCredential.js.map +1 -0
  46. package/dist/browser/credentials/environmentCredential.d.ts +5 -4
  47. package/dist/browser/credentials/environmentCredential.d.ts.map +1 -0
  48. package/dist/browser/credentials/environmentCredential.js +3 -3
  49. package/dist/browser/credentials/environmentCredential.js.map +1 -0
  50. package/dist/browser/credentials/interactiveBrowserCredential.d.ts +1 -1
  51. package/dist/browser/credentials/interactiveBrowserCredential.d.ts.map +1 -0
  52. package/dist/browser/credentials/interactiveBrowserCredential.js +1 -1
  53. package/dist/browser/credentials/interactiveBrowserCredential.js.map +1 -0
  54. package/dist/browser/credentials/managedIdentityCredential/index.d.ts +9 -4
  55. package/dist/browser/credentials/managedIdentityCredential/index.d.ts.map +1 -0
  56. package/dist/browser/credentials/managedIdentityCredential/index.js +3 -3
  57. package/dist/browser/credentials/managedIdentityCredential/index.js.map +1 -0
  58. package/dist/browser/credentials/onBehalfOfCredential.d.ts +5 -4
  59. package/dist/browser/credentials/onBehalfOfCredential.d.ts.map +1 -0
  60. package/dist/browser/credentials/onBehalfOfCredential.js +3 -3
  61. package/dist/browser/credentials/onBehalfOfCredential.js.map +1 -0
  62. package/dist/browser/credentials/usernamePasswordCredential.d.ts +1 -1
  63. package/dist/browser/credentials/usernamePasswordCredential.d.ts.map +1 -0
  64. package/dist/browser/credentials/usernamePasswordCredential.js +1 -1
  65. package/dist/browser/credentials/usernamePasswordCredential.js.map +1 -0
  66. package/dist/browser/credentials/visualStudioCodeCredential.d.ts +5 -4
  67. package/dist/browser/credentials/visualStudioCodeCredential.d.ts.map +1 -0
  68. package/dist/browser/credentials/visualStudioCodeCredential.js +3 -3
  69. package/dist/browser/credentials/visualStudioCodeCredential.js.map +1 -0
  70. package/dist/browser/credentials/workloadIdentityCredential.d.ts +5 -4
  71. package/dist/browser/credentials/workloadIdentityCredential.d.ts.map +1 -0
  72. package/dist/browser/credentials/workloadIdentityCredential.js +3 -3
  73. package/dist/browser/credentials/workloadIdentityCredential.js.map +1 -0
  74. package/dist/browser/index.d.ts +33 -33
  75. package/dist/browser/index.d.ts.map +1 -1
  76. package/dist/browser/index.js.map +1 -1
  77. package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  78. package/dist/browser/msal/browserFlows/msalBrowserCommon.js +2 -3
  79. package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  80. package/dist/browser/msal/msal.d.ts +2 -3
  81. package/dist/browser/msal/msal.d.ts.map +1 -0
  82. package/dist/browser/msal/msal.js +2 -3
  83. package/dist/browser/msal/msal.js.map +1 -0
  84. package/dist/browser/msal/nodeFlows/msalClient.d.ts +2 -2
  85. package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +1 -1
  86. package/dist/browser/msal/nodeFlows/msalClient.js +3 -3
  87. package/dist/browser/msal/nodeFlows/msalClient.js.map +1 -1
  88. package/dist/browser/msal/utils.d.ts +5 -4
  89. package/dist/browser/msal/utils.d.ts.map +1 -1
  90. package/dist/browser/msal/utils.js +10 -10
  91. package/dist/browser/msal/utils.js.map +1 -1
  92. package/dist/browser/plugins/consumer.d.ts +1 -1
  93. package/dist/browser/plugins/consumer.d.ts.map +1 -0
  94. package/dist/browser/plugins/consumer.js +1 -1
  95. package/dist/browser/plugins/consumer.js.map +1 -0
  96. package/dist/browser/util/processMultiTenantRequest.d.ts +3 -2
  97. package/dist/browser/util/processMultiTenantRequest.d.ts.map +1 -0
  98. package/dist/browser/util/processMultiTenantRequest.js +2 -2
  99. package/dist/browser/util/processMultiTenantRequest.js.map +1 -0
  100. package/dist/commonjs/client/identityClient.js +294 -288
  101. package/dist/commonjs/client/identityClient.js.map +7 -1
  102. package/dist/commonjs/constants.d.ts +1 -1
  103. package/dist/commonjs/constants.js +61 -78
  104. package/dist/commonjs/constants.js.map +7 -1
  105. package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
  106. package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
  107. package/dist/commonjs/credentials/authorizationCodeCredential.js +98 -74
  108. package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
  109. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
  110. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
  111. package/dist/commonjs/credentials/azureCliCredential.js +245 -214
  112. package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
  113. package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
  114. package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
  115. package/dist/commonjs/credentials/azureDeveloperCliCredential.js +237 -225
  116. package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
  117. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
  118. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
  119. package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
  120. package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
  121. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
  122. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
  123. package/dist/commonjs/credentials/azurePowerShellCredential.js +201 -205
  124. package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
  125. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
  126. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
  127. package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
  128. package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
  129. package/dist/commonjs/credentials/brokerCredential.js +103 -70
  130. package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
  131. package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
  132. package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
  133. package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
  134. package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
  135. package/dist/commonjs/credentials/clientAssertionCredential.js +101 -63
  136. package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
  137. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
  138. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
  139. package/dist/commonjs/credentials/clientCertificateCredential.js +129 -123
  140. package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
  141. package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
  142. package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
  143. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
  144. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
  145. package/dist/commonjs/credentials/clientSecretCredential.js +96 -67
  146. package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
  147. package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
  148. package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
  149. package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
  150. package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
  151. package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
  152. package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
  153. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
  154. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
  155. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  156. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
  157. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
  158. package/dist/commonjs/credentials/deviceCodeCredential.js +132 -103
  159. package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
  160. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
  161. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
  162. package/dist/commonjs/credentials/environmentCredential.js +157 -123
  163. package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
  164. package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
  165. package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
  166. package/dist/commonjs/credentials/interactiveBrowserCredential.js +144 -107
  167. package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
  168. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
  169. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
  170. package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
  171. package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
  172. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
  173. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
  174. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
  175. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
  176. package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
  177. package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
  178. package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
  179. package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
  180. package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
  181. package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
  182. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
  183. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
  184. package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
  185. package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
  186. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
  187. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
  188. package/dist/commonjs/credentials/onBehalfOfCredential.js +168 -126
  189. package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
  190. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
  191. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
  192. package/dist/commonjs/credentials/usernamePasswordCredential.js +112 -75
  193. package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
  194. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
  195. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
  196. package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
  197. package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
  198. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
  199. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
  200. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +16 -5
  201. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +7 -1
  202. package/dist/commonjs/credentials/workloadIdentityCredential.js +284 -274
  203. package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
  204. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
  205. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
  206. package/dist/commonjs/errors.js +131 -132
  207. package/dist/commonjs/errors.js.map +7 -1
  208. package/dist/commonjs/index.d.ts +33 -33
  209. package/dist/commonjs/index.d.ts.map +1 -1
  210. package/dist/commonjs/index.js +115 -67
  211. package/dist/commonjs/index.js.map +7 -1
  212. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  213. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +226 -249
  214. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +7 -1
  215. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +16 -5
  216. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +7 -1
  217. package/dist/commonjs/msal/credentials.js +16 -5
  218. package/dist/commonjs/msal/credentials.js.map +7 -1
  219. package/dist/commonjs/msal/msal.d.ts +1 -2
  220. package/dist/commonjs/msal/msal.d.ts.map +1 -1
  221. package/dist/commonjs/msal/msal.js +30 -9
  222. package/dist/commonjs/msal/msal.js.map +7 -1
  223. package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
  224. package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
  225. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts +2 -2
  226. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts.map +1 -1
  227. package/dist/commonjs/msal/nodeFlows/msalClient.js +450 -478
  228. package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
  229. package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
  230. package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
  231. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
  232. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
  233. package/dist/commonjs/msal/types.js +16 -5
  234. package/dist/commonjs/msal/types.js.map +7 -1
  235. package/dist/commonjs/msal/utils.d.ts +5 -4
  236. package/dist/commonjs/msal/utils.d.ts.map +1 -1
  237. package/dist/commonjs/msal/utils.js +171 -211
  238. package/dist/commonjs/msal/utils.js.map +7 -1
  239. package/dist/commonjs/plugins/consumer.js +32 -40
  240. package/dist/commonjs/plugins/consumer.js.map +7 -1
  241. package/dist/commonjs/plugins/provider.js +16 -5
  242. package/dist/commonjs/plugins/provider.js.map +7 -1
  243. package/dist/commonjs/regionalAuthority.js +93 -141
  244. package/dist/commonjs/regionalAuthority.js.map +7 -1
  245. package/dist/commonjs/tokenCredentialOptions.js +16 -5
  246. package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
  247. package/dist/commonjs/tokenProvider.js +52 -52
  248. package/dist/commonjs/tokenProvider.js.map +7 -1
  249. package/dist/commonjs/tsdoc-metadata.json +1 -1
  250. package/dist/commonjs/util/authorityHost.js +34 -19
  251. package/dist/commonjs/util/authorityHost.js.map +7 -1
  252. package/dist/commonjs/util/certificatesUtils.js +54 -45
  253. package/dist/commonjs/util/certificatesUtils.js.map +7 -1
  254. package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
  255. package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
  256. package/dist/commonjs/util/logging.js +91 -97
  257. package/dist/commonjs/util/logging.js.map +7 -1
  258. package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
  259. package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
  260. package/dist/commonjs/util/processUtils.js +60 -35
  261. package/dist/commonjs/util/processUtils.js.map +7 -1
  262. package/dist/commonjs/util/scopeUtils.js +39 -28
  263. package/dist/commonjs/util/scopeUtils.js.map +7 -1
  264. package/dist/commonjs/util/subscriptionUtils.js +35 -17
  265. package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
  266. package/dist/commonjs/util/tenantIdUtils.js +61 -45
  267. package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
  268. package/dist/commonjs/util/tracing.js +33 -16
  269. package/dist/commonjs/util/tracing.js.map +7 -1
  270. package/dist/esm/constants.d.ts +1 -1
  271. package/dist/esm/constants.js +1 -1
  272. package/dist/esm/constants.js.map +1 -1
  273. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  274. package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
  275. package/dist/esm/index.d.ts +33 -33
  276. package/dist/esm/index.d.ts.map +1 -1
  277. package/dist/esm/index.js.map +1 -1
  278. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  279. package/dist/esm/msal/browserFlows/msalBrowserCommon.js +2 -3
  280. package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  281. package/dist/esm/msal/msal.d.ts +1 -2
  282. package/dist/esm/msal/msal.d.ts.map +1 -1
  283. package/dist/esm/msal/msal.js +1 -2
  284. package/dist/esm/msal/msal.js.map +1 -1
  285. package/dist/esm/msal/nodeFlows/msalClient.d.ts +2 -2
  286. package/dist/esm/msal/nodeFlows/msalClient.d.ts.map +1 -1
  287. package/dist/esm/msal/nodeFlows/msalClient.js +3 -3
  288. package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
  289. package/dist/esm/msal/utils.d.ts +5 -4
  290. package/dist/esm/msal/utils.d.ts.map +1 -1
  291. package/dist/esm/msal/utils.js +10 -10
  292. package/dist/esm/msal/utils.js.map +1 -1
  293. package/dist/workerd/constants.d.ts +1 -1
  294. package/dist/workerd/constants.js +1 -1
  295. package/dist/workerd/constants.js.map +1 -1
  296. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  297. package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
  298. package/dist/workerd/index.d.ts +33 -33
  299. package/dist/workerd/index.d.ts.map +1 -1
  300. package/dist/workerd/index.js.map +1 -1
  301. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  302. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +2 -3
  303. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  304. package/dist/workerd/msal/msal.d.ts +1 -2
  305. package/dist/workerd/msal/msal.d.ts.map +1 -1
  306. package/dist/workerd/msal/msal.js +1 -2
  307. package/dist/workerd/msal/msal.js.map +1 -1
  308. package/dist/workerd/msal/nodeFlows/msalClient.d.ts +2 -2
  309. package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -1
  310. package/dist/workerd/msal/nodeFlows/msalClient.js +3 -3
  311. package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
  312. package/dist/workerd/msal/utils.d.ts +5 -4
  313. package/dist/workerd/msal/utils.d.ts.map +1 -1
  314. package/dist/workerd/msal/utils.js +10 -10
  315. package/dist/workerd/msal/utils.js.map +1 -1
  316. package/package.json +10 -27
  317. package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +0 -1
  318. package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +0 -1
  319. package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +0 -1
  320. package/dist/browser/credentials/azureCliCredential-browser.mjs.map +0 -1
  321. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +0 -1
  322. package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +0 -1
  323. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +0 -1
  324. package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +0 -1
  325. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +0 -1
  326. package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +0 -1
  327. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +0 -1
  328. package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +0 -1
  329. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +0 -1
  330. package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +0 -1
  331. package/dist/browser/credentials/clientSecretCredential-browser.d.mts.map +0 -1
  332. package/dist/browser/credentials/clientSecretCredential-browser.mjs.map +0 -1
  333. package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +0 -1
  334. package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +0 -1
  335. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +0 -1
  336. package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +0 -1
  337. package/dist/browser/credentials/environmentCredential-browser.d.mts.map +0 -1
  338. package/dist/browser/credentials/environmentCredential-browser.mjs.map +0 -1
  339. package/dist/browser/credentials/interactiveBrowserCredential-browser.d.mts.map +0 -1
  340. package/dist/browser/credentials/interactiveBrowserCredential-browser.mjs.map +0 -1
  341. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +0 -1
  342. package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +0 -1
  343. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +0 -1
  344. package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +0 -1
  345. package/dist/browser/credentials/usernamePasswordCredential-browser.d.mts.map +0 -1
  346. package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +0 -1
  347. package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +0 -1
  348. package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +0 -1
  349. package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +0 -1
  350. package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +0 -1
  351. package/dist/browser/msal/msal-browser.d.mts.map +0 -1
  352. package/dist/browser/msal/msal-browser.mjs.map +0 -1
  353. package/dist/browser/plugins/consumer-browser.d.mts.map +0 -1
  354. package/dist/browser/plugins/consumer-browser.mjs.map +0 -1
  355. package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
  356. package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
  357. package/dist/browser/util/authHostEnv-browser.mjs +0 -7
  358. package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
  359. package/dist/browser/util/processMultiTenantRequest-browser.d.mts.map +0 -1
  360. package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +0 -1
  361. package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
  362. package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
  363. package/dist/esm/util/authHostEnv-browser.mjs +0 -7
  364. package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
  365. package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
  366. package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
  367. package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
  368. package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
@@ -1 +1,7 @@
1
- {"version":3,"file":"clientCertificateCredentialOptions.js","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredentialOptions.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 { CredentialPersistenceOptions } from \"./credentialPersistenceOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Optional parameters for the {@link ClientCertificateCredential} class.\n */\nexport interface ClientCertificateCredentialOptions\n extends\n MultiTenantTokenCredentialOptions,\n CredentialPersistenceOptions,\n AuthorityValidationOptions {\n /**\n * Option to include x5c header for SubjectName and Issuer name authorization.\n * Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim\n */\n sendCertificateChain?: boolean;\n // TODO: Export again once we're ready to release this feature.\n // /**\n // * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n // * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n // * If the property is not specified, the credential uses the global authority endpoint.\n // */\n // regionalAuthority?: string;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/clientCertificateCredentialOptions.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthorityValidationOptions } from \"./authorityValidationOptions.js\";\nimport type { CredentialPersistenceOptions } from \"./credentialPersistenceOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Optional parameters for the {@link ClientCertificateCredential} class.\n */\nexport interface ClientCertificateCredentialOptions\n extends\n MultiTenantTokenCredentialOptions,\n CredentialPersistenceOptions,\n AuthorityValidationOptions {\n /**\n * Option to include x5c header for SubjectName and Issuer name authorization.\n * Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim\n */\n sendCertificateChain?: boolean;\n // TODO: Export again once we're ready to release this feature.\n // /**\n // * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n // * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n // * If the property is not specified, the credential uses the global authority endpoint.\n // */\n // regionalAuthority?: string;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,71 +1,100 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.ClientSecretCredential = void 0;
6
- const msalClient_js_1 = require("../msal/nodeFlows/msalClient.js");
7
- const tenantIdUtils_js_1 = require("../util/tenantIdUtils.js");
8
- const errors_js_1 = require("../errors.js");
9
- const logging_js_1 = require("../util/logging.js");
10
- const scopeUtils_js_1 = require("../util/scopeUtils.js");
11
- const tracing_js_1 = require("../util/tracing.js");
12
- const logger = (0, logging_js_1.credentialLogger)("ClientSecretCredential");
13
- /**
14
- * Enables authentication to Microsoft Entra ID using a client secret
15
- * that was generated for an App Registration. More information on how
16
- * to configure a client secret can be found here:
17
- *
18
- * https://learn.microsoft.com/entra/identity-platform/quickstart-configure-app-access-web-apis#add-credentials-to-your-web-application
19
- *
20
- */
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 clientSecretCredential_exports = {};
19
+ __export(clientSecretCredential_exports, {
20
+ ClientSecretCredential: () => ClientSecretCredential
21
+ });
22
+ module.exports = __toCommonJS(clientSecretCredential_exports);
23
+ var import_msalClient = require("../msal/nodeFlows/msalClient.js");
24
+ var import_tenantIdUtils = require("../util/tenantIdUtils.js");
25
+ var import_errors = require("../errors.js");
26
+ var import_logging = require("../util/logging.js");
27
+ var import_scopeUtils = require("../util/scopeUtils.js");
28
+ var import_tracing = require("../util/tracing.js");
29
+ const logger = (0, import_logging.credentialLogger)("ClientSecretCredential");
21
30
  class ClientSecretCredential {
22
- tenantId;
23
- additionallyAllowedTenantIds;
24
- msalClient;
25
- clientSecret;
26
- /**
27
- * Creates an instance of the ClientSecretCredential with the details
28
- * needed to authenticate against Microsoft Entra ID with a client
29
- * secret.
30
- *
31
- * @param tenantId - The Microsoft Entra tenant (directory) ID.
32
- * @param clientId - The client (application) ID of an App Registration in the tenant.
33
- * @param clientSecret - A client secret that was generated for the App Registration.
34
- * @param options - Options for configuring the client which makes the authentication request.
35
- */
36
- constructor(tenantId, clientId, clientSecret, options = {}) {
37
- if (!tenantId) {
38
- throw new errors_js_1.CredentialUnavailableError("ClientSecretCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.");
39
- }
40
- if (!clientId) {
41
- throw new errors_js_1.CredentialUnavailableError("ClientSecretCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.");
42
- }
43
- if (!clientSecret) {
44
- throw new errors_js_1.CredentialUnavailableError("ClientSecretCredential: clientSecret is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.");
45
- }
46
- this.clientSecret = clientSecret;
47
- this.tenantId = tenantId;
48
- this.additionallyAllowedTenantIds = (0, tenantIdUtils_js_1.resolveAdditionallyAllowedTenantIds)(options?.additionallyAllowedTenants);
49
- this.msalClient = (0, msalClient_js_1.createMsalClient)(clientId, tenantId, {
50
- ...options,
51
- logger,
52
- });
31
+ tenantId;
32
+ additionallyAllowedTenantIds;
33
+ msalClient;
34
+ clientSecret;
35
+ /**
36
+ * Creates an instance of the ClientSecretCredential with the details
37
+ * needed to authenticate against Microsoft Entra ID with a client
38
+ * secret.
39
+ *
40
+ * @param tenantId - The Microsoft Entra tenant (directory) ID.
41
+ * @param clientId - The client (application) ID of an App Registration in the tenant.
42
+ * @param clientSecret - A client secret that was generated for the App Registration.
43
+ * @param options - Options for configuring the client which makes the authentication request.
44
+ */
45
+ constructor(tenantId, clientId, clientSecret, options = {}) {
46
+ if (!tenantId) {
47
+ throw new import_errors.CredentialUnavailableError(
48
+ "ClientSecretCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot."
49
+ );
53
50
  }
54
- /**
55
- * Authenticates with Microsoft Entra ID and returns an access token if successful.
56
- * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
57
- *
58
- * @param scopes - The list of scopes for which the token will have access.
59
- * @param options - The options used to configure any requests this
60
- * TokenCredential implementation might make.
61
- */
62
- async getToken(scopes, options = {}) {
63
- return tracing_js_1.tracingClient.withSpan(`${this.constructor.name}.getToken`, options, async (newOptions) => {
64
- newOptions.tenantId = (0, tenantIdUtils_js_1.processMultiTenantRequest)(this.tenantId, newOptions, this.additionallyAllowedTenantIds, logger);
65
- const arrayScopes = (0, scopeUtils_js_1.ensureScopes)(scopes);
66
- return this.msalClient.getTokenByClientSecret(arrayScopes, this.clientSecret, newOptions);
67
- });
51
+ if (!clientId) {
52
+ throw new import_errors.CredentialUnavailableError(
53
+ "ClientSecretCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot."
54
+ );
68
55
  }
56
+ if (!clientSecret) {
57
+ throw new import_errors.CredentialUnavailableError(
58
+ "ClientSecretCredential: clientSecret is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot."
59
+ );
60
+ }
61
+ this.clientSecret = clientSecret;
62
+ this.tenantId = tenantId;
63
+ this.additionallyAllowedTenantIds = (0, import_tenantIdUtils.resolveAdditionallyAllowedTenantIds)(
64
+ options?.additionallyAllowedTenants
65
+ );
66
+ this.msalClient = (0, import_msalClient.createMsalClient)(clientId, tenantId, {
67
+ ...options,
68
+ logger
69
+ });
70
+ }
71
+ /**
72
+ * Authenticates with Microsoft Entra ID and returns an access token if successful.
73
+ * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
74
+ *
75
+ * @param scopes - The list of scopes for which the token will have access.
76
+ * @param options - The options used to configure any requests this
77
+ * TokenCredential implementation might make.
78
+ */
79
+ async getToken(scopes, options = {}) {
80
+ return import_tracing.tracingClient.withSpan(
81
+ `${this.constructor.name}.getToken`,
82
+ options,
83
+ async (newOptions) => {
84
+ newOptions.tenantId = (0, import_tenantIdUtils.processMultiTenantRequest)(
85
+ this.tenantId,
86
+ newOptions,
87
+ this.additionallyAllowedTenantIds,
88
+ logger
89
+ );
90
+ const arrayScopes = (0, import_scopeUtils.ensureScopes)(scopes);
91
+ return this.msalClient.getTokenByClientSecret(arrayScopes, this.clientSecret, newOptions);
92
+ }
93
+ );
94
+ }
69
95
  }
70
- exports.ClientSecretCredential = ClientSecretCredential;
71
- //# sourceMappingURL=clientSecretCredential.js.map
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ ClientSecretCredential
99
+ });
100
+ //# sourceMappingURL=clientSecretCredential.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"clientSecretCredential.js","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredential.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIlC,mEAAmE;AACnE,+DAGkC;AAGlC,4CAA0D;AAC1D,mDAAsD;AACtD,yDAAqD;AACrD,mDAAmD;AAEnD,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,wBAAwB,CAAC,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAa,sBAAsB;IACzB,QAAQ,CAAS;IACjB,4BAA4B,CAAW;IACvC,UAAU,CAAa;IACvB,YAAY,CAAS;IAE7B;;;;;;;;;OASG;IACH,YACE,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,UAAyC,EAAE;QAE3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,sCAA0B,CAClC,gKAAgK,CACjK,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,sCAA0B,CAClC,gKAAgK,CACjK,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,sCAA0B,CAClC,oKAAoK,CACrK,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,4BAA4B,GAAG,IAAA,sDAAmC,EACrE,OAAO,EAAE,0BAA0B,CACpC,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG,IAAA,gCAAgB,EAAC,QAAQ,EAAE,QAAQ,EAAE;YACrD,GAAG,OAAO;YACV,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAyB,EAAE,UAA2B,EAAE;QACrE,OAAO,0BAAa,CAAC,QAAQ,CAC3B,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,WAAW,EACnC,OAAO,EACP,KAAK,EAAE,UAAU,EAAE,EAAE;YACnB,UAAU,CAAC,QAAQ,GAAG,IAAA,4CAAyB,EAC7C,IAAI,CAAC,QAAQ,EACb,UAAU,EACV,IAAI,CAAC,4BAA4B,EACjC,MAAM,CACP,CAAC;YAEF,MAAM,WAAW,GAAG,IAAA,4BAAY,EAAC,MAAM,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAC5F,CAAC,CACF,CAAC;IACJ,CAAC;CACF;AA7ED,wDA6EC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\nimport type { MsalClient } from \"../msal/nodeFlows/msalClient.js\";\nimport { createMsalClient } from \"../msal/nodeFlows/msalClient.js\";\nimport {\n processMultiTenantRequest,\n resolveAdditionallyAllowedTenantIds,\n} from \"../util/tenantIdUtils.js\";\n\nimport type { ClientSecretCredentialOptions } from \"./clientSecretCredentialOptions.js\";\nimport { CredentialUnavailableError } from \"../errors.js\";\nimport { credentialLogger } from \"../util/logging.js\";\nimport { ensureScopes } from \"../util/scopeUtils.js\";\nimport { tracingClient } from \"../util/tracing.js\";\n\nconst logger = credentialLogger(\"ClientSecretCredential\");\n\n/**\n * Enables authentication to Microsoft Entra ID using a client secret\n * that was generated for an App Registration. More information on how\n * to configure a client secret can be found here:\n *\n * https://learn.microsoft.com/entra/identity-platform/quickstart-configure-app-access-web-apis#add-credentials-to-your-web-application\n *\n */\nexport class ClientSecretCredential implements TokenCredential {\n private tenantId: string;\n private additionallyAllowedTenantIds: string[];\n private msalClient: MsalClient;\n private clientSecret: string;\n\n /**\n * Creates an instance of the ClientSecretCredential with the details\n * needed to authenticate against Microsoft Entra ID with a client\n * secret.\n *\n * @param tenantId - The Microsoft Entra tenant (directory) ID.\n * @param clientId - The client (application) ID of an App Registration in the tenant.\n * @param clientSecret - A client secret that was generated for the App Registration.\n * @param options - Options for configuring the client which makes the authentication request.\n */\n constructor(\n tenantId: string,\n clientId: string,\n clientSecret: string,\n options: ClientSecretCredentialOptions = {},\n ) {\n if (!tenantId) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n if (!clientId) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n if (!clientSecret) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: clientSecret is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n this.clientSecret = clientSecret;\n this.tenantId = tenantId;\n this.additionallyAllowedTenantIds = resolveAdditionallyAllowedTenantIds(\n options?.additionallyAllowedTenants,\n );\n\n this.msalClient = createMsalClient(clientId, tenantId, {\n ...options,\n logger,\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 async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise<AccessToken> {\n return tracingClient.withSpan(\n `${this.constructor.name}.getToken`,\n options,\n async (newOptions) => {\n newOptions.tenantId = processMultiTenantRequest(\n this.tenantId,\n newOptions,\n this.additionallyAllowedTenantIds,\n logger,\n );\n\n const arrayScopes = ensureScopes(scopes);\n return this.msalClient.getTokenByClientSecret(arrayScopes, this.clientSecret, newOptions);\n },\n );\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/clientSecretCredential.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccessToken, GetTokenOptions, TokenCredential } from \"@azure/core-auth\";\nimport type { MsalClient } from \"../msal/nodeFlows/msalClient.js\";\nimport { createMsalClient } from \"../msal/nodeFlows/msalClient.js\";\nimport {\n processMultiTenantRequest,\n resolveAdditionallyAllowedTenantIds,\n} from \"../util/tenantIdUtils.js\";\n\nimport type { ClientSecretCredentialOptions } from \"./clientSecretCredentialOptions.js\";\nimport { CredentialUnavailableError } from \"../errors.js\";\nimport { credentialLogger } from \"../util/logging.js\";\nimport { ensureScopes } from \"../util/scopeUtils.js\";\nimport { tracingClient } from \"../util/tracing.js\";\n\nconst logger = credentialLogger(\"ClientSecretCredential\");\n\n/**\n * Enables authentication to Microsoft Entra ID using a client secret\n * that was generated for an App Registration. More information on how\n * to configure a client secret can be found here:\n *\n * https://learn.microsoft.com/entra/identity-platform/quickstart-configure-app-access-web-apis#add-credentials-to-your-web-application\n *\n */\nexport class ClientSecretCredential implements TokenCredential {\n private tenantId: string;\n private additionallyAllowedTenantIds: string[];\n private msalClient: MsalClient;\n private clientSecret: string;\n\n /**\n * Creates an instance of the ClientSecretCredential with the details\n * needed to authenticate against Microsoft Entra ID with a client\n * secret.\n *\n * @param tenantId - The Microsoft Entra tenant (directory) ID.\n * @param clientId - The client (application) ID of an App Registration in the tenant.\n * @param clientSecret - A client secret that was generated for the App Registration.\n * @param options - Options for configuring the client which makes the authentication request.\n */\n constructor(\n tenantId: string,\n clientId: string,\n clientSecret: string,\n options: ClientSecretCredentialOptions = {},\n ) {\n if (!tenantId) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: tenantId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n if (!clientId) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: clientId is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n if (!clientSecret) {\n throw new CredentialUnavailableError(\n \"ClientSecretCredential: clientSecret is a required parameter. To troubleshoot, visit https://aka.ms/azsdk/js/identity/serviceprincipalauthentication/troubleshoot.\",\n );\n }\n\n this.clientSecret = clientSecret;\n this.tenantId = tenantId;\n this.additionallyAllowedTenantIds = resolveAdditionallyAllowedTenantIds(\n options?.additionallyAllowedTenants,\n );\n\n this.msalClient = createMsalClient(clientId, tenantId, {\n ...options,\n logger,\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 async getToken(scopes: string | string[], options: GetTokenOptions = {}): Promise<AccessToken> {\n return tracingClient.withSpan(\n `${this.constructor.name}.getToken`,\n options,\n async (newOptions) => {\n newOptions.tenantId = processMultiTenantRequest(\n this.tenantId,\n newOptions,\n this.additionallyAllowedTenantIds,\n logger,\n );\n\n const arrayScopes = ensureScopes(scopes);\n return this.msalClient.getTokenByClientSecret(arrayScopes, this.clientSecret, newOptions);\n },\n );\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,wBAAiC;AACjC,2BAGO;AAGP,oBAA2C;AAC3C,qBAAiC;AACjC,wBAA6B;AAC7B,qBAA8B;AAE9B,MAAM,aAAS,iCAAiB,wBAAwB;AAUjD,MAAM,uBAAkD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYR,YACE,UACA,UACA,cACA,UAAyC,CAAC,GAC1C;AACA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,UAAU;AACb,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,CAAC,cAAc;AACjB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,SAAK,eAAe;AACpB,SAAK,WAAW;AAChB,SAAK,mCAA+B;AAAA,MAClC,SAAS;AAAA,IACX;AAEA,SAAK,iBAAa,oCAAiB,UAAU,UAAU;AAAA,MACrD,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,SAAS,QAA2B,UAA2B,CAAC,GAAyB;AAC7F,WAAO,6BAAc;AAAA,MACnB,GAAG,KAAK,YAAY,IAAI;AAAA,MACxB;AAAA,MACA,OAAO,eAAe;AACpB,mBAAW,eAAW;AAAA,UACpB,KAAK;AAAA,UACL;AAAA,UACA,KAAK;AAAA,UACL;AAAA,QACF;AAEA,cAAM,kBAAc,gCAAa,MAAM;AACvC,eAAO,KAAK,WAAW,uBAAuB,aAAa,KAAK,cAAc,UAAU;AAAA,MAC1F;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -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=clientSecretCredentialOptions.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 clientSecretCredentialOptions_exports = {};
15
+ module.exports = __toCommonJS(clientSecretCredentialOptions_exports);
16
+ //# sourceMappingURL=clientSecretCredentialOptions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"clientSecretCredentialOptions.js","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredentialOptions.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 { CredentialPersistenceOptions } from \"./credentialPersistenceOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Optional parameters for the {@link ClientSecretCredential} class.\n */\nexport interface ClientSecretCredentialOptions\n extends\n MultiTenantTokenCredentialOptions,\n CredentialPersistenceOptions,\n AuthorityValidationOptions {\n // TODO: Export again once we're ready to release this feature.\n // /**\n // * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n // * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n // * If the property is not specified, the credential uses the global authority endpoint.\n // */\n // regionalAuthority?: string;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/clientSecretCredentialOptions.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthorityValidationOptions } from \"./authorityValidationOptions.js\";\nimport type { CredentialPersistenceOptions } from \"./credentialPersistenceOptions.js\";\nimport type { MultiTenantTokenCredentialOptions } from \"./multiTenantTokenCredentialOptions.js\";\n\n/**\n * Optional parameters for the {@link ClientSecretCredential} class.\n */\nexport interface ClientSecretCredentialOptions\n extends\n MultiTenantTokenCredentialOptions,\n CredentialPersistenceOptions,\n AuthorityValidationOptions {\n // TODO: Export again once we're ready to release this feature.\n // /**\n // * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.\n // * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.\n // * If the property is not specified, the credential uses the global authority endpoint.\n // */\n // regionalAuthority?: string;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -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=credentialPersistenceOptions.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 credentialPersistenceOptions_exports = {};
15
+ module.exports = __toCommonJS(credentialPersistenceOptions_exports);
16
+ //# sourceMappingURL=credentialPersistenceOptions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"credentialPersistenceOptions.js","sourceRoot":"","sources":["../../../src/credentials/credentialPersistenceOptions.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions.js\";\n\n/**\n * Shared configuration options for credentials that support persistent token\n * caching.\n */\nexport interface CredentialPersistenceOptions {\n /**\n * Options to provide to the persistence layer (if one is available) when\n * storing credentials.\n *\n * You must first register a persistence provider plugin. See the\n * `@azure/identity-cache-persistence` package on NPM.\n *\n * Example:\n *\n * ```ts snippet:credential_persistence_options_example\n * import { useIdentityPlugin, DeviceCodeCredential } from \"@azure/identity\";\n *\n * useIdentityPlugin(cachePersistencePlugin);\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n * ```\n */\n\n tokenCachePersistenceOptions?: TokenCachePersistenceOptions;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credentials/credentialPersistenceOptions.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions.js\";\n\n/**\n * Shared configuration options for credentials that support persistent token\n * caching.\n */\nexport interface CredentialPersistenceOptions {\n /**\n * Options to provide to the persistence layer (if one is available) when\n * storing credentials.\n *\n * You must first register a persistence provider plugin. See the\n * `@azure/identity-cache-persistence` package on NPM.\n *\n * Example:\n *\n * ```ts snippet:credential_persistence_options_example\n * import { useIdentityPlugin, DeviceCodeCredential } from \"@azure/identity\";\n *\n * useIdentityPlugin(cachePersistencePlugin);\n *\n * const credential = new DeviceCodeCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true,\n * },\n * });\n * ```\n */\n\n tokenCachePersistenceOptions?: TokenCachePersistenceOptions;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,167 +1,129 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.DefaultAzureCredential = exports.UnavailableDefaultCredential = void 0;
6
- const chainedTokenCredential_js_1 = require("./chainedTokenCredential.js");
7
- const logging_js_1 = require("../util/logging.js");
8
- const defaultAzureCredentialFunctions_js_1 = require("./defaultAzureCredentialFunctions.js");
9
- const logger = (0, logging_js_1.credentialLogger)("DefaultAzureCredential");
10
- /**
11
- * A no-op credential that logs the reason it was skipped if getToken is called.
12
- * @internal
13
- */
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 defaultAzureCredential_exports = {};
19
+ __export(defaultAzureCredential_exports, {
20
+ DefaultAzureCredential: () => DefaultAzureCredential,
21
+ UnavailableDefaultCredential: () => UnavailableDefaultCredential
22
+ });
23
+ module.exports = __toCommonJS(defaultAzureCredential_exports);
24
+ var import_chainedTokenCredential = require("./chainedTokenCredential.js");
25
+ var import_logging = require("../util/logging.js");
26
+ var import_defaultAzureCredentialFunctions = require("./defaultAzureCredentialFunctions.js");
27
+ const logger = (0, import_logging.credentialLogger)("DefaultAzureCredential");
14
28
  class UnavailableDefaultCredential {
15
- credentialUnavailableErrorMessage;
16
- credentialName;
17
- constructor(credentialName, message) {
18
- this.credentialName = credentialName;
19
- this.credentialUnavailableErrorMessage = message;
20
- }
21
- getToken() {
22
- logger.getToken.info(`Skipping ${this.credentialName}, reason: ${this.credentialUnavailableErrorMessage}`);
23
- return Promise.resolve(null);
24
- }
29
+ credentialUnavailableErrorMessage;
30
+ credentialName;
31
+ constructor(credentialName, message) {
32
+ this.credentialName = credentialName;
33
+ this.credentialUnavailableErrorMessage = message;
34
+ }
35
+ getToken() {
36
+ logger.getToken.info(
37
+ `Skipping ${this.credentialName}, reason: ${this.credentialUnavailableErrorMessage}`
38
+ );
39
+ return Promise.resolve(null);
40
+ }
25
41
  }
26
- exports.UnavailableDefaultCredential = UnavailableDefaultCredential;
27
- /**
28
- * Provides a default {@link ChainedTokenCredential} configuration that works for most
29
- * applications that use Azure SDK client libraries. For more information, see
30
- * [DefaultAzureCredential overview](https://aka.ms/azsdk/js/identity/credential-chains#defaultazurecredential-overview).
31
- *
32
- * The following credential types will be tried, in order:
33
- *
34
- * - {@link EnvironmentCredential}
35
- * - {@link WorkloadIdentityCredential}
36
- * - {@link ManagedIdentityCredential}
37
- * - {@link VisualStudioCodeCredential}
38
- * - {@link AzureCliCredential}
39
- * - {@link AzurePowerShellCredential}
40
- * - {@link AzureDeveloperCliCredential}
41
- * - BrokerCredential (a broker-enabled credential that requires \@azure/identity-broker is installed)
42
- *
43
- * Consult the documentation of these credential types for more information
44
- * on how they attempt authentication.
45
- *
46
- * The following example demonstrates how to use the `requiredEnvVars` option to ensure that certain environment variables are set before the `DefaultAzureCredential` is instantiated.
47
- * If any of the specified environment variables are missing or empty, an error will be thrown, preventing the application from continuing execution without the necessary configuration.
48
- * It also demonstrates how to set the `AZURE_TOKEN_CREDENTIALS` environment variable to control which credentials are included in the chain.
49
-
50
- * ```ts snippet:defaultazurecredential_requiredEnvVars
51
- * import { DefaultAzureCredential } from "@azure/identity";
52
- *
53
- * const credential = new DefaultAzureCredential({
54
- * requiredEnvVars: [
55
- * "AZURE_CLIENT_ID",
56
- * "AZURE_TENANT_ID",
57
- * "AZURE_CLIENT_SECRET",
58
- * "AZURE_TOKEN_CREDENTIALS",
59
- * ],
60
- * });
61
- * ```
62
- */
63
- class DefaultAzureCredential extends chainedTokenCredential_js_1.ChainedTokenCredential {
64
- constructor(options) {
65
- validateRequiredEnvVars(options);
66
- // If AZURE_TOKEN_CREDENTIALS is not set, use the default credential chain.
67
- const azureTokenCredentials = process.env.AZURE_TOKEN_CREDENTIALS
68
- ? process.env.AZURE_TOKEN_CREDENTIALS.trim().toLowerCase()
69
- : undefined;
70
- const devCredentialFunctions = [
71
- defaultAzureCredentialFunctions_js_1.createDefaultVisualStudioCodeCredential,
72
- defaultAzureCredentialFunctions_js_1.createDefaultAzureCliCredential,
73
- defaultAzureCredentialFunctions_js_1.createDefaultAzurePowershellCredential,
74
- defaultAzureCredentialFunctions_js_1.createDefaultAzureDeveloperCliCredential,
75
- defaultAzureCredentialFunctions_js_1.createDefaultBrokerCredential,
76
- ];
77
- const prodCredentialFunctions = [
78
- defaultAzureCredentialFunctions_js_1.createDefaultEnvironmentCredential,
79
- defaultAzureCredentialFunctions_js_1.createDefaultWorkloadIdentityCredential,
80
- defaultAzureCredentialFunctions_js_1.createDefaultManagedIdentityCredential,
81
- ];
82
- let credentialFunctions = [];
83
- const validCredentialNames = "EnvironmentCredential, WorkloadIdentityCredential, ManagedIdentityCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential, AzureDeveloperCliCredential";
84
- // If AZURE_TOKEN_CREDENTIALS is set, use it to determine which credentials to use.
85
- // The value of AZURE_TOKEN_CREDENTIALS should be either "dev" or "prod" or any one of these credentials - {validCredentialNames}.
86
- if (azureTokenCredentials) {
87
- switch (azureTokenCredentials) {
88
- case "dev":
89
- credentialFunctions = devCredentialFunctions;
90
- break;
91
- case "prod":
92
- credentialFunctions = prodCredentialFunctions;
93
- break;
94
- case "environmentcredential":
95
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultEnvironmentCredential];
96
- break;
97
- case "workloadidentitycredential":
98
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultWorkloadIdentityCredential];
99
- break;
100
- case "managedidentitycredential":
101
- // Setting `sendProbeRequest` to false to ensure ManagedIdentityCredential behavior
102
- // is consistent when used standalone in DAC chain or used directly.
103
- credentialFunctions = [
104
- () => (0, defaultAzureCredentialFunctions_js_1.createDefaultManagedIdentityCredential)({ sendProbeRequest: false }),
105
- ];
106
- break;
107
- case "visualstudiocodecredential":
108
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultVisualStudioCodeCredential];
109
- break;
110
- case "azureclicredential":
111
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultAzureCliCredential];
112
- break;
113
- case "azurepowershellcredential":
114
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultAzurePowershellCredential];
115
- break;
116
- case "azuredeveloperclicredential":
117
- credentialFunctions = [defaultAzureCredentialFunctions_js_1.createDefaultAzureDeveloperCliCredential];
118
- break;
119
- default: {
120
- // If AZURE_TOKEN_CREDENTIALS is set to an unsupported value, throw an error.
121
- // This will prevent the creation of the DefaultAzureCredential.
122
- const errorMessage = `Invalid value for AZURE_TOKEN_CREDENTIALS = ${process.env.AZURE_TOKEN_CREDENTIALS}. Valid values are 'prod' or 'dev' or any of these credentials - ${validCredentialNames}.`;
123
- logger.warning(errorMessage);
124
- throw new Error(errorMessage);
125
- }
126
- }
42
+ class DefaultAzureCredential extends import_chainedTokenCredential.ChainedTokenCredential {
43
+ constructor(options) {
44
+ validateRequiredEnvVars(options);
45
+ const azureTokenCredentials = process.env.AZURE_TOKEN_CREDENTIALS ? process.env.AZURE_TOKEN_CREDENTIALS.trim().toLowerCase() : void 0;
46
+ const devCredentialFunctions = [
47
+ import_defaultAzureCredentialFunctions.createDefaultVisualStudioCodeCredential,
48
+ import_defaultAzureCredentialFunctions.createDefaultAzureCliCredential,
49
+ import_defaultAzureCredentialFunctions.createDefaultAzurePowershellCredential,
50
+ import_defaultAzureCredentialFunctions.createDefaultAzureDeveloperCliCredential,
51
+ import_defaultAzureCredentialFunctions.createDefaultBrokerCredential
52
+ ];
53
+ const prodCredentialFunctions = [
54
+ import_defaultAzureCredentialFunctions.createDefaultEnvironmentCredential,
55
+ import_defaultAzureCredentialFunctions.createDefaultWorkloadIdentityCredential,
56
+ import_defaultAzureCredentialFunctions.createDefaultManagedIdentityCredential
57
+ ];
58
+ let credentialFunctions = [];
59
+ const validCredentialNames = "EnvironmentCredential, WorkloadIdentityCredential, ManagedIdentityCredential, VisualStudioCodeCredential, AzureCliCredential, AzurePowerShellCredential, AzureDeveloperCliCredential";
60
+ if (azureTokenCredentials) {
61
+ switch (azureTokenCredentials) {
62
+ case "dev":
63
+ credentialFunctions = devCredentialFunctions;
64
+ break;
65
+ case "prod":
66
+ credentialFunctions = prodCredentialFunctions;
67
+ break;
68
+ case "environmentcredential":
69
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultEnvironmentCredential];
70
+ break;
71
+ case "workloadidentitycredential":
72
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultWorkloadIdentityCredential];
73
+ break;
74
+ case "managedidentitycredential":
75
+ credentialFunctions = [
76
+ () => (0, import_defaultAzureCredentialFunctions.createDefaultManagedIdentityCredential)({ sendProbeRequest: false })
77
+ ];
78
+ break;
79
+ case "visualstudiocodecredential":
80
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultVisualStudioCodeCredential];
81
+ break;
82
+ case "azureclicredential":
83
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultAzureCliCredential];
84
+ break;
85
+ case "azurepowershellcredential":
86
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultAzurePowershellCredential];
87
+ break;
88
+ case "azuredeveloperclicredential":
89
+ credentialFunctions = [import_defaultAzureCredentialFunctions.createDefaultAzureDeveloperCliCredential];
90
+ break;
91
+ default: {
92
+ const errorMessage = `Invalid value for AZURE_TOKEN_CREDENTIALS = ${process.env.AZURE_TOKEN_CREDENTIALS}. Valid values are 'prod' or 'dev' or any of these credentials - ${validCredentialNames}.`;
93
+ logger.warning(errorMessage);
94
+ throw new Error(errorMessage);
127
95
  }
128
- else {
129
- // If AZURE_TOKEN_CREDENTIALS is not set, use the default credential chain.
130
- credentialFunctions = [...prodCredentialFunctions, ...devCredentialFunctions];
131
- }
132
- // Errors from individual credentials should not be thrown in the DefaultAzureCredential constructor, instead throwing on getToken() which is handled by ChainedTokenCredential.
133
- // When adding new credentials to the default chain, consider:
134
- // 1. Making the constructor parameters required and explicit
135
- // 2. Validating any required parameters in the factory function
136
- // 3. Returning a UnavailableDefaultCredential from the factory function if a credential is unavailable for any reason
137
- const credentials = credentialFunctions.map((createCredentialFn) => {
138
- try {
139
- return createCredentialFn(options ?? {});
140
- }
141
- catch (err) {
142
- logger.warning(`Skipped ${createCredentialFn.name} because of an error creating the credential: ${err}`);
143
- return new UnavailableDefaultCredential(createCredentialFn.name, err.message);
144
- }
145
- });
146
- super(...credentials);
96
+ }
97
+ } else {
98
+ credentialFunctions = [...prodCredentialFunctions, ...devCredentialFunctions];
147
99
  }
100
+ const credentials = credentialFunctions.map((createCredentialFn) => {
101
+ try {
102
+ return createCredentialFn(options ?? {});
103
+ } catch (err) {
104
+ logger.warning(
105
+ `Skipped ${createCredentialFn.name} because of an error creating the credential: ${err}`
106
+ );
107
+ return new UnavailableDefaultCredential(createCredentialFn.name, err.message);
108
+ }
109
+ });
110
+ super(...credentials);
111
+ }
148
112
  }
149
- exports.DefaultAzureCredential = DefaultAzureCredential;
150
- /**
151
- * This function checks that all environment variables in `options.requiredEnvVars` are set and non-empty.
152
- * If any are missing or empty, it throws an error.
153
- */
154
113
  function validateRequiredEnvVars(options) {
155
- if (options?.requiredEnvVars) {
156
- const requiredVars = Array.isArray(options.requiredEnvVars)
157
- ? options.requiredEnvVars
158
- : [options.requiredEnvVars];
159
- const missing = requiredVars.filter((envVar) => !process.env[envVar]);
160
- if (missing.length > 0) {
161
- const errorMessage = `Required environment ${missing.length === 1 ? "variable" : "variables"} '${missing.join(", ")}' for DefaultAzureCredential ${missing.length === 1 ? "is" : "are"} not set or empty.`;
162
- logger.warning(errorMessage);
163
- throw new Error(errorMessage);
164
- }
114
+ if (options?.requiredEnvVars) {
115
+ const requiredVars = Array.isArray(options.requiredEnvVars) ? options.requiredEnvVars : [options.requiredEnvVars];
116
+ const missing = requiredVars.filter((envVar) => !process.env[envVar]);
117
+ if (missing.length > 0) {
118
+ const errorMessage = `Required environment ${missing.length === 1 ? "variable" : "variables"} '${missing.join(", ")}' for DefaultAzureCredential ${missing.length === 1 ? "is" : "are"} not set or empty.`;
119
+ logger.warning(errorMessage);
120
+ throw new Error(errorMessage);
165
121
  }
122
+ }
166
123
  }
167
- //# sourceMappingURL=defaultAzureCredential.js.map
124
+ // Annotate the CommonJS export names for ESM import in node:
125
+ 0 && (module.exports = {
126
+ DefaultAzureCredential,
127
+ UnavailableDefaultCredential
128
+ });
129
+ //# sourceMappingURL=defaultAzureCredential.js.map