@azure/msal-common 16.12.0 → 16.14.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 (300) hide show
  1. package/dist/account/AccountInfo.mjs +1 -1
  2. package/dist/account/AuthToken.mjs +1 -1
  3. package/dist/account/CcsCredential.mjs +1 -1
  4. package/dist/account/ClientInfo.mjs +1 -1
  5. package/dist/account/TokenClaims.mjs +1 -1
  6. package/dist/authority/Authority.mjs +2 -4
  7. package/dist/authority/Authority.mjs.map +1 -1
  8. package/dist/authority/AuthorityFactory.mjs +1 -1
  9. package/dist/authority/AuthorityMetadata.mjs +2 -14
  10. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  11. package/dist/authority/AuthorityOptions.mjs +1 -3
  12. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  13. package/dist/authority/AuthorityType.mjs +1 -2
  14. package/dist/authority/AuthorityType.mjs.map +1 -1
  15. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  16. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  17. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  18. package/dist/authority/ProtocolMode.mjs +1 -1
  19. package/dist/authority/RegionDiscovery.mjs +1 -1
  20. package/dist/cache/CacheManager.mjs +45 -23
  21. package/dist/cache/CacheManager.mjs.map +1 -1
  22. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  23. package/dist/cache/utils/AccountEntityUtils.mjs +3 -3
  24. package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -1
  25. package/dist/cache/utils/CacheHelpers.mjs +10 -3
  26. package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
  27. package/dist/client/AuthorizationCodeClient.mjs +5 -4
  28. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  29. package/dist/client/RefreshTokenClient.mjs +12 -4
  30. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  31. package/dist/client/SilentFlowClient.mjs +22 -3
  32. package/dist/client/SilentFlowClient.mjs.map +1 -1
  33. package/dist/config/ClientConfiguration.mjs +6 -3
  34. package/dist/config/ClientConfiguration.mjs.map +1 -1
  35. package/dist/constants/AADServerParamKeys.mjs +3 -2
  36. package/dist/constants/AADServerParamKeys.mjs.map +1 -1
  37. package/dist/crypto/DpopProofGenerator.mjs +153 -0
  38. package/dist/crypto/DpopProofGenerator.mjs.map +1 -0
  39. package/dist/crypto/ICrypto.mjs +16 -11
  40. package/dist/crypto/ICrypto.mjs.map +1 -1
  41. package/dist/crypto/ITokenBindingKeyManager.mjs +28 -0
  42. package/dist/crypto/ITokenBindingKeyManager.mjs.map +1 -0
  43. package/dist/crypto/JoseHeader.mjs +38 -11
  44. package/dist/crypto/JoseHeader.mjs.map +1 -1
  45. package/dist/crypto/PopTokenGenerator.mjs +28 -5
  46. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  47. package/dist/error/AuthError.mjs +1 -1
  48. package/dist/error/AuthErrorCodes.mjs +1 -1
  49. package/dist/error/CacheError.mjs +1 -1
  50. package/dist/error/CacheErrorCodes.mjs +1 -1
  51. package/dist/error/ClientAuthError.mjs +1 -1
  52. package/dist/error/ClientAuthErrorCodes.mjs +3 -2
  53. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  54. package/dist/error/ClientConfigurationError.mjs +1 -1
  55. package/dist/error/ClientConfigurationErrorCodes.mjs +6 -3
  56. package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
  57. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  58. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  59. package/dist/error/JoseHeaderError.mjs +1 -1
  60. package/dist/error/JoseHeaderErrorCodes.mjs +5 -3
  61. package/dist/error/JoseHeaderErrorCodes.mjs.map +1 -1
  62. package/dist/error/NetworkError.mjs +1 -1
  63. package/dist/error/PlatformBrokerError.mjs +1 -1
  64. package/dist/error/ServerError.mjs +1 -1
  65. package/dist/index-node.mjs +3 -2
  66. package/dist/index-node.mjs.map +1 -1
  67. package/dist/index.mjs +3 -2
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/logger/Logger.mjs +1 -1
  70. package/dist/network/INetworkModule.mjs +1 -1
  71. package/dist/network/RequestThumbprint.mjs +1 -1
  72. package/dist/network/ThrottlingUtils.mjs +1 -1
  73. package/dist/packageMetadata.mjs +2 -2
  74. package/dist/protocol/Authorize.mjs +1 -1
  75. package/dist/protocol/Token.mjs +22 -4
  76. package/dist/protocol/Token.mjs.map +1 -1
  77. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  78. package/dist/request/BaseAuthRequest.mjs +1 -1
  79. package/dist/request/BaseAuthRequest.mjs.map +1 -1
  80. package/dist/request/RequestParameterBuilder.mjs +8 -4
  81. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  82. package/dist/request/ScopeSet.mjs +1 -1
  83. package/dist/response/ResponseHandler.mjs +65 -9
  84. package/dist/response/ResponseHandler.mjs.map +1 -1
  85. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  86. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  87. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  88. package/dist/telemetry/performance/PerformanceEvents.mjs +1 -1
  89. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  90. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  91. package/dist/url/UrlString.mjs +1 -1
  92. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  93. package/dist/utils/Constants.mjs +6 -3
  94. package/dist/utils/Constants.mjs.map +1 -1
  95. package/dist/utils/FunctionWrappers.mjs +1 -1
  96. package/dist/utils/ObjectUtils.mjs +28 -0
  97. package/dist/utils/ObjectUtils.mjs.map +1 -0
  98. package/dist/utils/ProtocolUtils.mjs +1 -1
  99. package/dist/utils/StringUtils.mjs +1 -1
  100. package/dist/utils/TimeUtils.mjs +1 -1
  101. package/dist/utils/UrlUtils.mjs +1 -1
  102. package/dist-browser/account/AccountInfo.mjs +1 -1
  103. package/dist-browser/account/AuthToken.mjs +1 -1
  104. package/dist-browser/account/CcsCredential.mjs +1 -1
  105. package/dist-browser/account/ClientInfo.mjs +1 -1
  106. package/dist-browser/account/TokenClaims.mjs +1 -1
  107. package/dist-browser/authority/Authority.mjs +2 -4
  108. package/dist-browser/authority/Authority.mjs.map +1 -1
  109. package/dist-browser/authority/AuthorityFactory.mjs +1 -1
  110. package/dist-browser/authority/AuthorityMetadata.mjs +2 -14
  111. package/dist-browser/authority/AuthorityMetadata.mjs.map +1 -1
  112. package/dist-browser/authority/AuthorityOptions.mjs +1 -3
  113. package/dist-browser/authority/AuthorityOptions.mjs.map +1 -1
  114. package/dist-browser/authority/AuthorityType.mjs +1 -2
  115. package/dist-browser/authority/AuthorityType.mjs.map +1 -1
  116. package/dist-browser/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  117. package/dist-browser/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  118. package/dist-browser/authority/OpenIdConfigResponse.mjs +1 -1
  119. package/dist-browser/authority/ProtocolMode.mjs +1 -1
  120. package/dist-browser/authority/RegionDiscovery.mjs +1 -1
  121. package/dist-browser/cache/CacheManager.mjs +45 -23
  122. package/dist-browser/cache/CacheManager.mjs.map +1 -1
  123. package/dist-browser/cache/persistence/TokenCacheContext.mjs +1 -1
  124. package/dist-browser/cache/utils/AccountEntityUtils.mjs +3 -3
  125. package/dist-browser/cache/utils/AccountEntityUtils.mjs.map +1 -1
  126. package/dist-browser/cache/utils/CacheHelpers.mjs +10 -3
  127. package/dist-browser/cache/utils/CacheHelpers.mjs.map +1 -1
  128. package/dist-browser/client/AuthorizationCodeClient.mjs +5 -4
  129. package/dist-browser/client/AuthorizationCodeClient.mjs.map +1 -1
  130. package/dist-browser/client/RefreshTokenClient.mjs +12 -4
  131. package/dist-browser/client/RefreshTokenClient.mjs.map +1 -1
  132. package/dist-browser/client/SilentFlowClient.mjs +22 -3
  133. package/dist-browser/client/SilentFlowClient.mjs.map +1 -1
  134. package/dist-browser/config/ClientConfiguration.mjs +6 -3
  135. package/dist-browser/config/ClientConfiguration.mjs.map +1 -1
  136. package/dist-browser/constants/AADServerParamKeys.mjs +3 -2
  137. package/dist-browser/constants/AADServerParamKeys.mjs.map +1 -1
  138. package/dist-browser/crypto/DpopProofGenerator.mjs +153 -0
  139. package/dist-browser/crypto/DpopProofGenerator.mjs.map +1 -0
  140. package/dist-browser/crypto/ICrypto.mjs +16 -11
  141. package/dist-browser/crypto/ICrypto.mjs.map +1 -1
  142. package/dist-browser/crypto/ITokenBindingKeyManager.mjs +28 -0
  143. package/dist-browser/crypto/ITokenBindingKeyManager.mjs.map +1 -0
  144. package/dist-browser/crypto/JoseHeader.mjs +38 -11
  145. package/dist-browser/crypto/JoseHeader.mjs.map +1 -1
  146. package/dist-browser/crypto/PopTokenGenerator.mjs +28 -5
  147. package/dist-browser/crypto/PopTokenGenerator.mjs.map +1 -1
  148. package/dist-browser/error/AuthError.mjs +1 -1
  149. package/dist-browser/error/AuthErrorCodes.mjs +1 -1
  150. package/dist-browser/error/CacheError.mjs +1 -1
  151. package/dist-browser/error/CacheErrorCodes.mjs +1 -1
  152. package/dist-browser/error/ClientAuthError.mjs +1 -1
  153. package/dist-browser/error/ClientAuthErrorCodes.mjs +3 -2
  154. package/dist-browser/error/ClientAuthErrorCodes.mjs.map +1 -1
  155. package/dist-browser/error/ClientConfigurationError.mjs +1 -1
  156. package/dist-browser/error/ClientConfigurationErrorCodes.mjs +6 -3
  157. package/dist-browser/error/ClientConfigurationErrorCodes.mjs.map +1 -1
  158. package/dist-browser/error/InteractionRequiredAuthError.mjs +1 -1
  159. package/dist-browser/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  160. package/dist-browser/error/JoseHeaderError.mjs +1 -1
  161. package/dist-browser/error/JoseHeaderErrorCodes.mjs +5 -3
  162. package/dist-browser/error/JoseHeaderErrorCodes.mjs.map +1 -1
  163. package/dist-browser/error/NetworkError.mjs +1 -1
  164. package/dist-browser/error/PlatformBrokerError.mjs +1 -1
  165. package/dist-browser/error/ServerError.mjs +1 -1
  166. package/dist-browser/index-browser.mjs +3 -2
  167. package/dist-browser/index-browser.mjs.map +1 -1
  168. package/dist-browser/index.mjs +3 -2
  169. package/dist-browser/index.mjs.map +1 -1
  170. package/dist-browser/log-strings-mapping.json +13 -5
  171. package/dist-browser/logger/Logger.mjs +1 -1
  172. package/dist-browser/network/INetworkModule.mjs +1 -1
  173. package/dist-browser/network/RequestThumbprint.mjs +1 -1
  174. package/dist-browser/network/ThrottlingUtils.mjs +1 -1
  175. package/dist-browser/packageMetadata.mjs +2 -2
  176. package/dist-browser/protocol/Authorize.mjs +1 -1
  177. package/dist-browser/protocol/Token.mjs +22 -4
  178. package/dist-browser/protocol/Token.mjs.map +1 -1
  179. package/dist-browser/request/AuthenticationHeaderParser.mjs +1 -1
  180. package/dist-browser/request/BaseAuthRequest.mjs +1 -1
  181. package/dist-browser/request/BaseAuthRequest.mjs.map +1 -1
  182. package/dist-browser/request/RequestParameterBuilder.mjs +8 -4
  183. package/dist-browser/request/RequestParameterBuilder.mjs.map +1 -1
  184. package/dist-browser/request/ScopeSet.mjs +1 -1
  185. package/dist-browser/response/ResponseHandler.mjs +65 -9
  186. package/dist-browser/response/ResponseHandler.mjs.map +1 -1
  187. package/dist-browser/telemetry/performance/PerformanceClient.mjs +1 -1
  188. package/dist-browser/telemetry/performance/PerformanceEvent.mjs +1 -1
  189. package/dist-browser/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  190. package/dist-browser/telemetry/performance/PerformanceEvents.mjs +1 -1
  191. package/dist-browser/telemetry/performance/StubPerformanceClient.mjs +1 -1
  192. package/dist-browser/telemetry/server/ServerTelemetryManager.mjs +1 -1
  193. package/dist-browser/url/UrlString.mjs +1 -1
  194. package/dist-browser/utils/ClientAssertionUtils.mjs +1 -1
  195. package/dist-browser/utils/Constants.mjs +6 -3
  196. package/dist-browser/utils/Constants.mjs.map +1 -1
  197. package/dist-browser/utils/FunctionWrappers.mjs +1 -1
  198. package/dist-browser/utils/ObjectUtils.mjs +28 -0
  199. package/dist-browser/utils/ObjectUtils.mjs.map +1 -0
  200. package/dist-browser/utils/ProtocolUtils.mjs +1 -1
  201. package/dist-browser/utils/StringUtils.mjs +1 -1
  202. package/dist-browser/utils/TimeUtils.mjs +1 -1
  203. package/dist-browser/utils/UrlUtils.mjs +1 -1
  204. package/lib/index-browser.cjs +5 -67
  205. package/lib/index-browser.cjs.map +1 -1
  206. package/lib/{index-node-3p7V__ym.js → index-node-l_NIe8t5.js} +520 -83
  207. package/lib/index-node-l_NIe8t5.js.map +1 -0
  208. package/lib/index-node.cjs +4 -2
  209. package/lib/index-node.cjs.map +1 -1
  210. package/lib/index.cjs +5 -3
  211. package/lib/index.cjs.map +1 -1
  212. package/package.json +1 -1
  213. package/src/authority/Authority.ts +0 -2
  214. package/src/authority/AuthorityMetadata.ts +1 -13
  215. package/src/authority/AuthorityOptions.ts +0 -3
  216. package/src/authority/AuthorityType.ts +0 -1
  217. package/src/cache/CacheManager.ts +73 -35
  218. package/src/cache/utils/AccountEntityUtils.ts +2 -2
  219. package/src/cache/utils/CacheHelpers.ts +11 -1
  220. package/src/client/AuthorizationCodeClient.ts +11 -1
  221. package/src/client/RefreshTokenClient.ts +25 -1
  222. package/src/client/SilentFlowClient.ts +44 -2
  223. package/src/config/ClientConfiguration.ts +14 -1
  224. package/src/constants/AADServerParamKeys.ts +1 -0
  225. package/src/crypto/DpopProofGenerator.ts +92 -60
  226. package/src/crypto/ICrypto.ts +31 -26
  227. package/src/crypto/ITokenBindingKeyManager.ts +85 -0
  228. package/src/crypto/JoseHeader.ts +75 -14
  229. package/src/crypto/PopTokenGenerator.ts +62 -18
  230. package/src/crypto/PublicJsonWebKey.ts +24 -0
  231. package/src/error/ClientAuthErrorCodes.ts +1 -0
  232. package/src/error/ClientConfigurationErrorCodes.ts +4 -0
  233. package/src/error/JoseHeaderErrorCodes.ts +2 -0
  234. package/src/exports-common.ts +8 -0
  235. package/src/packageMetadata.ts +1 -1
  236. package/src/protocol/Token.ts +44 -1
  237. package/src/request/BaseAuthRequest.ts +5 -0
  238. package/src/request/CommonAuthorizationUrlRequest.ts +5 -0
  239. package/src/request/RequestParameterBuilder.ts +7 -3
  240. package/src/response/AuthenticationResult.ts +2 -0
  241. package/src/response/ResponseHandler.ts +115 -16
  242. package/src/telemetry/performance/PerformanceEvent.ts +22 -0
  243. package/src/utils/Constants.ts +4 -1
  244. package/src/utils/ObjectUtils.ts +31 -0
  245. package/types/authority/Authority.d.ts.map +1 -1
  246. package/types/authority/AuthorityMetadata.d.ts.map +1 -1
  247. package/types/authority/AuthorityOptions.d.ts +0 -1
  248. package/types/authority/AuthorityOptions.d.ts.map +1 -1
  249. package/types/authority/AuthorityType.d.ts +0 -1
  250. package/types/authority/AuthorityType.d.ts.map +1 -1
  251. package/types/cache/CacheManager.d.ts +5 -1
  252. package/types/cache/CacheManager.d.ts.map +1 -1
  253. package/types/cache/utils/CacheHelpers.d.ts.map +1 -1
  254. package/types/client/AuthorizationCodeClient.d.ts.map +1 -1
  255. package/types/client/RefreshTokenClient.d.ts.map +1 -1
  256. package/types/client/SilentFlowClient.d.ts.map +1 -1
  257. package/types/config/ClientConfiguration.d.ts +5 -1
  258. package/types/config/ClientConfiguration.d.ts.map +1 -1
  259. package/types/constants/AADServerParamKeys.d.ts +1 -0
  260. package/types/constants/AADServerParamKeys.d.ts.map +1 -1
  261. package/types/crypto/DpopProofGenerator.d.ts +16 -36
  262. package/types/crypto/DpopProofGenerator.d.ts.map +1 -1
  263. package/types/crypto/ICrypto.d.ts +10 -9
  264. package/types/crypto/ICrypto.d.ts.map +1 -1
  265. package/types/crypto/ITokenBindingKeyManager.d.ts +42 -0
  266. package/types/crypto/ITokenBindingKeyManager.d.ts.map +1 -0
  267. package/types/crypto/JoseHeader.d.ts +18 -5
  268. package/types/crypto/JoseHeader.d.ts.map +1 -1
  269. package/types/crypto/PopTokenGenerator.d.ts +3 -1
  270. package/types/crypto/PopTokenGenerator.d.ts.map +1 -1
  271. package/types/crypto/PublicJsonWebKey.d.ts +20 -0
  272. package/types/crypto/PublicJsonWebKey.d.ts.map +1 -0
  273. package/types/error/ClientAuthErrorCodes.d.ts +1 -0
  274. package/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
  275. package/types/error/ClientConfigurationErrorCodes.d.ts +3 -0
  276. package/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
  277. package/types/error/JoseHeaderErrorCodes.d.ts +2 -0
  278. package/types/error/JoseHeaderErrorCodes.d.ts.map +1 -1
  279. package/types/exports-common.d.ts +4 -2
  280. package/types/exports-common.d.ts.map +1 -1
  281. package/types/packageMetadata.d.ts +1 -1
  282. package/types/protocol/Token.d.ts +7 -0
  283. package/types/protocol/Token.d.ts.map +1 -1
  284. package/types/request/BaseAuthRequest.d.ts +5 -0
  285. package/types/request/BaseAuthRequest.d.ts.map +1 -1
  286. package/types/request/CommonAuthorizationUrlRequest.d.ts +5 -0
  287. package/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  288. package/types/request/RequestParameterBuilder.d.ts +2 -2
  289. package/types/request/RequestParameterBuilder.d.ts.map +1 -1
  290. package/types/response/AuthenticationResult.d.ts +2 -0
  291. package/types/response/AuthenticationResult.d.ts.map +1 -1
  292. package/types/response/ResponseHandler.d.ts +12 -2
  293. package/types/response/ResponseHandler.d.ts.map +1 -1
  294. package/types/telemetry/performance/PerformanceEvent.d.ts +18 -0
  295. package/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  296. package/types/utils/Constants.d.ts +4 -1
  297. package/types/utils/Constants.d.ts.map +1 -1
  298. package/types/utils/ObjectUtils.d.ts +6 -0
  299. package/types/utils/ObjectUtils.d.ts.map +1 -0
  300. package/lib/index-node-3p7V__ym.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -74,6 +74,7 @@ const invalidCacheEnvironment = "invalid_cache_environment";
74
74
  const noAccountFound = "no_account_found";
75
75
  const noCryptoObject = "no_crypto_object";
76
76
  const unexpectedCredentialType = "unexpected_credential_type";
77
+ const dpopTokenTypeMismatch = "dpop_token_type_mismatch";
77
78
  const tokenRefreshRequired = "token_refresh_required";
78
79
  const tokenClaimsCnfRequiredForSignedJwt = "token_claims_cnf_required_for_signedjwt";
79
80
  const authorizationCodeMissingFromServerResponse = "authorization_code_missing_from_server_response";
@@ -96,6 +97,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
96
97
  cannotRemoveEmptyScope: cannotRemoveEmptyScope,
97
98
  clientInfoDecodingError: clientInfoDecodingError,
98
99
  clientInfoEmptyError: clientInfoEmptyError,
100
+ dpopTokenTypeMismatch: dpopTokenTypeMismatch,
99
101
  emptyInputScopeSet: emptyInputScopeSet,
100
102
  endSessionEndpointNotSupported: endSessionEndpointNotSupported,
101
103
  endpointResolutionError: endpointResolutionError,
@@ -231,7 +233,6 @@ var AuthToken = /*#__PURE__*/Object.freeze({
231
233
  const AuthorityType = {
232
234
  Default: 0,
233
235
  Adfs: 1,
234
- Dsts: 2,
235
236
  Ciam: 3,
236
237
  };
237
238
 
@@ -266,6 +267,7 @@ const invalidAuthorityMetadata = "invalid_authority_metadata";
266
267
  const untrustedAuthority = "untrusted_authority";
267
268
  const missingSshJwk = "missing_ssh_jwk";
268
269
  const missingSshKid = "missing_ssh_kid";
270
+ const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
269
271
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
270
272
  const invalidAuthenticationHeader = "invalid_authentication_header";
271
273
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
@@ -276,7 +278,9 @@ const invalidPlatformBrokerConfiguration = "invalid_platform_broker_configuratio
276
278
  const issuerValidationFailed = "issuer_validation_failed";
277
279
  const invalidResponseMode = "invalid_response_mode";
278
280
  const invalidDpopHtm = "invalid_dpop_htm";
279
- const invalidDpopHtu = "invalid_dpop_htu";
281
+ const invalidDpopHtu = "invalid_dpop_htu";
282
+ const invalidDpopNonce = "invalid_dpop_nonce";
283
+ const dpopMissingResourceContext = "dpop_missing_resource_context";
280
284
 
281
285
  var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
282
286
  __proto__: null,
@@ -285,6 +289,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
285
289
  cannotAllowPlatformBroker: cannotAllowPlatformBroker,
286
290
  cannotSetOIDCOptions: cannotSetOIDCOptions,
287
291
  claimsRequestParsingError: claimsRequestParsingError,
292
+ dpopMissingResourceContext: dpopMissingResourceContext,
288
293
  emptyInputScopesError: emptyInputScopesError,
289
294
  invalidAuthenticationHeader: invalidAuthenticationHeader,
290
295
  invalidAuthorityMetadata: invalidAuthorityMetadata,
@@ -293,6 +298,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
293
298
  invalidCodeChallengeMethod: invalidCodeChallengeMethod,
294
299
  invalidDpopHtm: invalidDpopHtm,
295
300
  invalidDpopHtu: invalidDpopHtu,
301
+ invalidDpopNonce: invalidDpopNonce,
296
302
  invalidPlatformBrokerConfiguration: invalidPlatformBrokerConfiguration,
297
303
  invalidRequestMethodForEAR: invalidRequestMethodForEAR,
298
304
  invalidResponseMode: invalidResponseMode,
@@ -304,6 +310,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
304
310
  pkceParamsMissing: pkceParamsMissing,
305
311
  redirectUriEmpty: redirectUriEmpty,
306
312
  tokenRequestEmpty: tokenRequestEmpty,
313
+ unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
307
314
  untrustedAuthority: untrustedAuthority,
308
315
  urlEmptyError: urlEmptyError,
309
316
  urlParseError: urlParseError
@@ -417,7 +424,6 @@ const DEFAULT_AUTHORITY_HOST = "login.microsoftonline.com";
417
424
  const DEFAULT_COMMON_TENANT = "common";
418
425
  // ADFS String
419
426
  const ADFS = "adfs";
420
- const DSTS = "dstsv2";
421
427
  // Default AAD Instance Discovery Endpoint
422
428
  const AAD_INSTANCE_DISCOVERY_ENDPT = `${DEFAULT_AUTHORITY}discovery/instance?api-version=1.1&authorization_endpoint=`;
423
429
  // CIAM URL
@@ -487,6 +493,7 @@ const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, EMAIL_SCOPE];
487
493
  const HeaderNames = {
488
494
  CONTENT_TYPE: "Content-Type",
489
495
  CONTENT_LENGTH: "Content-Length",
496
+ DPOP: "DPoP",
490
497
  RETRY_AFTER: "Retry-After",
491
498
  CCS_HEADER: "X-AnchorMailbox",
492
499
  WWWAuthenticate: "WWW-Authenticate",
@@ -517,6 +524,7 @@ const ClaimsRequestKeys = {
517
524
  ID_TOKEN: "id_token",
518
525
  SIGNIN_STATE: "signin_state",
519
526
  LOGIN_HINT: "login_hint",
527
+ TENANT_REGION_SUB_SCOPE: "tenant_region_sub_scope",
520
528
  };
521
529
  /**
522
530
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
@@ -632,6 +640,7 @@ const SERVER_TELEM_UNKNOWN_ERROR = "unknown_error";
632
640
  const AuthenticationScheme = {
633
641
  BEARER: "Bearer",
634
642
  POP: "pop",
643
+ DPOP: "DPoP",
635
644
  SSH: "ssh-cert",
636
645
  };
637
646
  /**
@@ -694,6 +703,7 @@ const JsonWebTokenTypes = {
694
703
  Jwt: "JWT",
695
704
  Jwk: "JWK",
696
705
  Pop: "pop",
706
+ Dpop: "dpop+jwt",
697
707
  };
698
708
  const ONE_DAY_IN_MS = 86400000;
699
709
  // Token renewal offset default in seconds
@@ -739,7 +749,6 @@ var Constants = /*#__PURE__*/Object.freeze({
739
749
  DEFAULT_MAX_THROTTLE_TIME_SECONDS: DEFAULT_MAX_THROTTLE_TIME_SECONDS,
740
750
  DEFAULT_THROTTLE_TIME_SECONDS: DEFAULT_THROTTLE_TIME_SECONDS,
741
751
  DEFAULT_TOKEN_RENEWAL_OFFSET_SEC: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
742
- DSTS: DSTS,
743
752
  EMAIL_SCOPE: EMAIL_SCOPE,
744
753
  EncodingTypes: EncodingTypes,
745
754
  FORWARD_SLASH: FORWARD_SLASH,
@@ -971,10 +980,7 @@ class UrlString {
971
980
  // Build endpoint metadata dynamically to avoid string duplication
972
981
  const endpointHosts = [
973
982
  { host: "login.microsoftonline.com" },
974
- {
975
- host: "login.chinacloudapi.cn",
976
- issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
977
- },
983
+ { host: "login.partner.microsoftonline.cn" },
978
984
  { host: "login.microsoftonline.us" },
979
985
  { host: "login.sovcloud-identity.fr" },
980
986
  { host: "login.sovcloud-identity.de" },
@@ -1048,15 +1054,6 @@ const rawMetdataJSON = {
1048
1054
  preferred_cache: "login.sovcloud-identity.sg",
1049
1055
  aliases: ["login.sovcloud-identity.sg"],
1050
1056
  },
1051
- {
1052
- preferred_network: "login.windows-ppe.net",
1053
- preferred_cache: "login.windows-ppe.net",
1054
- aliases: [
1055
- "login.windows-ppe.net",
1056
- "sts.windows-ppe.net",
1057
- "login.microsoft-ppe.com",
1058
- ],
1059
- },
1060
1057
  ],
1061
1058
  },
1062
1059
  };
@@ -1160,8 +1157,6 @@ const AzureCloudInstance = {
1160
1157
  None: "none",
1161
1158
  // Microsoft Azure public cloud
1162
1159
  AzurePublic: "https://login.microsoftonline.com",
1163
- // Microsoft PPE
1164
- AzurePpe: "https://login.windows-ppe.net",
1165
1160
  // Microsoft Chinese national/regional cloud
1166
1161
  AzureChina: "https://login.chinacloudapi.cn",
1167
1162
  // Microsoft German national/regional cloud ("Black Forest")
@@ -1627,6 +1622,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1627
1622
  if (refreshOn) {
1628
1623
  atEntity.refreshOn = refreshOn.toString();
1629
1624
  }
1625
+ const normalizedTokenType = atEntity.tokenType?.toLowerCase();
1630
1626
  /*
1631
1627
  * Create Access Token With Auth Scheme instead of regular access token
1632
1628
  * Cast to lower to handle "bearer" from ADFS
@@ -1635,7 +1631,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1635
1631
  AuthenticationScheme.BEARER.toLowerCase()) {
1636
1632
  atEntity.credentialType =
1637
1633
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
1638
- switch (atEntity.tokenType) {
1634
+ switch (normalizedTokenType) {
1639
1635
  case AuthenticationScheme.POP:
1640
1636
  // Make sure keyId is present and add it to credential
1641
1637
  const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
@@ -1644,6 +1640,12 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1644
1640
  }
1645
1641
  atEntity.keyId = tokenClaims.cnf.kid;
1646
1642
  break;
1643
+ case "dpop":
1644
+ if (!keyId) {
1645
+ throw createClientAuthError(keyIdMissing, correlationId);
1646
+ }
1647
+ atEntity.keyId = keyId;
1648
+ break;
1647
1649
  case AuthenticationScheme.SSH:
1648
1650
  atEntity.keyId = keyId;
1649
1651
  }
@@ -1913,8 +1915,6 @@ class Authority {
1913
1915
  switch (pathSegments[0].toLowerCase()) {
1914
1916
  case ADFS:
1915
1917
  return AuthorityType.Adfs;
1916
- case DSTS:
1917
- return AuthorityType.Dsts;
1918
1918
  }
1919
1919
  }
1920
1920
  return AuthorityType.Default;
@@ -3050,6 +3050,7 @@ const CLIENT_ASSERTION = "client_assertion";
3050
3050
  const CLIENT_ASSERTION_TYPE = "client_assertion_type";
3051
3051
  const TOKEN_TYPE = "token_type";
3052
3052
  const REQ_CNF = "req_cnf";
3053
+ const DPOP_JKT = "dpop_jkt";
3053
3054
  const OBO_ASSERTION = "assertion";
3054
3055
  const REQUESTED_TOKEN_USE = "requested_token_use";
3055
3056
  const ON_BEHALF_OF = "on_behalf_of";
@@ -3096,6 +3097,7 @@ var AADServerParamKeys = /*#__PURE__*/Object.freeze({
3096
3097
  CODE_VERIFIER: CODE_VERIFIER,
3097
3098
  DEVICE_CODE: DEVICE_CODE,
3098
3099
  DOMAIN_HINT: DOMAIN_HINT,
3100
+ DPOP_JKT: DPOP_JKT,
3099
3101
  EAR_JWE_CRYPTO: EAR_JWE_CRYPTO,
3100
3102
  EAR_JWK: EAR_JWK,
3101
3103
  ERROR: ERROR,
@@ -3463,8 +3465,8 @@ function createAccountEntityFromAccountInfo(accountInfo, cloudGraphHostName, msG
3463
3465
  * @param authType
3464
3466
  */
3465
3467
  function generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, correlationId, idTokenClaims) {
3466
- // since ADFS/DSTS do not have tid and does not set client_info
3467
- if (!(authType === AuthorityType.Adfs || authType === AuthorityType.Dsts)) {
3468
+ // ADFS does not have tid and does not set client_info
3469
+ if (authType !== AuthorityType.Adfs) {
3468
3470
  // for cases where there is clientInfo
3469
3471
  if (serverClientInfo) {
3470
3472
  try {
@@ -4015,11 +4017,15 @@ function addExtraParameters(parameters, extraParams) {
4015
4017
  }
4016
4018
  /**
4017
4019
  * Default optional idToken claims requested on all auth requests.
4018
- * signin_state enables KMSI detection; login_hint enables login hint propagation.
4020
+ * signin_state enables KMSI detection; login_hint enables login hint propagation;
4021
+ * tenant_region_sub_scope identifies the sovereign enclave a tenant belongs to.
4019
4022
  */
4020
4023
  const DEFAULT_ID_TOKEN_CLAIMS = {
4021
4024
  [ClaimsRequestKeys.SIGNIN_STATE]: { essential: false },
4022
4025
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
4026
+ [ClaimsRequestKeys.TENANT_REGION_SUB_SCOPE]: {
4027
+ essential: false,
4028
+ },
4023
4029
  };
4024
4030
  /**
4025
4031
  * Parses a claims JSON string into an object, throwing a ClientConfigurationError
@@ -4038,7 +4044,7 @@ function parseClaims(claims, correlationId = "") {
4038
4044
  // Malformed JSON
4039
4045
  throw createClientConfigurationError(invalidClaims, correlationId);
4040
4046
  }
4041
- if (!isPlainObject(parsed)) {
4047
+ if (!isPlainObject$1(parsed)) {
4042
4048
  // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
4043
4049
  throw createClientConfigurationError(invalidClaims, correlationId);
4044
4050
  }
@@ -4049,7 +4055,7 @@ function parseClaims(claims, correlationId = "") {
4049
4055
  * @param value - The value to test
4050
4056
  * @returns True when value is a plain object that can be deep-merged
4051
4057
  */
4052
- function isPlainObject(value) {
4058
+ function isPlainObject$1(value) {
4053
4059
  return typeof value === "object" && value !== null && !Array.isArray(value);
4054
4060
  }
4055
4061
  /**
@@ -4066,7 +4072,7 @@ function deepMergeClaims(baseClaims, claimsToMerge) {
4066
4072
  const merged = { ...baseClaims };
4067
4073
  for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
4068
4074
  const baseValue = merged[key];
4069
- if (isPlainObject(baseValue) && isPlainObject(mergeInValue)) {
4075
+ if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
4070
4076
  merged[key] = deepMergeClaims(baseValue, mergeInValue);
4071
4077
  }
4072
4078
  else {
@@ -4078,8 +4084,8 @@ function deepMergeClaims(baseClaims, claimsToMerge) {
4078
4084
  /**
4079
4085
  * Parses claims JSON, optionally deep-merges a second client-originated claims string
4080
4086
  * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
4081
- * default optional idToken claims (signin_state, login_hint), and appends client
4082
- * capabilities (xms_cc) to the access_token section.
4087
+ * default optional idToken claims (signin_state, login_hint, tenant_region_sub_scope), and appends client
4088
+ * capabilities (xms_cc) to the access_token section
4083
4089
  * Does not overwrite idToken claims already specified by the caller.
4084
4090
  * @param claims - Existing claims JSON string from the request (may be undefined)
4085
4091
  * @param clientCapabilities - Client capabilities array from configuration
@@ -4273,6 +4279,14 @@ var RequestParameterBuilder = /*#__PURE__*/Object.freeze({
4273
4279
  * Copyright (c) Microsoft Corporation. All rights reserved.
4274
4280
  * Licensed under the MIT License.
4275
4281
  */
4282
+ /**
4283
+ * Shared JOSE algorithm literals used by MSAL package internals.
4284
+ * @internal
4285
+ */
4286
+ const JsonWebTokenAlgorithms = {
4287
+ ES256: "ES256",
4288
+ RS256: "RS256",
4289
+ };
4276
4290
  /**
4277
4291
  * Default crypto implementation used when a platform-specific implementation has
4278
4292
  * not been provided.
@@ -4293,23 +4307,41 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
4293
4307
  encodeKid: () => {
4294
4308
  throw createClientAuthError(methodNotImplemented, "");
4295
4309
  },
4296
- async getPublicKeyThumbprint() {
4297
- throw createClientAuthError(methodNotImplemented, "");
4298
- },
4299
- async removeTokenBindingKey() {
4300
- throw createClientAuthError(methodNotImplemented, "");
4310
+ async removeTokenBindingKey(kid, correlationId) {
4311
+ throw createClientAuthError(methodNotImplemented, correlationId);
4301
4312
  },
4302
- async clearKeystore() {
4303
- throw createClientAuthError(methodNotImplemented, "");
4313
+ async clearKeystore(correlationId) {
4314
+ throw createClientAuthError(methodNotImplemented, correlationId);
4304
4315
  },
4305
- async signJwt() {
4306
- throw createClientAuthError(methodNotImplemented, "");
4316
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
4317
+ throw createClientAuthError(methodNotImplemented, correlationId);
4307
4318
  },
4308
4319
  async hashString() {
4309
4320
  throw createClientAuthError(methodNotImplemented, "");
4310
4321
  },
4311
4322
  };
4312
4323
 
4324
+ /*
4325
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4326
+ * Licensed under the MIT License.
4327
+ */
4328
+ /**
4329
+ * Default token-binding key manager used when a platform-specific implementation
4330
+ * has not been provided.
4331
+ * @internal
4332
+ */
4333
+ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
4334
+ async provisionTokenBindingKey(request) {
4335
+ throw createClientAuthError(methodNotImplemented, request.correlationId);
4336
+ },
4337
+ async removeTokenBindingKey(_kid, correlationId) {
4338
+ throw createClientAuthError(methodNotImplemented, correlationId);
4339
+ },
4340
+ async getTokenBindingPublicKeyJwk(_kid, correlationId) {
4341
+ throw createClientAuthError(methodNotImplemented, correlationId);
4342
+ },
4343
+ };
4344
+
4313
4345
  /*
4314
4346
  * Copyright (c) Microsoft Corporation. All rights reserved.
4315
4347
  * Licensed under the MIT License.
@@ -4600,7 +4632,7 @@ class Logger {
4600
4632
 
4601
4633
  /* eslint-disable header/header */
4602
4634
  const name = "@azure/msal-common";
4603
- const version = "16.12.0";
4635
+ const version = "16.14.0";
4604
4636
 
4605
4637
  /*
4606
4638
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4660,9 +4692,10 @@ function createCacheError(e) {
4660
4692
  * @internal
4661
4693
  */
4662
4694
  class CacheManager {
4663
- constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
4695
+ constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions, tokenBindingKeyManager) {
4664
4696
  this.clientId = clientId;
4665
4697
  this.cryptoImpl = cryptoImpl;
4698
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
4666
4699
  this.commonLogger = logger.clone(name, version);
4667
4700
  this.staticAuthorityOptions = staticAuthorityOptions;
4668
4701
  this.performanceClient = performanceClient;
@@ -5010,16 +5043,9 @@ class CacheManager {
5010
5043
  // Access Token with Auth Scheme specific matching
5011
5044
  if (entity.credentialType ===
5012
5045
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
5013
- if (!!filter.tokenType &&
5014
- !this.matchTokenType(entity, filter.tokenType)) {
5046
+ if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
5015
5047
  return false;
5016
5048
  }
5017
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
5018
- if (filter.tokenType === AuthenticationScheme.SSH) {
5019
- if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
5020
- return false;
5021
- }
5022
- }
5023
5049
  }
5024
5050
  // Additional cache key components matching (bidirectional isolation)
5025
5051
  const entityComponents = entity.additionalCacheKeyComponents;
@@ -5158,19 +5184,24 @@ class CacheManager {
5158
5184
  }
5159
5185
  this.removeItem(key, correlationId);
5160
5186
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
5161
- // Remove Token Binding Key from key store for PoP Tokens Credentials
5187
+ // Remove Token Binding Key from key store for token-bound access token credentials
5162
5188
  if (credential.credentialType.toLowerCase() ===
5163
5189
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
5164
- if (credential.tokenType === AuthenticationScheme.POP) {
5165
- const accessTokenWithAuthSchemeEntity = credential;
5166
- const kid = accessTokenWithAuthSchemeEntity.keyId;
5167
- if (kid) {
5168
- void this.cryptoImpl
5169
- .removeTokenBindingKey(kid, correlationId)
5170
- .catch(() => {
5171
- this.commonLogger.error(`Failed to remove token binding key '${kid}'`, correlationId);
5172
- this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
5173
- });
5190
+ const tokenType = credential.tokenType?.toLowerCase();
5191
+ switch (tokenType) {
5192
+ case AuthenticationScheme.POP:
5193
+ case AuthenticationScheme.DPOP.toLowerCase(): {
5194
+ const accessTokenWithAuthSchemeEntity = credential;
5195
+ const kid = accessTokenWithAuthSchemeEntity.keyId;
5196
+ if (kid) {
5197
+ void this.tokenBindingKeyManager
5198
+ .removeTokenBindingKey(kid, correlationId)
5199
+ .catch(() => {
5200
+ this.commonLogger.error("Failed to remove token binding key", correlationId);
5201
+ this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
5202
+ });
5203
+ }
5204
+ break;
5174
5205
  }
5175
5206
  }
5176
5207
  }
@@ -5336,7 +5367,9 @@ class CacheManager {
5336
5367
  realm: targetRealm || account.tenantId,
5337
5368
  target: scopes,
5338
5369
  tokenType: authScheme,
5339
- keyId: request.sshKid,
5370
+ keyId: authScheme === AuthenticationScheme.SSH
5371
+ ? request.sshKid
5372
+ : undefined,
5340
5373
  additionalCacheKeyComponents: additionalCacheKeyComponents,
5341
5374
  };
5342
5375
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5698,7 +5731,28 @@ class CacheManager {
5698
5731
  * @param tokenType
5699
5732
  */
5700
5733
  matchTokenType(entity, tokenType) {
5701
- return !!(entity.tokenType && entity.tokenType === tokenType);
5734
+ return !!(entity.tokenType &&
5735
+ entity.tokenType.toLowerCase() === tokenType.toLowerCase());
5736
+ }
5737
+ matchAccessTokenWithAuthScheme(entity, filter) {
5738
+ const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
5739
+ if (!!filter.tokenType &&
5740
+ !this.matchTokenType(entity, filter.tokenType)) {
5741
+ return false;
5742
+ }
5743
+ switch (normalizedFilterTokenType) {
5744
+ case "dpop":
5745
+ case AuthenticationScheme.SSH:
5746
+ return this.matchKeyBoundAccessToken(entity, filter);
5747
+ default:
5748
+ return true;
5749
+ }
5750
+ }
5751
+ matchKeyBoundAccessToken(entity, filter) {
5752
+ if (!filter.keyId) {
5753
+ return true;
5754
+ }
5755
+ return this.matchKeyId(entity, filter.keyId);
5702
5756
  }
5703
5757
  /**
5704
5758
  * Returns true if the credential's keyId matches the one in the request, false otherwise
@@ -5988,19 +6042,21 @@ const DEFAULT_TELEMETRY_OPTIONS = {
5988
6042
  * @returns Configuration
5989
6043
  * @internal
5990
6044
  */
5991
- function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
6045
+ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, tokenBindingKeyManager: tokenBindingKeyManager, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
5992
6046
  const loggerOptions = {
5993
6047
  ...DEFAULT_LOGGER_IMPLEMENTATION,
5994
6048
  ...userLoggerOption,
5995
6049
  };
6050
+ const resolvedTokenBindingKeyManager = tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER;
5996
6051
  return {
5997
6052
  authOptions: buildAuthOptions(userAuthOptions),
5998
6053
  systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
5999
6054
  loggerOptions: loggerOptions,
6000
6055
  storageInterface: storageImplementation ||
6001
- new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name, version), new StubPerformanceClient()),
6056
+ new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name, version), new StubPerformanceClient(), undefined, resolvedTokenBindingKeyManager),
6002
6057
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
6003
6058
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
6059
+ tokenBindingKeyManager: resolvedTokenBindingKeyManager,
6004
6060
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
6005
6061
  libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
6006
6062
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
@@ -6056,16 +6112,135 @@ function isOidcProtocolMode(config) {
6056
6112
  }
6057
6113
  }
6058
6114
 
6115
+ /*
6116
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6117
+ * Licensed under the MIT License.
6118
+ */
6119
+ const missingKidError = "missing_kid_error";
6120
+ const missingAlgError = "missing_alg_error";
6121
+ const missingJwkError = "missing_jwk_error";
6122
+ const invalidJwkError = "invalid_jwk_error";
6123
+
6124
+ /*
6125
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6126
+ * Licensed under the MIT License.
6127
+ */
6128
+ /**
6129
+ * Error thrown when there is an error in the client code running on the browser.
6130
+ */
6131
+ class JoseHeaderError extends AuthError {
6132
+ constructor(errorCode, correlationId, errorMessage) {
6133
+ super(errorCode, correlationId, errorMessage);
6134
+ this.name = "JoseHeaderError";
6135
+ Object.setPrototypeOf(this, JoseHeaderError.prototype);
6136
+ }
6137
+ }
6138
+ /** Returns JoseHeaderError object */
6139
+ function createJoseHeaderError(code, correlationId) {
6140
+ return new JoseHeaderError(code, correlationId);
6141
+ }
6142
+
6143
+ /*
6144
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6145
+ * Licensed under the MIT License.
6146
+ */
6147
+ /**
6148
+ * Checks whether a value is a plain JSON-like object.
6149
+ * Allows objects with null prototypes, but rejects arrays and object subclasses.
6150
+ */
6151
+ function isPlainObject(value) {
6152
+ if (typeof value !== "object" ||
6153
+ value === null ||
6154
+ Object.prototype.toString.call(value) !== "[object Object]") {
6155
+ return false;
6156
+ }
6157
+ if (Object.getPrototypeOf(value) === null) {
6158
+ return true;
6159
+ }
6160
+ let proto = value;
6161
+ while (Object.getPrototypeOf(proto) !== null) {
6162
+ proto = Object.getPrototypeOf(proto);
6163
+ }
6164
+ return Object.getPrototypeOf(value) === proto;
6165
+ }
6166
+
6167
+ /*
6168
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6169
+ * Licensed under the MIT License.
6170
+ */
6171
+ /** @internal */
6172
+ class JoseHeader {
6173
+ constructor(options, correlationId) {
6174
+ if (typeof options.alg !== "string" || !options.alg) {
6175
+ throw createJoseHeaderError(missingAlgError, correlationId);
6176
+ }
6177
+ this.typ = options.typ;
6178
+ this.alg = options.alg;
6179
+ this.kid = options.kid;
6180
+ this.jwk = options.jwk;
6181
+ }
6182
+ /**
6183
+ * Builds SignedHttpRequest formatted JOSE Header from the
6184
+ * JOSE Header options provided or previously set on the object.
6185
+ * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
6186
+ * @param shrHeaderOptions
6187
+ * @param correlationId
6188
+ * @returns
6189
+ */
6190
+ static getShrHeader(shrHeaderOptions, correlationId) {
6191
+ // KeyID is required on the SHR header
6192
+ if (!shrHeaderOptions.kid) {
6193
+ throw createJoseHeaderError(missingKidError, correlationId);
6194
+ }
6195
+ // Alg is required on the SHR header
6196
+ if (!shrHeaderOptions.alg) {
6197
+ throw createJoseHeaderError(missingAlgError, correlationId);
6198
+ }
6199
+ return new JoseHeader({
6200
+ // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
6201
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes.Pop,
6202
+ kid: shrHeaderOptions.kid,
6203
+ alg: shrHeaderOptions.alg,
6204
+ }, correlationId);
6205
+ }
6206
+ /**
6207
+ * Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
6208
+ * Throws if public JWK or algorithm aren't provided since they are required for DPoP.
6209
+ * @param dpopHeaderOptions
6210
+ * @param correlationId
6211
+ * @returns
6212
+ */
6213
+ static getDpopHeader(dpopHeaderOptions, correlationId) {
6214
+ if (!isPlainObject(dpopHeaderOptions.jwk)) {
6215
+ throw createJoseHeaderError(missingJwkError, correlationId);
6216
+ }
6217
+ if (!dpopHeaderOptions.alg) {
6218
+ throw createJoseHeaderError(missingAlgError, correlationId);
6219
+ }
6220
+ if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
6221
+ throw createJoseHeaderError(invalidJwkError, correlationId);
6222
+ }
6223
+ return new JoseHeader({
6224
+ typ: JsonWebTokenTypes.Dpop,
6225
+ alg: dpopHeaderOptions.alg,
6226
+ jwk: dpopHeaderOptions.jwk,
6227
+ }, correlationId);
6228
+ }
6229
+ }
6230
+
6059
6231
  /*
6060
6232
  * Copyright (c) Microsoft Corporation. All rights reserved.
6061
6233
  * Licensed under the MIT License.
6062
6234
  */
6063
6235
  const KeyLocation = {
6064
6236
  SW: "sw"};
6237
+ const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
6238
+ const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
6065
6239
  /** @internal */
6066
6240
  class PopTokenGenerator {
6067
- constructor(cryptoUtils, performanceClient) {
6241
+ constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
6068
6242
  this.cryptoUtils = cryptoUtils;
6243
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6069
6244
  this.performanceClient = performanceClient;
6070
6245
  }
6071
6246
  /**
@@ -6088,7 +6263,11 @@ class PopTokenGenerator {
6088
6263
  * @returns
6089
6264
  */
6090
6265
  async generateKid(request) {
6091
- const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
6266
+ const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
6267
+ correlationId: request.correlationId,
6268
+ tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
6269
+ tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
6270
+ });
6092
6271
  return {
6093
6272
  kid: kidThumbprint,
6094
6273
  xms_ksl: KeyLocation.SW,
@@ -6118,7 +6297,17 @@ class PopTokenGenerator {
6118
6297
  ? new UrlString(resourceRequestUri, request.correlationId)
6119
6298
  : undefined;
6120
6299
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
6121
- return this.cryptoUtils.signJwt({
6300
+ const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
6301
+ const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
6302
+ const shrAlgorithm = shrOptions?.header?.alg ||
6303
+ publicKeyJwk.alg ||
6304
+ SHR_TOKEN_BINDING_KEY_ALGORITHM;
6305
+ const shrHeader = JoseHeader.getShrHeader({
6306
+ ...shrOptions?.header,
6307
+ alg: shrAlgorithm,
6308
+ kid: encodedKeyIdThumbprint,
6309
+ }, request.correlationId);
6310
+ const shrPayload = {
6122
6311
  at: payload,
6123
6312
  ts: nowSeconds(),
6124
6313
  m: resourceRequestMethod?.toUpperCase(),
@@ -6130,7 +6319,154 @@ class PopTokenGenerator {
6130
6319
  : undefined,
6131
6320
  client_claims: shrClaims || undefined,
6132
6321
  ...claims,
6133
- }, keyId, shrOptions, request.correlationId);
6322
+ cnf: {
6323
+ jwk: publicKeyJwk,
6324
+ },
6325
+ };
6326
+ return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
6327
+ }
6328
+ }
6329
+
6330
+ /*
6331
+ * Copyright (c) Microsoft Corporation. All rights reserved.
6332
+ * Licensed under the MIT License.
6333
+ */
6334
+ const DPOP_HTM_REGEX = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
6335
+ const DPOP_TOKEN_BINDING_KEY_TYPE = "dpop";
6336
+ const DPOP_JWT_HEADER_ALGORITHM = JsonWebTokenAlgorithms.ES256;
6337
+ function buildProofHeader(publicJwk, correlationId) {
6338
+ return JoseHeader.getDpopHeader({
6339
+ alg: DPOP_JWT_HEADER_ALGORITHM,
6340
+ jwk: publicJwk,
6341
+ }, correlationId);
6342
+ }
6343
+ function normalizeHtm(htm, correlationId) {
6344
+ if (typeof htm !== "string" || !DPOP_HTM_REGEX.test(htm)) {
6345
+ throw createClientConfigurationError(invalidDpopHtm, correlationId);
6346
+ }
6347
+ return htm.toUpperCase();
6348
+ }
6349
+ /**
6350
+ * Normalizes a URL for use as the DPoP htu claim.
6351
+ * Per RFC 9449 §4.2, htu is the target URI without query and fragment components.
6352
+ * WHATWG URL serialization handles RFC 3986 syntax- and scheme-based normalization
6353
+ * such as lowercasing scheme/host and eliding default ports.
6354
+ */
6355
+ function normalizeHtu(url, correlationId) {
6356
+ let parsedUrl;
6357
+ try {
6358
+ parsedUrl = new URL(url);
6359
+ }
6360
+ catch {
6361
+ throw createClientConfigurationError(urlParseError, correlationId);
6362
+ }
6363
+ if (!/^https:\/\//i.test(url) ||
6364
+ parsedUrl.protocol !== "https:" ||
6365
+ parsedUrl.username ||
6366
+ parsedUrl.password) {
6367
+ throw createClientConfigurationError(invalidDpopHtu, correlationId);
6368
+ }
6369
+ parsedUrl.search = "";
6370
+ parsedUrl.hash = "";
6371
+ return parsedUrl.href;
6372
+ }
6373
+ function validateDpopNonce(nonce, correlationId) {
6374
+ if (nonce !== undefined && nonce.trim().length === 0) {
6375
+ throw createClientConfigurationError(invalidDpopNonce, correlationId);
6376
+ }
6377
+ }
6378
+ /**
6379
+ * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6380
+ * resource-endpoint proof bindings.
6381
+ *
6382
+ * Not exported from any public package entry point.
6383
+ * This helper is internal-only until DPoP is wired into acquisition flows
6384
+ * in a subsequent work item.
6385
+ *
6386
+ * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6387
+ * @internal
6388
+ */
6389
+ class DpopProofGenerator {
6390
+ constructor(cryptoUtils, tokenBindingKeyManager) {
6391
+ this.cryptoUtils = cryptoUtils;
6392
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6393
+ }
6394
+ /**
6395
+ * Provisions a fresh DPoP key and returns the RFC 7638 JWK thumbprint used
6396
+ * as `dpop_jkt`.
6397
+ */
6398
+ async generateJkt(correlationId = "") {
6399
+ return this.tokenBindingKeyManager.provisionTokenBindingKey({
6400
+ tokenBindingKeyType: DPOP_TOKEN_BINDING_KEY_TYPE,
6401
+ tokenBindingKeyAlgorithm: DPOP_JWT_HEADER_ALGORITHM,
6402
+ correlationId,
6403
+ });
6404
+ }
6405
+ /**
6406
+ * Builds RFC 9449 claims for a token-endpoint DPoP proof.
6407
+ * - htm is always "POST" because token endpoint requests use HTTP POST (RFC 9449 §5).
6408
+ * - htu is the normalized token endpoint URI (query and fragment stripped).
6409
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6410
+ */
6411
+ buildTokenProofClaims(params, correlationId = "") {
6412
+ validateDpopNonce(params.nonce, correlationId);
6413
+ const claims = {
6414
+ jti: this.cryptoUtils.createNewGuid(),
6415
+ htm: "POST",
6416
+ htu: normalizeHtu(params.tokenEndpoint, correlationId),
6417
+ iat: nowSeconds(),
6418
+ };
6419
+ if (params.nonce !== undefined) {
6420
+ claims.nonce = params.nonce;
6421
+ }
6422
+ return claims;
6423
+ }
6424
+ /**
6425
+ * Builds and signs a compact DPoP proof JWT for a token-endpoint request.
6426
+ */
6427
+ async generateTokenProof(params, keyId, correlationId = "") {
6428
+ return this.generateProof(this.buildTokenProofClaims(params, correlationId), keyId, correlationId);
6429
+ }
6430
+ /**
6431
+ * Builds RFC 9449 claims for a resource-endpoint DPoP proof.
6432
+ * - htm is uppercased per RFC 9449 §4.2.
6433
+ * - htu is the normalized resource URI (query and fragment stripped).
6434
+ * - ath is the base64url-encoded SHA-256 hash of the ASCII access token.
6435
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6436
+ */
6437
+ buildResourceProofClaims(params, correlationId = "") {
6438
+ validateDpopNonce(params.nonce, correlationId);
6439
+ const claims = {
6440
+ jti: this.cryptoUtils.createNewGuid(),
6441
+ htm: normalizeHtm(params.htm, correlationId),
6442
+ htu: normalizeHtu(params.htu, correlationId),
6443
+ ath: params.ath,
6444
+ iat: nowSeconds(),
6445
+ };
6446
+ if (params.nonce !== undefined) {
6447
+ claims.nonce = params.nonce;
6448
+ }
6449
+ return claims;
6450
+ }
6451
+ /**
6452
+ * Builds and signs a compact DPoP proof JWT for a resource request.
6453
+ */
6454
+ async generateResourceProof(params, keyId, correlationId = "") {
6455
+ const { htu, htm, nonce } = params;
6456
+ if (!htu || !htm) {
6457
+ throw createClientConfigurationError(dpopMissingResourceContext, correlationId);
6458
+ }
6459
+ const ath = await this.cryptoUtils.hashString(params.accessToken);
6460
+ return this.generateProof(this.buildResourceProofClaims({
6461
+ htu,
6462
+ htm,
6463
+ ath,
6464
+ nonce,
6465
+ }, correlationId), keyId, correlationId);
6466
+ }
6467
+ async generateProof(claims, keyId, correlationId) {
6468
+ const publicJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, correlationId);
6469
+ return this.cryptoUtils.signTokenBindingJwt(buildProofHeader(publicJwk, correlationId), claims, keyId, correlationId);
6134
6470
  }
6135
6471
  }
6136
6472
 
@@ -6364,10 +6700,11 @@ var ProtocolUtils = /*#__PURE__*/Object.freeze({
6364
6700
  * @internal
6365
6701
  */
6366
6702
  class ResponseHandler {
6367
- constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
6703
+ constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
6368
6704
  this.clientId = clientId;
6369
6705
  this.cacheStorage = cacheStorage;
6370
6706
  this.cryptoObj = cryptoObj;
6707
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6371
6708
  this.logger = logger;
6372
6709
  this.performanceClient = performanceClient;
6373
6710
  this.serializableCache = serializableCache;
@@ -6441,7 +6778,21 @@ class ResponseHandler {
6441
6778
  }
6442
6779
  // Add keyId from request to serverTokenResponse if defined
6443
6780
  serverTokenResponse.key_id =
6444
- serverTokenResponse.key_id || request.sshKid || undefined;
6781
+ serverTokenResponse.key_id ||
6782
+ request.dpopJkt ||
6783
+ request.sshKid ||
6784
+ undefined;
6785
+ if (request.authenticationScheme === AuthenticationScheme.DPOP) {
6786
+ if (serverTokenResponse.token_type?.toLowerCase() !==
6787
+ AuthenticationScheme.DPOP.toLowerCase()) {
6788
+ this.performanceClient?.addFields({
6789
+ dpopTokenTypeMismatch: serverTokenResponse.token_type,
6790
+ }, request.correlationId);
6791
+ throw createClientAuthError(dpopTokenTypeMismatch, request.correlationId);
6792
+ }
6793
+ serverTokenResponse.token_type =
6794
+ AuthenticationScheme.DPOP;
6795
+ }
6445
6796
  // Compute components once for entity storage (fallback if hash not provided by client)
6446
6797
  const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6447
6798
  const cacheKeyComponents = additionalCacheKeyComponents ??
@@ -6476,7 +6827,12 @@ class ResponseHandler {
6476
6827
  this.performanceClient?.addFields({
6477
6828
  acntLoggedOut: true,
6478
6829
  }, request.correlationId);
6479
- return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, undefined, serverRequestId);
6830
+ return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6831
+ idTokenClaims,
6832
+ requestState: requestStateObj,
6833
+ requestId: serverRequestId,
6834
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6835
+ });
6480
6836
  }
6481
6837
  }
6482
6838
  await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
@@ -6489,7 +6845,13 @@ class ResponseHandler {
6489
6845
  await this.persistencePlugin.afterCacheAccess(cacheContext);
6490
6846
  }
6491
6847
  }
6492
- return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, serverTokenResponse, serverRequestId);
6848
+ return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6849
+ idTokenClaims,
6850
+ requestState: requestStateObj,
6851
+ serverTokenResponse,
6852
+ requestId: serverRequestId,
6853
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6854
+ });
6493
6855
  }
6494
6856
  /**
6495
6857
  * Generates CacheRecord
@@ -6585,14 +6947,17 @@ class ResponseHandler {
6585
6947
  * @param fromTokenCache
6586
6948
  * @param stateString
6587
6949
  */
6588
- static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, idTokenClaims, requestState, serverTokenResponse, requestId) {
6950
+ static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
6951
+ const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
6589
6952
  let accessToken = "";
6590
6953
  let responseScopes = [];
6591
6954
  let expiresOn = null;
6592
6955
  let extExpiresOn;
6593
6956
  let refreshOn;
6594
6957
  let familyId = "";
6958
+ let dpopProof;
6595
6959
  if (cacheRecord.accessToken) {
6960
+ const accessTokenType = cacheRecord.accessToken.tokenType?.toLowerCase();
6596
6961
  /*
6597
6962
  * if the request object has `popKid` property, `signPopToken` will be set to false and
6598
6963
  * the token will be returned unsigned
@@ -6600,7 +6965,7 @@ class ResponseHandler {
6600
6965
  if (cacheRecord.accessToken.tokenType ===
6601
6966
  AuthenticationScheme.POP &&
6602
6967
  !request.popKid) {
6603
- const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
6968
+ const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
6604
6969
  const { secret, keyId } = cacheRecord.accessToken;
6605
6970
  if (!keyId) {
6606
6971
  throw createClientAuthError(keyIdMissing, request.correlationId);
@@ -6610,6 +6975,18 @@ class ResponseHandler {
6610
6975
  else {
6611
6976
  accessToken = cacheRecord.accessToken.secret;
6612
6977
  }
6978
+ if (accessTokenType ===
6979
+ AuthenticationScheme.DPOP.toLowerCase()) {
6980
+ if (!cacheRecord.accessToken.keyId) {
6981
+ throw createClientAuthError(keyIdMissing, request.correlationId);
6982
+ }
6983
+ const dpopProofGenerator = new DpopProofGenerator(cryptoObj, tokenBindingKeyManager);
6984
+ dpopProof = await dpopProofGenerator.generateResourceProof({
6985
+ htu: request.resourceRequestUri,
6986
+ htm: request.resourceRequestMethod,
6987
+ accessToken: cacheRecord.accessToken.secret,
6988
+ }, cacheRecord.accessToken.keyId, request.correlationId);
6989
+ }
6613
6990
  responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target, request.correlationId).asArray();
6614
6991
  // Access token expiresOn cached in seconds, converting to Date for AuthenticationResult
6615
6992
  expiresOn = toDateFromSeconds(cacheRecord.accessToken.expiresOn);
@@ -6626,6 +7003,15 @@ class ResponseHandler {
6626
7003
  }
6627
7004
  const uid = idTokenClaims?.oid || idTokenClaims?.sub || "";
6628
7005
  const tid = idTokenClaims?.tid || "";
7006
+ /*
7007
+ * Surface the sovereign enclave for telemetry. This runs for both freshly acquired
7008
+ * and cache-served tokens because SilentFlowClient shares this method, so the field
7009
+ * is present on silent requests that never hit the network.
7010
+ */
7011
+ const regionSubScope = idTokenClaims?.tenant_region_sub_scope;
7012
+ if (typeof regionSubScope === "string") {
7013
+ performanceClient?.addFields({ regionSubScope }, request.correlationId);
7014
+ }
6629
7015
  // for hybrid + native bridge enablement, send back the native account Id
6630
7016
  if (serverTokenResponse?.spa_accountid && !!cacheRecord.account) {
6631
7017
  // Set on deprecated top-level for downgrade compat
@@ -6654,6 +7040,7 @@ class ResponseHandler {
6654
7040
  idToken: cacheRecord?.idToken?.secret || "",
6655
7041
  idTokenClaims: idTokenClaims || {},
6656
7042
  accessToken: accessToken,
7043
+ dpopProof,
6657
7044
  fromCache: fromTokenCache,
6658
7045
  expiresOn: expiresOn,
6659
7046
  extExpiresOn: extExpiresOn,
@@ -6661,7 +7048,10 @@ class ResponseHandler {
6661
7048
  correlationId: request.correlationId,
6662
7049
  requestId: requestId || "",
6663
7050
  familyId: familyId,
6664
- tokenType: cacheRecord.accessToken?.tokenType || "",
7051
+ tokenType: cacheRecord.accessToken?.tokenType?.toLowerCase() ===
7052
+ AuthenticationScheme.DPOP.toLowerCase()
7053
+ ? AuthenticationScheme.DPOP
7054
+ : cacheRecord.accessToken?.tokenType || "",
6665
7055
  state: requestState ? requestState.userRequestState : "",
6666
7056
  cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || "",
6667
7057
  msGraphHost: cacheRecord.account?.msGraphHost || "",
@@ -6907,6 +7297,23 @@ function createTokenRequestHeaders(logger, preventCorsPreflight, ccsCred) {
6907
7297
  }
6908
7298
  return headers;
6909
7299
  }
7300
+ /**
7301
+ * Adds the DPoP proof header for token endpoint requests when DPoP is requested.
7302
+ * @internal
7303
+ */
7304
+ async function addDpopTokenProofHeader(headers, request, tokenEndpoint, cryptoUtils, tokenBindingKeyManager) {
7305
+ if (request.authenticationScheme !== AuthenticationScheme.DPOP) {
7306
+ return;
7307
+ }
7308
+ const dpopProofGenerator = new DpopProofGenerator(cryptoUtils, tokenBindingKeyManager);
7309
+ const keyId = request.dpopJkt;
7310
+ if (!keyId?.trim()) {
7311
+ throw createClientAuthError(keyIdMissing, request.correlationId);
7312
+ }
7313
+ headers[HeaderNames.DPOP] = await dpopProofGenerator.generateTokenProof({
7314
+ tokenEndpoint,
7315
+ }, keyId, request.correlationId);
7316
+ }
6910
7317
  /**
6911
7318
  * Creates query string for the /token request
6912
7319
  * @param request
@@ -6995,6 +7402,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6995
7402
 
6996
7403
  var Token = /*#__PURE__*/Object.freeze({
6997
7404
  __proto__: null,
7405
+ addDpopTokenProofHeader: addDpopTokenProofHeader,
6998
7406
  createTokenQueryParameters: createTokenQueryParameters,
6999
7407
  createTokenRequestHeaders: createTokenRequestHeaders,
7000
7408
  executePostToTokenEndpoint: executePostToTokenEndpoint,
@@ -7049,7 +7457,7 @@ class AuthorizationCodeClient {
7049
7457
  const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
7050
7458
  // Retrieve requestId from response headers
7051
7459
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
7052
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7460
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
7053
7461
  // Validate response. This function throws a server error if an error is returned by the server.
7054
7462
  responseHandler.validateTokenResponse(response.body, request.correlationId);
7055
7463
  return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, authCodePayload, undefined, undefined, undefined, requestId);
@@ -7091,6 +7499,7 @@ class AuthorizationCodeClient {
7091
7499
  }
7092
7500
  }
7093
7501
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, ccsCredential || request.ccsCredential);
7502
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
7094
7503
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
7095
7504
  return invokeAsync(executePostToTokenEndpoint, AuthorizationCodeClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, this.cacheManager, this.networkClient, this.logger, this.performanceClient, serverTelemetryManager);
7096
7505
  }
@@ -7150,7 +7559,7 @@ class AuthorizationCodeClient {
7150
7559
  addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
7151
7560
  addClientInfo(parameters);
7152
7561
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7153
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7562
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7154
7563
  let reqCnfData;
7155
7564
  if (!request.popKid) {
7156
7565
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7295,7 +7704,7 @@ class RefreshTokenClient {
7295
7704
  const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
7296
7705
  // Retrieve requestId from response headers
7297
7706
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
7298
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7707
+ const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
7299
7708
  responseHandler.validateTokenResponse(response.body, request.correlationId);
7300
7709
  return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, undefined, undefined, true, request.forceCache, requestId);
7301
7710
  }
@@ -7371,6 +7780,12 @@ class RefreshTokenClient {
7371
7780
  type: CcsCredentialType.HOME_ACCOUNT_ID,
7372
7781
  },
7373
7782
  };
7783
+ if (refreshTokenRequest.authenticationScheme ===
7784
+ AuthenticationScheme.DPOP &&
7785
+ !refreshTokenRequest.dpopJkt) {
7786
+ const dpopProofGenerator = new DpopProofGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager);
7787
+ refreshTokenRequest.dpopJkt = await dpopProofGenerator.generateJkt(request.correlationId);
7788
+ }
7374
7789
  try {
7375
7790
  return await invokeAsync(this.acquireToken.bind(this), RefreshTokenClientAcquireToken, this.logger, this.performanceClient, request.correlationId)(refreshTokenRequest, apiId);
7376
7791
  }
@@ -7396,6 +7811,7 @@ class RefreshTokenClient {
7396
7811
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
7397
7812
  const requestBody = await invokeAsync(this.createTokenRequestBody.bind(this), RefreshTokenClientCreateTokenRequestBody, this.logger, this.performanceClient, request.correlationId)(request);
7398
7813
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, request.ccsCredential);
7814
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
7399
7815
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
7400
7816
  return invokeAsync(executePostToTokenEndpoint, RefreshTokenClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, this.cacheManager, this.networkClient, this.logger, this.performanceClient, this.serverTelemetryManager);
7401
7817
  }
@@ -7436,7 +7852,7 @@ class RefreshTokenClient {
7436
7852
  addClientAssertionType(parameters, clientAssertion.assertionType);
7437
7853
  }
7438
7854
  if (request.authenticationScheme === AuthenticationScheme.POP) {
7439
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7855
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7440
7856
  let reqCnfData;
7441
7857
  if (!request.popKid) {
7442
7858
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7554,6 +7970,22 @@ class SilentFlowClient {
7554
7970
  lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
7555
7971
  // don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
7556
7972
  }
7973
+ const cachedAccessTokenType = cachedAccessToken.tokenType?.toLowerCase();
7974
+ if (cachedAccessTokenType === AuthenticationScheme.DPOP.toLowerCase()) {
7975
+ if (!cachedAccessToken.keyId) {
7976
+ this.logger.info("SilentFlowClient:acquireCachedToken - Cached DPoP access token is missing keyId; refresh required", request.correlationId);
7977
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
7978
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
7979
+ }
7980
+ try {
7981
+ await this.config.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(cachedAccessToken.keyId, request.correlationId);
7982
+ }
7983
+ catch {
7984
+ this.logger.info("SilentFlowClient:acquireCachedToken - Local DPoP key was not found for cached access token; refresh required", request.correlationId);
7985
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
7986
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
7987
+ }
7988
+ }
7557
7989
  const environment = request.authority || this.authority.getPreferredCache();
7558
7990
  const cacheRecord = {
7559
7991
  account: this.cacheManager.getAccount(this.cacheManager.generateAccountKey(request.account), request.correlationId),
@@ -7589,7 +8021,10 @@ class SilentFlowClient {
7589
8021
  if (cacheRecord.idToken) {
7590
8022
  idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
7591
8023
  }
7592
- return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
8024
+ return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
8025
+ idTokenClaims,
8026
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
8027
+ });
7593
8028
  }
7594
8029
  }
7595
8030
 
@@ -8286,12 +8721,14 @@ exports.ClientConfigurationErrorCodes = ClientConfigurationErrorCodes;
8286
8721
  exports.Constants = Constants;
8287
8722
  exports.DEFAULT_CRYPTO_IMPLEMENTATION = DEFAULT_CRYPTO_IMPLEMENTATION;
8288
8723
  exports.DEFAULT_SYSTEM_OPTIONS = DEFAULT_SYSTEM_OPTIONS;
8724
+ exports.DEFAULT_TOKEN_BINDING_KEY_MANAGER = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
8289
8725
  exports.DefaultStorageClass = DefaultStorageClass;
8290
8726
  exports.EXT_FIELD_PREFIX = EXT_FIELD_PREFIX;
8291
8727
  exports.IntFields = IntFields;
8292
8728
  exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
8293
8729
  exports.InteractionRequiredAuthErrorCodes = InteractionRequiredAuthErrorCodes;
8294
- exports.JsonWebTokenTypes = JsonWebTokenTypes;
8730
+ exports.JoseHeader = JoseHeader;
8731
+ exports.JsonWebTokenAlgorithms = JsonWebTokenAlgorithms;
8295
8732
  exports.Logger = Logger;
8296
8733
  exports.NetworkError = NetworkError;
8297
8734
  exports.PerformanceEventStatus = PerformanceEventStatus;
@@ -8340,4 +8777,4 @@ exports.invokeAsync = invokeAsync;
8340
8777
  exports.tenantIdMatchesHomeTenant = tenantIdMatchesHomeTenant;
8341
8778
  exports.updateAccountTenantProfileData = updateAccountTenantProfileData;
8342
8779
  exports.version = version;
8343
- //# sourceMappingURL=index-node-3p7V__ym.js.map
8780
+ //# sourceMappingURL=index-node-l_NIe8t5.js.map