@azure/msal-node 3.8.4 → 5.0.0-beta.0

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 (313) hide show
  1. package/README.md +2 -1
  2. package/dist/cache/CacheHelpers.d.ts.map +1 -1
  3. package/dist/cache/CacheHelpers.mjs +4 -5
  4. package/dist/cache/CacheHelpers.mjs.map +1 -1
  5. package/dist/cache/NodeStorage.d.ts.map +1 -1
  6. package/dist/cache/NodeStorage.mjs +17 -18
  7. package/dist/cache/NodeStorage.mjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts.map +1 -1
  9. package/dist/cache/TokenCache.mjs +15 -15
  10. package/dist/cache/TokenCache.mjs.map +1 -1
  11. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  12. package/dist/cache/distributed/DistributedCachePlugin.mjs +3 -3
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  14. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  15. package/dist/cache/serializer/Deserializer.mjs +3 -5
  16. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  17. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  18. package/dist/cache/serializer/Serializer.mjs +1 -3
  19. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  20. package/dist/cache/serializer/SerializerTypes.d.ts +0 -2
  21. package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
  22. package/dist/client/BaseClient.d.ts +42 -0
  23. package/dist/client/BaseClient.d.ts.map +1 -0
  24. package/dist/client/BaseClient.mjs +68 -0
  25. package/dist/client/BaseClient.mjs.map +1 -0
  26. package/dist/client/ClientApplication.d.ts.map +1 -1
  27. package/dist/client/ClientApplication.mjs +33 -43
  28. package/dist/client/ClientApplication.mjs.map +1 -1
  29. package/dist/client/ClientAssertion.d.ts.map +1 -1
  30. package/dist/client/ClientAssertion.mjs +6 -5
  31. package/dist/client/ClientAssertion.mjs.map +1 -1
  32. package/dist/client/ClientCredentialClient.d.ts +4 -2
  33. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  34. package/dist/client/ClientCredentialClient.mjs +23 -21
  35. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  36. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  37. package/dist/client/ConfidentialClientApplication.mjs +10 -9
  38. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  39. package/dist/client/DeviceCodeClient.d.ts +3 -1
  40. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  41. package/dist/client/DeviceCodeClient.mjs +21 -19
  42. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  43. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  44. package/dist/client/ManagedIdentityApplication.mjs +7 -6
  45. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  46. package/dist/client/ManagedIdentityClient.mjs +1 -1
  47. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  48. package/dist/client/ManagedIdentitySources/AppService.mjs +3 -3
  49. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  50. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  51. package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
  52. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  53. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  54. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +12 -11
  55. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  56. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  57. package/dist/client/ManagedIdentitySources/CloudShell.mjs +3 -3
  58. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  59. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  60. package/dist/client/ManagedIdentitySources/Imds.mjs +3 -3
  61. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  63. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +3 -3
  64. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  65. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  66. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +4 -4
  67. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  68. package/dist/client/OnBehalfOfClient.d.ts +3 -1
  69. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  70. package/dist/client/OnBehalfOfClient.mjs +19 -18
  71. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  72. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  73. package/dist/client/PublicClientApplication.mjs +15 -14
  74. package/dist/client/PublicClientApplication.mjs.map +1 -1
  75. package/dist/client/UsernamePasswordClient.d.ts +3 -1
  76. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  77. package/dist/client/UsernamePasswordClient.mjs +8 -7
  78. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  79. package/dist/config/Configuration.d.ts +2 -19
  80. package/dist/config/Configuration.d.ts.map +1 -1
  81. package/dist/config/Configuration.mjs +18 -25
  82. package/dist/config/Configuration.mjs.map +1 -1
  83. package/dist/config/ManagedIdentityId.mjs +1 -1
  84. package/dist/config/ManagedIdentityRequestParameters.mjs +3 -3
  85. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  86. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  87. package/dist/crypto/CryptoProvider.mjs +5 -3
  88. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  89. package/dist/crypto/GuidGenerator.mjs +1 -1
  90. package/dist/crypto/HashUtils.mjs +1 -1
  91. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  92. package/dist/crypto/PkceGenerator.mjs +6 -4
  93. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  94. package/dist/error/ClientAuthErrorCodes.d.ts +8 -0
  95. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -0
  96. package/dist/error/ClientAuthErrorCodes.mjs +16 -0
  97. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -0
  98. package/dist/error/ManagedIdentityError.mjs +1 -1
  99. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  100. package/dist/error/NodeAuthError.mjs +1 -1
  101. package/dist/index.d.ts +15 -11
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.mjs +20 -8
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/internals.mjs +1 -1
  106. package/dist/network/HttpClient.d.ts +53 -40
  107. package/dist/network/HttpClient.d.ts.map +1 -1
  108. package/dist/network/HttpClient.mjs +149 -315
  109. package/dist/network/HttpClient.mjs.map +1 -1
  110. package/dist/network/HttpClientWithRetries.mjs +3 -3
  111. package/dist/network/HttpClientWithRetries.mjs.map +1 -1
  112. package/dist/network/LoopbackClient.d.ts.map +1 -1
  113. package/dist/network/LoopbackClient.mjs +3 -3
  114. package/dist/network/LoopbackClient.mjs.map +1 -1
  115. package/dist/packageMetadata.d.ts +1 -1
  116. package/dist/packageMetadata.d.ts.map +1 -1
  117. package/dist/packageMetadata.mjs +2 -2
  118. package/dist/protocol/Authorize.d.ts.map +1 -1
  119. package/dist/protocol/Authorize.mjs +6 -6
  120. package/dist/protocol/Authorize.mjs.map +1 -1
  121. package/dist/request/AuthorizationCodeRequest.d.ts +3 -2
  122. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  123. package/dist/request/AuthorizationUrlRequest.d.ts +3 -3
  124. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  125. package/dist/request/ClientCredentialRequest.d.ts +4 -4
  126. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  127. package/dist/request/CommonClientCredentialRequest.d.ts +17 -0
  128. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
  129. package/dist/request/CommonDeviceCodeRequest.d.ts +21 -0
  130. package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  131. package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -0
  132. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  133. package/dist/request/CommonUsernamePasswordRequest.d.ts +19 -0
  134. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  135. package/dist/request/DeviceCodeRequest.d.ts +3 -2
  136. package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
  137. package/dist/request/InteractiveRequest.d.ts +1 -1
  138. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  139. package/dist/request/ManagedIdentityRequest.d.ts +1 -1
  140. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
  141. package/dist/request/OnBehalfOfRequest.d.ts +2 -3
  142. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
  143. package/dist/request/RefreshTokenRequest.d.ts +3 -2
  144. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  145. package/dist/request/SilentFlowRequest.d.ts +3 -2
  146. package/dist/request/SilentFlowRequest.d.ts.map +1 -1
  147. package/dist/request/UsernamePasswordRequest.d.ts +4 -3
  148. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
  149. package/dist/response/ManagedIdentityTokenResponse.d.ts +2 -2
  150. package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  151. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  152. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  153. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +9 -9
  154. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  155. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  156. package/dist/retry/IHttpRetryPolicy.d.ts +1 -1
  157. package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -1
  158. package/dist/retry/ImdsRetryPolicy.d.ts +1 -1
  159. package/dist/retry/ImdsRetryPolicy.d.ts.map +1 -1
  160. package/dist/retry/ImdsRetryPolicy.mjs +11 -11
  161. package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
  162. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  163. package/dist/utils/Constants.d.ts +2 -9
  164. package/dist/utils/Constants.d.ts.map +1 -1
  165. package/dist/utils/Constants.mjs +4 -12
  166. package/dist/utils/Constants.mjs.map +1 -1
  167. package/dist/utils/EncodingUtils.d.ts.map +1 -1
  168. package/dist/utils/EncodingUtils.mjs +5 -5
  169. package/dist/utils/EncodingUtils.mjs.map +1 -1
  170. package/dist/utils/TimeUtils.mjs +1 -1
  171. package/lib/msal-node.cjs +5378 -6289
  172. package/lib/msal-node.cjs.map +1 -1
  173. package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
  174. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  175. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  176. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  177. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  178. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  179. package/lib/types/cache/serializer/SerializerTypes.d.ts +0 -2
  180. package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  181. package/lib/types/client/BaseClient.d.ts +42 -0
  182. package/lib/types/client/BaseClient.d.ts.map +1 -0
  183. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  184. package/lib/types/client/ClientAssertion.d.ts.map +1 -1
  185. package/lib/types/client/ClientCredentialClient.d.ts +4 -2
  186. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  187. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  188. package/lib/types/client/DeviceCodeClient.d.ts +3 -1
  189. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  190. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  191. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  192. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  193. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  194. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  195. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  196. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  197. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  198. package/lib/types/client/OnBehalfOfClient.d.ts +3 -1
  199. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  200. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  201. package/lib/types/client/UsernamePasswordClient.d.ts +3 -1
  202. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  203. package/lib/types/config/Configuration.d.ts +2 -19
  204. package/lib/types/config/Configuration.d.ts.map +1 -1
  205. package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
  206. package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
  207. package/lib/types/error/ClientAuthErrorCodes.d.ts +8 -0
  208. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
  209. package/lib/types/index.d.ts +15 -11
  210. package/lib/types/index.d.ts.map +1 -1
  211. package/lib/types/network/HttpClient.d.ts +53 -40
  212. package/lib/types/network/HttpClient.d.ts.map +1 -1
  213. package/lib/types/network/LoopbackClient.d.ts.map +1 -1
  214. package/lib/types/packageMetadata.d.ts +1 -1
  215. package/lib/types/packageMetadata.d.ts.map +1 -1
  216. package/lib/types/protocol/Authorize.d.ts.map +1 -1
  217. package/lib/types/request/AuthorizationCodeRequest.d.ts +3 -2
  218. package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
  219. package/lib/types/request/AuthorizationUrlRequest.d.ts +3 -3
  220. package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
  221. package/lib/types/request/ClientCredentialRequest.d.ts +4 -4
  222. package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
  223. package/lib/types/request/CommonClientCredentialRequest.d.ts +17 -0
  224. package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
  225. package/lib/types/request/CommonDeviceCodeRequest.d.ts +21 -0
  226. package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  227. package/lib/types/request/CommonOnBehalfOfRequest.d.ts +13 -0
  228. package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  229. package/lib/types/request/CommonUsernamePasswordRequest.d.ts +19 -0
  230. package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  231. package/lib/types/request/DeviceCodeRequest.d.ts +3 -2
  232. package/lib/types/request/DeviceCodeRequest.d.ts.map +1 -1
  233. package/lib/types/request/InteractiveRequest.d.ts +1 -1
  234. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  235. package/lib/types/request/ManagedIdentityRequest.d.ts +1 -1
  236. package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
  237. package/lib/types/request/OnBehalfOfRequest.d.ts +2 -3
  238. package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
  239. package/lib/types/request/RefreshTokenRequest.d.ts +3 -2
  240. package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
  241. package/lib/types/request/SilentFlowRequest.d.ts +3 -2
  242. package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
  243. package/lib/types/request/UsernamePasswordRequest.d.ts +4 -3
  244. package/lib/types/request/UsernamePasswordRequest.d.ts.map +1 -1
  245. package/lib/types/response/ManagedIdentityTokenResponse.d.ts +2 -2
  246. package/lib/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  247. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  248. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  249. package/lib/types/retry/IHttpRetryPolicy.d.ts +1 -1
  250. package/lib/types/retry/IHttpRetryPolicy.d.ts.map +1 -1
  251. package/lib/types/retry/ImdsRetryPolicy.d.ts +1 -1
  252. package/lib/types/retry/ImdsRetryPolicy.d.ts.map +1 -1
  253. package/lib/types/utils/Constants.d.ts +2 -9
  254. package/lib/types/utils/Constants.d.ts.map +1 -1
  255. package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
  256. package/package.json +4 -6
  257. package/src/cache/CacheHelpers.ts +3 -5
  258. package/src/cache/NodeStorage.ts +19 -16
  259. package/src/cache/TokenCache.ts +18 -14
  260. package/src/cache/distributed/DistributedCachePlugin.ts +2 -1
  261. package/src/cache/serializer/Deserializer.ts +7 -9
  262. package/src/cache/serializer/Serializer.ts +0 -2
  263. package/src/cache/serializer/SerializerTypes.ts +0 -2
  264. package/src/client/BaseClient.ts +158 -0
  265. package/src/client/ClientApplication.ts +50 -57
  266. package/src/client/ClientAssertion.ts +5 -6
  267. package/src/client/ClientCredentialClient.ts +32 -25
  268. package/src/client/ConfidentialClientApplication.ts +13 -13
  269. package/src/client/DeviceCodeClient.ts +33 -21
  270. package/src/client/ManagedIdentityApplication.ts +10 -7
  271. package/src/client/ManagedIdentitySources/AppService.ts +4 -2
  272. package/src/client/ManagedIdentitySources/AzureArc.ts +14 -8
  273. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +18 -9
  274. package/src/client/ManagedIdentitySources/CloudShell.ts +4 -2
  275. package/src/client/ManagedIdentitySources/Imds.ts +4 -2
  276. package/src/client/ManagedIdentitySources/MachineLearning.ts +4 -2
  277. package/src/client/ManagedIdentitySources/ServiceFabric.ts +6 -3
  278. package/src/client/OnBehalfOfClient.ts +27 -21
  279. package/src/client/PublicClientApplication.ts +16 -16
  280. package/src/client/UsernamePasswordClient.ts +14 -8
  281. package/src/config/Configuration.ts +19 -48
  282. package/src/config/ManagedIdentityRequestParameters.ts +2 -2
  283. package/src/crypto/CryptoProvider.ts +5 -3
  284. package/src/crypto/PkceGenerator.ts +6 -4
  285. package/src/error/ClientAuthErrorCodes.ts +12 -0
  286. package/src/index.ts +5 -19
  287. package/src/network/HttpClient.ts +168 -457
  288. package/src/network/HttpClientWithRetries.ts +2 -2
  289. package/src/network/LoopbackClient.ts +2 -3
  290. package/src/packageMetadata.ts +1 -1
  291. package/src/protocol/Authorize.ts +8 -10
  292. package/src/request/AuthorizationCodeRequest.ts +2 -2
  293. package/src/request/AuthorizationUrlRequest.ts +2 -3
  294. package/src/request/ClientCredentialRequest.ts +3 -7
  295. package/src/request/CommonClientCredentialRequest.ts +29 -0
  296. package/src/request/CommonDeviceCodeRequest.ts +30 -0
  297. package/src/request/CommonOnBehalfOfRequest.ts +21 -0
  298. package/src/request/CommonUsernamePasswordRequest.ts +24 -0
  299. package/src/request/DeviceCodeRequest.ts +2 -5
  300. package/src/request/InteractiveRequest.ts +1 -4
  301. package/src/request/ManagedIdentityRequest.ts +1 -1
  302. package/src/request/OnBehalfOfRequest.ts +1 -3
  303. package/src/request/RefreshTokenRequest.ts +2 -2
  304. package/src/request/SilentFlowRequest.ts +3 -5
  305. package/src/request/UsernamePasswordRequest.ts +3 -3
  306. package/src/response/ManagedIdentityTokenResponse.ts +2 -2
  307. package/src/retry/DefaultManagedIdentityRetryPolicy.ts +9 -8
  308. package/src/retry/IHttpRetryPolicy.ts +1 -1
  309. package/src/retry/ImdsRetryPolicy.ts +11 -10
  310. package/src/utils/Constants.ts +2 -11
  311. package/src/utils/EncodingUtils.ts +8 -4
  312. package/dist/utils/NetworkUtils.mjs +0 -43
  313. package/dist/utils/NetworkUtils.mjs.map +0 -1
@@ -10,11 +10,7 @@ import {
10
10
  } from "../utils/Constants.js";
11
11
  import {
12
12
  AuthenticationResult,
13
- CommonDeviceCodeRequest,
14
13
  AuthError,
15
- ResponseMode,
16
- OIDC_DEFAULT_SCOPES,
17
- CodeChallengeMethodValues,
18
14
  Constants as CommonConstants,
19
15
  ServerError,
20
16
  NativeRequest,
@@ -29,6 +25,7 @@ import { Configuration } from "../config/Configuration.js";
29
25
  import { ClientApplication } from "./ClientApplication.js";
30
26
  import { IPublicClientApplication } from "./IPublicClientApplication.js";
31
27
  import { DeviceCodeRequest } from "../request/DeviceCodeRequest.js";
28
+ import { CommonDeviceCodeRequest } from "../request/CommonDeviceCodeRequest.js";
32
29
  import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
33
30
  import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
34
31
  import { InteractiveRequest } from "../request/InteractiveRequest.js";
@@ -78,7 +75,8 @@ export class PublicClientApplication
78
75
  );
79
76
  } else {
80
77
  this.logger.warning(
81
- "NativeBroker implementation was provided but the broker is unavailable."
78
+ "NativeBroker implementation was provided but the broker is unavailable.",
79
+ ""
82
80
  );
83
81
  }
84
82
  }
@@ -102,7 +100,7 @@ export class PublicClientApplication
102
100
  ): Promise<AuthenticationResult | null> {
103
101
  this.logger.info(
104
102
  "acquireTokenByDeviceCode called",
105
- request.correlationId
103
+ request.correlationId || ""
106
104
  );
107
105
  const validRequest: CommonDeviceCodeRequest = Object.assign(
108
106
  request,
@@ -162,13 +160,13 @@ export class PublicClientApplication
162
160
  const brokerRequest: NativeRequest = {
163
161
  ...remainingProperties,
164
162
  clientId: this.config.auth.clientId,
165
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
163
+ scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
166
164
  redirectUri: request.redirectUri || "",
167
165
  authority: request.authority || this.config.auth.authority,
168
166
  correlationId: correlationId,
169
167
  extraParameters: {
170
168
  ...remainingProperties.extraQueryParameters,
171
- ...remainingProperties.tokenQueryParameters,
169
+ ...remainingProperties.extraParameters,
172
170
  [AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
173
171
  },
174
172
  accountId: remainingProperties.account?.nativeAccountId,
@@ -180,7 +178,7 @@ export class PublicClientApplication
180
178
  }
181
179
 
182
180
  if (request.redirectUri) {
183
- // If its not a broker fallback scenario, we throw a error
181
+ // If it's not a broker fallback scenario, we throw an error
184
182
  if (!this.config.broker.nativeBrokerPlugin) {
185
183
  throw NodeAuthError.createRedirectUriNotSupportedError();
186
184
  }
@@ -213,11 +211,12 @@ export class PublicClientApplication
213
211
  const validRequest: AuthorizationUrlRequest = {
214
212
  ...remainingProperties,
215
213
  correlationId: correlationId,
216
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
214
+ scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
217
215
  redirectUri: redirectUri,
218
- responseMode: ResponseMode.QUERY,
216
+ responseMode: CommonConstants.ResponseMode.QUERY,
219
217
  codeChallenge: challenge,
220
- codeChallengeMethod: CodeChallengeMethodValues.S256,
218
+ codeChallengeMethod:
219
+ CommonConstants.CodeChallengeMethodValues.S256,
221
220
  };
222
221
 
223
222
  const authCodeUrl = await this.getAuthCodeUrl(validRequest);
@@ -241,7 +240,7 @@ export class PublicClientApplication
241
240
  const tokenRequest: AuthorizationCodeRequest = {
242
241
  code: authCodeResponse.code,
243
242
  codeVerifier: verifier,
244
- clientInfo: clientInfo || CommonConstants.EMPTY_STRING,
243
+ clientInfo: clientInfo || "",
245
244
  ...validRequest,
246
245
  };
247
246
  return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
@@ -266,12 +265,13 @@ export class PublicClientApplication
266
265
  const brokerRequest: NativeRequest = {
267
266
  ...request,
268
267
  clientId: this.config.auth.clientId,
269
- scopes: request.scopes || OIDC_DEFAULT_SCOPES,
268
+ scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
270
269
  redirectUri: request.redirectUri || "",
271
270
  authority: request.authority || this.config.auth.authority,
272
271
  correlationId: correlationId,
273
272
  extraParameters: {
274
- ...request.tokenQueryParameters,
273
+ ...request.extraQueryParameters,
274
+ ...request.extraParameters,
275
275
  [AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
276
276
  },
277
277
  accountId: request.account.nativeAccountId,
@@ -281,7 +281,7 @@ export class PublicClientApplication
281
281
  }
282
282
 
283
283
  if (request.redirectUri) {
284
- // If its not a broker fallback scenario, we throw a error
284
+ // If it's not a broker fallback scenario, we throw an error
285
285
  if (!this.config.broker.nativeBrokerPlugin) {
286
286
  throw NodeAuthError.createRedirectUriNotSupportedError();
287
287
  }
@@ -6,14 +6,11 @@
6
6
  import {
7
7
  AuthenticationResult,
8
8
  Authority,
9
- BaseClient,
10
9
  CcsCredentialType,
11
10
  ClientAssertion,
12
11
  ClientConfiguration,
13
- CommonUsernamePasswordRequest,
14
- GrantType,
15
12
  NetworkResponse,
16
- OAuthResponseType,
13
+ Constants,
17
14
  RequestParameterBuilder,
18
15
  RequestThumbprint,
19
16
  ResponseHandler,
@@ -24,6 +21,8 @@ import {
24
21
  UrlUtils,
25
22
  getClientAssertion,
26
23
  } from "@azure/msal-common/node";
24
+ import { CommonUsernamePasswordRequest } from "../request/CommonUsernamePasswordRequest.js";
25
+ import { BaseClient } from "./BaseClient.js";
27
26
 
28
27
  /**
29
28
  * Oauth2.0 Password grant client
@@ -44,7 +43,10 @@ export class UsernamePasswordClient extends BaseClient {
44
43
  async acquireToken(
45
44
  request: CommonUsernamePasswordRequest
46
45
  ): Promise<AuthenticationResult | null> {
47
- this.logger.info("in acquireToken call in username-password client");
46
+ this.logger.info(
47
+ "in acquireToken call in username-password client",
48
+ request.correlationId
49
+ );
48
50
 
49
51
  const reqTimestamp = TimeUtils.nowSeconds();
50
52
  const response = await this.executeTokenRequest(
@@ -57,12 +59,16 @@ export class UsernamePasswordClient extends BaseClient {
57
59
  this.cacheManager,
58
60
  this.cryptoUtils,
59
61
  this.logger,
62
+ this.performanceClient,
60
63
  this.config.serializableCache,
61
64
  this.config.persistencePlugin
62
65
  );
63
66
 
64
67
  // Validate response. This function throws a server error if an error is returned by the server.
65
- responseHandler.validateTokenResponse(response.body);
68
+ responseHandler.validateTokenResponse(
69
+ response.body,
70
+ request.correlationId
71
+ );
66
72
  const tokenResponse = responseHandler.handleServerTokenResponse(
67
73
  response.body,
68
74
  this.authority,
@@ -133,12 +139,12 @@ export class UsernamePasswordClient extends BaseClient {
133
139
 
134
140
  RequestParameterBuilder.addResponseType(
135
141
  parameters,
136
- OAuthResponseType.IDTOKEN_TOKEN
142
+ Constants.OAuthResponseType.IDTOKEN_TOKEN
137
143
  );
138
144
 
139
145
  RequestParameterBuilder.addGrantType(
140
146
  parameters,
141
- GrantType.RESOURCE_OWNER_PASSWORD_GRANT
147
+ Constants.GrantType.RESOURCE_OWNER_PASSWORD_GRANT
142
148
  );
143
149
  RequestParameterBuilder.addClientInfo(parameters);
144
150
 
@@ -9,16 +9,14 @@ import {
9
9
  LogLevel,
10
10
  ProtocolMode,
11
11
  ICachePlugin,
12
- Constants,
13
12
  AzureCloudInstance,
14
13
  AzureCloudOptions,
15
14
  ApplicationTelemetry,
16
15
  INativeBrokerPlugin,
17
16
  ClientAssertionCallback,
17
+ Constants,
18
18
  } from "@azure/msal-common/node";
19
19
  import { HttpClient } from "../network/HttpClient.js";
20
- import http from "http";
21
- import https from "https";
22
20
  import { ManagedIdentityId } from "./ManagedIdentityId.js";
23
21
  import { NodeAuthError } from "../error/NodeAuthError.js";
24
22
 
@@ -29,9 +27,6 @@ import { NodeAuthError } from "../error/NodeAuthError.js";
29
27
  * - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
30
28
  * - clientAssertion - A ClientAssertion object containing an assertion string or a callback function that returns an assertion string that the application uses when requesting a token, as well as the assertion's type (urn:ietf:params:oauth:client-assertion-type:jwt-bearer). Only used in confidential client applications.
31
29
  * - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 or SHA-256 thumbprint of the certificate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
32
- * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
33
- * - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
34
- * - encodeExtraQueryParams - A flag to choose whether to encode extra query parameters in the request URL. Defaults to false.
35
30
  * @public
36
31
  */
37
32
  export type NodeAuthOptions = {
@@ -53,13 +48,7 @@ export type NodeAuthOptions = {
53
48
  cloudDiscoveryMetadata?: string;
54
49
  authorityMetadata?: string;
55
50
  clientCapabilities?: Array<string>;
56
- protocolMode?: ProtocolMode;
57
51
  azureCloudOptions?: AzureCloudOptions;
58
- skipAuthorityMetadataCache?: boolean;
59
- /**
60
- * @deprecated This flag is deprecated and will be removed in the next major version where all extra query params will be encoded by default.
61
- */
62
- encodeExtraQueryParams?: boolean;
63
52
  };
64
53
 
65
54
  /**
@@ -70,10 +59,6 @@ export type NodeAuthOptions = {
70
59
  */
71
60
  export type CacheOptions = {
72
61
  cachePlugin?: ICachePlugin;
73
- /**
74
- * @deprecated claims-based-caching functionality will be removed in the next version of MSALJS
75
- */
76
- claimsBasedCachingEnabled?: boolean;
77
62
  };
78
63
 
79
64
  /**
@@ -92,14 +77,14 @@ export type BrokerOptions = {
92
77
  *
93
78
  * - logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
94
79
  * - networkClient - Http client used for all http get and post calls. Defaults to using MSAL's default http client.
80
+ * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
95
81
  * @public
96
82
  */
97
83
  export type NodeSystemOptions = {
98
84
  loggerOptions?: LoggerOptions;
99
85
  networkClient?: INetworkModule;
100
- proxyUrl?: string;
101
- customAgentOptions?: http.AgentOptions | https.AgentOptions;
102
86
  disableInternalRetries?: boolean;
87
+ protocolMode?: ProtocolMode;
103
88
  };
104
89
 
105
90
  /** @public */
@@ -140,31 +125,24 @@ export type ManagedIdentityConfiguration = {
140
125
  };
141
126
 
142
127
  const DEFAULT_AUTH_OPTIONS: Required<NodeAuthOptions> = {
143
- clientId: Constants.EMPTY_STRING,
128
+ clientId: "",
144
129
  authority: Constants.DEFAULT_AUTHORITY,
145
- clientSecret: Constants.EMPTY_STRING,
146
- clientAssertion: Constants.EMPTY_STRING,
130
+ clientSecret: "",
131
+ clientAssertion: "",
147
132
  clientCertificate: {
148
- thumbprint: Constants.EMPTY_STRING,
149
- thumbprintSha256: Constants.EMPTY_STRING,
150
- privateKey: Constants.EMPTY_STRING,
151
- x5c: Constants.EMPTY_STRING,
133
+ thumbprint: "",
134
+ thumbprintSha256: "",
135
+ privateKey: "",
136
+ x5c: "",
152
137
  },
153
138
  knownAuthorities: [],
154
- cloudDiscoveryMetadata: Constants.EMPTY_STRING,
155
- authorityMetadata: Constants.EMPTY_STRING,
139
+ cloudDiscoveryMetadata: "",
140
+ authorityMetadata: "",
156
141
  clientCapabilities: [],
157
- protocolMode: ProtocolMode.AAD,
158
142
  azureCloudOptions: {
159
143
  azureCloudInstance: AzureCloudInstance.None,
160
- tenant: Constants.EMPTY_STRING,
144
+ tenant: "",
161
145
  },
162
- skipAuthorityMetadataCache: false,
163
- encodeExtraQueryParams: false,
164
- };
165
-
166
- const DEFAULT_CACHE_OPTIONS: CacheOptions = {
167
- claimsBasedCachingEnabled: false,
168
146
  };
169
147
 
170
148
  const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {
@@ -178,15 +156,14 @@ const DEFAULT_LOGGER_OPTIONS: LoggerOptions = {
178
156
  const DEFAULT_SYSTEM_OPTIONS: Required<NodeSystemOptions> = {
179
157
  loggerOptions: DEFAULT_LOGGER_OPTIONS,
180
158
  networkClient: new HttpClient(),
181
- proxyUrl: Constants.EMPTY_STRING,
182
- customAgentOptions: {} as http.AgentOptions | https.AgentOptions,
183
159
  disableInternalRetries: false,
160
+ protocolMode: ProtocolMode.AAD,
184
161
  };
185
162
 
186
163
  const DEFAULT_TELEMETRY_OPTIONS: Required<NodeTelemetryOptions> = {
187
164
  application: {
188
- appName: Constants.EMPTY_STRING,
189
- appVersion: Constants.EMPTY_STRING,
165
+ appName: "",
166
+ appVersion: "",
190
167
  },
191
168
  };
192
169
 
@@ -219,10 +196,7 @@ export function buildAppConfiguration({
219
196
  }: Configuration): NodeConfiguration {
220
197
  const systemOptions: Required<NodeSystemOptions> = {
221
198
  ...DEFAULT_SYSTEM_OPTIONS,
222
- networkClient: new HttpClient(
223
- system?.proxyUrl,
224
- system?.customAgentOptions as http.AgentOptions | https.AgentOptions
225
- ),
199
+ networkClient: new HttpClient(),
226
200
  loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
227
201
  disableInternalRetries: system?.disableInternalRetries || false,
228
202
  };
@@ -239,7 +213,7 @@ export function buildAppConfiguration({
239
213
  return {
240
214
  auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
241
215
  broker: { ...broker },
242
- cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
216
+ cache: { ...cache },
243
217
  system: { ...systemOptions, ...system },
244
218
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
245
219
  };
@@ -273,10 +247,7 @@ export function buildManagedIdentityConfiguration({
273
247
  networkClient = system.networkClient;
274
248
  // otherwise, create a new one
275
249
  } else {
276
- networkClient = new HttpClient(
277
- system?.proxyUrl,
278
- system?.customAgentOptions as http.AgentOptions | https.AgentOptions
279
- );
250
+ networkClient = new HttpClient();
280
251
  }
281
252
 
282
253
  return {
@@ -38,7 +38,7 @@ export class ManagedIdentityRequestParameters {
38
38
  const parameters = new Map<string, string>();
39
39
 
40
40
  if (this.queryParameters) {
41
- RequestParameterBuilder.addExtraQueryParameters(
41
+ RequestParameterBuilder.addExtraParameters(
42
42
  parameters,
43
43
  this.queryParameters
44
44
  );
@@ -56,7 +56,7 @@ export class ManagedIdentityRequestParameters {
56
56
  const parameters = new Map<string, string>();
57
57
 
58
58
  if (this.bodyParameters) {
59
- RequestParameterBuilder.addExtraQueryParameters(
59
+ RequestParameterBuilder.addExtraParameters(
60
60
  parameters,
61
61
  this.bodyParameters
62
62
  );
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { EncodingTypes, ICrypto, PkceCodes } from "@azure/msal-common/node";
6
+ import { Constants, ICrypto, PkceCodes } from "@azure/msal-common/node";
7
7
  import { GuidGenerator } from "./GuidGenerator.js";
8
8
  import { EncodingUtils } from "../utils/EncodingUtils.js";
9
9
  import { PkceGenerator } from "./PkceGenerator.js";
@@ -106,8 +106,10 @@ export class CryptoProvider implements ICrypto {
106
106
  */
107
107
  async hashString(plainText: string): Promise<string> {
108
108
  return EncodingUtils.base64EncodeUrl(
109
- this.hashUtils.sha256(plainText).toString(EncodingTypes.BASE64),
110
- EncodingTypes.BASE64
109
+ this.hashUtils
110
+ .sha256(plainText)
111
+ .toString(Constants.EncodingTypes.BASE64),
112
+ Constants.EncodingTypes.BASE64
111
113
  );
112
114
  }
113
115
  }
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { Constants, EncodingTypes, PkceCodes } from "@azure/msal-common/node";
6
+ import { PkceCodes, Constants } from "@azure/msal-common/node";
7
7
  import { CharSet, RANDOM_OCTET_SIZE } from "../utils/Constants.js";
8
8
  import { EncodingUtils } from "../utils/EncodingUtils.js";
9
9
  import { HashUtils } from "./HashUtils.js";
@@ -46,7 +46,7 @@ export class PkceGenerator {
46
46
  const index = byte % CharSet.CV_CHARSET.length;
47
47
  charArr.push(CharSet.CV_CHARSET[index]);
48
48
  }
49
- const verifier: string = charArr.join(Constants.EMPTY_STRING);
49
+ const verifier: string = charArr.join("");
50
50
  return EncodingUtils.base64EncodeUrl(verifier);
51
51
  }
52
52
 
@@ -56,8 +56,10 @@ export class PkceGenerator {
56
56
  */
57
57
  private generateCodeChallengeFromVerifier(codeVerifier: string): string {
58
58
  return EncodingUtils.base64EncodeUrl(
59
- this.hashUtils.sha256(codeVerifier).toString(EncodingTypes.BASE64),
60
- EncodingTypes.BASE64
59
+ this.hashUtils
60
+ .sha256(codeVerifier)
61
+ .toString(Constants.EncodingTypes.BASE64),
62
+ Constants.EncodingTypes.BASE64
61
63
  );
62
64
  }
63
65
  }
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export const missingTenantIdError = "missing_tenant_id_error";
7
+ export const userTimeoutReached = "user_timeout_reached";
8
+ export const invalidAssertion = "invalid_assertion";
9
+ export const invalidClientCredential = "invalid_client_credential";
10
+ export const deviceCodePollingCancelled = "device_code_polling_cancelled";
11
+ export const deviceCodeExpired = "device_code_expired";
12
+ export const deviceCodeUnknownError = "device_code_unknown_error";
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  * Breaking changes to these APIs will be shipped under a minor version, instead of a major version.
14
14
  */
15
15
  import * as internals from "./internals.js";
16
+ import { Constants as CommonConstants } from "@azure/msal-common/node";
16
17
  export { internals };
17
18
 
18
19
  // Interfaces
@@ -26,12 +27,7 @@ export { ILoopbackClient } from "./network/ILoopbackClient.js";
26
27
  // Clients and Configuration
27
28
  export { PublicClientApplication } from "./client/PublicClientApplication.js";
28
29
  export { ConfidentialClientApplication } from "./client/ConfidentialClientApplication.js";
29
- export { ClientApplication } from "./client/ClientApplication.js";
30
- export { ClientCredentialClient } from "./client/ClientCredentialClient.js";
31
- export { DeviceCodeClient } from "./client/DeviceCodeClient.js";
32
- export { OnBehalfOfClient } from "./client/OnBehalfOfClient.js";
33
30
  export { ManagedIdentityApplication } from "./client/ManagedIdentityApplication.js";
34
- export { UsernamePasswordClient } from "./client/UsernamePasswordClient.js";
35
31
 
36
32
  export {
37
33
  Configuration,
@@ -62,9 +58,6 @@ export { DistributedCachePlugin } from "./cache/distributed/DistributedCachePlug
62
58
  // Constants
63
59
  export { ManagedIdentitySourceNames } from "./utils/Constants.js";
64
60
 
65
- // Crypto
66
- export { CryptoProvider } from "./crypto/CryptoProvider.js";
67
-
68
61
  // Request objects
69
62
  export type { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest.js";
70
63
  export type { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest.js";
@@ -78,36 +71,29 @@ export type { InteractiveRequest } from "./request/InteractiveRequest.js";
78
71
  export type { SignOutRequest } from "./request/SignOutRequest.js";
79
72
  export type { ManagedIdentityRequestParams } from "./request/ManagedIdentityRequestParams.js";
80
73
 
74
+ const PromptValue = CommonConstants.PromptValue;
75
+ const ResponseMode = CommonConstants.ResponseMode;
76
+ export { PromptValue, ResponseMode };
77
+
81
78
  // Common Object Formats
82
79
  export {
83
- // Request
84
- PromptValue,
85
- ResponseMode,
86
80
  AuthorizationCodePayload,
87
81
  // Response
88
82
  AuthenticationResult,
89
83
  AuthorizeResponse,
90
- /**
91
- * @deprecated Use AuthorizeResponse instead
92
- */
93
- AuthorizeResponse as ServerAuthorizationCodeResponse,
94
84
  IdTokenClaims,
95
85
  // Cache
96
86
  AccountInfo,
97
87
  ValidCacheType,
98
88
  // Error
99
89
  AuthError,
100
- AuthErrorMessage,
101
90
  AuthErrorCodes,
102
91
  ClientAuthError,
103
92
  ClientAuthErrorCodes,
104
- ClientAuthErrorMessage,
105
93
  ClientConfigurationError,
106
94
  ClientConfigurationErrorCodes,
107
- ClientConfigurationErrorMessage,
108
95
  InteractionRequiredAuthError,
109
96
  InteractionRequiredAuthErrorCodes,
110
- InteractionRequiredAuthErrorMessage,
111
97
  ServerError,
112
98
  // Network Interface
113
99
  INetworkModule,