@azure/identity 4.13.0 → 4.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (540) hide show
  1. package/dist/browser/constants.d.ts +1 -1
  2. package/dist/browser/constants.js +1 -1
  3. package/dist/browser/constants.js.map +1 -1
  4. package/dist/browser/credentials/{authorizationCodeCredential.d.ts → authorizationCodeCredential-browser.d.mts} +2 -2
  5. package/dist/browser/credentials/authorizationCodeCredential-browser.d.mts.map +1 -1
  6. package/dist/browser/credentials/{authorizationCodeCredential.js → authorizationCodeCredential-browser.mjs} +1 -1
  7. package/dist/browser/credentials/authorizationCodeCredential-browser.mjs.map +1 -1
  8. package/dist/browser/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  9. package/dist/browser/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  10. package/dist/browser/credentials/azureCliCredential-browser.d.mts +14 -0
  11. package/dist/browser/credentials/azureCliCredential-browser.d.mts.map +1 -1
  12. package/dist/browser/credentials/{azureCliCredential.js → azureCliCredential-browser.mjs} +2 -2
  13. package/dist/browser/credentials/azureCliCredential-browser.mjs.map +1 -1
  14. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts +14 -0
  15. package/dist/browser/credentials/azureDeveloperCliCredential-browser.d.mts.map +1 -1
  16. package/dist/browser/credentials/{azureDeveloperCliCredential.js → azureDeveloperCliCredential-browser.mjs} +2 -2
  17. package/dist/browser/credentials/azureDeveloperCliCredential-browser.mjs.map +1 -1
  18. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts +14 -0
  19. package/dist/browser/credentials/azurePipelinesCredential-browser.d.mts.map +1 -1
  20. package/dist/browser/credentials/{azurePipelinesCredential.js → azurePipelinesCredential-browser.mjs} +2 -2
  21. package/dist/browser/credentials/azurePipelinesCredential-browser.mjs.map +1 -1
  22. package/dist/browser/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  23. package/dist/browser/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  24. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts +13 -0
  25. package/dist/browser/credentials/azurePowerShellCredential-browser.d.mts.map +1 -1
  26. package/dist/browser/credentials/{azurePowerShellCredential.js → azurePowerShellCredential-browser.mjs} +2 -2
  27. package/dist/browser/credentials/azurePowerShellCredential-browser.mjs.map +1 -1
  28. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts +13 -0
  29. package/dist/browser/credentials/clientAssertionCredential-browser.d.mts.map +1 -1
  30. package/dist/browser/credentials/{clientAssertionCredential.js → clientAssertionCredential-browser.mjs} +2 -2
  31. package/dist/browser/credentials/clientAssertionCredential-browser.mjs.map +1 -1
  32. package/dist/browser/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  33. package/dist/browser/credentials/clientAssertionCredentialOptions.js.map +1 -1
  34. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts +15 -0
  35. package/dist/browser/credentials/clientCertificateCredential-browser.d.mts.map +1 -1
  36. package/dist/browser/credentials/{clientCertificateCredential.js → clientCertificateCredential-browser.mjs} +2 -2
  37. package/dist/browser/credentials/clientCertificateCredential-browser.mjs.map +1 -1
  38. package/dist/browser/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  39. package/dist/browser/credentials/clientCertificateCredentialModels.js.map +1 -1
  40. package/dist/browser/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  41. package/dist/browser/credentials/clientCertificateCredentialOptions.js.map +1 -1
  42. package/dist/browser/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  43. package/dist/browser/credentials/clientSecretCredentialOptions.js.map +1 -1
  44. package/dist/browser/credentials/{defaultAzureCredential.d.ts → defaultAzureCredential-browser.d.mts} +2 -2
  45. package/dist/browser/credentials/defaultAzureCredential-browser.d.mts.map +1 -1
  46. package/dist/browser/credentials/{defaultAzureCredential.js → defaultAzureCredential-browser.mjs} +1 -1
  47. package/dist/browser/credentials/defaultAzureCredential-browser.mjs.map +1 -1
  48. package/dist/browser/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  49. package/dist/browser/credentials/defaultAzureCredentialOptions.js.map +1 -1
  50. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts +14 -0
  51. package/dist/browser/credentials/deviceCodeCredential-browser.d.mts.map +1 -1
  52. package/dist/browser/credentials/{deviceCodeCredential.js → deviceCodeCredential-browser.mjs} +2 -2
  53. package/dist/browser/credentials/deviceCodeCredential-browser.mjs.map +1 -1
  54. package/dist/browser/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  55. package/dist/browser/credentials/deviceCodeCredentialOptions.js.map +1 -1
  56. package/dist/browser/credentials/environmentCredential-browser.d.mts +14 -0
  57. package/dist/browser/credentials/environmentCredential-browser.d.mts.map +1 -1
  58. package/dist/browser/credentials/{environmentCredential.js → environmentCredential-browser.mjs} +2 -2
  59. package/dist/browser/credentials/environmentCredential-browser.mjs.map +1 -1
  60. package/dist/browser/credentials/environmentCredentialOptions.d.ts.map +1 -1
  61. package/dist/browser/credentials/environmentCredentialOptions.js.map +1 -1
  62. package/dist/browser/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  63. package/dist/browser/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  64. package/dist/browser/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  65. package/dist/browser/credentials/interactiveCredentialOptions.js.map +1 -1
  66. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts +11 -0
  67. package/dist/browser/credentials/managedIdentityCredential/index-browser.d.mts.map +1 -1
  68. package/dist/browser/credentials/managedIdentityCredential/{index.js → index-browser.mjs} +2 -2
  69. package/dist/browser/credentials/managedIdentityCredential/index-browser.mjs.map +1 -1
  70. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts +13 -0
  71. package/dist/browser/credentials/onBehalfOfCredential-browser.d.mts.map +1 -1
  72. package/dist/browser/credentials/{onBehalfOfCredential.js → onBehalfOfCredential-browser.mjs} +2 -2
  73. package/dist/browser/credentials/onBehalfOfCredential-browser.mjs.map +1 -1
  74. package/dist/browser/credentials/usernamePasswordCredential-browser.mjs.map +1 -1
  75. package/dist/browser/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  76. package/dist/browser/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  77. package/dist/browser/credentials/{visualStudioCodeCredential.d.ts → visualStudioCodeCredential-browser.d.mts} +4 -3
  78. package/dist/browser/credentials/visualStudioCodeCredential-browser.d.mts.map +1 -1
  79. package/dist/browser/credentials/{visualStudioCodeCredential.js → visualStudioCodeCredential-browser.mjs} +2 -2
  80. package/dist/browser/credentials/visualStudioCodeCredential-browser.mjs.map +1 -1
  81. package/dist/browser/credentials/{workloadIdentityCredential.d.ts → workloadIdentityCredential-browser.d.mts} +4 -3
  82. package/dist/browser/credentials/workloadIdentityCredential-browser.d.mts.map +1 -1
  83. package/dist/browser/credentials/{workloadIdentityCredential.js → workloadIdentityCredential-browser.mjs} +2 -2
  84. package/dist/browser/credentials/workloadIdentityCredential-browser.mjs.map +1 -1
  85. package/dist/browser/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  86. package/dist/browser/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  87. package/dist/browser/index.d.ts +51 -51
  88. package/dist/browser/index.d.ts.map +1 -1
  89. package/dist/browser/index.js +19 -19
  90. package/dist/browser/index.js.map +1 -1
  91. package/dist/browser/msal/browserFlows/msalBrowserCommon.d.ts.map +1 -1
  92. package/dist/browser/msal/browserFlows/msalBrowserCommon.js +4 -4
  93. package/dist/browser/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  94. package/dist/browser/msal/utils.d.ts +1 -1
  95. package/dist/browser/msal/utils.d.ts.map +1 -1
  96. package/dist/browser/msal/utils.js +1 -1
  97. package/dist/browser/msal/utils.js.map +1 -1
  98. package/dist/browser/util/tenantIdUtils.d.ts +1 -1
  99. package/dist/browser/util/tenantIdUtils.d.ts.map +1 -1
  100. package/dist/browser/util/tenantIdUtils.js +1 -1
  101. package/dist/browser/util/tenantIdUtils.js.map +1 -1
  102. package/dist/commonjs/client/identityClient.js +263 -252
  103. package/dist/commonjs/client/identityClient.js.map +7 -1
  104. package/dist/commonjs/constants.d.ts +1 -1
  105. package/dist/commonjs/constants.js +61 -78
  106. package/dist/commonjs/constants.js.map +7 -1
  107. package/dist/commonjs/credentials/authorityValidationOptions.js +16 -5
  108. package/dist/commonjs/credentials/authorityValidationOptions.js.map +7 -1
  109. package/dist/commonjs/credentials/authorizationCodeCredential.js +99 -75
  110. package/dist/commonjs/credentials/authorizationCodeCredential.js.map +7 -1
  111. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  112. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js +16 -5
  113. package/dist/commonjs/credentials/authorizationCodeCredentialOptions.js.map +7 -1
  114. package/dist/commonjs/credentials/azureCliCredential.d.ts.map +1 -1
  115. package/dist/commonjs/credentials/azureCliCredential.js +228 -214
  116. package/dist/commonjs/credentials/azureCliCredential.js.map +7 -1
  117. package/dist/commonjs/credentials/azureCliCredentialOptions.js +16 -5
  118. package/dist/commonjs/credentials/azureCliCredentialOptions.js.map +7 -1
  119. package/dist/commonjs/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  120. package/dist/commonjs/credentials/azureDeveloperCliCredential.js +192 -202
  121. package/dist/commonjs/credentials/azureDeveloperCliCredential.js.map +7 -1
  122. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js +16 -5
  123. package/dist/commonjs/credentials/azureDeveloperCliCredentialOptions.js.map +7 -1
  124. package/dist/commonjs/credentials/azurePipelinesCredential.js +173 -135
  125. package/dist/commonjs/credentials/azurePipelinesCredential.js.map +7 -1
  126. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  127. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js +16 -5
  128. package/dist/commonjs/credentials/azurePipelinesCredentialOptions.js.map +7 -1
  129. package/dist/commonjs/credentials/azurePowerShellCredential.d.ts +10 -0
  130. package/dist/commonjs/credentials/azurePowerShellCredential.d.ts.map +1 -1
  131. package/dist/commonjs/credentials/azurePowerShellCredential.js +229 -208
  132. package/dist/commonjs/credentials/azurePowerShellCredential.js.map +7 -1
  133. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js +16 -5
  134. package/dist/commonjs/credentials/azurePowerShellCredentialOptions.js.map +7 -1
  135. package/dist/commonjs/credentials/brokerAuthOptions.js +16 -3
  136. package/dist/commonjs/credentials/brokerAuthOptions.js.map +7 -1
  137. package/dist/commonjs/credentials/brokerCredential.d.ts +2 -2
  138. package/dist/commonjs/credentials/brokerCredential.d.ts.map +1 -1
  139. package/dist/commonjs/credentials/brokerCredential.js +104 -71
  140. package/dist/commonjs/credentials/brokerCredential.js.map +7 -1
  141. package/dist/commonjs/credentials/browserCustomizationOptions.js +16 -5
  142. package/dist/commonjs/credentials/browserCustomizationOptions.js.map +7 -1
  143. package/dist/commonjs/credentials/chainedTokenCredential.js +113 -93
  144. package/dist/commonjs/credentials/chainedTokenCredential.js.map +7 -1
  145. package/dist/commonjs/credentials/clientAssertionCredential.js +102 -64
  146. package/dist/commonjs/credentials/clientAssertionCredential.js.map +7 -1
  147. package/dist/commonjs/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  148. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js +16 -5
  149. package/dist/commonjs/credentials/clientAssertionCredentialOptions.js.map +7 -1
  150. package/dist/commonjs/credentials/clientCertificateCredential.js +139 -134
  151. package/dist/commonjs/credentials/clientCertificateCredential.js.map +7 -1
  152. package/dist/commonjs/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  153. package/dist/commonjs/credentials/clientCertificateCredentialModels.js +16 -5
  154. package/dist/commonjs/credentials/clientCertificateCredentialModels.js.map +7 -1
  155. package/dist/commonjs/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  156. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js +16 -5
  157. package/dist/commonjs/credentials/clientCertificateCredentialOptions.js.map +7 -1
  158. package/dist/commonjs/credentials/clientSecretCredential.js +97 -68
  159. package/dist/commonjs/credentials/clientSecretCredential.js.map +7 -1
  160. package/dist/commonjs/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  161. package/dist/commonjs/credentials/clientSecretCredentialOptions.js +16 -5
  162. package/dist/commonjs/credentials/clientSecretCredentialOptions.js.map +7 -1
  163. package/dist/commonjs/credentials/credentialPersistenceOptions.js +16 -5
  164. package/dist/commonjs/credentials/credentialPersistenceOptions.js.map +7 -1
  165. package/dist/commonjs/credentials/defaultAzureCredential.js +121 -159
  166. package/dist/commonjs/credentials/defaultAzureCredential.js.map +7 -1
  167. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js +110 -140
  168. package/dist/commonjs/credentials/defaultAzureCredentialFunctions.js.map +7 -1
  169. package/dist/commonjs/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  170. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js +16 -5
  171. package/dist/commonjs/credentials/defaultAzureCredentialOptions.js.map +7 -1
  172. package/dist/commonjs/credentials/deviceCodeCredential.js +133 -104
  173. package/dist/commonjs/credentials/deviceCodeCredential.js.map +7 -1
  174. package/dist/commonjs/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  175. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js +16 -5
  176. package/dist/commonjs/credentials/deviceCodeCredentialOptions.js.map +7 -1
  177. package/dist/commonjs/credentials/environmentCredential.d.ts.map +1 -1
  178. package/dist/commonjs/credentials/environmentCredential.js +157 -123
  179. package/dist/commonjs/credentials/environmentCredential.js.map +7 -1
  180. package/dist/commonjs/credentials/environmentCredentialOptions.d.ts.map +1 -1
  181. package/dist/commonjs/credentials/environmentCredentialOptions.js +16 -5
  182. package/dist/commonjs/credentials/environmentCredentialOptions.js.map +7 -1
  183. package/dist/commonjs/credentials/interactiveBrowserCredential.js +145 -108
  184. package/dist/commonjs/credentials/interactiveBrowserCredential.js.map +7 -1
  185. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  186. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js +16 -5
  187. package/dist/commonjs/credentials/interactiveBrowserCredentialOptions.js.map +7 -1
  188. package/dist/commonjs/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  189. package/dist/commonjs/credentials/interactiveCredentialOptions.js +16 -5
  190. package/dist/commonjs/credentials/interactiveCredentialOptions.js.map +7 -1
  191. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js +92 -91
  192. package/dist/commonjs/credentials/managedIdentityCredential/imdsMsi.js.map +7 -1
  193. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js +51 -44
  194. package/dist/commonjs/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +7 -1
  195. package/dist/commonjs/credentials/managedIdentityCredential/index.js +256 -242
  196. package/dist/commonjs/credentials/managedIdentityCredential/index.js.map +7 -1
  197. package/dist/commonjs/credentials/managedIdentityCredential/models.js +16 -5
  198. package/dist/commonjs/credentials/managedIdentityCredential/models.js.map +7 -1
  199. package/dist/commonjs/credentials/managedIdentityCredential/options.js +16 -5
  200. package/dist/commonjs/credentials/managedIdentityCredential/options.js.map +7 -1
  201. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js +56 -39
  202. package/dist/commonjs/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +7 -1
  203. package/dist/commonjs/credentials/managedIdentityCredential/utils.js +79 -75
  204. package/dist/commonjs/credentials/managedIdentityCredential/utils.js.map +7 -1
  205. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js +16 -5
  206. package/dist/commonjs/credentials/multiTenantTokenCredentialOptions.js.map +7 -1
  207. package/dist/commonjs/credentials/onBehalfOfCredential.js +169 -127
  208. package/dist/commonjs/credentials/onBehalfOfCredential.js.map +7 -1
  209. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js +16 -5
  210. package/dist/commonjs/credentials/onBehalfOfCredentialOptions.js.map +7 -1
  211. package/dist/commonjs/credentials/usernamePasswordCredential.js +113 -76
  212. package/dist/commonjs/credentials/usernamePasswordCredential.js.map +7 -1
  213. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  214. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js +16 -5
  215. package/dist/commonjs/credentials/usernamePasswordCredentialOptions.js.map +7 -1
  216. package/dist/commonjs/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  217. package/dist/commonjs/credentials/visualStudioCodeCredential.js +144 -132
  218. package/dist/commonjs/credentials/visualStudioCodeCredential.js.map +7 -1
  219. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js +16 -5
  220. package/dist/commonjs/credentials/visualStudioCodeCredentialOptions.js.map +7 -1
  221. package/dist/commonjs/credentials/workloadIdentityCredential.js +123 -109
  222. package/dist/commonjs/credentials/workloadIdentityCredential.js.map +7 -1
  223. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  224. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js +16 -5
  225. package/dist/commonjs/credentials/workloadIdentityCredentialOptions.js.map +7 -1
  226. package/dist/commonjs/errors.js +131 -132
  227. package/dist/commonjs/errors.js.map +7 -1
  228. package/dist/commonjs/index.d.ts +33 -33
  229. package/dist/commonjs/index.d.ts.map +1 -1
  230. package/dist/commonjs/index.js +115 -67
  231. package/dist/commonjs/index.js.map +7 -1
  232. package/dist/commonjs/msal/msal.js +38 -9
  233. package/dist/commonjs/msal/msal.js.map +7 -1
  234. package/dist/commonjs/msal/nodeFlows/brokerOptions.js +16 -3
  235. package/dist/commonjs/msal/nodeFlows/brokerOptions.js.map +7 -1
  236. package/dist/commonjs/msal/nodeFlows/msalClient.js +449 -478
  237. package/dist/commonjs/msal/nodeFlows/msalClient.js.map +7 -1
  238. package/dist/commonjs/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  239. package/dist/commonjs/msal/nodeFlows/msalPlugins.js +140 -147
  240. package/dist/commonjs/msal/nodeFlows/msalPlugins.js.map +7 -1
  241. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js +16 -5
  242. package/dist/commonjs/msal/nodeFlows/tokenCachePersistenceOptions.js.map +7 -1
  243. package/dist/commonjs/msal/types.js +16 -5
  244. package/dist/commonjs/msal/types.js.map +7 -1
  245. package/dist/commonjs/msal/utils.d.ts.map +1 -1
  246. package/dist/commonjs/msal/utils.js +179 -224
  247. package/dist/commonjs/msal/utils.js.map +7 -1
  248. package/dist/commonjs/plugins/consumer.js +32 -40
  249. package/dist/commonjs/plugins/consumer.js.map +7 -1
  250. package/dist/commonjs/plugins/provider.js +16 -5
  251. package/dist/commonjs/plugins/provider.js.map +7 -1
  252. package/dist/commonjs/regionalAuthority.js +93 -141
  253. package/dist/commonjs/regionalAuthority.js.map +7 -1
  254. package/dist/commonjs/tokenCredentialOptions.js +16 -5
  255. package/dist/commonjs/tokenCredentialOptions.js.map +7 -1
  256. package/dist/commonjs/tokenProvider.js +52 -52
  257. package/dist/commonjs/tokenProvider.js.map +7 -1
  258. package/dist/commonjs/tsdoc-metadata.json +1 -1
  259. package/dist/commonjs/util/identityTokenEndpoint.js +32 -12
  260. package/dist/commonjs/util/identityTokenEndpoint.js.map +7 -1
  261. package/dist/commonjs/util/logging.js +91 -97
  262. package/dist/commonjs/util/logging.js.map +7 -1
  263. package/dist/commonjs/util/processMultiTenantRequest.js +43 -33
  264. package/dist/commonjs/util/processMultiTenantRequest.js.map +7 -1
  265. package/dist/commonjs/util/processUtils.d.ts +14 -3
  266. package/dist/commonjs/util/processUtils.d.ts.map +1 -1
  267. package/dist/commonjs/util/processUtils.js +67 -35
  268. package/dist/commonjs/util/processUtils.js.map +7 -1
  269. package/dist/commonjs/util/scopeUtils.js +39 -28
  270. package/dist/commonjs/util/scopeUtils.js.map +7 -1
  271. package/dist/commonjs/util/subscriptionUtils.js +35 -17
  272. package/dist/commonjs/util/subscriptionUtils.js.map +7 -1
  273. package/dist/commonjs/util/tenantIdUtils.d.ts.map +1 -1
  274. package/dist/commonjs/util/tenantIdUtils.js +61 -45
  275. package/dist/commonjs/util/tenantIdUtils.js.map +7 -1
  276. package/dist/commonjs/util/tracing.js +33 -16
  277. package/dist/commonjs/util/tracing.js.map +7 -1
  278. package/dist/esm/constants.d.ts +1 -1
  279. package/dist/esm/constants.js +1 -1
  280. package/dist/esm/constants.js.map +1 -1
  281. package/dist/esm/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  282. package/dist/esm/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  283. package/dist/esm/credentials/azureCliCredential.d.ts.map +1 -1
  284. package/dist/esm/credentials/azureCliCredential.js +21 -24
  285. package/dist/esm/credentials/azureCliCredential.js.map +1 -1
  286. package/dist/esm/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  287. package/dist/esm/credentials/azureDeveloperCliCredential.js +16 -24
  288. package/dist/esm/credentials/azureDeveloperCliCredential.js.map +1 -1
  289. package/dist/esm/credentials/azurePipelinesCredential.js.map +1 -1
  290. package/dist/esm/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  291. package/dist/esm/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  292. package/dist/esm/credentials/azurePowerShellCredential.d.ts +10 -0
  293. package/dist/esm/credentials/azurePowerShellCredential.d.ts.map +1 -1
  294. package/dist/esm/credentials/azurePowerShellCredential.js +26 -6
  295. package/dist/esm/credentials/azurePowerShellCredential.js.map +1 -1
  296. package/dist/esm/credentials/brokerCredential.d.ts +2 -2
  297. package/dist/esm/credentials/brokerCredential.d.ts.map +1 -1
  298. package/dist/esm/credentials/brokerCredential.js.map +1 -1
  299. package/dist/esm/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  300. package/dist/esm/credentials/clientAssertionCredentialOptions.js.map +1 -1
  301. package/dist/esm/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  302. package/dist/esm/credentials/clientCertificateCredentialModels.js.map +1 -1
  303. package/dist/esm/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  304. package/dist/esm/credentials/clientCertificateCredentialOptions.js.map +1 -1
  305. package/dist/esm/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  306. package/dist/esm/credentials/clientSecretCredentialOptions.js.map +1 -1
  307. package/dist/esm/credentials/defaultAzureCredential.js.map +1 -1
  308. package/dist/esm/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  309. package/dist/esm/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  310. package/dist/esm/credentials/defaultAzureCredentialOptions.js.map +1 -1
  311. package/dist/esm/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  312. package/dist/esm/credentials/deviceCodeCredentialOptions.js.map +1 -1
  313. package/dist/esm/credentials/environmentCredential.d.ts.map +1 -1
  314. package/dist/esm/credentials/environmentCredential.js.map +1 -1
  315. package/dist/esm/credentials/environmentCredentialOptions.d.ts.map +1 -1
  316. package/dist/esm/credentials/environmentCredentialOptions.js.map +1 -1
  317. package/dist/esm/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  318. package/dist/esm/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  319. package/dist/esm/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  320. package/dist/esm/credentials/interactiveCredentialOptions.js.map +1 -1
  321. package/dist/esm/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  322. package/dist/esm/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  323. package/dist/esm/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  324. package/dist/esm/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  325. package/dist/esm/credentials/visualStudioCodeCredential.js.map +1 -1
  326. package/dist/esm/credentials/workloadIdentityCredential.js.map +1 -1
  327. package/dist/esm/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  328. package/dist/esm/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  329. package/dist/esm/index.d.ts +33 -33
  330. package/dist/esm/index.d.ts.map +1 -1
  331. package/dist/esm/index.js.map +1 -1
  332. package/dist/esm/msal/nodeFlows/msalClient.js +3 -3
  333. package/dist/esm/msal/nodeFlows/msalClient.js.map +1 -1
  334. package/dist/esm/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  335. package/dist/esm/msal/nodeFlows/msalPlugins.js.map +1 -1
  336. package/dist/esm/msal/utils.d.ts.map +1 -1
  337. package/dist/esm/msal/utils.js.map +1 -1
  338. package/dist/esm/util/processUtils.d.ts +14 -3
  339. package/dist/esm/util/processUtils.d.ts.map +1 -1
  340. package/dist/esm/util/processUtils.js +36 -19
  341. package/dist/esm/util/processUtils.js.map +1 -1
  342. package/dist/esm/util/tenantIdUtils.d.ts.map +1 -1
  343. package/dist/esm/util/tenantIdUtils.js.map +1 -1
  344. package/dist/workerd/constants.d.ts +1 -1
  345. package/dist/workerd/constants.js +1 -1
  346. package/dist/workerd/constants.js.map +1 -1
  347. package/dist/workerd/credentials/authorizationCodeCredentialOptions.d.ts.map +1 -1
  348. package/dist/workerd/credentials/authorizationCodeCredentialOptions.js.map +1 -1
  349. package/dist/workerd/credentials/azureCliCredential.d.ts.map +1 -1
  350. package/dist/workerd/credentials/azureCliCredential.js +21 -24
  351. package/dist/workerd/credentials/azureCliCredential.js.map +1 -1
  352. package/dist/workerd/credentials/azureDeveloperCliCredential.d.ts.map +1 -1
  353. package/dist/workerd/credentials/azureDeveloperCliCredential.js +16 -24
  354. package/dist/workerd/credentials/azureDeveloperCliCredential.js.map +1 -1
  355. package/dist/workerd/credentials/azurePipelinesCredential.js.map +1 -1
  356. package/dist/workerd/credentials/azurePipelinesCredentialOptions.d.ts.map +1 -1
  357. package/dist/workerd/credentials/azurePipelinesCredentialOptions.js.map +1 -1
  358. package/dist/workerd/credentials/azurePowerShellCredential.d.ts +10 -0
  359. package/dist/workerd/credentials/azurePowerShellCredential.d.ts.map +1 -1
  360. package/dist/workerd/credentials/azurePowerShellCredential.js +26 -6
  361. package/dist/workerd/credentials/azurePowerShellCredential.js.map +1 -1
  362. package/dist/workerd/credentials/brokerCredential.d.ts +2 -2
  363. package/dist/workerd/credentials/brokerCredential.d.ts.map +1 -1
  364. package/dist/workerd/credentials/brokerCredential.js.map +1 -1
  365. package/dist/workerd/credentials/clientAssertionCredentialOptions.d.ts.map +1 -1
  366. package/dist/workerd/credentials/clientAssertionCredentialOptions.js.map +1 -1
  367. package/dist/workerd/credentials/clientCertificateCredentialModels.d.ts.map +1 -1
  368. package/dist/workerd/credentials/clientCertificateCredentialModels.js.map +1 -1
  369. package/dist/workerd/credentials/clientCertificateCredentialOptions.d.ts.map +1 -1
  370. package/dist/workerd/credentials/clientCertificateCredentialOptions.js.map +1 -1
  371. package/dist/workerd/credentials/clientSecretCredentialOptions.d.ts.map +1 -1
  372. package/dist/workerd/credentials/clientSecretCredentialOptions.js.map +1 -1
  373. package/dist/workerd/credentials/defaultAzureCredential.js.map +1 -1
  374. package/dist/workerd/credentials/defaultAzureCredentialFunctions.js.map +1 -1
  375. package/dist/workerd/credentials/defaultAzureCredentialOptions.d.ts.map +1 -1
  376. package/dist/workerd/credentials/defaultAzureCredentialOptions.js.map +1 -1
  377. package/dist/workerd/credentials/deviceCodeCredentialOptions.d.ts.map +1 -1
  378. package/dist/workerd/credentials/deviceCodeCredentialOptions.js.map +1 -1
  379. package/dist/workerd/credentials/environmentCredential.d.ts.map +1 -1
  380. package/dist/workerd/credentials/environmentCredential.js.map +1 -1
  381. package/dist/workerd/credentials/environmentCredentialOptions.d.ts.map +1 -1
  382. package/dist/workerd/credentials/environmentCredentialOptions.js.map +1 -1
  383. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -1
  384. package/dist/workerd/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  385. package/dist/workerd/credentials/interactiveCredentialOptions.d.ts.map +1 -1
  386. package/dist/workerd/credentials/interactiveCredentialOptions.js.map +1 -1
  387. package/dist/workerd/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -1
  388. package/dist/workerd/credentials/usernamePasswordCredentialOptions.d.ts.map +1 -1
  389. package/dist/workerd/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  390. package/dist/workerd/credentials/visualStudioCodeCredential.d.ts.map +1 -1
  391. package/dist/workerd/credentials/visualStudioCodeCredential.js.map +1 -1
  392. package/dist/workerd/credentials/workloadIdentityCredential.js.map +1 -1
  393. package/dist/workerd/credentials/workloadIdentityCredentialOptions.d.ts.map +1 -1
  394. package/dist/workerd/credentials/workloadIdentityCredentialOptions.js.map +1 -1
  395. package/dist/workerd/index.d.ts +33 -33
  396. package/dist/workerd/index.d.ts.map +1 -1
  397. package/dist/workerd/index.js.map +1 -1
  398. package/dist/workerd/msal/nodeFlows/msalClient.js +3 -3
  399. package/dist/workerd/msal/nodeFlows/msalClient.js.map +1 -1
  400. package/dist/workerd/msal/nodeFlows/msalPlugins.d.ts.map +1 -1
  401. package/dist/workerd/msal/nodeFlows/msalPlugins.js.map +1 -1
  402. package/dist/workerd/msal/utils.d.ts.map +1 -1
  403. package/dist/workerd/msal/utils.js.map +1 -1
  404. package/dist/workerd/util/processUtils.d.ts +14 -3
  405. package/dist/workerd/util/processUtils.d.ts.map +1 -1
  406. package/dist/workerd/util/processUtils.js +36 -19
  407. package/dist/workerd/util/processUtils.js.map +1 -1
  408. package/dist/workerd/util/tenantIdUtils.d.ts.map +1 -1
  409. package/dist/workerd/util/tenantIdUtils.js.map +1 -1
  410. package/package.json +36 -38
  411. package/dist/browser/credentials/azureCliCredential.d.ts +0 -13
  412. package/dist/browser/credentials/azureDeveloperCliCredential.d.ts +0 -13
  413. package/dist/browser/credentials/azurePipelinesCredential.d.ts +0 -13
  414. package/dist/browser/credentials/azurePowerShellCredential.d.ts +0 -12
  415. package/dist/browser/credentials/brokerCredential.d.ts +0 -35
  416. package/dist/browser/credentials/brokerCredential.d.ts.map +0 -1
  417. package/dist/browser/credentials/brokerCredential.js +0 -69
  418. package/dist/browser/credentials/brokerCredential.js.map +0 -1
  419. package/dist/browser/credentials/clientAssertionCredential.d.ts +0 -12
  420. package/dist/browser/credentials/clientCertificateCredential.d.ts +0 -13
  421. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts +0 -64
  422. package/dist/browser/credentials/defaultAzureCredentialFunctions.d.ts.map +0 -1
  423. package/dist/browser/credentials/defaultAzureCredentialFunctions.js +0 -147
  424. package/dist/browser/credentials/defaultAzureCredentialFunctions.js.map +0 -1
  425. package/dist/browser/credentials/deviceCodeCredential.d.ts +0 -13
  426. package/dist/browser/credentials/environmentCredential.d.ts +0 -13
  427. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts +0 -18
  428. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.d.ts.map +0 -1
  429. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js +0 -97
  430. package/dist/browser/credentials/managedIdentityCredential/imdsMsi.js.map +0 -1
  431. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts +0 -13
  432. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.d.ts.map +0 -1
  433. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js +0 -43
  434. package/dist/browser/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +0 -1
  435. package/dist/browser/credentials/managedIdentityCredential/index.d.ts +0 -6
  436. package/dist/browser/credentials/managedIdentityCredential/models.d.ts +0 -24
  437. package/dist/browser/credentials/managedIdentityCredential/models.d.ts.map +0 -1
  438. package/dist/browser/credentials/managedIdentityCredential/models.js +0 -4
  439. package/dist/browser/credentials/managedIdentityCredential/models.js.map +0 -1
  440. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts +0 -14
  441. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.d.ts.map +0 -1
  442. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js +0 -38
  443. package/dist/browser/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +0 -1
  444. package/dist/browser/credentials/onBehalfOfCredential.d.ts +0 -12
  445. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  446. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  447. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  448. package/dist/browser/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  449. package/dist/browser/msal/nodeFlows/msalClient.d.ts +0 -199
  450. package/dist/browser/msal/nodeFlows/msalClient.d.ts.map +0 -1
  451. package/dist/browser/msal/nodeFlows/msalClient.js +0 -499
  452. package/dist/browser/msal/nodeFlows/msalClient.js.map +0 -1
  453. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts +0 -109
  454. package/dist/browser/msal/nodeFlows/msalPlugins.d.ts.map +0 -1
  455. package/dist/browser/msal/nodeFlows/msalPlugins.js +0 -160
  456. package/dist/browser/msal/nodeFlows/msalPlugins.js.map +0 -1
  457. package/dist/browser/regionalAuthority.d.ts +0 -122
  458. package/dist/browser/regionalAuthority.d.ts.map +0 -1
  459. package/dist/browser/regionalAuthority.js +0 -139
  460. package/dist/browser/regionalAuthority.js.map +0 -1
  461. package/dist/browser/util/authHostEnv-browser.d.mts +0 -4
  462. package/dist/browser/util/authHostEnv-browser.d.mts.map +0 -1
  463. package/dist/browser/util/authHostEnv-browser.mjs +0 -7
  464. package/dist/browser/util/authHostEnv-browser.mjs.map +0 -1
  465. package/dist/browser/util/processUtils.d.ts +0 -13
  466. package/dist/browser/util/processUtils.d.ts.map +0 -1
  467. package/dist/browser/util/processUtils.js +0 -32
  468. package/dist/browser/util/processUtils.js.map +0 -1
  469. package/dist/browser/util/subscriptionUtils.d.ts +0 -6
  470. package/dist/browser/util/subscriptionUtils.d.ts.map +0 -1
  471. package/dist/browser/util/subscriptionUtils.js +0 -16
  472. package/dist/browser/util/subscriptionUtils.js.map +0 -1
  473. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  474. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  475. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js +0 -5
  476. package/dist/commonjs/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  477. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  478. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  479. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js +0 -265
  480. package/dist/commonjs/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  481. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  482. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  483. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js +0 -5
  484. package/dist/commonjs/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  485. package/dist/commonjs/msal/credentials.d.ts +0 -52
  486. package/dist/commonjs/msal/credentials.d.ts.map +0 -1
  487. package/dist/commonjs/msal/credentials.js +0 -5
  488. package/dist/commonjs/msal/credentials.js.map +0 -1
  489. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  490. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  491. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  492. package/dist/esm/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  493. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  494. package/dist/esm/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  495. package/dist/esm/msal/browserFlows/msalBrowserCommon.js +0 -261
  496. package/dist/esm/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  497. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  498. package/dist/esm/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  499. package/dist/esm/msal/browserFlows/msalBrowserOptions.js +0 -4
  500. package/dist/esm/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  501. package/dist/esm/msal/credentials.d.ts +0 -52
  502. package/dist/esm/msal/credentials.d.ts.map +0 -1
  503. package/dist/esm/msal/credentials.js +0 -4
  504. package/dist/esm/msal/credentials.js.map +0 -1
  505. package/dist/esm/util/authHostEnv-browser.d.mts +0 -4
  506. package/dist/esm/util/authHostEnv-browser.d.mts.map +0 -1
  507. package/dist/esm/util/authHostEnv-browser.mjs +0 -7
  508. package/dist/esm/util/authHostEnv-browser.mjs.map +0 -1
  509. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts +0 -12
  510. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.d.ts.map +0 -1
  511. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js +0 -4
  512. package/dist/workerd/credentials/visualStudioCodeCredentialPlugin.js.map +0 -1
  513. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts +0 -19
  514. package/dist/workerd/msal/browserFlows/msalBrowserCommon.d.ts.map +0 -1
  515. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js +0 -261
  516. package/dist/workerd/msal/browserFlows/msalBrowserCommon.js.map +0 -1
  517. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts +0 -87
  518. package/dist/workerd/msal/browserFlows/msalBrowserOptions.d.ts.map +0 -1
  519. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js +0 -4
  520. package/dist/workerd/msal/browserFlows/msalBrowserOptions.js.map +0 -1
  521. package/dist/workerd/msal/credentials.d.ts +0 -52
  522. package/dist/workerd/msal/credentials.d.ts.map +0 -1
  523. package/dist/workerd/msal/credentials.js +0 -4
  524. package/dist/workerd/msal/credentials.js.map +0 -1
  525. package/dist/workerd/util/authHostEnv-browser.d.mts +0 -4
  526. package/dist/workerd/util/authHostEnv-browser.d.mts.map +0 -1
  527. package/dist/workerd/util/authHostEnv-browser.mjs +0 -7
  528. package/dist/workerd/util/authHostEnv-browser.mjs.map +0 -1
  529. /package/dist/browser/credentials/{clientSecretCredential.d.ts → clientSecretCredential-browser.d.mts} +0 -0
  530. /package/dist/browser/credentials/{clientSecretCredential.js → clientSecretCredential-browser.mjs} +0 -0
  531. /package/dist/browser/credentials/{interactiveBrowserCredential.d.ts → interactiveBrowserCredential-browser.d.mts} +0 -0
  532. /package/dist/browser/credentials/{interactiveBrowserCredential.js → interactiveBrowserCredential-browser.mjs} +0 -0
  533. /package/dist/browser/credentials/{usernamePasswordCredential.d.ts → usernamePasswordCredential-browser.d.mts} +0 -0
  534. /package/dist/browser/credentials/{usernamePasswordCredential.js → usernamePasswordCredential-browser.mjs} +0 -0
  535. /package/dist/browser/msal/{msal.d.ts → msal-browser.d.mts} +0 -0
  536. /package/dist/browser/msal/{msal.js → msal-browser.mjs} +0 -0
  537. /package/dist/browser/plugins/{consumer.d.ts → consumer-browser.d.mts} +0 -0
  538. /package/dist/browser/plugins/{consumer.js → consumer-browser.mjs} +0 -0
  539. /package/dist/browser/util/{processMultiTenantRequest.d.ts → processMultiTenantRequest-browser.d.mts} +0 -0
  540. /package/dist/browser/util/{processMultiTenantRequest.js → processMultiTenantRequest-browser.mjs} +0 -0
@@ -1,504 +1,475 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.generateMsalConfiguration = generateMsalConfiguration;
6
- exports.createMsalClient = createMsalClient;
7
- const tslib_1 = require("tslib");
8
- const msal = tslib_1.__importStar(require("@azure/msal-node"));
9
- const logging_js_1 = require("../../util/logging.js");
10
- const msalPlugins_js_1 = require("./msalPlugins.js");
11
- const utils_js_1 = require("../utils.js");
12
- const errors_js_1 = require("../../errors.js");
13
- const identityClient_js_1 = require("../../client/identityClient.js");
14
- const regionalAuthority_js_1 = require("../../regionalAuthority.js");
15
- const logger_1 = require("@azure/logger");
16
- const tenantIdUtils_js_1 = require("../../util/tenantIdUtils.js");
17
- /**
18
- * The default logger used if no logger was passed in by the credential.
19
- */
20
- const msalLogger = (0, logging_js_1.credentialLogger)("MsalClient");
21
- /**
22
- * Generates the configuration for MSAL (Microsoft Authentication Library).
23
- *
24
- * @param clientId - The client ID of the application.
25
- * @param tenantId - The tenant ID of the Azure Active Directory.
26
- * @param msalClientOptions - Optional. Additional options for creating the MSAL client.
27
- * @returns The MSAL configuration object.
28
- */
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var msalClient_exports = {};
29
+ __export(msalClient_exports, {
30
+ createMsalClient: () => createMsalClient,
31
+ generateMsalConfiguration: () => generateMsalConfiguration
32
+ });
33
+ module.exports = __toCommonJS(msalClient_exports);
34
+ var msal = __toESM(require("@azure/msal-node"));
35
+ var import_logging = require("../../util/logging.js");
36
+ var import_msalPlugins = require("./msalPlugins.js");
37
+ var import_utils = require("../utils.js");
38
+ var import_errors = require("../../errors.js");
39
+ var import_identityClient = require("../../client/identityClient.js");
40
+ var import_regionalAuthority = require("../../regionalAuthority.js");
41
+ var import_logger = require("@azure/logger");
42
+ var import_tenantIdUtils = require("../../util/tenantIdUtils.js");
43
+ const msalLogger = (0, import_logging.credentialLogger)("MsalClient");
29
44
  function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
30
- const resolvedTenant = (0, tenantIdUtils_js_1.resolveTenantId)(msalClientOptions.logger ?? msalLogger, tenantId, clientId);
31
- // TODO: move and reuse getIdentityClientAuthorityHost
32
- const authority = (0, utils_js_1.getAuthority)(resolvedTenant, (0, utils_js_1.getAuthorityHost)(msalClientOptions));
33
- const httpClient = new identityClient_js_1.IdentityClient({
34
- ...msalClientOptions.tokenCredentialOptions,
35
- authorityHost: authority,
36
- loggingOptions: msalClientOptions.loggingOptions,
37
- });
38
- const msalConfig = {
39
- auth: {
40
- clientId,
41
- authority,
42
- knownAuthorities: (0, utils_js_1.getKnownAuthorities)(resolvedTenant, authority, msalClientOptions.disableInstanceDiscovery),
43
- },
44
- system: {
45
- networkClient: httpClient,
46
- loggerOptions: {
47
- loggerCallback: (0, utils_js_1.defaultLoggerCallback)(msalClientOptions.logger ?? msalLogger),
48
- logLevel: (0, utils_js_1.getMSALLogLevel)((0, logger_1.getLogLevel)()),
49
- piiLoggingEnabled: msalClientOptions.loggingOptions?.enableUnsafeSupportLogging,
50
- },
51
- },
52
- };
53
- return msalConfig;
45
+ const resolvedTenant = (0, import_tenantIdUtils.resolveTenantId)(
46
+ msalClientOptions.logger ?? msalLogger,
47
+ tenantId,
48
+ clientId
49
+ );
50
+ const authority = (0, import_utils.getAuthority)(resolvedTenant, (0, import_utils.getAuthorityHost)(msalClientOptions));
51
+ const httpClient = new import_identityClient.IdentityClient({
52
+ ...msalClientOptions.tokenCredentialOptions,
53
+ authorityHost: authority,
54
+ loggingOptions: msalClientOptions.loggingOptions
55
+ });
56
+ const msalConfig = {
57
+ auth: {
58
+ clientId,
59
+ authority,
60
+ knownAuthorities: (0, import_utils.getKnownAuthorities)(
61
+ resolvedTenant,
62
+ authority,
63
+ msalClientOptions.disableInstanceDiscovery
64
+ )
65
+ },
66
+ system: {
67
+ networkClient: httpClient,
68
+ loggerOptions: {
69
+ loggerCallback: (0, import_utils.defaultLoggerCallback)(msalClientOptions.logger ?? msalLogger),
70
+ logLevel: (0, import_utils.getMSALLogLevel)((0, import_logger.getLogLevel)()),
71
+ piiLoggingEnabled: msalClientOptions.loggingOptions?.enableUnsafeSupportLogging
72
+ }
73
+ }
74
+ };
75
+ return msalConfig;
54
76
  }
55
- /**
56
- * Creates an instance of the MSAL (Microsoft Authentication Library) client.
57
- *
58
- * @param clientId - The client ID of the application.
59
- * @param tenantId - The tenant ID of the Azure Active Directory.
60
- * @param createMsalClientOptions - Optional. Additional options for creating the MSAL client.
61
- * @returns An instance of the MSAL client.
62
- *
63
- * @public
64
- */
65
77
  function createMsalClient(clientId, tenantId, createMsalClientOptions = {}) {
66
- const state = {
67
- msalConfig: generateMsalConfiguration(clientId, tenantId, createMsalClientOptions),
68
- cachedAccount: createMsalClientOptions.authenticationRecord
69
- ? (0, utils_js_1.publicToMsal)(createMsalClientOptions.authenticationRecord)
70
- : null,
71
- pluginConfiguration: msalPlugins_js_1.msalPlugins.generatePluginConfiguration(createMsalClientOptions),
72
- logger: createMsalClientOptions.logger ?? msalLogger,
73
- };
74
- const publicApps = new Map();
75
- async function getPublicApp(options = {}) {
76
- const appKey = options.enableCae ? "CAE" : "default";
77
- let publicClientApp = publicApps.get(appKey);
78
- if (publicClientApp) {
79
- state.logger.getToken.info("Existing PublicClientApplication found in cache, returning it.");
80
- return publicClientApp;
81
- }
82
- // Initialize a new app and cache it
83
- state.logger.getToken.info(`Creating new PublicClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`);
84
- const cachePlugin = options.enableCae
85
- ? state.pluginConfiguration.cache.cachePluginCae
86
- : state.pluginConfiguration.cache.cachePlugin;
87
- state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : undefined;
88
- publicClientApp = new msal.PublicClientApplication({
89
- ...state.msalConfig,
90
- broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
91
- cache: { cachePlugin: await cachePlugin },
92
- });
93
- publicApps.set(appKey, publicClientApp);
94
- return publicClientApp;
78
+ const state = {
79
+ msalConfig: generateMsalConfiguration(clientId, tenantId, createMsalClientOptions),
80
+ cachedAccount: createMsalClientOptions.authenticationRecord ? (0, import_utils.publicToMsal)(createMsalClientOptions.authenticationRecord) : null,
81
+ pluginConfiguration: import_msalPlugins.msalPlugins.generatePluginConfiguration(createMsalClientOptions),
82
+ logger: createMsalClientOptions.logger ?? msalLogger
83
+ };
84
+ const publicApps = /* @__PURE__ */ new Map();
85
+ async function getPublicApp(options = {}) {
86
+ const appKey = options.enableCae ? "CAE" : "default";
87
+ let publicClientApp = publicApps.get(appKey);
88
+ if (publicClientApp) {
89
+ state.logger.getToken.info("Existing PublicClientApplication found in cache, returning it.");
90
+ return publicClientApp;
95
91
  }
96
- const confidentialApps = new Map();
97
- async function getConfidentialApp(options = {}) {
98
- const appKey = options.enableCae ? "CAE" : "default";
99
- let confidentialClientApp = confidentialApps.get(appKey);
100
- if (confidentialClientApp) {
101
- state.logger.getToken.info("Existing ConfidentialClientApplication found in cache, returning it.");
102
- return confidentialClientApp;
103
- }
104
- // Initialize a new app and cache it
105
- state.logger.getToken.info(`Creating new ConfidentialClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`);
106
- const cachePlugin = options.enableCae
107
- ? state.pluginConfiguration.cache.cachePluginCae
108
- : state.pluginConfiguration.cache.cachePlugin;
109
- state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : undefined;
110
- confidentialClientApp = new msal.ConfidentialClientApplication({
111
- ...state.msalConfig,
112
- broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
113
- cache: { cachePlugin: await cachePlugin },
114
- });
115
- confidentialApps.set(appKey, confidentialClientApp);
116
- return confidentialClientApp;
92
+ state.logger.getToken.info(
93
+ `Creating new PublicClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`
94
+ );
95
+ const cachePlugin = options.enableCae ? state.pluginConfiguration.cache.cachePluginCae : state.pluginConfiguration.cache.cachePlugin;
96
+ state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : void 0;
97
+ publicClientApp = new msal.PublicClientApplication({
98
+ ...state.msalConfig,
99
+ broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
100
+ cache: { cachePlugin: await cachePlugin }
101
+ });
102
+ publicApps.set(appKey, publicClientApp);
103
+ return publicClientApp;
104
+ }
105
+ const confidentialApps = /* @__PURE__ */ new Map();
106
+ async function getConfidentialApp(options = {}) {
107
+ const appKey = options.enableCae ? "CAE" : "default";
108
+ let confidentialClientApp = confidentialApps.get(appKey);
109
+ if (confidentialClientApp) {
110
+ state.logger.getToken.info(
111
+ "Existing ConfidentialClientApplication found in cache, returning it."
112
+ );
113
+ return confidentialClientApp;
117
114
  }
118
- async function getTokenSilent(app, scopes, options = {}) {
119
- if (state.cachedAccount === null) {
120
- state.logger.getToken.info("No cached account found in local state.");
121
- throw new errors_js_1.AuthenticationRequiredError({ scopes });
122
- }
123
- // Keep track and reuse the claims we received across challenges
124
- if (options.claims) {
125
- state.cachedClaims = options.claims;
126
- }
127
- const silentRequest = {
128
- account: state.cachedAccount,
129
- scopes,
130
- claims: state.cachedClaims,
131
- };
132
- if (state.pluginConfiguration.broker.isEnabled) {
133
- silentRequest.tokenQueryParameters ||= {};
134
- if (state.pluginConfiguration.broker.enableMsaPassthrough) {
135
- silentRequest.tokenQueryParameters["msal_request_type"] = "consumer_passthrough";
136
- }
137
- }
138
- if (options.proofOfPossessionOptions) {
139
- silentRequest.shrNonce = options.proofOfPossessionOptions.nonce;
140
- silentRequest.authenticationScheme = "pop";
141
- silentRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
142
- silentRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
143
- }
144
- state.logger.getToken.info("Attempting to acquire token silently");
145
- try {
146
- return await app.acquireTokenSilent(silentRequest);
147
- }
148
- catch (err) {
149
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
150
- }
115
+ state.logger.getToken.info(
116
+ `Creating new ConfidentialClientApplication with CAE ${options.enableCae ? "enabled" : "disabled"}.`
117
+ );
118
+ const cachePlugin = options.enableCae ? state.pluginConfiguration.cache.cachePluginCae : state.pluginConfiguration.cache.cachePlugin;
119
+ state.msalConfig.auth.clientCapabilities = options.enableCae ? ["cp1"] : void 0;
120
+ confidentialClientApp = new msal.ConfidentialClientApplication({
121
+ ...state.msalConfig,
122
+ broker: { nativeBrokerPlugin: state.pluginConfiguration.broker.nativeBrokerPlugin },
123
+ cache: { cachePlugin: await cachePlugin }
124
+ });
125
+ confidentialApps.set(appKey, confidentialClientApp);
126
+ return confidentialClientApp;
127
+ }
128
+ async function getTokenSilent(app, scopes, options = {}) {
129
+ if (state.cachedAccount === null) {
130
+ state.logger.getToken.info("No cached account found in local state.");
131
+ throw new import_errors.AuthenticationRequiredError({ scopes });
151
132
  }
152
- /**
153
- * Builds an authority URL for the given request. The authority may be different than the one used when creating the MSAL client
154
- * if the user is creating cross-tenant requests
155
- */
156
- function calculateRequestAuthority(options) {
157
- if (options?.tenantId) {
158
- return (0, utils_js_1.getAuthority)(options.tenantId, (0, utils_js_1.getAuthorityHost)(createMsalClientOptions));
159
- }
160
- return state.msalConfig.auth.authority;
133
+ if (options.claims) {
134
+ state.cachedClaims = options.claims;
161
135
  }
162
- /**
163
- * Performs silent authentication using MSAL to acquire an access token.
164
- * If silent authentication fails, falls back to interactive authentication.
165
- *
166
- * @param msalApp - The MSAL application instance.
167
- * @param scopes - The scopes for which to acquire the access token.
168
- * @param options - The options for acquiring the access token.
169
- * @param onAuthenticationRequired - A callback function to handle interactive authentication when silent authentication fails.
170
- * @returns A promise that resolves to an AccessToken object containing the access token and its expiration timestamp.
171
- */
172
- async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
173
- let response = null;
174
- try {
175
- response = await getTokenSilent(msalApp, scopes, options);
176
- }
177
- catch (e) {
178
- if (e.name !== "AuthenticationRequiredError") {
179
- throw e;
180
- }
181
- if (options.disableAutomaticAuthentication) {
182
- throw new errors_js_1.AuthenticationRequiredError({
183
- scopes,
184
- getTokenOptions: options,
185
- message: "Automatic authentication has been disabled. You may call the authentication() method.",
186
- });
187
- }
188
- }
189
- // Silent authentication failed
190
- if (response === null) {
191
- try {
192
- response = await onAuthenticationRequired();
193
- }
194
- catch (err) {
195
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
196
- }
197
- }
198
- // At this point we should have a token, process it
199
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
200
- state.cachedAccount = response?.account ?? null;
201
- state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
202
- return {
203
- token: response.accessToken,
204
- expiresOnTimestamp: response.expiresOn.getTime(),
205
- refreshAfterTimestamp: response.refreshOn?.getTime(),
206
- tokenType: response.tokenType,
207
- };
136
+ const silentRequest = {
137
+ account: state.cachedAccount,
138
+ scopes,
139
+ claims: state.cachedClaims
140
+ };
141
+ if (state.pluginConfiguration.broker.isEnabled) {
142
+ silentRequest.extraQueryParameters ||= {};
143
+ if (state.pluginConfiguration.broker.enableMsaPassthrough) {
144
+ silentRequest.extraQueryParameters["msal_request_type"] = "consumer_passthrough";
145
+ }
208
146
  }
209
- async function getTokenByClientSecret(scopes, clientSecret, options = {}) {
210
- state.logger.getToken.info(`Attempting to acquire token using client secret`);
211
- state.msalConfig.auth.clientSecret = clientSecret;
212
- const msalApp = await getConfidentialApp(options);
213
- try {
214
- const response = await msalApp.acquireTokenByClientCredential({
215
- scopes,
216
- authority: calculateRequestAuthority(options),
217
- azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
218
- claims: options?.claims,
219
- });
220
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
221
- state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
222
- return {
223
- token: response.accessToken,
224
- expiresOnTimestamp: response.expiresOn.getTime(),
225
- refreshAfterTimestamp: response.refreshOn?.getTime(),
226
- tokenType: response.tokenType,
227
- };
228
- }
229
- catch (err) {
230
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
231
- }
147
+ if (options.proofOfPossessionOptions) {
148
+ silentRequest.shrNonce = options.proofOfPossessionOptions.nonce;
149
+ silentRequest.authenticationScheme = "pop";
150
+ silentRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
151
+ silentRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
232
152
  }
233
- async function getTokenByClientAssertion(scopes, clientAssertion, options = {}) {
234
- state.logger.getToken.info(`Attempting to acquire token using client assertion`);
235
- state.msalConfig.auth.clientAssertion = clientAssertion;
236
- const msalApp = await getConfidentialApp(options);
237
- try {
238
- const response = await msalApp.acquireTokenByClientCredential({
239
- scopes,
240
- authority: calculateRequestAuthority(options),
241
- azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
242
- claims: options?.claims,
243
- clientAssertion,
244
- });
245
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
246
- state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
247
- return {
248
- token: response.accessToken,
249
- expiresOnTimestamp: response.expiresOn.getTime(),
250
- refreshAfterTimestamp: response.refreshOn?.getTime(),
251
- tokenType: response.tokenType,
252
- };
253
- }
254
- catch (err) {
255
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
256
- }
153
+ state.logger.getToken.info("Attempting to acquire token silently");
154
+ try {
155
+ return await app.acquireTokenSilent(silentRequest);
156
+ } catch (err) {
157
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
257
158
  }
258
- async function getTokenByClientCertificate(scopes, certificate, options = {}) {
259
- state.logger.getToken.info(`Attempting to acquire token using client certificate`);
260
- state.msalConfig.auth.clientCertificate = certificate;
261
- const msalApp = await getConfidentialApp(options);
262
- try {
263
- const response = await msalApp.acquireTokenByClientCredential({
264
- scopes,
265
- authority: calculateRequestAuthority(options),
266
- azureRegion: (0, regionalAuthority_js_1.calculateRegionalAuthority)(),
267
- claims: options?.claims,
268
- });
269
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
270
- state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
271
- return {
272
- token: response.accessToken,
273
- expiresOnTimestamp: response.expiresOn.getTime(),
274
- refreshAfterTimestamp: response.refreshOn?.getTime(),
275
- tokenType: response.tokenType,
276
- };
277
- }
278
- catch (err) {
279
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
280
- }
159
+ }
160
+ function calculateRequestAuthority(options) {
161
+ if (options?.tenantId) {
162
+ return (0, import_utils.getAuthority)(options.tenantId, (0, import_utils.getAuthorityHost)(createMsalClientOptions));
281
163
  }
282
- async function getTokenByDeviceCode(scopes, deviceCodeCallback, options = {}) {
283
- state.logger.getToken.info(`Attempting to acquire token using device code`);
284
- const msalApp = await getPublicApp(options);
285
- return withSilentAuthentication(msalApp, scopes, options, () => {
286
- const requestOptions = {
287
- scopes,
288
- cancel: options?.abortSignal?.aborted ?? false,
289
- deviceCodeCallback,
290
- authority: calculateRequestAuthority(options),
291
- claims: options?.claims,
292
- };
293
- const deviceCodeRequest = msalApp.acquireTokenByDeviceCode(requestOptions);
294
- if (options.abortSignal) {
295
- options.abortSignal.addEventListener("abort", () => {
296
- requestOptions.cancel = true;
297
- });
298
- }
299
- return deviceCodeRequest;
164
+ return state.msalConfig.auth.authority;
165
+ }
166
+ async function withSilentAuthentication(msalApp, scopes, options, onAuthenticationRequired) {
167
+ let response = null;
168
+ try {
169
+ response = await getTokenSilent(msalApp, scopes, options);
170
+ } catch (e) {
171
+ if (e.name !== "AuthenticationRequiredError") {
172
+ throw e;
173
+ }
174
+ if (options.disableAutomaticAuthentication) {
175
+ throw new import_errors.AuthenticationRequiredError({
176
+ scopes,
177
+ getTokenOptions: options,
178
+ message: "Automatic authentication has been disabled. You may call the authentication() method."
300
179
  });
180
+ }
301
181
  }
302
- async function getTokenByUsernamePassword(scopes, username, password, options = {}) {
303
- state.logger.getToken.info(`Attempting to acquire token using username and password`);
304
- const msalApp = await getPublicApp(options);
305
- return withSilentAuthentication(msalApp, scopes, options, () => {
306
- const requestOptions = {
307
- scopes,
308
- username,
309
- password,
310
- authority: calculateRequestAuthority(options),
311
- claims: options?.claims,
312
- };
313
- return msalApp.acquireTokenByUsernamePassword(requestOptions);
314
- });
182
+ if (response === null) {
183
+ try {
184
+ response = await onAuthenticationRequired();
185
+ } catch (err) {
186
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
187
+ }
315
188
  }
316
- function getActiveAccount() {
317
- if (!state.cachedAccount) {
318
- return undefined;
319
- }
320
- return (0, utils_js_1.msalToPublic)(clientId, state.cachedAccount);
189
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
190
+ state.cachedAccount = response?.account ?? null;
191
+ state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
192
+ return {
193
+ token: response.accessToken,
194
+ expiresOnTimestamp: response.expiresOn.getTime(),
195
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
196
+ tokenType: response.tokenType
197
+ };
198
+ }
199
+ async function getTokenByClientSecret(scopes, clientSecret, options = {}) {
200
+ state.logger.getToken.info(`Attempting to acquire token using client secret`);
201
+ state.msalConfig.auth.clientSecret = clientSecret;
202
+ const msalApp = await getConfidentialApp(options);
203
+ try {
204
+ const response = await msalApp.acquireTokenByClientCredential({
205
+ scopes,
206
+ authority: calculateRequestAuthority(options),
207
+ azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
208
+ claims: options?.claims
209
+ });
210
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
211
+ state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
212
+ return {
213
+ token: response.accessToken,
214
+ expiresOnTimestamp: response.expiresOn.getTime(),
215
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
216
+ tokenType: response.tokenType
217
+ };
218
+ } catch (err) {
219
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
321
220
  }
322
- async function getTokenByAuthorizationCode(scopes, redirectUri, authorizationCode, clientSecret, options = {}) {
323
- state.logger.getToken.info(`Attempting to acquire token using authorization code`);
324
- let msalApp;
325
- if (clientSecret) {
326
- // If a client secret is provided, we need to use a confidential client application
327
- // See https://learn.microsoft.com/entra/identity-platform/v2-oauth2-auth-code-flow#request-an-access-token-with-a-client_secret
328
- state.msalConfig.auth.clientSecret = clientSecret;
329
- msalApp = await getConfidentialApp(options);
330
- }
331
- else {
332
- msalApp = await getPublicApp(options);
333
- }
334
- return withSilentAuthentication(msalApp, scopes, options, () => {
335
- return msalApp.acquireTokenByCode({
336
- scopes,
337
- redirectUri,
338
- code: authorizationCode,
339
- authority: calculateRequestAuthority(options),
340
- claims: options?.claims,
341
- });
221
+ }
222
+ async function getTokenByClientAssertion(scopes, clientAssertion, options = {}) {
223
+ state.logger.getToken.info(`Attempting to acquire token using client assertion`);
224
+ state.msalConfig.auth.clientAssertion = clientAssertion;
225
+ const msalApp = await getConfidentialApp(options);
226
+ try {
227
+ const response = await msalApp.acquireTokenByClientCredential({
228
+ scopes,
229
+ authority: calculateRequestAuthority(options),
230
+ azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
231
+ claims: options?.claims,
232
+ clientAssertion
233
+ });
234
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
235
+ state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
236
+ return {
237
+ token: response.accessToken,
238
+ expiresOnTimestamp: response.expiresOn.getTime(),
239
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
240
+ tokenType: response.tokenType
241
+ };
242
+ } catch (err) {
243
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
244
+ }
245
+ }
246
+ async function getTokenByClientCertificate(scopes, certificate, options = {}) {
247
+ state.logger.getToken.info(`Attempting to acquire token using client certificate`);
248
+ state.msalConfig.auth.clientCertificate = certificate;
249
+ const msalApp = await getConfidentialApp(options);
250
+ try {
251
+ const response = await msalApp.acquireTokenByClientCredential({
252
+ scopes,
253
+ authority: calculateRequestAuthority(options),
254
+ azureRegion: (0, import_regionalAuthority.calculateRegionalAuthority)(),
255
+ claims: options?.claims
256
+ });
257
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
258
+ state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
259
+ return {
260
+ token: response.accessToken,
261
+ expiresOnTimestamp: response.expiresOn.getTime(),
262
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
263
+ tokenType: response.tokenType
264
+ };
265
+ } catch (err) {
266
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
267
+ }
268
+ }
269
+ async function getTokenByDeviceCode(scopes, deviceCodeCallback, options = {}) {
270
+ state.logger.getToken.info(`Attempting to acquire token using device code`);
271
+ const msalApp = await getPublicApp(options);
272
+ return withSilentAuthentication(msalApp, scopes, options, () => {
273
+ const requestOptions = {
274
+ scopes,
275
+ cancel: options?.abortSignal?.aborted ?? false,
276
+ deviceCodeCallback,
277
+ authority: calculateRequestAuthority(options),
278
+ claims: options?.claims
279
+ };
280
+ const deviceCodeRequest = msalApp.acquireTokenByDeviceCode(requestOptions);
281
+ if (options.abortSignal) {
282
+ options.abortSignal.addEventListener("abort", () => {
283
+ requestOptions.cancel = true;
342
284
  });
285
+ }
286
+ return deviceCodeRequest;
287
+ });
288
+ }
289
+ async function getTokenByUsernamePassword(scopes, username, password, options = {}) {
290
+ state.logger.getToken.info(`Attempting to acquire token using username and password`);
291
+ const msalApp = await getPublicApp(options);
292
+ return withSilentAuthentication(msalApp, scopes, options, () => {
293
+ const requestOptions = {
294
+ scopes,
295
+ username,
296
+ password,
297
+ authority: calculateRequestAuthority(options),
298
+ claims: options?.claims
299
+ };
300
+ return msalApp.acquireTokenByUsernamePassword(requestOptions);
301
+ });
302
+ }
303
+ function getActiveAccount() {
304
+ if (!state.cachedAccount) {
305
+ return void 0;
343
306
  }
344
- async function getTokenOnBehalfOf(scopes, userAssertionToken, clientCredentials, options = {}) {
345
- msalLogger.getToken.info(`Attempting to acquire token on behalf of another user`);
346
- if (typeof clientCredentials === "string") {
347
- // Client secret
348
- msalLogger.getToken.info(`Using client secret for on behalf of flow`);
349
- state.msalConfig.auth.clientSecret = clientCredentials;
350
- }
351
- else if (typeof clientCredentials === "function") {
352
- // Client Assertion
353
- msalLogger.getToken.info(`Using client assertion callback for on behalf of flow`);
354
- state.msalConfig.auth.clientAssertion = clientCredentials;
355
- }
356
- else {
357
- // Client certificate
358
- msalLogger.getToken.info(`Using client certificate for on behalf of flow`);
359
- state.msalConfig.auth.clientCertificate = clientCredentials;
360
- }
361
- const msalApp = await getConfidentialApp(options);
362
- try {
363
- const response = await msalApp.acquireTokenOnBehalfOf({
364
- scopes,
365
- authority: calculateRequestAuthority(options),
366
- claims: options.claims,
367
- oboAssertion: userAssertionToken,
368
- });
369
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
370
- msalLogger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
371
- return {
372
- token: response.accessToken,
373
- expiresOnTimestamp: response.expiresOn.getTime(),
374
- refreshAfterTimestamp: response.refreshOn?.getTime(),
375
- tokenType: response.tokenType,
376
- };
377
- }
378
- catch (err) {
379
- throw (0, utils_js_1.handleMsalError)(scopes, err, options);
380
- }
307
+ return (0, import_utils.msalToPublic)(clientId, state.cachedAccount);
308
+ }
309
+ async function getTokenByAuthorizationCode(scopes, redirectUri, authorizationCode, clientSecret, options = {}) {
310
+ state.logger.getToken.info(`Attempting to acquire token using authorization code`);
311
+ let msalApp;
312
+ if (clientSecret) {
313
+ state.msalConfig.auth.clientSecret = clientSecret;
314
+ msalApp = await getConfidentialApp(options);
315
+ } else {
316
+ msalApp = await getPublicApp(options);
381
317
  }
382
- /**
383
- * Creates a base interactive request configuration for MSAL interactive authentication.
384
- * This is shared between interactive and brokered authentication flows.
385
- */
386
- function createBaseInteractiveRequest(scopes, options) {
387
- return {
388
- openBrowser: async (url) => {
389
- const open = await import("open");
390
- await open.default(url, { newInstance: true });
391
- },
392
- scopes,
393
- authority: calculateRequestAuthority(options),
394
- claims: options?.claims,
395
- loginHint: options?.loginHint,
396
- errorTemplate: options?.browserCustomizationOptions?.errorMessage,
397
- successTemplate: options?.browserCustomizationOptions?.successMessage,
398
- prompt: options?.loginHint ? "login" : "select_account",
399
- };
318
+ return withSilentAuthentication(msalApp, scopes, options, () => {
319
+ return msalApp.acquireTokenByCode({
320
+ scopes,
321
+ redirectUri,
322
+ code: authorizationCode,
323
+ authority: calculateRequestAuthority(options),
324
+ claims: options?.claims
325
+ });
326
+ });
327
+ }
328
+ async function getTokenOnBehalfOf(scopes, userAssertionToken, clientCredentials, options = {}) {
329
+ msalLogger.getToken.info(`Attempting to acquire token on behalf of another user`);
330
+ if (typeof clientCredentials === "string") {
331
+ msalLogger.getToken.info(`Using client secret for on behalf of flow`);
332
+ state.msalConfig.auth.clientSecret = clientCredentials;
333
+ } else if (typeof clientCredentials === "function") {
334
+ msalLogger.getToken.info(`Using client assertion callback for on behalf of flow`);
335
+ state.msalConfig.auth.clientAssertion = clientCredentials;
336
+ } else {
337
+ msalLogger.getToken.info(`Using client certificate for on behalf of flow`);
338
+ state.msalConfig.auth.clientCertificate = clientCredentials;
400
339
  }
401
- /**
402
- * @internal
403
- */
404
- async function getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options = {}) {
405
- msalLogger.verbose("Authentication will resume through the broker");
406
- const app = await getPublicApp(options);
407
- const interactiveRequest = createBaseInteractiveRequest(scopes, options);
408
- if (state.pluginConfiguration.broker.parentWindowHandle) {
409
- interactiveRequest.windowHandle = Buffer.from(state.pluginConfiguration.broker.parentWindowHandle);
410
- }
411
- else {
412
- // this is a bug, as the pluginConfiguration handler should validate this case.
413
- msalLogger.warning("Parent window handle is not specified for the broker. This may cause unexpected behavior. Please provide the parentWindowHandle.");
414
- }
415
- if (state.pluginConfiguration.broker.enableMsaPassthrough) {
416
- (interactiveRequest.tokenQueryParameters ??= {})["msal_request_type"] =
417
- "consumer_passthrough";
418
- }
419
- if (useDefaultBrokerAccount) {
420
- interactiveRequest.prompt = "none";
421
- msalLogger.verbose("Attempting broker authentication using the default broker account");
422
- }
423
- else {
424
- msalLogger.verbose("Attempting broker authentication without the default broker account");
425
- }
426
- if (options.proofOfPossessionOptions) {
427
- interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
428
- interactiveRequest.authenticationScheme = "pop";
429
- interactiveRequest.resourceRequestMethod =
430
- options.proofOfPossessionOptions.resourceRequestMethod;
431
- interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
432
- }
433
- try {
434
- return await app.acquireTokenInteractive(interactiveRequest);
435
- }
436
- catch (e) {
437
- msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
438
- if (options.disableAutomaticAuthentication) {
439
- throw new errors_js_1.AuthenticationRequiredError({
440
- scopes,
441
- getTokenOptions: options,
442
- message: "Cannot silently authenticate with default broker account.",
443
- });
444
- }
445
- // If we tried to use the default broker account and failed, fall back to interactive authentication
446
- if (useDefaultBrokerAccount) {
447
- return getBrokeredTokenInternal(scopes, false, options);
448
- }
449
- else {
450
- throw e;
451
- }
452
- }
340
+ const msalApp = await getConfidentialApp(options);
341
+ try {
342
+ const response = await msalApp.acquireTokenOnBehalfOf({
343
+ scopes,
344
+ authority: calculateRequestAuthority(options),
345
+ claims: options.claims,
346
+ oboAssertion: userAssertionToken
347
+ });
348
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
349
+ msalLogger.getToken.info((0, import_logging.formatSuccess)(scopes));
350
+ return {
351
+ token: response.accessToken,
352
+ expiresOnTimestamp: response.expiresOn.getTime(),
353
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
354
+ tokenType: response.tokenType
355
+ };
356
+ } catch (err) {
357
+ throw (0, import_utils.handleMsalError)(scopes, err, options);
453
358
  }
454
- /**
455
- * A helper function that supports brokered authentication through the MSAL's public application.
456
- *
457
- * When useDefaultBrokerAccount is true, the method will attempt to authenticate using the default broker account.
458
- * If the default broker account is not available, the method will fall back to interactive authentication.
459
- */
460
- async function getBrokeredToken(scopes, useDefaultBrokerAccount, options = {}) {
461
- msalLogger.getToken.info(`Attempting to acquire token using brokered authentication with useDefaultBrokerAccount: ${useDefaultBrokerAccount}`);
462
- const response = await getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options);
463
- (0, utils_js_1.ensureValidMsalToken)(scopes, response, options);
464
- state.cachedAccount = response?.account ?? null;
465
- state.logger.getToken.info((0, logging_js_1.formatSuccess)(scopes));
466
- return {
467
- token: response.accessToken,
468
- expiresOnTimestamp: response.expiresOn.getTime(),
469
- refreshAfterTimestamp: response.refreshOn?.getTime(),
470
- tokenType: response.tokenType,
471
- };
359
+ }
360
+ function createBaseInteractiveRequest(scopes, options) {
361
+ return {
362
+ openBrowser: async (url) => {
363
+ const open = await import("open");
364
+ await open.default(url, { newInstance: true });
365
+ },
366
+ scopes,
367
+ authority: calculateRequestAuthority(options),
368
+ claims: options?.claims,
369
+ loginHint: options?.loginHint,
370
+ errorTemplate: options?.browserCustomizationOptions?.errorMessage,
371
+ successTemplate: options?.browserCustomizationOptions?.successMessage,
372
+ prompt: options?.loginHint ? "login" : "select_account"
373
+ };
374
+ }
375
+ async function getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options = {}) {
376
+ msalLogger.verbose("Authentication will resume through the broker");
377
+ const app = await getPublicApp(options);
378
+ const interactiveRequest = createBaseInteractiveRequest(scopes, options);
379
+ if (state.pluginConfiguration.broker.parentWindowHandle) {
380
+ interactiveRequest.windowHandle = Buffer.from(
381
+ state.pluginConfiguration.broker.parentWindowHandle
382
+ );
383
+ } else {
384
+ msalLogger.warning(
385
+ "Parent window handle is not specified for the broker. This may cause unexpected behavior. Please provide the parentWindowHandle."
386
+ );
387
+ }
388
+ if (state.pluginConfiguration.broker.enableMsaPassthrough) {
389
+ (interactiveRequest.extraQueryParameters ??= {})["msal_request_type"] = "consumer_passthrough";
390
+ }
391
+ if (useDefaultBrokerAccount) {
392
+ interactiveRequest.prompt = "none";
393
+ msalLogger.verbose("Attempting broker authentication using the default broker account");
394
+ } else {
395
+ msalLogger.verbose("Attempting broker authentication without the default broker account");
472
396
  }
473
- async function getTokenByInteractiveRequest(scopes, options = {}) {
474
- msalLogger.getToken.info(`Attempting to acquire token interactively`);
475
- const app = await getPublicApp(options);
476
- return withSilentAuthentication(app, scopes, options, async () => {
477
- const interactiveRequest = createBaseInteractiveRequest(scopes, options);
478
- if (state.pluginConfiguration.broker.isEnabled) {
479
- return getBrokeredTokenInternal(scopes, state.pluginConfiguration.broker.useDefaultBrokerAccount ?? false, options);
480
- }
481
- if (options.proofOfPossessionOptions) {
482
- interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
483
- interactiveRequest.authenticationScheme = "pop";
484
- interactiveRequest.resourceRequestMethod =
485
- options.proofOfPossessionOptions.resourceRequestMethod;
486
- interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
487
- }
488
- return app.acquireTokenInteractive(interactiveRequest);
397
+ if (options.proofOfPossessionOptions) {
398
+ interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
399
+ interactiveRequest.authenticationScheme = "pop";
400
+ interactiveRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
401
+ interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
402
+ }
403
+ try {
404
+ return await app.acquireTokenInteractive(interactiveRequest);
405
+ } catch (e) {
406
+ msalLogger.verbose(`Failed to authenticate through the broker: ${e.message}`);
407
+ if (options.disableAutomaticAuthentication) {
408
+ throw new import_errors.AuthenticationRequiredError({
409
+ scopes,
410
+ getTokenOptions: options,
411
+ message: "Cannot silently authenticate with default broker account."
489
412
  });
413
+ }
414
+ if (useDefaultBrokerAccount) {
415
+ return getBrokeredTokenInternal(scopes, false, options);
416
+ } else {
417
+ throw e;
418
+ }
490
419
  }
420
+ }
421
+ async function getBrokeredToken(scopes, useDefaultBrokerAccount, options = {}) {
422
+ msalLogger.getToken.info(
423
+ `Attempting to acquire token using brokered authentication with useDefaultBrokerAccount: ${useDefaultBrokerAccount}`
424
+ );
425
+ const response = await getBrokeredTokenInternal(scopes, useDefaultBrokerAccount, options);
426
+ (0, import_utils.ensureValidMsalToken)(scopes, response, options);
427
+ state.cachedAccount = response?.account ?? null;
428
+ state.logger.getToken.info((0, import_logging.formatSuccess)(scopes));
491
429
  return {
492
- getActiveAccount,
493
- getBrokeredToken,
494
- getTokenByClientSecret,
495
- getTokenByClientAssertion,
496
- getTokenByClientCertificate,
497
- getTokenByDeviceCode,
498
- getTokenByUsernamePassword,
499
- getTokenByAuthorizationCode,
500
- getTokenOnBehalfOf,
501
- getTokenByInteractiveRequest,
430
+ token: response.accessToken,
431
+ expiresOnTimestamp: response.expiresOn.getTime(),
432
+ refreshAfterTimestamp: response.refreshOn?.getTime(),
433
+ tokenType: response.tokenType
502
434
  };
435
+ }
436
+ async function getTokenByInteractiveRequest(scopes, options = {}) {
437
+ msalLogger.getToken.info(`Attempting to acquire token interactively`);
438
+ const app = await getPublicApp(options);
439
+ return withSilentAuthentication(app, scopes, options, async () => {
440
+ const interactiveRequest = createBaseInteractiveRequest(scopes, options);
441
+ if (state.pluginConfiguration.broker.isEnabled) {
442
+ return getBrokeredTokenInternal(
443
+ scopes,
444
+ state.pluginConfiguration.broker.useDefaultBrokerAccount ?? false,
445
+ options
446
+ );
447
+ }
448
+ if (options.proofOfPossessionOptions) {
449
+ interactiveRequest.shrNonce = options.proofOfPossessionOptions.nonce;
450
+ interactiveRequest.authenticationScheme = "pop";
451
+ interactiveRequest.resourceRequestMethod = options.proofOfPossessionOptions.resourceRequestMethod;
452
+ interactiveRequest.resourceRequestUri = options.proofOfPossessionOptions.resourceRequestUrl;
453
+ }
454
+ return app.acquireTokenInteractive(interactiveRequest);
455
+ });
456
+ }
457
+ return {
458
+ getActiveAccount,
459
+ getBrokeredToken,
460
+ getTokenByClientSecret,
461
+ getTokenByClientAssertion,
462
+ getTokenByClientCertificate,
463
+ getTokenByDeviceCode,
464
+ getTokenByUsernamePassword,
465
+ getTokenByAuthorizationCode,
466
+ getTokenOnBehalfOf,
467
+ getTokenByInteractiveRequest
468
+ };
503
469
  }
504
- //# sourceMappingURL=msalClient.js.map
470
+ // Annotate the CommonJS export names for ESM import in node:
471
+ 0 && (module.exports = {
472
+ createMsalClient,
473
+ generateMsalConfiguration
474
+ });
475
+ //# sourceMappingURL=msalClient.js.map