@azure/msal-node 3.8.0 → 5.0.0-alpha.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 (316) 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/ClientApplication.d.ts.map +1 -1
  23. package/dist/client/ClientApplication.mjs +33 -43
  24. package/dist/client/ClientApplication.mjs.map +1 -1
  25. package/dist/client/ClientAssertion.d.ts.map +1 -1
  26. package/dist/client/ClientAssertion.mjs +6 -5
  27. package/dist/client/ClientAssertion.mjs.map +1 -1
  28. package/dist/client/ClientCredentialClient.d.ts +3 -2
  29. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  30. package/dist/client/ClientCredentialClient.mjs +23 -22
  31. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  32. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  33. package/dist/client/ConfidentialClientApplication.mjs +10 -9
  34. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  35. package/dist/client/DeviceCodeClient.d.ts +2 -1
  36. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  37. package/dist/client/DeviceCodeClient.mjs +19 -18
  38. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  39. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  40. package/dist/client/ManagedIdentityApplication.mjs +7 -6
  41. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  42. package/dist/client/ManagedIdentityClient.mjs +1 -1
  43. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  44. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  45. package/dist/client/ManagedIdentitySources/AppService.mjs +3 -3
  46. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  47. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  48. package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
  49. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  50. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  51. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +12 -11
  52. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  53. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  54. package/dist/client/ManagedIdentitySources/CloudShell.mjs +3 -3
  55. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  56. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  57. package/dist/client/ManagedIdentitySources/Imds.mjs +3 -3
  58. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  59. package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  60. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +3 -3
  61. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  63. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +4 -4
  64. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  65. package/dist/client/OnBehalfOfClient.d.ts +2 -1
  66. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  67. package/dist/client/OnBehalfOfClient.mjs +19 -19
  68. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  69. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  70. package/dist/client/PublicClientApplication.mjs +12 -27
  71. package/dist/client/PublicClientApplication.mjs.map +1 -1
  72. package/dist/client/UsernamePasswordClient.d.ts +2 -1
  73. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  74. package/dist/client/UsernamePasswordClient.mjs +8 -8
  75. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  76. package/dist/config/Configuration.d.ts +2 -13
  77. package/dist/config/Configuration.d.ts.map +1 -1
  78. package/dist/config/Configuration.mjs +17 -22
  79. package/dist/config/Configuration.mjs.map +1 -1
  80. package/dist/config/ManagedIdentityId.mjs +1 -1
  81. package/dist/config/ManagedIdentityId.mjs.map +1 -1
  82. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  83. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  84. package/dist/crypto/CryptoProvider.d.ts.map +1 -1
  85. package/dist/crypto/CryptoProvider.mjs +5 -3
  86. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  87. package/dist/crypto/GuidGenerator.mjs +1 -1
  88. package/dist/crypto/GuidGenerator.mjs.map +1 -1
  89. package/dist/crypto/HashUtils.mjs +1 -1
  90. package/dist/crypto/HashUtils.mjs.map +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/ManagedIdentityError.mjs.map +1 -1
  100. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  101. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
  102. package/dist/error/NodeAuthError.d.ts +0 -8
  103. package/dist/error/NodeAuthError.d.ts.map +1 -1
  104. package/dist/error/NodeAuthError.mjs +1 -11
  105. package/dist/error/NodeAuthError.mjs.map +1 -1
  106. package/dist/index.d.ts +15 -5
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.mjs +20 -2
  109. package/dist/index.mjs.map +1 -1
  110. package/dist/internals.mjs +1 -1
  111. package/dist/network/HttpClient.d.ts.map +1 -1
  112. package/dist/network/HttpClient.mjs +15 -13
  113. package/dist/network/HttpClient.mjs.map +1 -1
  114. package/dist/network/HttpClientWithRetries.mjs +3 -3
  115. package/dist/network/HttpClientWithRetries.mjs.map +1 -1
  116. package/dist/network/LoopbackClient.d.ts.map +1 -1
  117. package/dist/network/LoopbackClient.mjs +3 -3
  118. package/dist/network/LoopbackClient.mjs.map +1 -1
  119. package/dist/packageMetadata.d.ts +1 -1
  120. package/dist/packageMetadata.d.ts.map +1 -1
  121. package/dist/packageMetadata.mjs +2 -2
  122. package/dist/protocol/Authorize.d.ts.map +1 -1
  123. package/dist/protocol/Authorize.mjs +5 -5
  124. package/dist/protocol/Authorize.mjs.map +1 -1
  125. package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
  126. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  127. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  128. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  129. package/dist/request/ClientCredentialRequest.d.ts +4 -3
  130. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  131. package/dist/request/CommonClientCredentialRequest.d.ts +16 -0
  132. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
  133. package/dist/request/CommonDeviceCodeRequest.d.ts +20 -0
  134. package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  135. package/dist/request/CommonOnBehalfOfRequest.d.ts +14 -0
  136. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  137. package/dist/request/CommonUsernamePasswordRequest.d.ts +18 -0
  138. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  139. package/dist/request/DeviceCodeRequest.d.ts +3 -2
  140. package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
  141. package/dist/request/InteractiveRequest.d.ts +1 -1
  142. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  143. package/dist/request/ManagedIdentityRequest.d.ts +1 -1
  144. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
  145. package/dist/request/OnBehalfOfRequest.d.ts +2 -2
  146. package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
  147. package/dist/request/RefreshTokenRequest.d.ts +1 -1
  148. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  149. package/dist/request/SilentFlowRequest.d.ts +1 -1
  150. package/dist/request/SilentFlowRequest.d.ts.map +1 -1
  151. package/dist/request/UsernamePasswordRequest.d.ts +2 -2
  152. package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
  153. package/dist/response/ManagedIdentityTokenResponse.d.ts +2 -2
  154. package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  155. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  156. package/dist/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  157. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +9 -9
  158. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  159. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  160. package/dist/retry/ExponentialRetryStrategy.mjs.map +1 -1
  161. package/dist/retry/IHttpRetryPolicy.d.ts +1 -1
  162. package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -1
  163. package/dist/retry/ImdsRetryPolicy.d.ts +1 -1
  164. package/dist/retry/ImdsRetryPolicy.d.ts.map +1 -1
  165. package/dist/retry/ImdsRetryPolicy.mjs +11 -11
  166. package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
  167. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  168. package/dist/retry/LinearRetryStrategy.mjs.map +1 -1
  169. package/dist/utils/Constants.d.ts +4 -4
  170. package/dist/utils/Constants.mjs +5 -5
  171. package/dist/utils/Constants.mjs.map +1 -1
  172. package/dist/utils/EncodingUtils.d.ts.map +1 -1
  173. package/dist/utils/EncodingUtils.mjs +5 -5
  174. package/dist/utils/EncodingUtils.mjs.map +1 -1
  175. package/dist/utils/NetworkUtils.mjs +1 -1
  176. package/dist/utils/NetworkUtils.mjs.map +1 -1
  177. package/dist/utils/TimeUtils.mjs +1 -1
  178. package/dist/utils/TimeUtils.mjs.map +1 -1
  179. package/lib/msal-node.cjs +1396 -2249
  180. package/lib/msal-node.cjs.map +1 -1
  181. package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
  182. package/lib/types/cache/NodeStorage.d.ts.map +1 -1
  183. package/lib/types/cache/TokenCache.d.ts.map +1 -1
  184. package/lib/types/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  185. package/lib/types/cache/serializer/Deserializer.d.ts.map +1 -1
  186. package/lib/types/cache/serializer/Serializer.d.ts.map +1 -1
  187. package/lib/types/cache/serializer/SerializerTypes.d.ts +0 -2
  188. package/lib/types/cache/serializer/SerializerTypes.d.ts.map +1 -1
  189. package/lib/types/client/ClientApplication.d.ts.map +1 -1
  190. package/lib/types/client/ClientAssertion.d.ts.map +1 -1
  191. package/lib/types/client/ClientCredentialClient.d.ts +3 -2
  192. package/lib/types/client/ClientCredentialClient.d.ts.map +1 -1
  193. package/lib/types/client/ConfidentialClientApplication.d.ts.map +1 -1
  194. package/lib/types/client/DeviceCodeClient.d.ts +2 -1
  195. package/lib/types/client/DeviceCodeClient.d.ts.map +1 -1
  196. package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
  197. package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  198. package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  199. package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  200. package/lib/types/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  201. package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  202. package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
  203. package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  204. package/lib/types/client/OnBehalfOfClient.d.ts +2 -1
  205. package/lib/types/client/OnBehalfOfClient.d.ts.map +1 -1
  206. package/lib/types/client/PublicClientApplication.d.ts.map +1 -1
  207. package/lib/types/client/UsernamePasswordClient.d.ts +2 -1
  208. package/lib/types/client/UsernamePasswordClient.d.ts.map +1 -1
  209. package/lib/types/config/Configuration.d.ts +2 -13
  210. package/lib/types/config/Configuration.d.ts.map +1 -1
  211. package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
  212. package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
  213. package/lib/types/error/ClientAuthErrorCodes.d.ts +8 -0
  214. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -0
  215. package/lib/types/error/NodeAuthError.d.ts +0 -8
  216. package/lib/types/error/NodeAuthError.d.ts.map +1 -1
  217. package/lib/types/index.d.ts +15 -5
  218. package/lib/types/index.d.ts.map +1 -1
  219. package/lib/types/network/HttpClient.d.ts.map +1 -1
  220. package/lib/types/network/LoopbackClient.d.ts.map +1 -1
  221. package/lib/types/packageMetadata.d.ts +1 -1
  222. package/lib/types/packageMetadata.d.ts.map +1 -1
  223. package/lib/types/protocol/Authorize.d.ts.map +1 -1
  224. package/lib/types/request/AuthorizationCodeRequest.d.ts +1 -1
  225. package/lib/types/request/AuthorizationCodeRequest.d.ts.map +1 -1
  226. package/lib/types/request/AuthorizationUrlRequest.d.ts +1 -1
  227. package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
  228. package/lib/types/request/ClientCredentialRequest.d.ts +4 -3
  229. package/lib/types/request/ClientCredentialRequest.d.ts.map +1 -1
  230. package/lib/types/request/CommonClientCredentialRequest.d.ts +16 -0
  231. package/lib/types/request/CommonClientCredentialRequest.d.ts.map +1 -0
  232. package/lib/types/request/CommonDeviceCodeRequest.d.ts +20 -0
  233. package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  234. package/lib/types/request/CommonOnBehalfOfRequest.d.ts +14 -0
  235. package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  236. package/lib/types/request/CommonUsernamePasswordRequest.d.ts +18 -0
  237. package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  238. package/lib/types/request/DeviceCodeRequest.d.ts +3 -2
  239. package/lib/types/request/DeviceCodeRequest.d.ts.map +1 -1
  240. package/lib/types/request/InteractiveRequest.d.ts +1 -1
  241. package/lib/types/request/InteractiveRequest.d.ts.map +1 -1
  242. package/lib/types/request/ManagedIdentityRequest.d.ts +1 -1
  243. package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
  244. package/lib/types/request/OnBehalfOfRequest.d.ts +2 -2
  245. package/lib/types/request/OnBehalfOfRequest.d.ts.map +1 -1
  246. package/lib/types/request/RefreshTokenRequest.d.ts +1 -1
  247. package/lib/types/request/RefreshTokenRequest.d.ts.map +1 -1
  248. package/lib/types/request/SilentFlowRequest.d.ts +1 -1
  249. package/lib/types/request/SilentFlowRequest.d.ts.map +1 -1
  250. package/lib/types/request/UsernamePasswordRequest.d.ts +2 -2
  251. package/lib/types/request/UsernamePasswordRequest.d.ts.map +1 -1
  252. package/lib/types/response/ManagedIdentityTokenResponse.d.ts +2 -2
  253. package/lib/types/response/ManagedIdentityTokenResponse.d.ts.map +1 -1
  254. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts +1 -1
  255. package/lib/types/retry/DefaultManagedIdentityRetryPolicy.d.ts.map +1 -1
  256. package/lib/types/retry/IHttpRetryPolicy.d.ts +1 -1
  257. package/lib/types/retry/IHttpRetryPolicy.d.ts.map +1 -1
  258. package/lib/types/retry/ImdsRetryPolicy.d.ts +1 -1
  259. package/lib/types/retry/ImdsRetryPolicy.d.ts.map +1 -1
  260. package/lib/types/utils/Constants.d.ts +4 -4
  261. package/lib/types/utils/EncodingUtils.d.ts.map +1 -1
  262. package/package.json +88 -90
  263. package/src/cache/CacheHelpers.ts +3 -5
  264. package/src/cache/NodeStorage.ts +21 -16
  265. package/src/cache/TokenCache.ts +18 -14
  266. package/src/cache/distributed/DistributedCachePlugin.ts +2 -1
  267. package/src/cache/serializer/Deserializer.ts +7 -9
  268. package/src/cache/serializer/Serializer.ts +0 -2
  269. package/src/cache/serializer/SerializerTypes.ts +0 -2
  270. package/src/client/ClientApplication.ts +50 -57
  271. package/src/client/ClientAssertion.ts +5 -6
  272. package/src/client/ClientCredentialClient.ts +33 -25
  273. package/src/client/ConfidentialClientApplication.ts +13 -13
  274. package/src/client/DeviceCodeClient.ts +32 -19
  275. package/src/client/ManagedIdentityApplication.ts +10 -7
  276. package/src/client/ManagedIdentitySources/AppService.ts +4 -2
  277. package/src/client/ManagedIdentitySources/AzureArc.ts +14 -8
  278. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +18 -9
  279. package/src/client/ManagedIdentitySources/CloudShell.ts +4 -2
  280. package/src/client/ManagedIdentitySources/Imds.ts +4 -2
  281. package/src/client/ManagedIdentitySources/MachineLearning.ts +4 -2
  282. package/src/client/ManagedIdentitySources/ServiceFabric.ts +6 -3
  283. package/src/client/OnBehalfOfClient.ts +28 -21
  284. package/src/client/PublicClientApplication.ts +13 -31
  285. package/src/client/UsernamePasswordClient.ts +15 -8
  286. package/src/config/Configuration.ts +18 -35
  287. package/src/crypto/CryptoProvider.ts +5 -3
  288. package/src/crypto/PkceGenerator.ts +6 -4
  289. package/src/error/ClientAuthErrorCodes.ts +12 -0
  290. package/src/error/NodeAuthError.ts +0 -14
  291. package/src/index.ts +5 -11
  292. package/src/network/HttpClient.ts +11 -9
  293. package/src/network/HttpClientWithRetries.ts +2 -2
  294. package/src/network/LoopbackClient.ts +2 -3
  295. package/src/packageMetadata.ts +1 -1
  296. package/src/protocol/Authorize.ts +7 -9
  297. package/src/request/AuthorizationCodeRequest.ts +0 -1
  298. package/src/request/AuthorizationUrlRequest.ts +0 -1
  299. package/src/request/ClientCredentialRequest.ts +3 -6
  300. package/src/request/CommonClientCredentialRequest.ts +25 -0
  301. package/src/request/CommonDeviceCodeRequest.ts +33 -0
  302. package/src/request/CommonOnBehalfOfRequest.ts +19 -0
  303. package/src/request/CommonUsernamePasswordRequest.ts +23 -0
  304. package/src/request/DeviceCodeRequest.ts +2 -5
  305. package/src/request/InteractiveRequest.ts +1 -1
  306. package/src/request/ManagedIdentityRequest.ts +1 -1
  307. package/src/request/OnBehalfOfRequest.ts +1 -2
  308. package/src/request/RefreshTokenRequest.ts +0 -1
  309. package/src/request/SilentFlowRequest.ts +1 -4
  310. package/src/request/UsernamePasswordRequest.ts +1 -2
  311. package/src/response/ManagedIdentityTokenResponse.ts +2 -2
  312. package/src/retry/DefaultManagedIdentityRetryPolicy.ts +9 -8
  313. package/src/retry/IHttpRetryPolicy.ts +1 -1
  314. package/src/retry/ImdsRetryPolicy.ts +11 -10
  315. package/src/utils/Constants.ts +5 -5
  316. package/src/utils/EncodingUtils.ts +8 -4
@@ -20,8 +20,10 @@ import {
20
20
  ValidCredentialType,
21
21
  StaticAuthorityOptions,
22
22
  CacheHelpers,
23
+ AccountEntityUtils,
23
24
  CredentialEntity,
24
25
  AccountInfo,
26
+ StubPerformanceClient,
25
27
  } from "@azure/msal-common/node";
26
28
 
27
29
  import { Deserializer } from "./serializer/Deserializer.js";
@@ -31,7 +33,6 @@ import {
31
33
  JsonCache,
32
34
  CacheKVStore,
33
35
  } from "./serializer/SerializerTypes.js";
34
- import { StubPerformanceClient } from "@azure/msal-common";
35
36
  import { generateAccountKey, generateCredentialKey } from "./CacheHelpers.js";
36
37
 
37
38
  /**
@@ -93,7 +94,7 @@ export class NodeStorage extends CacheManager {
93
94
  if (typeof value !== "object") {
94
95
  continue;
95
96
  }
96
- if (value instanceof AccountEntity) {
97
+ if (AccountEntityUtils.isAccountEntity(value)) {
97
98
  inMemoryCache.accounts[key] = value as AccountEntity;
98
99
  } else if (CacheHelpers.isIdTokenEntity(value)) {
99
100
  inMemoryCache.idTokens[key] = value as IdTokenEntity;
@@ -136,7 +137,7 @@ export class NodeStorage extends CacheManager {
136
137
  * gets the current in memory cache for the client
137
138
  */
138
139
  getInMemoryCache(): InMemoryCache {
139
- this.logger.trace("Getting in-memory cache");
140
+ this.logger.trace("Getting in-memory cache", "");
140
141
 
141
142
  // convert the cache key value store to inMemoryCache
142
143
  const inMemoryCache = this.cacheToInMemoryCache(this.getCache());
@@ -148,7 +149,7 @@ export class NodeStorage extends CacheManager {
148
149
  * @param inMemoryCache - key value map in memory
149
150
  */
150
151
  setInMemoryCache(inMemoryCache: InMemoryCache): void {
151
- this.logger.trace("Setting in-memory cache");
152
+ this.logger.trace("Setting in-memory cache", "");
152
153
 
153
154
  // convert and append the inMemoryCache to cacheKVStore
154
155
  const cache = this.inMemoryCacheToCache(inMemoryCache);
@@ -161,7 +162,7 @@ export class NodeStorage extends CacheManager {
161
162
  * get the current cache key-value store
162
163
  */
163
164
  getCache(): CacheKVStore {
164
- this.logger.trace("Getting cache key-value store");
165
+ this.logger.trace("Getting cache key-value store", "");
165
166
  return this.cache;
166
167
  }
167
168
 
@@ -170,7 +171,7 @@ export class NodeStorage extends CacheManager {
170
171
  * @param cacheMap - key value map
171
172
  */
172
173
  setCache(cache: CacheKVStore): void {
173
- this.logger.trace("Setting cache key value store");
174
+ this.logger.trace("Setting cache key value store", "");
174
175
  this.cache = cache;
175
176
 
176
177
  // mark change in cache
@@ -182,7 +183,7 @@ export class NodeStorage extends CacheManager {
182
183
  * @param key - lookup key for the cache entry
183
184
  */
184
185
  getItem(key: string): ValidCacheType {
185
- this.logger.tracePii(`Item key: ${key}`);
186
+ this.logger.tracePii(`Item key: ${key}`, "");
186
187
 
187
188
  // read cache
188
189
  const cache = this.getCache();
@@ -195,7 +196,7 @@ export class NodeStorage extends CacheManager {
195
196
  * @param value - value of the cache entry
196
197
  */
197
198
  setItem(key: string, value: ValidCacheType): void {
198
- this.logger.tracePii(`Item key: ${key}`);
199
+ this.logger.tracePii(`Item key: ${key}`, "");
199
200
 
200
201
  // read cache
201
202
  const cache = this.getCache();
@@ -238,8 +239,8 @@ export class NodeStorage extends CacheManager {
238
239
  */
239
240
  getAccount(accountKey: string): AccountEntity | null {
240
241
  const cachedAccount = this.getItem(accountKey);
241
- return cachedAccount
242
- ? Object.assign(new AccountEntity(), this.getItem(accountKey))
242
+ return cachedAccount && typeof cachedAccount === "object"
243
+ ? ({ ...cachedAccount } as AccountEntity)
243
244
  : null;
244
245
  }
245
246
 
@@ -248,7 +249,9 @@ export class NodeStorage extends CacheManager {
248
249
  * @param account - cache value to be set of type AccountEntity
249
250
  */
250
251
  async setAccount(account: AccountEntity): Promise<void> {
251
- const accountKey = this.generateAccountKey(account.getAccountInfo());
252
+ const accountKey = this.generateAccountKey(
253
+ AccountEntityUtils.getAccountInfo(account)
254
+ );
252
255
  this.setItem(accountKey, account);
253
256
  }
254
257
 
@@ -450,7 +453,7 @@ export class NodeStorage extends CacheManager {
450
453
  * @param inMemory - key value map of the cache
451
454
  */
452
455
  removeItem(key: string): boolean {
453
- this.logger.tracePii(`Item key: ${key}`);
456
+ this.logger.tracePii(`Item key: ${key}`, "");
454
457
 
455
458
  // read inMemoryCache
456
459
  let result: boolean = false;
@@ -489,7 +492,7 @@ export class NodeStorage extends CacheManager {
489
492
  * Gets all keys in window.
490
493
  */
491
494
  getKeys(): string[] {
492
- this.logger.trace("Retrieving all cache keys");
495
+ this.logger.trace("Retrieving all cache keys", "");
493
496
 
494
497
  // read cache
495
498
  const cache = this.getCache();
@@ -500,7 +503,7 @@ export class NodeStorage extends CacheManager {
500
503
  * Clears all cache entries created by MSAL (except tokens).
501
504
  */
502
505
  clear(): void {
503
- this.logger.trace("Clearing cache entries created by MSAL");
506
+ this.logger.trace("Clearing cache entries created by MSAL", "");
504
507
 
505
508
  // read inMemoryCache
506
509
  const cacheKeys = this.getKeys();
@@ -545,12 +548,14 @@ export class NodeStorage extends CacheManager {
545
548
  this.removeItem(currentCacheKey);
546
549
  this.setItem(updatedCacheKey, cacheItem);
547
550
  this.logger.verbose(
548
- `Updated an outdated ${credential.credentialType} cache key`
551
+ `Updated an outdated ${credential.credentialType} cache key`,
552
+ ""
549
553
  );
550
554
  return updatedCacheKey;
551
555
  } else {
552
556
  this.logger.error(
553
- `Attempted to update an outdated ${credential.credentialType} cache key but no item matching the outdated key was found in storage`
557
+ `Attempted to update an outdated ${credential.credentialType} cache key but no item matching the outdated key was found in storage`,
558
+ ""
554
559
  );
555
560
  }
556
561
  }
@@ -24,8 +24,8 @@ import {
24
24
  import { Deserializer } from "./serializer/Deserializer.js";
25
25
  import { Serializer } from "./serializer/Serializer.js";
26
26
  import { ITokenCache } from "./ITokenCache.js";
27
- import { CryptoProvider } from "../crypto/CryptoProvider.js";
28
27
  import { GuidGenerator } from "../crypto/GuidGenerator.js";
28
+ import { CryptoProvider } from "../crypto/CryptoProvider.js";
29
29
 
30
30
  const defaultSerializedCache: JsonCache = {
31
31
  Account: {},
@@ -71,20 +71,20 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
71
71
  * Serializes in memory cache to JSON
72
72
  */
73
73
  serialize(): string {
74
- this.logger.trace("Serializing in-memory cache");
74
+ this.logger.trace("Serializing in-memory cache", "");
75
75
  let finalState = Serializer.serializeAllCache(
76
76
  this.storage.getInMemoryCache() as InMemoryCache
77
77
  );
78
78
 
79
79
  // if cacheSnapshot not null or empty, merge
80
80
  if (this.cacheSnapshot) {
81
- this.logger.trace("Reading cache snapshot from disk");
81
+ this.logger.trace("Reading cache snapshot from disk", "");
82
82
  finalState = this.mergeState(
83
83
  JSON.parse(this.cacheSnapshot),
84
84
  finalState
85
85
  );
86
86
  } else {
87
- this.logger.trace("No cache snapshot to merge");
87
+ this.logger.trace("No cache snapshot to merge", "");
88
88
  }
89
89
  this.cacheHasChanged = false;
90
90
 
@@ -96,17 +96,17 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
96
96
  * @param cache - blob formatted cache
97
97
  */
98
98
  deserialize(cache: string): void {
99
- this.logger.trace("Deserializing JSON to in-memory cache");
99
+ this.logger.trace("Deserializing JSON to in-memory cache", "");
100
100
  this.cacheSnapshot = cache;
101
101
 
102
102
  if (this.cacheSnapshot) {
103
- this.logger.trace("Reading cache snapshot from disk");
103
+ this.logger.trace("Reading cache snapshot from disk", "");
104
104
  const deserializedCache = Deserializer.deserializeAllCache(
105
105
  this.overlayDefaults(JSON.parse(this.cacheSnapshot))
106
106
  );
107
107
  this.storage.setInMemoryCache(deserializedCache);
108
108
  } else {
109
- this.logger.trace("No cache snapshot to deserialize");
109
+ this.logger.trace("No cache snapshot to deserialize", "");
110
110
  }
111
111
  }
112
112
 
@@ -133,7 +133,7 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
133
133
  async getAllAccounts(
134
134
  correlationId: string = new CryptoProvider().createNewGuid()
135
135
  ): Promise<AccountInfo[]> {
136
- this.logger.trace("getAllAccounts called");
136
+ this.logger.trace("getAllAccounts called", correlationId);
137
137
  let cacheContext;
138
138
  try {
139
139
  if (this.persistence) {
@@ -198,7 +198,7 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
198
198
  account: AccountInfo,
199
199
  correlationId?: string
200
200
  ): Promise<void> {
201
- this.logger.trace("removeAccount called");
201
+ this.logger.trace("removeAccount called", correlationId || "");
202
202
  let cacheContext;
203
203
  try {
204
204
  if (this.persistence) {
@@ -222,11 +222,15 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
222
222
  async overwriteCache(): Promise<void> {
223
223
  if (!this.persistence) {
224
224
  this.logger.info(
225
- "No persistence layer specified, cache cannot be overwritten"
225
+ "No persistence layer specified, cache cannot be overwritten",
226
+ ""
226
227
  );
227
228
  return;
228
229
  }
229
- this.logger.info("Overwriting in-memory cache with persistent cache");
230
+ this.logger.info(
231
+ "Overwriting in-memory cache with persistent cache",
232
+ ""
233
+ );
230
234
  this.storage.clear();
231
235
  const cacheContext = new TokenCacheContext(this, false);
232
236
  await this.persistence.beforeCacheAccess(cacheContext);
@@ -251,7 +255,7 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
251
255
  oldState: JsonCache,
252
256
  currentState: JsonCache
253
257
  ): JsonCache {
254
- this.logger.trace("Merging in-memory cache with cache snapshot");
258
+ this.logger.trace("Merging in-memory cache with cache snapshot", "");
255
259
  const stateAfterRemoval = this.mergeRemovals(oldState, currentState);
256
260
  return this.mergeUpdates(stateAfterRemoval, currentState);
257
261
  }
@@ -302,7 +306,7 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
302
306
  * @param newState - updated cache
303
307
  */
304
308
  private mergeRemovals(oldState: JsonCache, newState: JsonCache): JsonCache {
305
- this.logger.trace("Remove updated entries in cache");
309
+ this.logger.trace("Remove updated entries in cache", "");
306
310
  const accounts = oldState.Account
307
311
  ? this.mergeRemovalsDict<SerializedAccountEntity>(
308
312
  oldState.Account,
@@ -367,7 +371,7 @@ export class TokenCache implements ISerializableTokenCache, ITokenCache {
367
371
  * @param passedInCache - cache read from the blob
368
372
  */
369
373
  private overlayDefaults(passedInCache: JsonCache): JsonCache {
370
- this.logger.trace("Overlaying input cache with the default cache");
374
+ this.logger.trace("Overlaying input cache with the default cache", "");
371
375
  return {
372
376
  Account: {
373
377
  ...defaultSerializedCache.Account,
@@ -6,6 +6,7 @@
6
6
  import {
7
7
  AccountEntity,
8
8
  ICachePlugin,
9
+ AccountEntityUtils,
9
10
  TokenCacheContext,
10
11
  } from "@azure/msal-common/node";
11
12
  import { TokenCache } from "../TokenCache.js";
@@ -49,7 +50,7 @@ export class DistributedCachePlugin implements ICachePlugin {
49
50
  cacheContext.tokenCache as TokenCache
50
51
  ).getKVStore();
51
52
  const accountEntities = Object.values(kvStore).filter((value) =>
52
- AccountEntity.isAccountEntity(value as object)
53
+ AccountEntityUtils.isAccountEntity(value as object)
53
54
  );
54
55
 
55
56
  let partitionKey: string;
@@ -14,8 +14,7 @@ import {
14
14
  AccessTokenEntity,
15
15
  RefreshTokenEntity,
16
16
  CacheManager,
17
- CredentialType,
18
- AuthenticationScheme,
17
+ Constants,
19
18
  } from "@azure/msal-common/node";
20
19
  import {
21
20
  JsonCache,
@@ -70,7 +69,7 @@ export class Deserializer {
70
69
  ),
71
70
  lastUpdatedAt: Date.now().toString(),
72
71
  };
73
- const account: AccountEntity = new AccountEntity();
72
+ const account: AccountEntity = {} as AccountEntity;
74
73
  CacheManager.toObject(account, mappedAcc);
75
74
  accountObjects[key] = account;
76
75
  });
@@ -94,7 +93,7 @@ export class Deserializer {
94
93
  homeAccountId: serializedIdT.home_account_id,
95
94
  environment: serializedIdT.environment,
96
95
  credentialType:
97
- serializedIdT.credential_type as CredentialType,
96
+ serializedIdT.credential_type as Constants.CredentialType,
98
97
  clientId: serializedIdT.client_id,
99
98
  secret: serializedIdT.secret,
100
99
  realm: serializedIdT.realm,
@@ -121,7 +120,7 @@ export class Deserializer {
121
120
  homeAccountId: serializedAT.home_account_id,
122
121
  environment: serializedAT.environment,
123
122
  credentialType:
124
- serializedAT.credential_type as CredentialType,
123
+ serializedAT.credential_type as Constants.CredentialType,
125
124
  clientId: serializedAT.client_id,
126
125
  secret: serializedAT.secret,
127
126
  realm: serializedAT.realm,
@@ -131,9 +130,8 @@ export class Deserializer {
131
130
  extendedExpiresOn: serializedAT.extended_expires_on,
132
131
  refreshOn: serializedAT.refresh_on,
133
132
  keyId: serializedAT.key_id,
134
- tokenType: serializedAT.token_type as AuthenticationScheme,
135
- requestedClaims: serializedAT.requestedClaims,
136
- requestedClaimsHash: serializedAT.requestedClaimsHash,
133
+ tokenType:
134
+ serializedAT.token_type as Constants.AuthenticationScheme,
137
135
  userAssertionHash: serializedAT.userAssertionHash,
138
136
  lastUpdatedAt: Date.now().toString(),
139
137
  };
@@ -159,7 +157,7 @@ export class Deserializer {
159
157
  homeAccountId: serializedRT.home_account_id,
160
158
  environment: serializedRT.environment,
161
159
  credentialType:
162
- serializedRT.credential_type as CredentialType,
160
+ serializedRT.credential_type as Constants.CredentialType,
163
161
  clientId: serializedRT.client_id,
164
162
  secret: serializedRT.secret,
165
163
  familyId: serializedRT.family_id,
@@ -112,8 +112,6 @@ export class Serializer {
112
112
  refresh_on: atEntity.refreshOn,
113
113
  key_id: atEntity.keyId,
114
114
  token_type: atEntity.tokenType,
115
- requestedClaims: atEntity.requestedClaims,
116
- requestedClaimsHash: atEntity.requestedClaimsHash,
117
115
  userAssertionHash: atEntity.userAssertionHash,
118
116
  };
119
117
  });
@@ -91,8 +91,6 @@ export type SerializedAccessTokenEntity = {
91
91
  refresh_on?: string;
92
92
  key_id?: string;
93
93
  token_type?: string;
94
- requestedClaims?: string;
95
- requestedClaimsHash?: string;
96
94
  userAssertionHash?: string;
97
95
  };
98
96
 
@@ -19,25 +19,20 @@ import {
19
19
  CommonRefreshTokenRequest,
20
20
  CommonAuthorizationCodeRequest,
21
21
  CommonAuthorizationUrlRequest,
22
- CommonUsernamePasswordRequest,
23
- AuthenticationScheme,
24
- ResponseMode,
25
22
  AuthorityOptions,
26
- OIDC_DEFAULT_SCOPES,
27
23
  AzureRegionConfiguration,
28
24
  AuthError,
29
25
  AzureCloudOptions,
30
26
  AuthorizationCodePayload,
31
- Constants,
32
- StringUtils,
33
27
  createClientAuthError,
34
28
  ClientAuthErrorCodes,
35
29
  buildStaticAuthorityOptions,
36
30
  ClientAssertion as ClientAssertionType,
37
31
  getClientAssertion,
38
32
  ClientAssertionCallback,
39
- CacheOutcome,
33
+ Constants,
40
34
  ClientAuthError,
35
+ StubPerformanceClient,
41
36
  } from "@azure/msal-common/node";
42
37
  import {
43
38
  Configuration,
@@ -55,6 +50,7 @@ import { RefreshTokenRequest } from "../request/RefreshTokenRequest.js";
55
50
  import { SilentFlowRequest } from "../request/SilentFlowRequest.js";
56
51
  import { version, name } from "../packageMetadata.js";
57
52
  import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest.js";
53
+ import { CommonUsernamePasswordRequest } from "../request/CommonUsernamePasswordRequest.js";
58
54
  import { NodeAuthError } from "../error/NodeAuthError.js";
59
55
  import { UsernamePasswordClient } from "./UsernamePasswordClient.js";
60
56
  import { getAuthCodeRequestUrl } from "../protocol/Authorize.js";
@@ -125,12 +121,12 @@ export abstract class ClientApplication {
125
121
  * `acquireTokenByCode(AuthorizationCodeRequest)`.
126
122
  */
127
123
  async getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string> {
128
- this.logger.info("getAuthCodeUrl called", request.correlationId);
124
+ this.logger.info("getAuthCodeUrl called", request.correlationId || "");
129
125
  const validRequest: CommonAuthorizationUrlRequest = {
130
126
  ...request,
131
127
  ...(await this.initializeBaseRequest(request)),
132
- responseMode: request.responseMode || ResponseMode.QUERY,
133
- authenticationScheme: AuthenticationScheme.BEARER,
128
+ responseMode: request.responseMode || Constants.ResponseMode.QUERY,
129
+ authenticationScheme: Constants.AuthenticationScheme.BEARER,
134
130
  state: request.state || "",
135
131
  nonce: request.nonce || "",
136
132
  };
@@ -161,9 +157,15 @@ export abstract class ClientApplication {
161
157
  request: AuthorizationCodeRequest,
162
158
  authCodePayLoad?: AuthorizationCodePayload
163
159
  ): Promise<AuthenticationResult> {
164
- this.logger.info("acquireTokenByCode called");
160
+ this.logger.info(
161
+ "acquireTokenByCode called",
162
+ request.correlationId || ""
163
+ );
165
164
  if (request.state && authCodePayLoad) {
166
- this.logger.info("acquireTokenByCode - validating state");
165
+ this.logger.info(
166
+ "acquireTokenByCode - validating state",
167
+ request.correlationId || ""
168
+ );
167
169
  this.validateState(request.state, authCodePayLoad.state || "");
168
170
  // eslint-disable-next-line no-param-reassign
169
171
  authCodePayLoad = { ...authCodePayLoad, state: "" };
@@ -171,7 +173,7 @@ export abstract class ClientApplication {
171
173
  const validRequest: CommonAuthorizationCodeRequest = {
172
174
  ...request,
173
175
  ...(await this.initializeBaseRequest(request)),
174
- authenticationScheme: AuthenticationScheme.BEARER,
176
+ authenticationScheme: Constants.AuthenticationScheme.BEARER,
175
177
  };
176
178
 
177
179
  const serverTelemetryManager = this.initializeServerTelemetryManager(
@@ -192,7 +194,8 @@ export abstract class ClientApplication {
192
194
  serverTelemetryManager
193
195
  );
194
196
  const authorizationCodeClient = new AuthorizationCodeClient(
195
- authClientConfig
197
+ authClientConfig,
198
+ new StubPerformanceClient()
196
199
  );
197
200
  this.logger.verbose(
198
201
  "Auth code client created",
@@ -223,12 +226,12 @@ export abstract class ClientApplication {
223
226
  ): Promise<AuthenticationResult | null> {
224
227
  this.logger.info(
225
228
  "acquireTokenByRefreshToken called",
226
- request.correlationId
229
+ request.correlationId || ""
227
230
  );
228
231
  const validRequest: CommonRefreshTokenRequest = {
229
232
  ...request,
230
233
  ...(await this.initializeBaseRequest(request)),
231
- authenticationScheme: AuthenticationScheme.BEARER,
234
+ authenticationScheme: Constants.AuthenticationScheme.BEARER,
232
235
  };
233
236
 
234
237
  const serverTelemetryManager = this.initializeServerTelemetryManager(
@@ -250,7 +253,8 @@ export abstract class ClientApplication {
250
253
  serverTelemetryManager
251
254
  );
252
255
  const refreshTokenClient = new RefreshTokenClient(
253
- refreshTokenClientConfig
256
+ refreshTokenClientConfig,
257
+ new StubPerformanceClient()
254
258
  );
255
259
  this.logger.verbose(
256
260
  "Refresh token client created",
@@ -303,7 +307,10 @@ export abstract class ClientApplication {
303
307
  validRequest.redirectUri || "",
304
308
  serverTelemetryManager
305
309
  );
306
- const silentFlowClient = new SilentFlowClient(clientConfiguration);
310
+ const silentFlowClient = new SilentFlowClient(
311
+ clientConfiguration,
312
+ new StubPerformanceClient()
313
+ );
307
314
  this.logger.verbose(
308
315
  "Silent flow client created",
309
316
  validRequest.correlationId
@@ -323,7 +330,8 @@ export abstract class ClientApplication {
323
330
  ClientAuthErrorCodes.tokenRefreshRequired
324
331
  ) {
325
332
  const refreshTokenClient = new RefreshTokenClient(
326
- clientConfiguration
333
+ clientConfiguration,
334
+ new StubPerformanceClient()
327
335
  );
328
336
  return refreshTokenClient.acquireTokenByRefreshToken(
329
337
  validRequest
@@ -350,16 +358,18 @@ export abstract class ClientApplication {
350
358
  ...validRequest,
351
359
  scopes: validRequest.scopes?.length
352
360
  ? validRequest.scopes
353
- : [...OIDC_DEFAULT_SCOPES],
361
+ : [...Constants.OIDC_DEFAULT_SCOPES],
354
362
  });
355
363
 
356
- if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
364
+ if (cacheOutcome === Constants.CacheOutcome.PROACTIVELY_REFRESHED) {
357
365
  this.logger.info(
358
- "ClientApplication:acquireCachedTokenSilent - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
366
+ "ClientApplication:acquireCachedTokenSilent - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.",
367
+ validRequest.correlationId
359
368
  );
360
369
  // refresh the access token in the background
361
370
  const refreshTokenClient = new RefreshTokenClient(
362
- clientConfiguration
371
+ clientConfiguration,
372
+ new StubPerformanceClient()
363
373
  );
364
374
 
365
375
  try {
@@ -391,7 +401,7 @@ export abstract class ClientApplication {
391
401
  ): Promise<AuthenticationResult | null> {
392
402
  this.logger.info(
393
403
  "acquireTokenByUsernamePassword called",
394
- request.correlationId
404
+ request.correlationId || ""
395
405
  );
396
406
  const validRequest: CommonUsernamePasswordRequest = {
397
407
  ...request,
@@ -436,7 +446,7 @@ export abstract class ClientApplication {
436
446
  * Gets the token cache for the application.
437
447
  */
438
448
  getTokenCache(): TokenCache {
439
- this.logger.info("getTokenCache called");
449
+ this.logger.info("getTokenCache called", "");
440
450
  return this.tokenCache;
441
451
  }
442
452
 
@@ -513,10 +523,6 @@ export abstract class ClientApplication {
513
523
  this.config.system.loggerOptions.piiLoggingEnabled,
514
524
  correlationId: requestCorrelationId,
515
525
  },
516
- cacheOptions: {
517
- claimsBasedCachingEnabled:
518
- this.config.cache.claimsBasedCachingEnabled,
519
- },
520
526
  cryptoInterface: this.cryptoProvider,
521
527
  networkInterface: this.config.system.networkClient,
522
528
  storageInterface: this.storage,
@@ -530,8 +536,8 @@ export abstract class ClientApplication {
530
536
  libraryInfo: {
531
537
  sku: NodeConstants.MSAL_SKU,
532
538
  version: version,
533
- cpu: process.arch || Constants.EMPTY_STRING,
534
- os: process.platform || Constants.EMPTY_STRING,
539
+ cpu: process.arch || "",
540
+ os: process.platform || "",
535
541
  },
536
542
  telemetry: this.config.telemetry,
537
543
  persistencePlugin: this.config.cache.cachePlugin,
@@ -573,43 +579,31 @@ export abstract class ClientApplication {
573
579
  protected async initializeBaseRequest(
574
580
  authRequest: Partial<BaseAuthRequest>
575
581
  ): Promise<BaseAuthRequest> {
576
- this.logger.verbose(
577
- "initializeRequestScopes called",
578
- authRequest.correlationId
579
- );
582
+ const correlationId =
583
+ authRequest.correlationId || this.cryptoProvider.createNewGuid();
584
+ this.logger.verbose("initializeRequestScopes called", correlationId);
580
585
  // Default authenticationScheme to Bearer, log that POP isn't supported yet
581
586
  if (
582
587
  authRequest.authenticationScheme &&
583
- authRequest.authenticationScheme === AuthenticationScheme.POP
588
+ authRequest.authenticationScheme ===
589
+ Constants.AuthenticationScheme.POP
584
590
  ) {
585
591
  this.logger.verbose(
586
592
  "Authentication Scheme 'pop' is not supported yet, setting Authentication Scheme to 'Bearer' for request",
587
- authRequest.correlationId
593
+ correlationId
588
594
  );
589
595
  }
590
596
 
591
- authRequest.authenticationScheme = AuthenticationScheme.BEARER;
592
-
593
- // Set requested claims hash if claims-based caching is enabled and claims were requested
594
- if (
595
- this.config.cache.claimsBasedCachingEnabled &&
596
- authRequest.claims &&
597
- // Checks for empty stringified object "{}" which doesn't qualify as requested claims
598
- !StringUtils.isEmptyObj(authRequest.claims)
599
- ) {
600
- authRequest.requestedClaimsHash =
601
- await this.cryptoProvider.hashString(authRequest.claims);
602
- }
597
+ authRequest.authenticationScheme =
598
+ Constants.AuthenticationScheme.BEARER;
603
599
 
604
600
  return {
605
601
  ...authRequest,
606
602
  scopes: [
607
603
  ...((authRequest && authRequest.scopes) || []),
608
- ...OIDC_DEFAULT_SCOPES,
604
+ ...Constants.OIDC_DEFAULT_SCOPES,
609
605
  ],
610
- correlationId:
611
- (authRequest && authRequest.correlationId) ||
612
- this.cryptoProvider.createNewGuid(),
606
+ correlationId,
613
607
  authority: authRequest.authority || this.config.auth.authority,
614
608
  };
615
609
  }
@@ -655,13 +649,11 @@ export abstract class ClientApplication {
655
649
  );
656
650
 
657
651
  const authorityOptions: AuthorityOptions = {
658
- protocolMode: this.config.auth.protocolMode,
652
+ protocolMode: this.config.system.protocolMode,
659
653
  knownAuthorities: this.config.auth.knownAuthorities,
660
654
  cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
661
655
  authorityMetadata: this.config.auth.authorityMetadata,
662
656
  azureRegionConfiguration,
663
- skipAuthorityMetadataCache:
664
- this.config.auth.skipAuthorityMetadataCache,
665
657
  };
666
658
 
667
659
  return AuthorityFactory.createDiscoveredInstance(
@@ -670,7 +662,8 @@ export abstract class ClientApplication {
670
662
  this.storage,
671
663
  authorityOptions,
672
664
  this.logger,
673
- requestCorrelationId
665
+ requestCorrelationId,
666
+ new StubPerformanceClient()
674
667
  );
675
668
  }
676
669
 
@@ -6,14 +6,13 @@
6
6
  import jwt from "jsonwebtoken";
7
7
  import {
8
8
  TimeUtils,
9
- Constants,
10
9
  createClientAuthError,
11
- ClientAuthErrorCodes,
12
- EncodingTypes,
10
+ Constants,
13
11
  } from "@azure/msal-common/node";
14
12
  import { CryptoProvider } from "../crypto/CryptoProvider.js";
15
13
  import { EncodingUtils } from "../utils/EncodingUtils.js";
16
14
  import { JwtConstants } from "../utils/Constants.js";
15
+ import * as NodeClientAuthErrorCodes from "../error/ClientAuthErrorCodes.js";
17
16
 
18
17
  /**
19
18
  * Client assertion of type jwt-bearer used in confidential client flows
@@ -117,7 +116,7 @@ export class ClientAssertion {
117
116
  return this.jwt;
118
117
  }
119
118
 
120
- throw createClientAuthError(ClientAuthErrorCodes.invalidAssertion);
119
+ throw createClientAuthError(NodeClientAuthErrorCodes.invalidAssertion);
121
120
  }
122
121
 
123
122
  /**
@@ -146,7 +145,7 @@ export class ClientAssertion {
146
145
  Object.assign(header, {
147
146
  [thumbprintHeader]: EncodingUtils.base64EncodeUrl(
148
147
  this.thumbprint,
149
- EncodingTypes.HEX
148
+ Constants.EncodingTypes.HEX
150
149
  ),
151
150
  } as Partial<jwt.JwtHeader>);
152
151
 
@@ -195,7 +194,7 @@ export class ClientAssertion {
195
194
  let matches;
196
195
  while ((matches = regexToFindCerts.exec(publicCertificate)) !== null) {
197
196
  // matches[1] represents the first parens capture group in the regex.
198
- certs.push(matches[1].replace(/\r*\n/g, Constants.EMPTY_STRING));
197
+ certs.push(matches[1].replace(/\r*\n/g, ""));
199
198
  }
200
199
 
201
200
  return certs;