@azure/identity 4.14.0-beta.2 → 4.14.0-beta.4

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 (470) hide show
  1. package/dist/browser/client/identityClient.d.ts.map +1 -1
  2. package/dist/browser/client/identityClient.js +2 -1
  3. package/dist/browser/client/identityClient.js.map +1 -1
  4. package/dist/browser/constants.d.ts +1 -1
  5. package/dist/browser/constants.js +1 -1
  6. package/dist/browser/constants.js.map +1 -1
  7. package/dist/browser/credentials/{authorizationCodeCredential.d.ts → authorizationCodeCredential-browser.d.mts} +2 -2
  8. package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +1 -1
  9. package/dist/browser/credentials/{authorizationCodeCredential.js → authorizationCodeCredential-browser.mjs} +1 -1
  10. package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +1 -1
  11. package/dist/browser/credentials/azureCliCredential-browser.d.mts +14 -0
  12. package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +1 -1
  13. package/dist/browser/credentials/{azureCliCredential.js → azureCliCredential-browser.mjs} +2 -2
  14. package/dist/browser/credentials/azureCliCredential-browser.mjs.map +1 -1
  15. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts +14 -0
  16. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +1 -1
  17. package/dist/browser/credentials/{azureDeveloperCliCredential.js → azureDeveloperCliCredential-browser.mjs} +2 -2
  18. package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +1 -1
  19. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts +14 -0
  20. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +1 -1
  21. package/dist/browser/credentials/{azurePipelinesCredential.js → azurePipelinesCredential-browser.mjs} +2 -2
  22. package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +1 -1
  23. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts +13 -0
  24. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +1 -1
  25. package/dist/browser/credentials/{azurePowerShellCredential.js → azurePowerShellCredential-browser.mjs} +2 -2
  26. package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +1 -1
  27. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts +13 -0
  28. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +1 -1
  29. package/dist/browser/credentials/{clientAssertionCredential.js → clientAssertionCredential-browser.mjs} +2 -2
  30. package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +1 -1
  31. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts +15 -0
  32. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +1 -1
  33. package/dist/browser/credentials/{clientCertificateCredential.js → clientCertificateCredential-browser.mjs} +2 -2
  34. package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +1 -1
  35. package/dist/browser/credentials/{defaultAzureCredential.d.ts → defaultAzureCredential-browser.d.mts} +2 -2
  36. package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +1 -1
  37. package/dist/browser/credentials/{defaultAzureCredential.js → defaultAzureCredential-browser.mjs} +1 -1
  38. package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +1 -1
  39. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  40. package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
  41. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts +14 -0
  42. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +1 -1
  43. package/dist/browser/credentials/{deviceCodeCredential.js → deviceCodeCredential-browser.mjs} +2 -2
  44. package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +1 -1
  45. package/dist/browser/credentials/environmentCredential-browser.d.mts +14 -0
  46. package/dist/browser/credentials/environmentCredential-browser.d.mts.map +1 -1
  47. package/dist/browser/credentials/{environmentCredential.js → environmentCredential-browser.mjs} +2 -2
  48. package/dist/browser/credentials/environmentCredential-browser.mjs.map +1 -1
  49. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts +11 -0
  50. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +1 -1
  51. package/dist/browser/credentials/managedIdentityCredential/{index.js → index-browser.mjs} +2 -2
  52. package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +1 -1
  53. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts +13 -0
  54. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +1 -1
  55. package/dist/browser/credentials/{onBehalfOfCredential.js → onBehalfOfCredential-browser.mjs} +2 -2
  56. package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +1 -1
  57. package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +1 -1
  58. package/dist/browser/credentials/{visualStudioCodeCredential.d.ts → visualStudioCodeCredential-browser.d.mts} +4 -3
  59. package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +1 -1
  60. package/dist/browser/credentials/{visualStudioCodeCredential.js → visualStudioCodeCredential-browser.mjs} +2 -2
  61. package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +1 -1
  62. package/dist/browser/credentials/{workloadIdentityCredential.d.ts → workloadIdentityCredential-browser.d.mts} +4 -3
  63. package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +1 -1
  64. package/dist/browser/credentials/{workloadIdentityCredential.js → workloadIdentityCredential-browser.mjs} +2 -2
  65. package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +1 -1
  66. package/dist/browser/index.d.ts +51 -51
  67. package/dist/browser/index.d.ts.map +1 -1
  68. package/dist/browser/index.js +19 -19
  69. package/dist/browser/index.js.map +1 -1
  70. package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  71. package/dist/browser/msal/browserFlows/msalBrowserCommon.js +2 -3
  72. package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  73. package/dist/browser/msal/msal-browser.d.mts +2 -0
  74. package/dist/browser/msal/msal-browser.d.mts.map +1 -1
  75. package/dist/browser/msal/msal-browser.mjs +4 -0
  76. package/dist/browser/msal/msal-browser.mjs.map +1 -1
  77. package/dist/browser/msal/utils.d.ts +5 -4
  78. package/dist/browser/msal/utils.d.ts.map +1 -1
  79. package/dist/browser/msal/utils.js +16 -11
  80. package/dist/browser/msal/utils.js.map +1 -1
  81. package/dist/browser/util/{processMultiTenantRequest.d.ts → processMultiTenantRequest-browser.d.mts} +2 -1
  82. package/dist/browser/util/processMultiTenantRequest-browser.d.mts.map +1 -1
  83. package/dist/browser/util/{processMultiTenantRequest.js → processMultiTenantRequest-browser.mjs} +1 -1
  84. package/dist/browser/util/processMultiTenantRequest-browser.mjs.map +1 -1
  85. package/dist/browser/util/tenantIdUtils.d.ts +1 -1
  86. package/dist/browser/util/tenantIdUtils.d.ts.map +1 -1
  87. package/dist/browser/util/tenantIdUtils.js +1 -1
  88. package/dist/browser/util/tenantIdUtils.js.map +1 -1
  89. package/dist/commonjs/client/identityClient.d.ts.map +1 -1
  90. package/dist/commonjs/client/identityClient.js +295 -288
  91. package/dist/commonjs/client/identityClient.js.map +7 -1
  92. package/dist/commonjs/constants.d.ts +1 -1
  93. package/dist/commonjs/constants.js +61 -78
  94. package/dist/commonjs/constants.js.map +7 -1
  95. package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
  96. package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
  97. package/dist/commonjs/credentials/authorizationCodeCredential.js +98 -74
  98. package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
  99. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
  100. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
  101. package/dist/commonjs/credentials/azureCliCredential.d.ts.map +1 -1
  102. package/dist/commonjs/credentials/azureCliCredential.js +246 -214
  103. package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
  104. package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
  105. package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
  106. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts +12 -4
  107. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  108. package/dist/commonjs/credentials/azureDeveloperCliCredential.js +262 -224
  109. package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
  110. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
  111. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
  112. package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
  113. package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
  114. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
  115. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
  116. package/dist/commonjs/credentials/azurePowerShellCredential.d.ts.map +1 -1
  117. package/dist/commonjs/credentials/azurePowerShellCredential.js +205 -205
  118. package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
  119. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
  120. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
  121. package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
  122. package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
  123. package/dist/commonjs/credentials/brokerCredential.js +103 -70
  124. package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
  125. package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
  126. package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
  127. package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
  128. package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
  129. package/dist/commonjs/credentials/clientAssertionCredential.js +101 -63
  130. package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
  131. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
  132. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
  133. package/dist/commonjs/credentials/clientCertificateCredential.js +129 -123
  134. package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
  135. package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
  136. package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
  137. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
  138. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
  139. package/dist/commonjs/credentials/clientSecretCredential.js +96 -67
  140. package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
  141. package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
  142. package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
  143. package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
  144. package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
  145. package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
  146. package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
  147. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
  148. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
  149. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  150. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
  151. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
  152. package/dist/commonjs/credentials/deviceCodeCredential.js +132 -103
  153. package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
  154. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
  155. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
  156. package/dist/commonjs/credentials/environmentCredential.js +157 -123
  157. package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
  158. package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
  159. package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
  160. package/dist/commonjs/credentials/interactiveBrowserCredential.js +144 -107
  161. package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
  162. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
  163. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
  164. package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
  165. package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
  166. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
  167. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
  168. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
  169. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
  170. package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
  171. package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
  172. package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
  173. package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
  174. package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
  175. package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
  176. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
  177. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
  178. package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
  179. package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
  180. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
  181. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
  182. package/dist/commonjs/credentials/onBehalfOfCredential.js +168 -126
  183. package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
  184. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
  185. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
  186. package/dist/commonjs/credentials/usernamePasswordCredential.js +112 -75
  187. package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
  188. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
  189. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
  190. package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
  191. package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
  192. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
  193. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
  194. package/dist/commonjs/credentials/workloadIdentityCredential.js +284 -274
  195. package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
  196. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
  197. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
  198. package/dist/commonjs/errors.js +131 -132
  199. package/dist/commonjs/errors.js.map +7 -1
  200. package/dist/commonjs/index.d.ts +33 -33
  201. package/dist/commonjs/index.d.ts.map +1 -1
  202. package/dist/commonjs/index.js +115 -67
  203. package/dist/commonjs/index.js.map +7 -1
  204. package/dist/commonjs/msal/msal.d.ts +1 -2
  205. package/dist/commonjs/msal/msal.d.ts.map +1 -1
  206. package/dist/commonjs/msal/msal.js +30 -9
  207. package/dist/commonjs/msal/msal.js.map +7 -1
  208. package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
  209. package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
  210. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts +2 -2
  211. package/dist/commonjs/msal/nodeFlows/msalClient.d.ts.map +1 -1
  212. package/dist/commonjs/msal/nodeFlows/msalClient.js +450 -478
  213. package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
  214. package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
  215. package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
  216. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
  217. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
  218. package/dist/commonjs/msal/types.js +16 -5
  219. package/dist/commonjs/msal/types.js.map +7 -1
  220. package/dist/commonjs/msal/utils.d.ts +5 -4
  221. package/dist/commonjs/msal/utils.d.ts.map +1 -1
  222. package/dist/commonjs/msal/utils.js +176 -211
  223. package/dist/commonjs/msal/utils.js.map +7 -1
  224. package/dist/commonjs/plugins/consumer.js +32 -40
  225. package/dist/commonjs/plugins/consumer.js.map +7 -1
  226. package/dist/commonjs/plugins/provider.js +16 -5
  227. package/dist/commonjs/plugins/provider.js.map +7 -1
  228. package/dist/commonjs/regionalAuthority.js +93 -141
  229. package/dist/commonjs/regionalAuthority.js.map +7 -1
  230. package/dist/commonjs/tokenCredentialOptions.js +16 -5
  231. package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
  232. package/dist/commonjs/tokenProvider.js +52 -52
  233. package/dist/commonjs/tokenProvider.js.map +7 -1
  234. package/dist/commonjs/tsdoc-metadata.json +1 -1
  235. package/dist/commonjs/util/authorityHost.js +34 -19
  236. package/dist/commonjs/util/authorityHost.js.map +7 -1
  237. package/dist/commonjs/util/certificatesUtils.js +54 -45
  238. package/dist/commonjs/util/certificatesUtils.js.map +7 -1
  239. package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
  240. package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
  241. package/dist/commonjs/util/logging.js +91 -97
  242. package/dist/commonjs/util/logging.js.map +7 -1
  243. package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
  244. package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
  245. package/dist/commonjs/util/processUtils.js +60 -35
  246. package/dist/commonjs/util/processUtils.js.map +7 -1
  247. package/dist/commonjs/util/scopeUtils.js +39 -28
  248. package/dist/commonjs/util/scopeUtils.js.map +7 -1
  249. package/dist/commonjs/util/subscriptionUtils.js +35 -17
  250. package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
  251. package/dist/commonjs/util/tenantIdUtils.d.ts.map +1 -1
  252. package/dist/commonjs/util/tenantIdUtils.js +61 -45
  253. package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
  254. package/dist/commonjs/util/tracing.js +33 -16
  255. package/dist/commonjs/util/tracing.js.map +7 -1
  256. package/dist/esm/client/identityClient.d.ts.map +1 -1
  257. package/dist/esm/client/identityClient.js +2 -1
  258. package/dist/esm/client/identityClient.js.map +1 -1
  259. package/dist/esm/constants.d.ts +1 -1
  260. package/dist/esm/constants.js +1 -1
  261. package/dist/esm/constants.js.map +1 -1
  262. package/dist/esm/credentials/azureCliCredential.d.ts.map +1 -1
  263. package/dist/esm/credentials/azureCliCredential.js +2 -1
  264. package/dist/esm/credentials/azureCliCredential.js.map +1 -1
  265. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts +12 -4
  266. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  267. package/dist/esm/credentials/azureDeveloperCliCredential.js +40 -14
  268. package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
  269. package/dist/esm/credentials/azurePipelinesCredential.js.map +1 -1
  270. package/dist/esm/credentials/azurePowerShellCredential.d.ts.map +1 -1
  271. package/dist/esm/credentials/azurePowerShellCredential.js +2 -1
  272. package/dist/esm/credentials/azurePowerShellCredential.js.map +1 -1
  273. package/dist/esm/credentials/defaultAzureCredential.js.map +1 -1
  274. package/dist/esm/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  275. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  276. package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
  277. package/dist/esm/credentials/environmentCredential.js.map +1 -1
  278. package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  279. package/dist/esm/credentials/workloadIdentityCredential.js.map +1 -1
  280. package/dist/esm/index.d.ts +33 -33
  281. package/dist/esm/index.d.ts.map +1 -1
  282. package/dist/esm/index.js.map +1 -1
  283. package/dist/esm/msal/msal.d.ts +1 -2
  284. package/dist/esm/msal/msal.d.ts.map +1 -1
  285. package/dist/esm/msal/msal.js +1 -2
  286. package/dist/esm/msal/msal.js.map +1 -1
  287. package/dist/esm/msal/nodeFlows/msalClient.d.ts +2 -2
  288. package/dist/esm/msal/nodeFlows/msalClient.d.ts.map +1 -1
  289. package/dist/esm/msal/nodeFlows/msalClient.js +3 -3
  290. package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
  291. package/dist/esm/msal/utils.d.ts +5 -4
  292. package/dist/esm/msal/utils.d.ts.map +1 -1
  293. package/dist/esm/msal/utils.js +16 -11
  294. package/dist/esm/msal/utils.js.map +1 -1
  295. package/dist/esm/util/tenantIdUtils.d.ts.map +1 -1
  296. package/dist/esm/util/tenantIdUtils.js.map +1 -1
  297. package/dist/workerd/client/identityClient.d.ts.map +1 -1
  298. package/dist/workerd/client/identityClient.js +2 -1
  299. package/dist/workerd/client/identityClient.js.map +1 -1
  300. package/dist/workerd/constants.d.ts +1 -1
  301. package/dist/workerd/constants.js +1 -1
  302. package/dist/workerd/constants.js.map +1 -1
  303. package/dist/workerd/credentials/azureCliCredential.d.ts.map +1 -1
  304. package/dist/workerd/credentials/azureCliCredential.js +2 -1
  305. package/dist/workerd/credentials/azureCliCredential.js.map +1 -1
  306. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts +12 -4
  307. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  308. package/dist/workerd/credentials/azureDeveloperCliCredential.js +40 -14
  309. package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
  310. package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -1
  311. package/dist/workerd/credentials/azurePowerShellCredential.d.ts.map +1 -1
  312. package/dist/workerd/credentials/azurePowerShellCredential.js +2 -1
  313. package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -1
  314. package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -1
  315. package/dist/workerd/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  316. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts +2 -2
  317. package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
  318. package/dist/workerd/credentials/environmentCredential.js.map +1 -1
  319. package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  320. package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -1
  321. package/dist/workerd/index.d.ts +33 -33
  322. package/dist/workerd/index.d.ts.map +1 -1
  323. package/dist/workerd/index.js.map +1 -1
  324. package/dist/workerd/msal/msal.d.ts +1 -2
  325. package/dist/workerd/msal/msal.d.ts.map +1 -1
  326. package/dist/workerd/msal/msal.js +1 -2
  327. package/dist/workerd/msal/msal.js.map +1 -1
  328. package/dist/workerd/msal/nodeFlows/msalClient.d.ts +2 -2
  329. package/dist/workerd/msal/nodeFlows/msalClient.d.ts.map +1 -1
  330. package/dist/workerd/msal/nodeFlows/msalClient.js +3 -3
  331. package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
  332. package/dist/workerd/msal/utils.d.ts +5 -4
  333. package/dist/workerd/msal/utils.d.ts.map +1 -1
  334. package/dist/workerd/msal/utils.js +16 -11
  335. package/dist/workerd/msal/utils.js.map +1 -1
  336. package/dist/workerd/util/tenantIdUtils.d.ts.map +1 -1
  337. package/dist/workerd/util/tenantIdUtils.js.map +1 -1
  338. package/package.json +29 -36
  339. package/dist/browser/credentials/azureCliCredential.d.ts +0 -13
  340. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +0 -13
  341. package/dist/browser/credentials/azurePipelinesCredential.d.ts +0 -13
  342. package/dist/browser/credentials/azurePowerShellCredential.d.ts +0 -12
  343. package/dist/browser/credentials/brokerCredential.d.ts +0 -35
  344. package/dist/browser/credentials/brokerCredential.d.ts.map +0 -1
  345. package/dist/browser/credentials/brokerCredential.js +0 -68
  346. package/dist/browser/credentials/brokerCredential.js.map +0 -1
  347. package/dist/browser/credentials/clientAssertionCredential.d.ts +0 -12
  348. package/dist/browser/credentials/clientCertificateCredential.d.ts +0 -13
  349. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts +0 -64
  350. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts.map +0 -1
  351. package/dist/browser/credentials/defaultAzureCredentialFunctions.js +0 -147
  352. package/dist/browser/credentials/defaultAzureCredentialFunctions.js.map +0 -1
  353. package/dist/browser/credentials/deviceCodeCredential.d.ts +0 -13
  354. package/dist/browser/credentials/environmentCredential.d.ts +0 -13
  355. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts +0 -18
  356. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts.map +0 -1
  357. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js +0 -97
  358. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js.map +0 -1
  359. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +0 -13
  360. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +0 -1
  361. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +0 -43
  362. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +0 -1
  363. package/dist/browser/credentials/managedIdentityCredential/index.d.ts +0 -6
  364. package/dist/browser/credentials/managedIdentityCredential/models.d.ts +0 -24
  365. package/dist/browser/credentials/managedIdentityCredential/models.d.ts.map +0 -1
  366. package/dist/browser/credentials/managedIdentityCredential/models.js +0 -4
  367. package/dist/browser/credentials/managedIdentityCredential/models.js.map +0 -1
  368. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts +0 -14
  369. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts.map +0 -1
  370. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js +0 -38
  371. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +0 -1
  372. package/dist/browser/credentials/onBehalfOfCredential.d.ts +0 -12
  373. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  374. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  375. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  376. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  377. package/dist/browser/msal/msal.d.ts +0 -3
  378. package/dist/browser/msal/msal.js +0 -5
  379. package/dist/browser/msal/nodeFlows/msalClient.d.ts +0 -205
  380. package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +0 -1
  381. package/dist/browser/msal/nodeFlows/msalClient.js +0 -499
  382. package/dist/browser/msal/nodeFlows/msalClient.js.map +0 -1
  383. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts +0 -109
  384. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts.map +0 -1
  385. package/dist/browser/msal/nodeFlows/msalPlugins.js +0 -160
  386. package/dist/browser/msal/nodeFlows/msalPlugins.js.map +0 -1
  387. package/dist/browser/regionalAuthority.d.ts +0 -122
  388. package/dist/browser/regionalAuthority.d.ts.map +0 -1
  389. package/dist/browser/regionalAuthority.js +0 -139
  390. package/dist/browser/regionalAuthority.js.map +0 -1
  391. package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
  392. package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
  393. package/dist/browser/util/authHostEnv-browser.mjs +0 -7
  394. package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
  395. package/dist/browser/util/certificatesUtils.d.ts +0 -13
  396. package/dist/browser/util/certificatesUtils.d.ts.map +0 -1
  397. package/dist/browser/util/certificatesUtils.js +0 -47
  398. package/dist/browser/util/certificatesUtils.js.map +0 -1
  399. package/dist/browser/util/processUtils.d.ts +0 -13
  400. package/dist/browser/util/processUtils.d.ts.map +0 -1
  401. package/dist/browser/util/processUtils.js +0 -32
  402. package/dist/browser/util/processUtils.js.map +0 -1
  403. package/dist/browser/util/subscriptionUtils.d.ts +0 -6
  404. package/dist/browser/util/subscriptionUtils.d.ts.map +0 -1
  405. package/dist/browser/util/subscriptionUtils.js +0 -16
  406. package/dist/browser/util/subscriptionUtils.js.map +0 -1
  407. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  408. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  409. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +0 -5
  410. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  411. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  412. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  413. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +0 -265
  414. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  415. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  416. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  417. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +0 -5
  418. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  419. package/dist/commonjs/msal/credentials.d.ts +0 -52
  420. package/dist/commonjs/msal/credentials.d.ts.map +0 -1
  421. package/dist/commonjs/msal/credentials.js +0 -5
  422. package/dist/commonjs/msal/credentials.js.map +0 -1
  423. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  424. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  425. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  426. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  427. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  428. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  429. package/dist/esm/msal/browserFlows/msalBrowserCommon.js +0 -261
  430. package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  431. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  432. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  433. package/dist/esm/msal/browserFlows/msalBrowserOptions.js +0 -4
  434. package/dist/esm/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  435. package/dist/esm/msal/credentials.d.ts +0 -52
  436. package/dist/esm/msal/credentials.d.ts.map +0 -1
  437. package/dist/esm/msal/credentials.js +0 -4
  438. package/dist/esm/msal/credentials.js.map +0 -1
  439. package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
  440. package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
  441. package/dist/esm/util/authHostEnv-browser.mjs +0 -7
  442. package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
  443. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  444. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  445. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  446. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  447. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  448. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  449. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +0 -261
  450. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  451. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  452. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  453. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js +0 -4
  454. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  455. package/dist/workerd/msal/credentials.d.ts +0 -52
  456. package/dist/workerd/msal/credentials.d.ts.map +0 -1
  457. package/dist/workerd/msal/credentials.js +0 -4
  458. package/dist/workerd/msal/credentials.js.map +0 -1
  459. package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
  460. package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
  461. package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
  462. package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
  463. /package/dist/browser/credentials/{clientSecretCredential.d.ts → clientSecretCredential-browser.d.mts} +0 -0
  464. /package/dist/browser/credentials/{clientSecretCredential.js → clientSecretCredential-browser.mjs} +0 -0
  465. /package/dist/browser/credentials/{interactiveBrowserCredential.d.ts → interactiveBrowserCredential-browser.d.mts} +0 -0
  466. /package/dist/browser/credentials/{interactiveBrowserCredential.js → interactiveBrowserCredential-browser.mjs} +0 -0
  467. /package/dist/browser/credentials/{usernamePasswordCredential.d.ts → usernamePasswordCredential-browser.d.mts} +0 -0
  468. /package/dist/browser/credentials/{usernamePasswordCredential.js → usernamePasswordCredential-browser.mjs} +0 -0
  469. /package/dist/browser/plugins/{consumer.d.ts → consumer-browser.d.mts} +0 -0
  470. /package/dist/browser/plugins/{consumer.js → consumer-browser.mjs} +0 -0
@@ -1,302 +1,309 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.IdentityClient = void 0;
6
- const core_client_1 = require("@azure/core-client");
7
- const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
8
- const errors_js_1 = require("../errors.js");
9
- const identityTokenEndpoint_js_1 = require("../util/identityTokenEndpoint.js");
10
- const constants_js_1 = require("../constants.js");
11
- const tracing_js_1 = require("../util/tracing.js");
12
- const logging_js_1 = require("../util/logging.js");
13
- const utils_js_1 = require("../credentials/managedIdentityCredential/utils.js");
14
- const authorityHost_js_1 = require("../util/authorityHost.js");
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 identityClient_exports = {};
19
+ __export(identityClient_exports, {
20
+ IdentityClient: () => IdentityClient
21
+ });
22
+ module.exports = __toCommonJS(identityClient_exports);
23
+ var import_core_client = require("@azure/core-client");
24
+ var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
25
+ var import_core_util = require("@azure/core-util");
26
+ var import_errors = require("../errors.js");
27
+ var import_identityTokenEndpoint = require("../util/identityTokenEndpoint.js");
28
+ var import_constants = require("../constants.js");
29
+ var import_tracing = require("../util/tracing.js");
30
+ var import_logging = require("../util/logging.js");
31
+ var import_utils = require("../credentials/managedIdentityCredential/utils.js");
32
+ var import_authorityHost = require("../util/authorityHost.js");
15
33
  const noCorrelationId = "noCorrelationId";
16
34
  const HttpStatus = {
17
- CLIENT_ERROR_RANGE_START: 400,
18
- CLIENT_ERROR_RANGE_END: 499,
19
- SERVER_ERROR_RANGE_START: 500,
20
- SERVER_ERROR_RANGE_END: 599,
35
+ CLIENT_ERROR_RANGE_START: 400,
36
+ CLIENT_ERROR_RANGE_END: 499,
37
+ SERVER_ERROR_RANGE_START: 500,
38
+ SERVER_ERROR_RANGE_END: 599
21
39
  };
22
- /**
23
- * The network module used by the Identity credentials.
24
- *
25
- * It allows for credentials to abort any pending request independently of the MSAL flow,
26
- * by calling to the `abortRequests()` method.
27
- *
28
- */
29
- class IdentityClient extends core_client_1.ServiceClient {
30
- authorityHost;
31
- allowLoggingAccountIdentifiers;
32
- abortControllers;
33
- allowInsecureConnection = false;
34
- // used for WorkloadIdentity
35
- tokenCredentialOptions;
36
- constructor(options) {
37
- const packageDetails = `azsdk-js-identity/${constants_js_1.SDK_VERSION}`;
38
- const userAgentPrefix = options?.userAgentOptions?.userAgentPrefix
39
- ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
40
- : `${packageDetails}`;
41
- const baseUri = (0, authorityHost_js_1.getAuthorityHost)(options);
42
- if (!baseUri.startsWith("https:")) {
43
- throw new Error("The authorityHost address must use the 'https' protocol.");
44
- }
45
- super({
46
- requestContentType: "application/json; charset=utf-8",
47
- retryOptions: {
48
- maxRetries: 3,
49
- },
50
- ...options,
51
- userAgentOptions: {
52
- userAgentPrefix,
53
- },
54
- baseUri,
55
- });
56
- this.authorityHost = baseUri;
57
- this.abortControllers = new Map();
58
- this.allowLoggingAccountIdentifiers = options?.loggingOptions?.allowLoggingAccountIdentifiers;
59
- // used for WorkloadIdentity
60
- this.tokenCredentialOptions = { ...options };
61
- // used for ManagedIdentity
62
- if (options?.allowInsecureConnection) {
63
- this.allowInsecureConnection = options.allowInsecureConnection;
64
- }
65
- }
66
- async sendTokenRequest(request) {
67
- logging_js_1.logger.info(`IdentityClient: sending token request to [${request.url}]`);
68
- const response = await this.sendRequest(request);
69
- if (response.bodyAsText && (response.status === 200 || response.status === 201)) {
70
- const parsedBody = JSON.parse(response.bodyAsText);
71
- if (!parsedBody.access_token) {
72
- return null;
73
- }
74
- this.logIdentifiers(response);
75
- const token = {
76
- accessToken: {
77
- token: parsedBody.access_token,
78
- expiresOnTimestamp: (0, utils_js_1.parseExpirationTimestamp)(parsedBody),
79
- refreshAfterTimestamp: (0, utils_js_1.parseRefreshTimestamp)(parsedBody),
80
- tokenType: "Bearer",
81
- },
82
- refreshToken: parsedBody.refresh_token,
83
- };
84
- logging_js_1.logger.info(`IdentityClient: [${request.url}] token acquired, expires on ${token.accessToken.expiresOnTimestamp}`);
85
- return token;
86
- }
87
- else {
88
- const error = new errors_js_1.AuthenticationError(response.status, response.bodyAsText);
89
- logging_js_1.logger.warning(`IdentityClient: authentication error. HTTP status: ${response.status}, ${error.errorResponse.errorDescription}`);
90
- throw error;
91
- }
92
- }
93
- async refreshAccessToken(tenantId, clientId, scopes, refreshToken, clientSecret, options = {}) {
94
- if (refreshToken === undefined) {
95
- return null;
96
- }
97
- logging_js_1.logger.info(`IdentityClient: refreshing access token with client ID: ${clientId}, scopes: ${scopes} started`);
98
- const refreshParams = {
99
- grant_type: "refresh_token",
100
- client_id: clientId,
101
- refresh_token: refreshToken,
102
- scope: scopes,
103
- };
104
- if (clientSecret !== undefined) {
105
- refreshParams.client_secret = clientSecret;
106
- }
107
- const query = new URLSearchParams(refreshParams);
108
- return tracing_js_1.tracingClient.withSpan("IdentityClient.refreshAccessToken", options, async (updatedOptions) => {
109
- try {
110
- const urlSuffix = (0, identityTokenEndpoint_js_1.getIdentityTokenEndpointSuffix)(tenantId);
111
- const request = (0, core_rest_pipeline_1.createPipelineRequest)({
112
- url: `${this.authorityHost}/${tenantId}/${urlSuffix}`,
113
- method: "POST",
114
- body: query.toString(),
115
- abortSignal: options.abortSignal,
116
- headers: (0, core_rest_pipeline_1.createHttpHeaders)({
117
- Accept: "application/json",
118
- "Content-Type": "application/x-www-form-urlencoded",
119
- }),
120
- tracingOptions: updatedOptions.tracingOptions,
121
- });
122
- const response = await this.sendTokenRequest(request);
123
- logging_js_1.logger.info(`IdentityClient: refreshed token for client ID: ${clientId}`);
124
- return response;
125
- }
126
- catch (err) {
127
- if (err.name === errors_js_1.AuthenticationErrorName &&
128
- err.errorResponse.error === "interaction_required") {
129
- // It's likely that the refresh token has expired, so
130
- // return null so that the credential implementation will
131
- // initiate the authentication flow again.
132
- logging_js_1.logger.info(`IdentityClient: interaction required for client ID: ${clientId}`);
133
- return null;
134
- }
135
- else {
136
- logging_js_1.logger.warning(`IdentityClient: failed refreshing token for client ID: ${clientId}: ${err}`);
137
- throw err;
138
- }
139
- }
140
- });
40
+ class IdentityClient extends import_core_client.ServiceClient {
41
+ authorityHost;
42
+ allowLoggingAccountIdentifiers;
43
+ abortControllers;
44
+ allowInsecureConnection = false;
45
+ // used for WorkloadIdentity
46
+ tokenCredentialOptions;
47
+ constructor(options) {
48
+ const packageDetails = `azsdk-js-identity/${import_constants.SDK_VERSION}`;
49
+ const userAgentPrefix = options?.userAgentOptions?.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`;
50
+ const baseUri = (0, import_authorityHost.getAuthorityHost)(options);
51
+ if (!baseUri.startsWith("https:")) {
52
+ throw new Error("The authorityHost address must use the 'https' protocol.");
141
53
  }
142
- // Here is a custom layer that allows us to abort requests that go through MSAL,
143
- // since MSAL doesn't allow us to pass options all the way through.
144
- generateAbortSignal(correlationId) {
145
- const controller = new AbortController();
146
- const controllers = this.abortControllers.get(correlationId) || [];
147
- controllers.push(controller);
148
- this.abortControllers.set(correlationId, controllers);
149
- const existingOnAbort = controller.signal.onabort;
150
- controller.signal.onabort = (...params) => {
151
- this.abortControllers.set(correlationId, undefined);
152
- if (existingOnAbort) {
153
- existingOnAbort.apply(controller.signal, params);
154
- }
155
- };
156
- return controller.signal;
54
+ super({
55
+ requestContentType: "application/json; charset=utf-8",
56
+ retryOptions: {
57
+ maxRetries: 3
58
+ },
59
+ ...options,
60
+ userAgentOptions: {
61
+ userAgentPrefix
62
+ },
63
+ baseUri
64
+ });
65
+ this.authorityHost = baseUri;
66
+ this.abortControllers = /* @__PURE__ */ new Map();
67
+ this.allowLoggingAccountIdentifiers = options?.loggingOptions?.allowLoggingAccountIdentifiers;
68
+ this.tokenCredentialOptions = { ...options };
69
+ if (options?.allowInsecureConnection) {
70
+ this.allowInsecureConnection = options.allowInsecureConnection;
157
71
  }
158
- abortRequests(correlationId) {
159
- const key = correlationId || noCorrelationId;
160
- const controllers = [
161
- ...(this.abortControllers.get(key) || []),
162
- // MSAL passes no correlation ID to the get requests...
163
- ...(this.abortControllers.get(noCorrelationId) || []),
164
- ];
165
- if (!controllers.length) {
166
- return;
167
- }
168
- for (const controller of controllers) {
169
- controller.abort();
170
- }
171
- this.abortControllers.set(key, undefined);
72
+ }
73
+ async sendTokenRequest(request) {
74
+ import_logging.logger.info(`IdentityClient: sending token request to [${request.url}]`);
75
+ const response = await this.sendRequest(request);
76
+ if (response.bodyAsText && (response.status === 200 || response.status === 201)) {
77
+ const parsedBody = JSON.parse(response.bodyAsText);
78
+ if (!parsedBody.access_token) {
79
+ return null;
80
+ }
81
+ this.logIdentifiers(response);
82
+ const token = {
83
+ accessToken: {
84
+ token: parsedBody.access_token,
85
+ expiresOnTimestamp: (0, import_utils.parseExpirationTimestamp)(parsedBody),
86
+ refreshAfterTimestamp: (0, import_utils.parseRefreshTimestamp)(parsedBody),
87
+ tokenType: "Bearer"
88
+ },
89
+ refreshToken: parsedBody.refresh_token
90
+ };
91
+ import_logging.logger.info(
92
+ `IdentityClient: [${request.url}] token acquired, expires on ${token.accessToken.expiresOnTimestamp}`
93
+ );
94
+ return token;
95
+ } else {
96
+ const error = new import_errors.AuthenticationError(response.status, response.bodyAsText);
97
+ import_logging.logger.warning(
98
+ `IdentityClient: authentication error. HTTP status: ${response.status}, ${error.errorResponse.errorDescription}`
99
+ );
100
+ throw error;
172
101
  }
173
- getCorrelationId(options) {
174
- const parameter = options?.body
175
- ?.split("&")
176
- .map((part) => part.split("="))
177
- .find(([key]) => key === "client-request-id");
178
- return parameter && parameter.length ? parameter[1] || noCorrelationId : noCorrelationId;
102
+ }
103
+ async refreshAccessToken(tenantId, clientId, scopes, refreshToken, clientSecret, options = {}) {
104
+ if (refreshToken === void 0) {
105
+ return null;
179
106
  }
180
- // The MSAL network module methods follow
181
- async sendGetRequestAsync(url, options) {
182
- const request = (0, core_rest_pipeline_1.createPipelineRequest)({
183
- url,
184
- method: "GET",
185
- body: options?.body,
186
- allowInsecureConnection: this.allowInsecureConnection,
187
- headers: (0, core_rest_pipeline_1.createHttpHeaders)(options?.headers),
188
- abortSignal: this.generateAbortSignal(noCorrelationId),
189
- });
190
- const response = await this.sendRequest(request);
191
- this.logIdentifiers(response);
192
- return {
193
- body: this.parseResponseBody(response),
194
- headers: response.headers.toJSON(),
195
- status: response.status,
196
- };
107
+ import_logging.logger.info(
108
+ `IdentityClient: refreshing access token with client ID: ${clientId}, scopes: ${scopes} started`
109
+ );
110
+ const refreshParams = {
111
+ grant_type: "refresh_token",
112
+ client_id: clientId,
113
+ refresh_token: refreshToken,
114
+ scope: scopes
115
+ };
116
+ if (clientSecret !== void 0) {
117
+ refreshParams.client_secret = clientSecret;
197
118
  }
198
- async sendPostRequestAsync(url, options) {
199
- const request = (0, core_rest_pipeline_1.createPipelineRequest)({
200
- url,
119
+ const query = new URLSearchParams(refreshParams);
120
+ return import_tracing.tracingClient.withSpan(
121
+ "IdentityClient.refreshAccessToken",
122
+ options,
123
+ async (updatedOptions) => {
124
+ try {
125
+ const urlSuffix = (0, import_identityTokenEndpoint.getIdentityTokenEndpointSuffix)(tenantId);
126
+ const request = (0, import_core_rest_pipeline.createPipelineRequest)({
127
+ url: `${this.authorityHost}/${tenantId}/${urlSuffix}`,
201
128
  method: "POST",
202
- body: options?.body,
203
- headers: (0, core_rest_pipeline_1.createHttpHeaders)(options?.headers),
204
- allowInsecureConnection: this.allowInsecureConnection,
205
- // MSAL doesn't send the correlation ID on the get requests.
206
- abortSignal: this.generateAbortSignal(this.getCorrelationId(options)),
207
- });
208
- const response = await this.sendRequest(request);
209
- this.logIdentifiers(response);
210
- return {
211
- body: this.parseResponseBody(response),
212
- headers: response.headers.toJSON(),
213
- status: response.status,
214
- };
129
+ body: query.toString(),
130
+ abortSignal: options.abortSignal,
131
+ headers: (0, import_core_rest_pipeline.createHttpHeaders)({
132
+ Accept: "application/json",
133
+ "Content-Type": "application/x-www-form-urlencoded"
134
+ }),
135
+ tracingOptions: updatedOptions.tracingOptions
136
+ });
137
+ const response = await this.sendTokenRequest(request);
138
+ import_logging.logger.info(`IdentityClient: refreshed token for client ID: ${clientId}`);
139
+ return response;
140
+ } catch (err) {
141
+ if (err.name === import_errors.AuthenticationErrorName && err.errorResponse.error === "interaction_required") {
142
+ import_logging.logger.info(`IdentityClient: interaction required for client ID: ${clientId}`);
143
+ return null;
144
+ } else {
145
+ import_logging.logger.warning(
146
+ `IdentityClient: failed refreshing token for client ID: ${clientId}: ${err}`
147
+ );
148
+ throw err;
149
+ }
150
+ }
151
+ }
152
+ );
153
+ }
154
+ // Here is a custom layer that allows us to abort requests that go through MSAL,
155
+ // since MSAL doesn't allow us to pass options all the way through.
156
+ generateAbortSignal(correlationId) {
157
+ const controller = new AbortController();
158
+ const controllers = this.abortControllers.get(correlationId) || [];
159
+ controllers.push(controller);
160
+ this.abortControllers.set(correlationId, controllers);
161
+ const existingOnAbort = controller.signal.onabort;
162
+ controller.signal.onabort = (...params) => {
163
+ this.abortControllers.set(correlationId, void 0);
164
+ if (existingOnAbort) {
165
+ existingOnAbort.apply(controller.signal, params);
166
+ }
167
+ };
168
+ return controller.signal;
169
+ }
170
+ abortRequests(correlationId) {
171
+ const key = correlationId || noCorrelationId;
172
+ const controllers = [
173
+ ...this.abortControllers.get(key) || [],
174
+ // MSAL passes no correlation ID to the get requests...
175
+ ...this.abortControllers.get(noCorrelationId) || []
176
+ ];
177
+ if (!controllers.length) {
178
+ return;
215
179
  }
216
- /**
217
- *
218
- * @internal
219
- */
220
- getTokenCredentialOptions() {
221
- return this.tokenCredentialOptions;
180
+ for (const controller of controllers) {
181
+ controller.abort();
222
182
  }
223
- /**
224
- * If allowLoggingAccountIdentifiers was set on the constructor options
225
- * we try to log the account identifiers by parsing the received access token.
226
- *
227
- * The account identifiers we try to log are:
228
- * - `appid`: The application or Client Identifier.
229
- * - `upn`: User Principal Name.
230
- * - It might not be available in some authentication scenarios.
231
- * - If it's not available, we put a placeholder: "No User Principal Name available".
232
- * - `tid`: Tenant Identifier.
233
- * - `oid`: Object Identifier of the authenticated user.
234
- */
235
- logIdentifiers(response) {
236
- if (!this.allowLoggingAccountIdentifiers || !response.bodyAsText) {
237
- return;
238
- }
239
- const unavailableUpn = "No User Principal Name available";
240
- try {
241
- const parsed = response.parsedBody || JSON.parse(response.bodyAsText);
242
- const accessToken = parsed.access_token;
243
- if (!accessToken) {
244
- // Without an access token allowLoggingAccountIdentifiers isn't useful.
245
- return;
246
- }
247
- const base64Metadata = accessToken.split(".")[1];
248
- const { appid, upn, tid, oid } = JSON.parse(Buffer.from(base64Metadata, "base64").toString("utf8"));
249
- logging_js_1.logger.info(`[Authenticated account] Client ID: ${appid}. Tenant ID: ${tid}. User Principal Name: ${upn || unavailableUpn}. Object ID (user): ${oid}`);
250
- }
251
- catch (e) {
252
- logging_js_1.logger.warning("allowLoggingAccountIdentifiers was set, but we couldn't log the account information. Error:", e.message);
253
- }
183
+ this.abortControllers.set(key, void 0);
184
+ }
185
+ getCorrelationId(options) {
186
+ const parameter = options?.body?.split("&").map((part) => part.split("=")).find(([key]) => key === "client-request-id");
187
+ return parameter && parameter.length ? parameter[1] || noCorrelationId : noCorrelationId;
188
+ }
189
+ // The MSAL network module methods follow
190
+ async sendGetRequestAsync(url, options) {
191
+ const request = (0, import_core_rest_pipeline.createPipelineRequest)({
192
+ url,
193
+ method: "GET",
194
+ body: options?.body,
195
+ allowInsecureConnection: this.allowInsecureConnection,
196
+ headers: (0, import_core_rest_pipeline.createHttpHeaders)(options?.headers),
197
+ abortSignal: this.generateAbortSignal(noCorrelationId)
198
+ });
199
+ const response = await this.sendRequest(request);
200
+ this.logIdentifiers(response);
201
+ return {
202
+ body: this.parseResponseBody(response),
203
+ headers: response.headers.toJSON(),
204
+ status: response.status
205
+ };
206
+ }
207
+ async sendPostRequestAsync(url, options) {
208
+ const request = (0, import_core_rest_pipeline.createPipelineRequest)({
209
+ url,
210
+ method: "POST",
211
+ body: options?.body,
212
+ headers: (0, import_core_rest_pipeline.createHttpHeaders)(options?.headers),
213
+ allowInsecureConnection: this.allowInsecureConnection,
214
+ // MSAL doesn't send the correlation ID on the get requests.
215
+ abortSignal: this.generateAbortSignal(this.getCorrelationId(options))
216
+ });
217
+ const response = await this.sendRequest(request);
218
+ this.logIdentifiers(response);
219
+ return {
220
+ body: this.parseResponseBody(response),
221
+ headers: response.headers.toJSON(),
222
+ status: response.status
223
+ };
224
+ }
225
+ /**
226
+ *
227
+ * @internal
228
+ */
229
+ getTokenCredentialOptions() {
230
+ return this.tokenCredentialOptions;
231
+ }
232
+ /**
233
+ * If allowLoggingAccountIdentifiers was set on the constructor options
234
+ * we try to log the account identifiers by parsing the received access token.
235
+ *
236
+ * The account identifiers we try to log are:
237
+ * - `appid`: The application or Client Identifier.
238
+ * - `upn`: User Principal Name.
239
+ * - It might not be available in some authentication scenarios.
240
+ * - If it's not available, we put a placeholder: "No User Principal Name available".
241
+ * - `tid`: Tenant Identifier.
242
+ * - `oid`: Object Identifier of the authenticated user.
243
+ */
244
+ logIdentifiers(response) {
245
+ if (!this.allowLoggingAccountIdentifiers || !response.bodyAsText) {
246
+ return;
254
247
  }
255
- /**
256
- * Parses the response body if possible. Add error properties if parsing fails.
257
- * This follows MSAL INetworkModule behavior so the response is in expected format.
258
- */
259
- parseResponseBody(response) {
260
- let parsedBody;
261
- try {
262
- parsedBody = JSON.parse(response.bodyAsText || "");
263
- }
264
- catch (error) {
265
- logging_js_1.logger.info(`IdentityClient: Could not parse response body: ${error}`);
266
- let errorType;
267
- let errorDescriptionHelper;
268
- /**
269
- * Determine error type based on status code ranges following MSAL patterns:
270
- * Client error responses (400 – 499)
271
- * Server error responses (500 599)
272
- */
273
- if (response.status >= HttpStatus.CLIENT_ERROR_RANGE_START &&
274
- response.status <= HttpStatus.CLIENT_ERROR_RANGE_END) {
275
- errorType = "client_error";
276
- errorDescriptionHelper = "A client";
277
- }
278
- else if (response.status >= HttpStatus.SERVER_ERROR_RANGE_START &&
279
- response.status <= HttpStatus.SERVER_ERROR_RANGE_END) {
280
- errorType = "server_error";
281
- errorDescriptionHelper = "A server";
282
- }
283
- else {
284
- errorType = "unknown_error";
285
- errorDescriptionHelper = "An unknown";
286
- }
287
- const errorDescriptionLines = [
288
- `${errorDescriptionHelper} error occured.`,
289
- `Http status code: ${response.status}`,
290
- `Http status message: ${response.bodyAsText || "Unknown"}`,
291
- `Headers: ${JSON.stringify(response.headers)}`,
292
- ];
293
- parsedBody = {
294
- error: errorType,
295
- error_description: errorDescriptionLines.join("\n"),
296
- };
297
- }
298
- return parsedBody;
248
+ const unavailableUpn = "No User Principal Name available";
249
+ try {
250
+ const parsed = response.parsedBody || JSON.parse(response.bodyAsText);
251
+ const accessToken = parsed.access_token;
252
+ if (!accessToken) {
253
+ return;
254
+ }
255
+ const base64Metadata = accessToken.split(".")[1];
256
+ const { appid, upn, tid, oid } = JSON.parse(
257
+ (0, import_core_util.uint8ArrayToString)((0, import_core_util.stringToUint8Array)(base64Metadata, "base64url"), "utf-8")
258
+ );
259
+ import_logging.logger.info(
260
+ `[Authenticated account] Client ID: ${appid}. Tenant ID: ${tid}. User Principal Name: ${upn || unavailableUpn}. Object ID (user): ${oid}`
261
+ );
262
+ } catch (e) {
263
+ import_logging.logger.warning(
264
+ "allowLoggingAccountIdentifiers was set, but we couldn't log the account information. Error:",
265
+ e.message
266
+ );
267
+ }
268
+ }
269
+ /**
270
+ * Parses the response body if possible. Add error properties if parsing fails.
271
+ * This follows MSAL INetworkModule behavior so the response is in expected format.
272
+ */
273
+ parseResponseBody(response) {
274
+ let parsedBody;
275
+ try {
276
+ parsedBody = JSON.parse(response.bodyAsText || "");
277
+ } catch (error) {
278
+ import_logging.logger.info(`IdentityClient: Could not parse response body: ${error}`);
279
+ let errorType;
280
+ let errorDescriptionHelper;
281
+ if (response.status >= HttpStatus.CLIENT_ERROR_RANGE_START && response.status <= HttpStatus.CLIENT_ERROR_RANGE_END) {
282
+ errorType = "client_error";
283
+ errorDescriptionHelper = "A client";
284
+ } else if (response.status >= HttpStatus.SERVER_ERROR_RANGE_START && response.status <= HttpStatus.SERVER_ERROR_RANGE_END) {
285
+ errorType = "server_error";
286
+ errorDescriptionHelper = "A server";
287
+ } else {
288
+ errorType = "unknown_error";
289
+ errorDescriptionHelper = "An unknown";
290
+ }
291
+ const errorDescriptionLines = [
292
+ `${errorDescriptionHelper} error occured.`,
293
+ `Http status code: ${response.status}`,
294
+ `Http status message: ${response.bodyAsText || "Unknown"}`,
295
+ `Headers: ${JSON.stringify(response.headers)}`
296
+ ];
297
+ parsedBody = {
298
+ error: errorType,
299
+ error_description: errorDescriptionLines.join("\n")
300
+ };
299
301
  }
302
+ return parsedBody;
303
+ }
300
304
  }
301
- exports.IdentityClient = IdentityClient;
302
- //# sourceMappingURL=identityClient.js.map
305
+ // Annotate the CommonJS export names for ESM import in node:
306
+ 0 && (module.exports = {
307
+ IdentityClient
308
+ });
309
+ //# sourceMappingURL=identityClient.js.map