@azure/msal-browser 5.17.3 → 5.19.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 (329) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  4. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
  7. package/dist/cache/AccountManager.mjs +1 -1
  8. package/dist/cache/AsyncMemoryStorage.mjs +9 -12
  9. package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
  10. package/dist/cache/BrowserCacheManager.mjs +15 -7
  11. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  12. package/dist/cache/CacheHelpers.mjs +1 -1
  13. package/dist/cache/CacheKeys.mjs +1 -1
  14. package/dist/cache/CookieStorage.mjs +1 -1
  15. package/dist/cache/DatabaseStorage.mjs +1 -1
  16. package/dist/cache/EncryptedData.mjs +1 -1
  17. package/dist/cache/LocalStorage.mjs +1 -1
  18. package/dist/cache/MemoryStorage.mjs +1 -1
  19. package/dist/cache/SessionStorage.mjs +1 -1
  20. package/dist/cache/TokenCache.mjs +1 -1
  21. package/dist/config/Configuration.mjs +1 -1
  22. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  23. package/dist/controllers/StandardController.mjs +34 -17
  24. package/dist/controllers/StandardController.mjs.map +1 -1
  25. package/dist/crypto/BrowserCrypto.mjs +19 -19
  26. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  27. package/dist/crypto/CryptoOps.mjs +62 -103
  28. package/dist/crypto/CryptoOps.mjs.map +1 -1
  29. package/dist/crypto/PkceGenerator.mjs +1 -1
  30. package/dist/crypto/SignedHttpRequest.mjs +4 -2
  31. package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
  32. package/dist/crypto/TokenBindingKeyManager.mjs +157 -0
  33. package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -0
  34. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  35. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  36. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +2 -2
  37. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  38. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  39. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  55. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  56. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  57. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  58. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  59. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  60. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  61. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  62. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  63. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  64. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  65. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  66. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  67. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  68. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  69. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  70. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  71. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +4 -4
  72. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs.map +1 -1
  73. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +4 -3
  74. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs.map +1 -1
  75. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  76. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  77. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  78. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  79. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  80. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  81. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  82. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  83. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  84. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  85. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  86. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  87. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  88. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  89. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  90. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  91. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  92. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  93. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  94. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  95. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  96. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  97. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  98. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  99. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  100. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  101. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  102. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +2 -1
  103. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs.map +1 -1
  104. package/dist/custom_auth/index.mjs +1 -1
  105. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  106. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  107. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  108. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  109. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  110. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  111. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  112. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  113. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  114. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  115. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  116. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  117. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  118. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  119. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  120. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  121. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  122. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  123. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  124. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  125. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  126. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  127. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  128. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  129. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  130. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  131. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  132. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  133. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  134. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  135. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  136. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  137. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  138. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  139. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  140. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  141. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  142. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  143. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  144. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  145. package/dist/encode/Base64Decode.mjs +1 -1
  146. package/dist/encode/Base64Encode.mjs +1 -1
  147. package/dist/error/BrowserAuthError.mjs +1 -1
  148. package/dist/error/BrowserAuthErrorCodes.mjs +5 -2
  149. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  150. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  151. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  152. package/dist/error/NativeAuthError.mjs +1 -1
  153. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  154. package/dist/error/NestedAppAuthError.mjs +1 -1
  155. package/dist/event/EventHandler.mjs +1 -1
  156. package/dist/event/EventMessage.mjs +1 -1
  157. package/dist/event/EventType.mjs +1 -1
  158. package/dist/index.mjs +1 -1
  159. package/dist/interaction_client/BaseInteractionClient.mjs +6 -2
  160. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  161. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  162. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +30 -9
  163. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  164. package/dist/interaction_client/PopupClient.mjs +3 -3
  165. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  166. package/dist/interaction_client/RedirectClient.mjs +3 -3
  167. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  168. package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -3
  169. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  170. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  171. package/dist/interaction_client/SilentIframeClient.mjs +3 -3
  172. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  173. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  174. package/dist/interaction_client/StandardInteractionClient.mjs +2 -1
  175. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  176. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  177. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  178. package/dist/log-strings-mapping.json +1196 -1200
  179. package/dist/naa/BridgeError.mjs +1 -1
  180. package/dist/naa/BridgeProxy.mjs +27 -32
  181. package/dist/naa/BridgeProxy.mjs.map +1 -1
  182. package/dist/naa/BridgeStatusCode.mjs +1 -1
  183. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +54 -25
  184. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
  185. package/dist/navigation/NavigationClient.mjs +1 -1
  186. package/dist/network/FetchClient.mjs +1 -1
  187. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  188. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  189. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  190. package/dist/packageMetadata.mjs +2 -2
  191. package/dist/popup_relay/constants.mjs +1 -1
  192. package/dist/popup_relay/index.mjs +1 -1
  193. package/dist/popup_relay/relayClient.mjs +1 -1
  194. package/dist/protocol/Authorize.mjs +5 -3
  195. package/dist/protocol/Authorize.mjs.map +1 -1
  196. package/dist/redirect_bridge/index.mjs +1 -1
  197. package/dist/request/RequestHelpers.mjs +11 -3
  198. package/dist/request/RequestHelpers.mjs.map +1 -1
  199. package/dist/response/ResponseHandler.mjs +1 -1
  200. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  201. package/dist/telemetry/BrowserPerformanceEvents.mjs +5 -5
  202. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  203. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  204. package/dist/utils/BrowserConstants.mjs +1 -1
  205. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  206. package/dist/utils/BrowserUtils.mjs +1 -1
  207. package/dist/utils/Helpers.mjs +1 -1
  208. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  209. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +64 -0
  210. package/dist/webBrokerBridge/PendingRequestRegistry.mjs.map +1 -0
  211. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +39 -0
  212. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs.map +1 -0
  213. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +58 -0
  214. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs.map +1 -0
  215. package/lib/custom-auth-path/log-strings-mapping.json +39 -43
  216. package/lib/custom-auth-path/msal-custom-auth.cjs +4542 -4060
  217. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  218. package/lib/custom-auth-path/msal-custom-auth.js +4542 -4060
  219. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  220. package/lib/log-strings-mapping.json +11 -15
  221. package/lib/msal-browser.cjs +1030 -432
  222. package/lib/msal-browser.cjs.map +1 -1
  223. package/lib/msal-browser.js +1030 -432
  224. package/lib/msal-browser.js.map +1 -1
  225. package/lib/msal-browser.min.js +2 -2
  226. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  227. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  228. package/lib/popup-relay/msal-popup-relay.js +2 -2
  229. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  230. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  231. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  232. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  233. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  234. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  235. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  236. package/package.json +2 -2
  237. package/src/broker/nativeBroker/PlatformAuthRequest.ts +2 -1
  238. package/src/cache/AsyncMemoryStorage.ts +7 -13
  239. package/src/cache/BrowserCacheManager.ts +24 -6
  240. package/src/controllers/StandardController.ts +58 -15
  241. package/src/crypto/BrowserCrypto.ts +10 -8
  242. package/src/crypto/CryptoOps.ts +138 -178
  243. package/src/crypto/SignedHttpRequest.ts +3 -0
  244. package/src/crypto/TokenBindingKeyManager.ts +299 -0
  245. package/src/custom_auth/controller/CustomAuthStandardController.ts +2 -1
  246. package/src/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.ts +8 -3
  247. package/src/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.ts +7 -3
  248. package/src/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.ts +1 -0
  249. package/src/error/BrowserAuthErrorCodes.ts +6 -0
  250. package/src/interaction_client/BaseInteractionClient.ts +8 -1
  251. package/src/interaction_client/PlatformAuthInteractionClient.ts +44 -6
  252. package/src/interaction_client/PopupClient.ts +5 -2
  253. package/src/interaction_client/RedirectClient.ts +5 -2
  254. package/src/interaction_client/SilentAuthCodeClient.ts +5 -2
  255. package/src/interaction_client/SilentIframeClient.ts +5 -2
  256. package/src/interaction_client/StandardInteractionClient.ts +1 -0
  257. package/src/naa/BridgeProxy.ts +38 -44
  258. package/src/naa/TokenRequest.ts +1 -0
  259. package/src/naa/mapping/NestedAppAuthAdapter.ts +62 -55
  260. package/src/packageMetadata.ts +1 -1
  261. package/src/protocol/Authorize.ts +8 -1
  262. package/src/request/RequestHelpers.ts +19 -2
  263. package/src/telemetry/BrowserPerformanceEvents.ts +4 -4
  264. package/src/webBrokerBridge/IWebBrokerBridgeMessage.ts +42 -0
  265. package/src/webBrokerBridge/PendingRequestRegistry.ts +76 -0
  266. package/src/webBrokerBridge/WebBrokerBridgeError.ts +69 -0
  267. package/src/webBrokerBridge/WebBrokerBridgeErrorMap.ts +108 -0
  268. package/src/webBrokerBridge/index.ts +25 -0
  269. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +1 -0
  270. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
  271. package/types/cache/AsyncMemoryStorage.d.ts +1 -2
  272. package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
  273. package/types/cache/BrowserCacheManager.d.ts +7 -5
  274. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  275. package/types/controllers/StandardController.d.ts +2 -1
  276. package/types/controllers/StandardController.d.ts.map +1 -1
  277. package/types/crypto/BrowserCrypto.d.ts +2 -2
  278. package/types/crypto/BrowserCrypto.d.ts.map +1 -1
  279. package/types/crypto/CryptoOps.d.ts +7 -21
  280. package/types/crypto/CryptoOps.d.ts.map +1 -1
  281. package/types/crypto/SignedHttpRequest.d.ts.map +1 -1
  282. package/types/crypto/TokenBindingKeyManager.d.ts +83 -0
  283. package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -0
  284. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  285. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  286. package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts +2 -2
  287. package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts.map +1 -1
  288. package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts +4 -3
  289. package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts.map +1 -1
  290. package/types/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.d.ts.map +1 -1
  291. package/types/error/BrowserAuthErrorCodes.d.ts +3 -0
  292. package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  293. package/types/index.d.ts +1 -0
  294. package/types/index.d.ts.map +1 -1
  295. package/types/interaction_client/BaseInteractionClient.d.ts +3 -2
  296. package/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  297. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +2 -2
  298. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  299. package/types/interaction_client/PopupClient.d.ts +2 -2
  300. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  301. package/types/interaction_client/RedirectClient.d.ts +2 -2
  302. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  303. package/types/interaction_client/SilentAuthCodeClient.d.ts +2 -2
  304. package/types/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  305. package/types/interaction_client/SilentIframeClient.d.ts +2 -2
  306. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  307. package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  308. package/types/naa/BridgeProxy.d.ts +14 -2
  309. package/types/naa/BridgeProxy.d.ts.map +1 -1
  310. package/types/naa/TokenRequest.d.ts +1 -0
  311. package/types/naa/TokenRequest.d.ts.map +1 -1
  312. package/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  313. package/types/packageMetadata.d.ts +1 -1
  314. package/types/protocol/Authorize.d.ts.map +1 -1
  315. package/types/request/RequestHelpers.d.ts.map +1 -1
  316. package/types/telemetry/BrowserPerformanceEvents.d.ts +4 -4
  317. package/types/webBrokerBridge/IWebBrokerBridgeMessage.d.ts +35 -0
  318. package/types/webBrokerBridge/IWebBrokerBridgeMessage.d.ts.map +1 -0
  319. package/types/webBrokerBridge/PendingRequestRegistry.d.ts +27 -0
  320. package/types/webBrokerBridge/PendingRequestRegistry.d.ts.map +1 -0
  321. package/types/webBrokerBridge/WebBrokerBridgeError.d.ts +50 -0
  322. package/types/webBrokerBridge/WebBrokerBridgeError.d.ts.map +1 -0
  323. package/types/webBrokerBridge/WebBrokerBridgeErrorMap.d.ts +10 -0
  324. package/types/webBrokerBridge/WebBrokerBridgeErrorMap.d.ts.map +1 -0
  325. package/types/webBrokerBridge/index.d.ts +16 -0
  326. package/types/webBrokerBridge/index.d.ts.map +1 -0
  327. package/src/naa/BridgeRequest.ts +0 -16
  328. package/types/naa/BridgeRequest.d.ts +0 -8
  329. package/types/naa/BridgeRequest.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v5.17.3 2026-07-29 */
1
+ /*! @azure/msal-browser v5.19.0 2026-08-18 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v16.11.3 2026-07-29 */
9
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -56,9 +56,10 @@
56
56
  const EAR_JWK = "ear_jwk";
57
57
  const EAR_JWE_CRYPTO = "ear_jwe_crypto";
58
58
  const RESOURCE = "resource";
59
- const CLI_DATA = "clidata";
59
+ const CLI_DATA = "clidata";
60
+ const ATTRIBUTE_TOKENS = "attribute_tokens";
60
61
 
61
- /*! @azure/msal-common v16.11.3 2026-07-29 */
62
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
62
63
  /*
63
64
  * Copyright (c) Microsoft Corporation. All rights reserved.
64
65
  * Licensed under the MIT License.
@@ -290,11 +291,12 @@
290
291
  Jwt: "JWT",
291
292
  Jwk: "JWK",
292
293
  Pop: "pop",
294
+ Dpop: "dpop+jwt",
293
295
  };
294
296
  // Token renewal offset default in seconds
295
297
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
296
298
 
297
- /*! @azure/msal-common v16.11.3 2026-07-29 */
299
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
298
300
  /*
299
301
  * Copyright (c) Microsoft Corporation. All rights reserved.
300
302
  * Licensed under the MIT License.
@@ -323,7 +325,7 @@
323
325
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
324
326
  }
325
327
 
326
- /*! @azure/msal-common v16.11.3 2026-07-29 */
328
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
327
329
 
328
330
  /*
329
331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -346,7 +348,7 @@
346
348
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
347
349
  }
348
350
 
349
- /*! @azure/msal-common v16.11.3 2026-07-29 */
351
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
350
352
  /*
351
353
  * Copyright (c) Microsoft Corporation. All rights reserved.
352
354
  * Licensed under the MIT License.
@@ -430,7 +432,7 @@
430
432
  userCanceled: userCanceled
431
433
  });
432
434
 
433
- /*! @azure/msal-common v16.11.3 2026-07-29 */
435
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
434
436
 
435
437
  /*
436
438
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -468,7 +470,7 @@
468
470
  };
469
471
  }
470
472
 
471
- /*! @azure/msal-common v16.11.3 2026-07-29 */
473
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
472
474
 
473
475
  /*
474
476
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -534,7 +536,7 @@
534
536
  return matches[2];
535
537
  }
536
538
 
537
- /*! @azure/msal-common v16.11.3 2026-07-29 */
539
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
538
540
 
539
541
  /*
540
542
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -622,7 +624,7 @@
622
624
  return updatedAccountInfo;
623
625
  }
624
626
 
625
- /*! @azure/msal-common v16.11.3 2026-07-29 */
627
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
626
628
  /*
627
629
  * Copyright (c) Microsoft Corporation. All rights reserved.
628
630
  * Licensed under the MIT License.
@@ -637,7 +639,7 @@
637
639
  Ciam: 3,
638
640
  };
639
641
 
640
- /*! @azure/msal-common v16.11.3 2026-07-29 */
642
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
641
643
  /*
642
644
  * Copyright (c) Microsoft Corporation. All rights reserved.
643
645
  * Licensed under the MIT License.
@@ -659,7 +661,7 @@
659
661
  return null;
660
662
  }
661
663
 
662
- /*! @azure/msal-common v16.11.3 2026-07-29 */
664
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
663
665
  /*
664
666
  * Copyright (c) Microsoft Corporation. All rights reserved.
665
667
  * Licensed under the MIT License.
@@ -683,7 +685,7 @@
683
685
  EAR: "EAR",
684
686
  };
685
687
 
686
- /*! @azure/msal-common v16.11.3 2026-07-29 */
688
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
687
689
  /**
688
690
  * Returns the AccountInfo interface for this account.
689
691
  * @internal
@@ -872,7 +874,7 @@
872
874
  entity.hasOwnProperty("authorityType"));
873
875
  }
874
876
 
875
- /*! @azure/msal-common v16.11.3 2026-07-29 */
877
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
876
878
  /*
877
879
  * Copyright (c) Microsoft Corporation. All rights reserved.
878
880
  * Licensed under the MIT License.
@@ -889,7 +891,7 @@
889
891
  unexpectedError: unexpectedError
890
892
  });
891
893
 
892
- /*! @azure/msal-common v16.11.3 2026-07-29 */
894
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
893
895
 
894
896
  /*
895
897
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -909,7 +911,7 @@
909
911
  return new ClientConfigurationError(errorCode, correlationId);
910
912
  }
911
913
 
912
- /*! @azure/msal-common v16.11.3 2026-07-29 */
914
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
913
915
  /*
914
916
  * Copyright (c) Microsoft Corporation. All rights reserved.
915
917
  * Licensed under the MIT License.
@@ -930,6 +932,7 @@
930
932
  const untrustedAuthority = "untrusted_authority";
931
933
  const missingSshJwk = "missing_ssh_jwk";
932
934
  const missingSshKid = "missing_ssh_kid";
935
+ const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
933
936
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
934
937
  const invalidAuthenticationHeader = "invalid_authentication_header";
935
938
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
@@ -968,12 +971,13 @@
968
971
  pkceParamsMissing: pkceParamsMissing,
969
972
  redirectUriEmpty: redirectUriEmpty,
970
973
  tokenRequestEmpty: tokenRequestEmpty,
974
+ unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
971
975
  untrustedAuthority: untrustedAuthority,
972
976
  urlEmptyError: urlEmptyError,
973
977
  urlParseError: urlParseError
974
978
  });
975
979
 
976
- /*! @azure/msal-common v16.11.3 2026-07-29 */
980
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
977
981
 
978
982
  /*
979
983
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1031,7 +1035,7 @@
1031
1035
  }
1032
1036
  }
1033
1037
 
1034
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1038
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1035
1039
  /*
1036
1040
  * Copyright (c) Microsoft Corporation. All rights reserved.
1037
1041
  * Licensed under the MIT License.
@@ -1043,7 +1047,7 @@
1043
1047
  response.hasOwnProperty("jwks_uri"));
1044
1048
  }
1045
1049
 
1046
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1050
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1047
1051
  /*
1048
1052
  * Copyright (c) Microsoft Corporation. All rights reserved.
1049
1053
  * Licensed under the MIT License.
@@ -1123,7 +1127,7 @@
1123
1127
  }
1124
1128
  }
1125
1129
 
1126
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1130
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1127
1131
 
1128
1132
  /*
1129
1133
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1281,7 +1285,7 @@
1281
1285
  }
1282
1286
  }
1283
1287
 
1284
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1288
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1285
1289
 
1286
1290
  /*
1287
1291
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1290,10 +1294,7 @@
1290
1294
  // Build endpoint metadata dynamically to avoid string duplication
1291
1295
  const endpointHosts = [
1292
1296
  { host: "login.microsoftonline.com" },
1293
- {
1294
- host: "login.chinacloudapi.cn",
1295
- issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
1296
- },
1297
+ { host: "login.partner.microsoftonline.cn" },
1297
1298
  { host: "login.microsoftonline.us" },
1298
1299
  { host: "login.sovcloud-identity.fr" },
1299
1300
  { host: "login.sovcloud-identity.de" },
@@ -1447,7 +1448,7 @@
1447
1448
  return null;
1448
1449
  }
1449
1450
 
1450
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1451
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1451
1452
  /*
1452
1453
  * Copyright (c) Microsoft Corporation. All rights reserved.
1453
1454
  * Licensed under the MIT License.
@@ -1467,7 +1468,7 @@
1467
1468
  AzureUsGovernment: "https://login.microsoftonline.us",
1468
1469
  };
1469
1470
 
1470
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1471
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1471
1472
  /*
1472
1473
  * Copyright (c) Microsoft Corporation. All rights reserved.
1473
1474
  * Licensed under the MIT License.
@@ -1477,7 +1478,7 @@
1477
1478
  response.hasOwnProperty("metadata"));
1478
1479
  }
1479
1480
 
1480
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1481
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1481
1482
  /*
1482
1483
  * Copyright (c) Microsoft Corporation. All rights reserved.
1483
1484
  * Licensed under the MIT License.
@@ -1487,7 +1488,7 @@
1487
1488
  response.hasOwnProperty("error_description"));
1488
1489
  }
1489
1490
 
1490
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1491
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1491
1492
  /*
1492
1493
  * Copyright (c) Microsoft Corporation. All rights reserved.
1493
1494
  * Licensed under the MIT License.
@@ -1558,7 +1559,7 @@
1558
1559
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1559
1560
  const SetUserData = "setUserData";
1560
1561
 
1561
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1562
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1562
1563
  /*
1563
1564
  * Copyright (c) Microsoft Corporation. All rights reserved.
1564
1565
  * Licensed under the MIT License.
@@ -1651,7 +1652,7 @@
1651
1652
  };
1652
1653
  };
1653
1654
 
1654
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1655
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1655
1656
 
1656
1657
  /*
1657
1658
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1762,7 +1763,7 @@
1762
1763
  },
1763
1764
  };
1764
1765
 
1765
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1766
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1766
1767
  /*
1767
1768
  * Copyright (c) Microsoft Corporation. All rights reserved.
1768
1769
  * Licensed under the MIT License.
@@ -1827,7 +1828,7 @@
1827
1828
  return cachedAtSec > nowSeconds();
1828
1829
  }
1829
1830
 
1830
- /*! @azure/msal-common v16.11.3 2026-07-29 */
1831
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
1831
1832
 
1832
1833
  /*
1833
1834
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1884,6 +1885,7 @@
1884
1885
  if (refreshOn) {
1885
1886
  atEntity.refreshOn = refreshOn.toString();
1886
1887
  }
1888
+ const normalizedTokenType = atEntity.tokenType?.toLowerCase();
1887
1889
  /*
1888
1890
  * Create Access Token With Auth Scheme instead of regular access token
1889
1891
  * Cast to lower to handle "bearer" from ADFS
@@ -1892,7 +1894,7 @@
1892
1894
  AuthenticationScheme$1.BEARER.toLowerCase()) {
1893
1895
  atEntity.credentialType =
1894
1896
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
1895
- switch (atEntity.tokenType) {
1897
+ switch (normalizedTokenType) {
1896
1898
  case AuthenticationScheme$1.POP:
1897
1899
  // Make sure keyId is present and add it to credential
1898
1900
  const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
@@ -1901,6 +1903,12 @@
1901
1903
  }
1902
1904
  atEntity.keyId = tokenClaims.cnf.kid;
1903
1905
  break;
1906
+ case "dpop":
1907
+ if (!keyId) {
1908
+ throw createClientAuthError(keyIdMissing, correlationId);
1909
+ }
1910
+ atEntity.keyId = keyId;
1911
+ break;
1904
1912
  case AuthenticationScheme$1.SSH:
1905
1913
  atEntity.keyId = keyId;
1906
1914
  }
@@ -2092,9 +2100,22 @@
2092
2100
  */
2093
2101
  function isAuthorityMetadataExpired(metadata) {
2094
2102
  return metadata.expiresAt <= nowSeconds();
2103
+ }
2104
+ /**
2105
+ * Serialize attribute tokens synchronously (sort and join).
2106
+ * This is a sync-only operation for use at request construction time.
2107
+ * @param attributeTokens - array of tokens
2108
+ * @returns serialized partition string or undefined if no tokens
2109
+ */
2110
+ function serializeAttributeTokens(attributeTokens) {
2111
+ if (!attributeTokens || attributeTokens.length === 0) {
2112
+ return undefined;
2113
+ }
2114
+ // Serialize: sort and join tokens
2115
+ return [...attributeTokens].sort().join(" ");
2095
2116
  }
2096
2117
 
2097
- /*! @azure/msal-common v16.11.3 2026-07-29 */
2118
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
2098
2119
 
2099
2120
  /*
2100
2121
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3064,7 +3085,7 @@
3064
3085
  };
3065
3086
  }
3066
3087
 
3067
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3088
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3068
3089
 
3069
3090
  /*
3070
3091
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3098,7 +3119,7 @@
3098
3119
  }
3099
3120
  }
3100
3121
 
3101
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3122
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3102
3123
 
3103
3124
  /*
3104
3125
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3294,7 +3315,7 @@
3294
3315
  }
3295
3316
  }
3296
3317
 
3297
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3318
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3298
3319
 
3299
3320
  /*
3300
3321
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3422,13 +3443,14 @@
3422
3443
  * @param claims - The claims string from the request
3423
3444
  * @param clientCapabilities - The client capabilities from configuration
3424
3445
  * @param skipBrokerClaims - When true and BROKER_CLIENT_ID is present, excludes clientCapabilities from claims
3446
+ * @param claimsToMerge - Optional client-originated claims JSON string (e.g. `claimsFromClient`) deep-merged into `claims` with precedence on conflicts
3425
3447
  */
3426
- function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
3448
+ function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims, claimsToMerge) {
3427
3449
  // Skip clientCapabilities if skipBrokerClaims is set to true and this is a brokered authentication flow
3428
3450
  const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID)
3429
3451
  ? undefined
3430
3452
  : clientCapabilities;
3431
- const mergedClaims = buildMergedClaims$1(claims, configClaims, correlationId);
3453
+ const mergedClaims = buildMergedClaims$1(claims, configClaims, correlationId, claimsToMerge);
3432
3454
  parameters.set(CLAIMS, mergedClaims);
3433
3455
  }
3434
3456
  /**
@@ -3594,32 +3616,79 @@
3594
3616
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
3595
3617
  };
3596
3618
  /**
3597
- * Parses claims JSON, merges default optional idToken claims (signin_state, login_hint),
3598
- * and appends client capabilities (xms_cc) to the access_token section.
3619
+ * Parses a claims JSON string into an object, throwing a ClientConfigurationError
3620
+ * (error code `invalid_claims`) if the value is not a valid JSON object. The raw
3621
+ * claims value is never included in the error - it may contain sensitive data.
3622
+ * @param claims - Claims JSON string. Must be valid JSON representing an object.
3623
+ * @param correlationId - The request correlation id
3624
+ * @returns The parsed claims object
3625
+ */
3626
+ function parseClaims(claims, correlationId = "") {
3627
+ let parsed;
3628
+ try {
3629
+ parsed = JSON.parse(claims);
3630
+ }
3631
+ catch (e) {
3632
+ // Malformed JSON
3633
+ throw createClientConfigurationError(invalidClaims, correlationId);
3634
+ }
3635
+ if (!isPlainObject$1(parsed)) {
3636
+ // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
3637
+ throw createClientConfigurationError(invalidClaims, correlationId);
3638
+ }
3639
+ return parsed;
3640
+ }
3641
+ /**
3642
+ * Type guard for a non-null, non-array object (a JSON "object" value).
3643
+ * @param value - The value to test
3644
+ * @returns True when value is a plain object that can be deep-merged
3645
+ */
3646
+ function isPlainObject$1(value) {
3647
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3648
+ }
3649
+ /**
3650
+ * Recursively deep-merges two parsed claims objects. Nested objects are merged key-by-key;
3651
+ * for any other value type (arrays, scalars, null) the value from `claimsToMerge` replaces
3652
+ * the base. This mirrors the deep merge used by msal-dotnet so that, for example, a server
3653
+ * `access_token` challenge and a client-originated `access_token` claim are combined rather
3654
+ * than one clobbering the other.
3655
+ * @param baseClaims - The parsed base claims object
3656
+ * @param claimsToMerge - The parsed claims object merged in with precedence
3657
+ * @returns The deep-merged claims object
3658
+ */
3659
+ function deepMergeClaims(baseClaims, claimsToMerge) {
3660
+ const merged = { ...baseClaims };
3661
+ for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
3662
+ const baseValue = merged[key];
3663
+ if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
3664
+ merged[key] = deepMergeClaims(baseValue, mergeInValue);
3665
+ }
3666
+ else {
3667
+ merged[key] = mergeInValue;
3668
+ }
3669
+ }
3670
+ return merged;
3671
+ }
3672
+ /**
3673
+ * Parses claims JSON, optionally deep-merges a second client-originated claims string
3674
+ * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
3675
+ * default optional idToken claims (signin_state, login_hint), and appends client
3676
+ * capabilities (xms_cc) to the access_token section.
3599
3677
  * Does not overwrite idToken claims already specified by the caller.
3600
3678
  * @param claims - Existing claims JSON string from the request (may be undefined)
3601
3679
  * @param clientCapabilities - Client capabilities array from configuration
3680
+ * @param correlationId - The request correlation id
3681
+ * @param claimsToMerge - Optional second claims JSON string (e.g. client-originated `claimsFromClient`)
3682
+ * deep-merged into `claims` with precedence on conflicts; parsed and validated when present. Nested
3683
+ * objects are merged recursively; arrays and scalar values are replaced.
3602
3684
  * @returns Merged claims JSON string
3603
3685
  */
3604
- function buildMergedClaims$1(claims, clientCapabilities, correlationId = "") {
3605
- let mergedClaims;
3686
+ function buildMergedClaims$1(claims, clientCapabilities, correlationId = "", claimsToMerge) {
3606
3687
  // Parse provided claims into JSON object or initialize empty object
3607
- if (!claims) {
3608
- mergedClaims = {};
3609
- }
3610
- else {
3611
- try {
3612
- const parsed = JSON.parse(claims);
3613
- if (typeof parsed !== "object" ||
3614
- parsed === null ||
3615
- Array.isArray(parsed)) {
3616
- throw new Error("Claims must be a JSON object");
3617
- }
3618
- mergedClaims = parsed;
3619
- }
3620
- catch (e) {
3621
- throw createClientConfigurationError(invalidClaims, correlationId);
3622
- }
3688
+ let mergedClaims = claims ? parseClaims(claims, correlationId) : {};
3689
+ // Deep-merge client-originated claims (e.g. `claimsFromClient`) with precedence on conflicts
3690
+ if (claimsToMerge?.trim()) {
3691
+ mergedClaims = deepMergeClaims(mergedClaims, parseClaims(claimsToMerge, correlationId));
3623
3692
  }
3624
3693
  // Add default optional idToken claims
3625
3694
  if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
@@ -3707,9 +3776,28 @@
3707
3776
  if (resource) {
3708
3777
  parameters.set(RESOURCE, resource);
3709
3778
  }
3779
+ }
3780
+ /**
3781
+ * Add the `attribute_tokens` parameter to a /token request body.
3782
+ *
3783
+ * When `attributeTokens` is a non-empty array the values are sorted lexicographically and joined
3784
+ * with a single space, then written to the request body. When `attributeTokens` is an empty array
3785
+ * the parameter is deleted from the request body.
3786
+ *
3787
+ * @param parameters - request parameter map that will be serialized into the /token body
3788
+ * @param attributeTokens - caller-provided attribute token strings
3789
+ */
3790
+ function addAttributeTokens(parameters, attributeTokens) {
3791
+ const serialized = serializeAttributeTokens(attributeTokens);
3792
+ if (serialized) {
3793
+ parameters.set(ATTRIBUTE_TOKENS, serialized);
3794
+ }
3795
+ else {
3796
+ parameters.delete(ATTRIBUTE_TOKENS);
3797
+ }
3710
3798
  }
3711
3799
 
3712
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3800
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3713
3801
 
3714
3802
  /*
3715
3803
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3831,12 +3919,20 @@
3831
3919
  }
3832
3920
  }
3833
3921
 
3834
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3922
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3835
3923
 
3836
3924
  /*
3837
3925
  * Copyright (c) Microsoft Corporation. All rights reserved.
3838
3926
  * Licensed under the MIT License.
3839
3927
  */
3928
+ /**
3929
+ * Shared JOSE algorithm literals used by MSAL package internals.
3930
+ * @internal
3931
+ */
3932
+ const JsonWebTokenAlgorithms = {
3933
+ ES256: "ES256",
3934
+ RS256: "RS256",
3935
+ };
3840
3936
  /**
3841
3937
  * Default crypto implementation used when a platform-specific implementation has
3842
3938
  * not been provided.
@@ -3857,24 +3953,44 @@
3857
3953
  encodeKid: () => {
3858
3954
  throw createClientAuthError(methodNotImplemented, "");
3859
3955
  },
3860
- async getPublicKeyThumbprint() {
3861
- throw createClientAuthError(methodNotImplemented, "");
3862
- },
3863
- async removeTokenBindingKey() {
3864
- throw createClientAuthError(methodNotImplemented, "");
3956
+ async removeTokenBindingKey(kid, correlationId) {
3957
+ throw createClientAuthError(methodNotImplemented, correlationId);
3865
3958
  },
3866
- async clearKeystore() {
3867
- throw createClientAuthError(methodNotImplemented, "");
3959
+ async clearKeystore(correlationId) {
3960
+ throw createClientAuthError(methodNotImplemented, correlationId);
3868
3961
  },
3869
- async signJwt() {
3870
- throw createClientAuthError(methodNotImplemented, "");
3962
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
3963
+ throw createClientAuthError(methodNotImplemented, correlationId);
3871
3964
  },
3872
3965
  async hashString() {
3873
3966
  throw createClientAuthError(methodNotImplemented, "");
3874
3967
  },
3875
3968
  };
3876
3969
 
3877
- /*! @azure/msal-common v16.11.3 2026-07-29 */
3970
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3971
+
3972
+ /*
3973
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3974
+ * Licensed under the MIT License.
3975
+ */
3976
+ /**
3977
+ * Default token-binding key manager used when a platform-specific implementation
3978
+ * has not been provided.
3979
+ * @internal
3980
+ */
3981
+ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3982
+ async provisionTokenBindingKey(request) {
3983
+ throw createClientAuthError(methodNotImplemented, request.correlationId);
3984
+ },
3985
+ async removeTokenBindingKey(_kid, correlationId) {
3986
+ throw createClientAuthError(methodNotImplemented, correlationId);
3987
+ },
3988
+ async getTokenBindingPublicKeyJwk(_kid, correlationId) {
3989
+ throw createClientAuthError(methodNotImplemented, correlationId);
3990
+ },
3991
+ };
3992
+
3993
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
3878
3994
  /*
3879
3995
  * Copyright (c) Microsoft Corporation. All rights reserved.
3880
3996
  * Licensed under the MIT License.
@@ -4163,12 +4279,12 @@
4163
4279
  }
4164
4280
  }
4165
4281
 
4166
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4282
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4167
4283
  /* eslint-disable header/header */
4168
4284
  const name$1 = "@azure/msal-common";
4169
- const version$1 = "16.11.3";
4285
+ const version$1 = "16.13.0";
4170
4286
 
4171
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4287
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4172
4288
  /*
4173
4289
  * Copyright (c) Microsoft Corporation. All rights reserved.
4174
4290
  * Licensed under the MIT License.
@@ -4176,7 +4292,7 @@
4176
4292
  const cacheQuotaExceeded = "cache_quota_exceeded";
4177
4293
  const cacheErrorUnknown = "cache_error_unknown";
4178
4294
 
4179
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4295
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4180
4296
 
4181
4297
  /*
4182
4298
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4214,7 +4330,7 @@
4214
4330
  }
4215
4331
  }
4216
4332
 
4217
- /*! @azure/msal-common v16.11.3 2026-07-29 */
4333
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
4218
4334
 
4219
4335
  /*
4220
4336
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4441,9 +4557,17 @@
4441
4557
  }
4442
4558
  /**
4443
4559
  * saves access token credential
4444
- * @param credential
4560
+ * @param credential - the access token entity to save
4561
+ * @param correlationId - unique identifier for the request
4562
+ * @param kmsi - keep me signed in flag
4445
4563
  */
4446
4564
  async saveAccessToken(credential, correlationId, kmsi) {
4565
+ // Compute hash from components on the entity itself — no need to thread externally.
4566
+ let additionalCacheKeyHash;
4567
+ if (credential.additionalCacheKeyComponents &&
4568
+ Object.keys(credential.additionalCacheKeyComponents).length > 0) {
4569
+ additionalCacheKeyHash = await this.cryptoImpl.hashString(JSON.stringify(credential.additionalCacheKeyComponents));
4570
+ }
4447
4571
  const accessTokenFilter = {
4448
4572
  clientId: credential.clientId,
4449
4573
  credentialType: credential.credentialType,
@@ -4467,7 +4591,7 @@
4467
4591
  }
4468
4592
  }
4469
4593
  });
4470
- await this.setAccessTokenCredential(credential, correlationId, kmsi);
4594
+ await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4471
4595
  }
4472
4596
  /**
4473
4597
  * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
@@ -4567,16 +4691,9 @@
4567
4691
  // Access Token with Auth Scheme specific matching
4568
4692
  if (entity.credentialType ===
4569
4693
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
4570
- if (!!filter.tokenType &&
4571
- !this.matchTokenType(entity, filter.tokenType)) {
4694
+ if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
4572
4695
  return false;
4573
4696
  }
4574
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
4575
- if (filter.tokenType === AuthenticationScheme$1.SSH) {
4576
- if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
4577
- return false;
4578
- }
4579
- }
4580
4697
  }
4581
4698
  // Additional cache key components matching (bidirectional isolation)
4582
4699
  const entityComponents = entity.additionalCacheKeyComponents;
@@ -4879,6 +4996,12 @@
4879
4996
  AuthenticationScheme$1.BEARER.toLowerCase()
4880
4997
  ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
4881
4998
  : CredentialType.ACCESS_TOKEN;
4999
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
5000
+ const additionalCacheKeyComponents = attributeTokenPartition
5001
+ ? {
5002
+ attribute_tokens: attributeTokenPartition,
5003
+ }
5004
+ : undefined;
4882
5005
  const accessTokenFilter = {
4883
5006
  homeAccountId: account.homeAccountId,
4884
5007
  environment: account.environment,
@@ -4887,11 +5010,15 @@
4887
5010
  realm: targetRealm || account.tenantId,
4888
5011
  target: scopes,
4889
5012
  tokenType: authScheme,
4890
- keyId: request.sshKid,
5013
+ keyId: authScheme === AuthenticationScheme$1.SSH
5014
+ ? request.sshKid
5015
+ : undefined,
5016
+ additionalCacheKeyComponents: additionalCacheKeyComponents,
4891
5017
  };
4892
5018
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
4893
5019
  this.getTokenKeys().accessToken;
4894
5020
  const accessTokens = [];
5021
+ const matchedKeys = [];
4895
5022
  accessTokenKeys.forEach((key) => {
4896
5023
  // Validate key
4897
5024
  if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
@@ -4900,18 +5027,18 @@
4900
5027
  if (accessToken &&
4901
5028
  this.credentialMatchesFilter(accessToken, accessTokenFilter, correlationId)) {
4902
5029
  accessTokens.push(accessToken);
5030
+ matchedKeys.push(key);
4903
5031
  }
4904
5032
  }
4905
5033
  });
4906
- const numAccessTokens = accessTokens.length;
4907
- if (numAccessTokens < 1) {
5034
+ if (accessTokens.length < 1) {
4908
5035
  this.commonLogger.info("1nckna", correlationId);
4909
5036
  return null;
4910
5037
  }
4911
- else if (numAccessTokens > 1) {
5038
+ else if (accessTokens.length > 1) {
4912
5039
  this.commonLogger.info("1wkfwp", correlationId);
4913
- accessTokens.forEach((accessToken) => {
4914
- this.removeAccessToken(this.generateCredentialKey(accessToken), correlationId);
5040
+ matchedKeys.forEach((key) => {
5041
+ this.removeAccessToken(key, correlationId);
4915
5042
  });
4916
5043
  this.performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
4917
5044
  return null;
@@ -5247,7 +5374,29 @@
5247
5374
  * @param tokenType
5248
5375
  */
5249
5376
  matchTokenType(entity, tokenType) {
5250
- return !!(entity.tokenType && entity.tokenType === tokenType);
5377
+ return !!(entity.tokenType &&
5378
+ entity.tokenType.toLowerCase() === tokenType.toLowerCase());
5379
+ }
5380
+ matchAccessTokenWithAuthScheme(entity, filter) {
5381
+ const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
5382
+ if (!!filter.tokenType &&
5383
+ !this.matchTokenType(entity, filter.tokenType)) {
5384
+ return false;
5385
+ }
5386
+ switch (normalizedFilterTokenType) {
5387
+ case "dpop":
5388
+ return this.matchKeyBoundAccessToken(entity, filter, true);
5389
+ case AuthenticationScheme$1.SSH:
5390
+ return this.matchKeyBoundAccessToken(entity, filter, false);
5391
+ default:
5392
+ return true;
5393
+ }
5394
+ }
5395
+ matchKeyBoundAccessToken(entity, filter, requireKeyId) {
5396
+ if (!filter.keyId) {
5397
+ return !requireKeyId;
5398
+ }
5399
+ return this.matchKeyId(entity, filter.keyId);
5251
5400
  }
5252
5401
  /**
5253
5402
  * Returns true if the credential's keyId matches the one in the request, false otherwise
@@ -5354,7 +5503,9 @@
5354
5503
  getTokenKeys() {
5355
5504
  throw createClientAuthError(methodNotImplemented, "");
5356
5505
  }
5357
- generateCredentialKey() {
5506
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5507
+ generateCredentialKey(_credential, _hash) {
5508
+ /* eslint-enable @typescript-eslint/no-unused-vars */
5358
5509
  throw createClientAuthError(methodNotImplemented, "");
5359
5510
  }
5360
5511
  generateAccountKey() {
@@ -5362,7 +5513,7 @@
5362
5513
  }
5363
5514
  }
5364
5515
 
5365
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5516
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5366
5517
  /*
5367
5518
  * Copyright (c) Microsoft Corporation. All rights reserved.
5368
5519
  * Licensed under the MIT License.
@@ -5427,7 +5578,7 @@
5427
5578
  "fetchRetryCount",
5428
5579
  ]);
5429
5580
 
5430
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5581
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5431
5582
 
5432
5583
  /*
5433
5584
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5485,7 +5636,7 @@
5485
5636
  }
5486
5637
  }
5487
5638
 
5488
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5639
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5489
5640
 
5490
5641
  /*
5491
5642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5539,7 +5690,7 @@
5539
5690
  * @returns Configuration
5540
5691
  * @internal
5541
5692
  */
5542
- 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, }) {
5693
+ 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, }) {
5543
5694
  const loggerOptions = {
5544
5695
  ...DEFAULT_LOGGER_IMPLEMENTATION,
5545
5696
  ...userLoggerOption,
@@ -5552,6 +5703,7 @@
5552
5703
  new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
5553
5704
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
5554
5705
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
5706
+ tokenBindingKeyManager: tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER,
5555
5707
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
5556
5708
  libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
5557
5709
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
@@ -5581,7 +5733,7 @@
5581
5733
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5582
5734
  }
5583
5735
 
5584
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5736
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5585
5737
  /*
5586
5738
  * Copyright (c) Microsoft Corporation. All rights reserved.
5587
5739
  * Licensed under the MIT License.
@@ -5608,7 +5760,129 @@
5608
5760
  }
5609
5761
  }
5610
5762
 
5611
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5763
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5764
+
5765
+ /*
5766
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5767
+ * Licensed under the MIT License.
5768
+ */
5769
+ /**
5770
+ * Error thrown when there is an error in the client code running on the browser.
5771
+ */
5772
+ class JoseHeaderError extends AuthError {
5773
+ constructor(errorCode, correlationId, errorMessage) {
5774
+ super(errorCode, correlationId, errorMessage);
5775
+ this.name = "JoseHeaderError";
5776
+ Object.setPrototypeOf(this, JoseHeaderError.prototype);
5777
+ }
5778
+ }
5779
+ /** Returns JoseHeaderError object */
5780
+ function createJoseHeaderError(code, correlationId) {
5781
+ return new JoseHeaderError(code, correlationId);
5782
+ }
5783
+
5784
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5785
+ /*
5786
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5787
+ * Licensed under the MIT License.
5788
+ */
5789
+ /**
5790
+ * Checks whether a value is a plain JSON-like object.
5791
+ * Allows objects with null prototypes, but rejects arrays and object subclasses.
5792
+ */
5793
+ function isPlainObject(value) {
5794
+ if (typeof value !== "object" ||
5795
+ value === null ||
5796
+ Object.prototype.toString.call(value) !== "[object Object]") {
5797
+ return false;
5798
+ }
5799
+ if (Object.getPrototypeOf(value) === null) {
5800
+ return true;
5801
+ }
5802
+ let proto = value;
5803
+ while (Object.getPrototypeOf(proto) !== null) {
5804
+ proto = Object.getPrototypeOf(proto);
5805
+ }
5806
+ return Object.getPrototypeOf(value) === proto;
5807
+ }
5808
+
5809
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5810
+ /*
5811
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5812
+ * Licensed under the MIT License.
5813
+ */
5814
+ const missingKidError = "missing_kid_error";
5815
+ const missingAlgError = "missing_alg_error";
5816
+ const missingJwkError = "missing_jwk_error";
5817
+ const invalidJwkError = "invalid_jwk_error";
5818
+
5819
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5820
+
5821
+ /*
5822
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5823
+ * Licensed under the MIT License.
5824
+ */
5825
+ /** @internal */
5826
+ class JoseHeader {
5827
+ constructor(options, correlationId) {
5828
+ if (typeof options.alg !== "string" || !options.alg) {
5829
+ throw createJoseHeaderError(missingAlgError, correlationId);
5830
+ }
5831
+ this.typ = options.typ;
5832
+ this.alg = options.alg;
5833
+ this.kid = options.kid;
5834
+ this.jwk = options.jwk;
5835
+ }
5836
+ /**
5837
+ * Builds SignedHttpRequest formatted JOSE Header from the
5838
+ * JOSE Header options provided or previously set on the object.
5839
+ * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
5840
+ * @param shrHeaderOptions
5841
+ * @param correlationId
5842
+ * @returns
5843
+ */
5844
+ static getShrHeader(shrHeaderOptions, correlationId) {
5845
+ // KeyID is required on the SHR header
5846
+ if (!shrHeaderOptions.kid) {
5847
+ throw createJoseHeaderError(missingKidError, correlationId);
5848
+ }
5849
+ // Alg is required on the SHR header
5850
+ if (!shrHeaderOptions.alg) {
5851
+ throw createJoseHeaderError(missingAlgError, correlationId);
5852
+ }
5853
+ return new JoseHeader({
5854
+ // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
5855
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
5856
+ kid: shrHeaderOptions.kid,
5857
+ alg: shrHeaderOptions.alg,
5858
+ }, correlationId);
5859
+ }
5860
+ /**
5861
+ * Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
5862
+ * Throws if public JWK or algorithm aren't provided since they are required for DPoP.
5863
+ * @param dpopHeaderOptions
5864
+ * @param correlationId
5865
+ * @returns
5866
+ */
5867
+ static getDpopHeader(dpopHeaderOptions, correlationId) {
5868
+ if (!isPlainObject(dpopHeaderOptions.jwk)) {
5869
+ throw createJoseHeaderError(missingJwkError, correlationId);
5870
+ }
5871
+ if (!dpopHeaderOptions.alg) {
5872
+ throw createJoseHeaderError(missingAlgError, correlationId);
5873
+ }
5874
+ if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
5875
+ throw createJoseHeaderError(invalidJwkError, correlationId);
5876
+ }
5877
+ return new JoseHeader({
5878
+ typ: JsonWebTokenTypes$1.Dpop,
5879
+ alg: dpopHeaderOptions.alg,
5880
+ jwk: dpopHeaderOptions.jwk,
5881
+ }, correlationId);
5882
+ }
5883
+ }
5884
+
5885
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5612
5886
 
5613
5887
  /*
5614
5888
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5616,10 +5890,13 @@
5616
5890
  */
5617
5891
  const KeyLocation = {
5618
5892
  SW: "sw"};
5893
+ const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
5894
+ const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
5619
5895
  /** @internal */
5620
5896
  class PopTokenGenerator {
5621
- constructor(cryptoUtils, performanceClient) {
5897
+ constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
5622
5898
  this.cryptoUtils = cryptoUtils;
5899
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5623
5900
  this.performanceClient = performanceClient;
5624
5901
  }
5625
5902
  /**
@@ -5642,7 +5919,11 @@
5642
5919
  * @returns
5643
5920
  */
5644
5921
  async generateKid(request) {
5645
- const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
5922
+ const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
5923
+ correlationId: request.correlationId,
5924
+ tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
5925
+ tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
5926
+ });
5646
5927
  return {
5647
5928
  kid: kidThumbprint,
5648
5929
  xms_ksl: KeyLocation.SW,
@@ -5672,7 +5953,17 @@
5672
5953
  ? new UrlString(resourceRequestUri, request.correlationId)
5673
5954
  : undefined;
5674
5955
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
5675
- return this.cryptoUtils.signJwt({
5956
+ const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
5957
+ const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
5958
+ const shrAlgorithm = shrOptions?.header?.alg ||
5959
+ publicKeyJwk.alg ||
5960
+ SHR_TOKEN_BINDING_KEY_ALGORITHM;
5961
+ const shrHeader = JoseHeader.getShrHeader({
5962
+ ...shrOptions?.header,
5963
+ alg: shrAlgorithm,
5964
+ kid: encodedKeyIdThumbprint,
5965
+ }, request.correlationId);
5966
+ const shrPayload = {
5676
5967
  at: payload,
5677
5968
  ts: nowSeconds(),
5678
5969
  m: resourceRequestMethod?.toUpperCase(),
@@ -5684,11 +5975,15 @@
5684
5975
  : undefined,
5685
5976
  client_claims: shrClaims || undefined,
5686
5977
  ...claims,
5687
- }, keyId, shrOptions, request.correlationId);
5978
+ cnf: {
5979
+ jwk: publicKeyJwk,
5980
+ },
5981
+ };
5982
+ return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
5688
5983
  }
5689
5984
  }
5690
5985
 
5691
- /*! @azure/msal-common v16.11.3 2026-07-29 */
5986
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5692
5987
  /*
5693
5988
  * Copyright (c) Microsoft Corporation. All rights reserved.
5694
5989
  * Licensed under the MIT License.
@@ -5752,7 +6047,7 @@
5752
6047
  uiNotAllowed: uiNotAllowed
5753
6048
  });
5754
6049
 
5755
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6050
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5756
6051
 
5757
6052
  /*
5758
6053
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5819,7 +6114,7 @@
5819
6114
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
5820
6115
  }
5821
6116
 
5822
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6117
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5823
6118
 
5824
6119
  /*
5825
6120
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5838,7 +6133,7 @@
5838
6133
  }
5839
6134
  }
5840
6135
 
5841
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6136
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5842
6137
 
5843
6138
  /*
5844
6139
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5909,7 +6204,7 @@
5909
6204
  }
5910
6205
  }
5911
6206
 
5912
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6207
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
5913
6208
 
5914
6209
  /*
5915
6210
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5920,10 +6215,11 @@
5920
6215
  * @internal
5921
6216
  */
5922
6217
  class ResponseHandler {
5923
- constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
6218
+ constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
5924
6219
  this.clientId = clientId;
5925
6220
  this.cacheStorage = cacheStorage;
5926
6221
  this.cryptoObj = cryptoObj;
6222
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5927
6223
  this.logger = logger;
5928
6224
  this.performanceClient = performanceClient;
5929
6225
  this.serializableCache = serializableCache;
@@ -5998,7 +6294,15 @@
5998
6294
  // Add keyId from request to serverTokenResponse if defined
5999
6295
  serverTokenResponse.key_id =
6000
6296
  serverTokenResponse.key_id || request.sshKid || undefined;
6001
- const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, additionalCacheKeyComponents);
6297
+ // Compute components once for entity storage (fallback if hash not provided by client)
6298
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6299
+ const cacheKeyComponents = additionalCacheKeyComponents ??
6300
+ (attributeTokenPartition
6301
+ ? {
6302
+ attribute_tokens: attributeTokenPartition,
6303
+ }
6304
+ : undefined);
6305
+ const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, cacheKeyComponents);
6002
6306
  let cacheContext;
6003
6307
  try {
6004
6308
  if (this.persistencePlugin && this.serializableCache) {
@@ -6024,7 +6328,12 @@
6024
6328
  this.performanceClient?.addFields({
6025
6329
  acntLoggedOut: true,
6026
6330
  }, request.correlationId);
6027
- return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, undefined, serverRequestId);
6331
+ return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6332
+ idTokenClaims,
6333
+ requestState: requestStateObj,
6334
+ requestId: serverRequestId,
6335
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6336
+ });
6028
6337
  }
6029
6338
  }
6030
6339
  await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
@@ -6037,7 +6346,13 @@
6037
6346
  await this.persistencePlugin.afterCacheAccess(cacheContext);
6038
6347
  }
6039
6348
  }
6040
- return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, serverTokenResponse, serverRequestId);
6349
+ return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6350
+ idTokenClaims,
6351
+ requestState: requestStateObj,
6352
+ serverTokenResponse,
6353
+ requestId: serverRequestId,
6354
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6355
+ });
6041
6356
  }
6042
6357
  /**
6043
6358
  * Generates CacheRecord
@@ -6133,7 +6448,8 @@
6133
6448
  * @param fromTokenCache
6134
6449
  * @param stateString
6135
6450
  */
6136
- static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, idTokenClaims, requestState, serverTokenResponse, requestId) {
6451
+ static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
6452
+ const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
6137
6453
  let accessToken = "";
6138
6454
  let responseScopes = [];
6139
6455
  let expiresOn = null;
@@ -6148,7 +6464,7 @@
6148
6464
  if (cacheRecord.accessToken.tokenType ===
6149
6465
  AuthenticationScheme$1.POP &&
6150
6466
  !request.popKid) {
6151
- const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
6467
+ const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
6152
6468
  const { secret, keyId } = cacheRecord.accessToken;
6153
6469
  if (!keyId) {
6154
6470
  throw createClientAuthError(keyIdMissing, request.correlationId);
@@ -6260,7 +6576,7 @@
6260
6576
  return baseAccount;
6261
6577
  }
6262
6578
 
6263
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6579
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6264
6580
  /*
6265
6581
  * Copyright (c) Microsoft Corporation. All rights reserved.
6266
6582
  * Licensed under the MIT License.
@@ -6270,7 +6586,7 @@
6270
6586
  UPN: "UPN",
6271
6587
  };
6272
6588
 
6273
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6589
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6274
6590
  /*
6275
6591
  * Copyright (c) Microsoft Corporation. All rights reserved.
6276
6592
  * Licensed under the MIT License.
@@ -6289,7 +6605,8 @@
6289
6605
  }
6290
6606
  }
6291
6607
 
6292
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6608
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6609
+
6293
6610
  /*
6294
6611
  * Copyright (c) Microsoft Corporation. All rights reserved.
6295
6612
  * Licensed under the MIT License.
@@ -6308,10 +6625,11 @@
6308
6625
  sshKid: request.sshKid,
6309
6626
  embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
6310
6627
  resource: request.resource,
6628
+ attributeTokens: serializeAttributeTokens(request.attributeTokens),
6311
6629
  };
6312
6630
  }
6313
6631
 
6314
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6632
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6315
6633
 
6316
6634
  /*
6317
6635
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6397,7 +6715,7 @@
6397
6715
  }
6398
6716
  }
6399
6717
 
6400
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6718
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6401
6719
 
6402
6720
  /*
6403
6721
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6428,7 +6746,7 @@
6428
6746
  return new NetworkError(error, httpStatus, responseHeaders);
6429
6747
  }
6430
6748
 
6431
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6749
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6432
6750
 
6433
6751
  /*
6434
6752
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6544,7 +6862,7 @@
6544
6862
  return response;
6545
6863
  }
6546
6864
 
6547
- /*! @azure/msal-common v16.11.3 2026-07-29 */
6865
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6548
6866
 
6549
6867
  /*
6550
6868
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6594,7 +6912,7 @@
6594
6912
  const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
6595
6913
  // Retrieve requestId from response headers
6596
6914
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
6597
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
6915
+ 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);
6598
6916
  // Validate response. This function throws a server error if an error is returned by the server.
6599
6917
  responseHandler.validateTokenResponse(response.body, request.correlationId);
6600
6918
  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);
@@ -6665,6 +6983,12 @@
6665
6983
  // Add scope array, parameter builder will add default scopes and dedupe
6666
6984
  addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
6667
6985
  addResource(parameters, request.resource);
6986
+ if (request.attributeTokens) {
6987
+ addAttributeTokens(parameters, request.attributeTokens);
6988
+ }
6989
+ this.performanceClient?.addFields({
6990
+ hasAttributeTokens: !!request.attributeTokens?.length,
6991
+ }, request.correlationId);
6668
6992
  // add code: user set, not validated
6669
6993
  addAuthorizationCode(parameters, request.code);
6670
6994
  // Add library metadata
@@ -6689,7 +7013,7 @@
6689
7013
  addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
6690
7014
  addClientInfo(parameters);
6691
7015
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
6692
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7016
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
6693
7017
  let reqCnfData;
6694
7018
  if (!request.popKid) {
6695
7019
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -6801,7 +7125,7 @@
6801
7125
  }
6802
7126
  }
6803
7127
 
6804
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7128
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
6805
7129
 
6806
7130
  /*
6807
7131
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7028,76 +7352,7 @@
7028
7352
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7029
7353
  }
7030
7354
 
7031
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7032
-
7033
- /*
7034
- * Copyright (c) Microsoft Corporation. All rights reserved.
7035
- * Licensed under the MIT License.
7036
- */
7037
- /**
7038
- * Error thrown when there is an error in the client code running on the browser.
7039
- */
7040
- class JoseHeaderError extends AuthError {
7041
- constructor(errorCode, correlationId, errorMessage) {
7042
- super(errorCode, correlationId, errorMessage);
7043
- this.name = "JoseHeaderError";
7044
- Object.setPrototypeOf(this, JoseHeaderError.prototype);
7045
- }
7046
- }
7047
- /** Returns JoseHeaderError object */
7048
- function createJoseHeaderError(code, correlationId) {
7049
- return new JoseHeaderError(code, correlationId);
7050
- }
7051
-
7052
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7053
- /*
7054
- * Copyright (c) Microsoft Corporation. All rights reserved.
7055
- * Licensed under the MIT License.
7056
- */
7057
- const missingKidError = "missing_kid_error";
7058
- const missingAlgError = "missing_alg_error";
7059
-
7060
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7061
-
7062
- /*
7063
- * Copyright (c) Microsoft Corporation. All rights reserved.
7064
- * Licensed under the MIT License.
7065
- */
7066
- /** @internal */
7067
- class JoseHeader {
7068
- constructor(options) {
7069
- this.typ = options.typ;
7070
- this.alg = options.alg;
7071
- this.kid = options.kid;
7072
- }
7073
- /**
7074
- * Builds SignedHttpRequest formatted JOSE Header from the
7075
- * JOSE Header options provided or previously set on the object and returns
7076
- * the stringified header object.
7077
- * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
7078
- * @param shrHeaderOptions
7079
- * @returns
7080
- */
7081
- static getShrHeaderString(shrHeaderOptions) {
7082
- // KeyID is required on the SHR header
7083
- if (!shrHeaderOptions.kid) {
7084
- throw createJoseHeaderError(missingKidError, "");
7085
- }
7086
- // Alg is required on the SHR header
7087
- if (!shrHeaderOptions.alg) {
7088
- throw createJoseHeaderError(missingAlgError, "");
7089
- }
7090
- const shrHeader = new JoseHeader({
7091
- // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
7092
- typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
7093
- kid: shrHeaderOptions.kid,
7094
- alg: shrHeaderOptions.alg,
7095
- });
7096
- return JSON.stringify(shrHeader);
7097
- }
7098
- }
7099
-
7100
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7355
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7101
7356
 
7102
7357
  /*
7103
7358
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7646,7 +7901,7 @@
7646
7901
  }
7647
7902
  }
7648
7903
 
7649
- /*! @azure/msal-common v16.11.3 2026-07-29 */
7904
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7650
7905
 
7651
7906
  /*
7652
7907
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7681,7 +7936,7 @@
7681
7936
  const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
7682
7937
  // Retrieve requestId from response headers
7683
7938
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
7684
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7939
+ 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);
7685
7940
  responseHandler.validateTokenResponse(response.body, request.correlationId);
7686
7941
  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);
7687
7942
  }
@@ -7807,6 +8062,12 @@
7807
8062
  addServerTelemetry(parameters, this.serverTelemetryManager);
7808
8063
  }
7809
8064
  addRefreshToken(parameters, request.refreshToken);
8065
+ if (request.attributeTokens) {
8066
+ addAttributeTokens(parameters, request.attributeTokens);
8067
+ }
8068
+ this.performanceClient?.addFields({
8069
+ hasAttributeTokens: !!request.attributeTokens?.length,
8070
+ }, request.correlationId);
7810
8071
  if (this.config.clientCredentials.clientSecret) {
7811
8072
  addClientSecret(parameters, this.config.clientCredentials.clientSecret);
7812
8073
  }
@@ -7816,7 +8077,7 @@
7816
8077
  addClientAssertionType(parameters, clientAssertion.assertionType);
7817
8078
  }
7818
8079
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
7819
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
8080
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7820
8081
  let reqCnfData;
7821
8082
  if (!request.popKid) {
7822
8083
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7867,7 +8128,7 @@
7867
8128
  }
7868
8129
  }
7869
8130
 
7870
- /*! @azure/msal-common v16.11.3 2026-07-29 */
8131
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
7871
8132
 
7872
8133
  /*
7873
8134
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8160,7 +8421,7 @@
8160
8421
  clearNativeBrokerErrorCode() { }
8161
8422
  }
8162
8423
 
8163
- /*! @azure/msal-common v16.11.3 2026-07-29 */
8424
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
8164
8425
 
8165
8426
  /*
8166
8427
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8264,11 +8525,14 @@
8264
8525
  if (cacheRecord.idToken) {
8265
8526
  idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
8266
8527
  }
8267
- return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
8528
+ return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
8529
+ idTokenClaims,
8530
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
8531
+ });
8268
8532
  }
8269
8533
  }
8270
8534
 
8271
- /*! @azure/msal-common v16.11.3 2026-07-29 */
8535
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
8272
8536
 
8273
8537
  /*
8274
8538
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8284,7 +8548,7 @@
8284
8548
  },
8285
8549
  };
8286
8550
 
8287
- /*! @azure/msal-common v16.11.3 2026-07-29 */
8551
+ /*! @azure/msal-common v16.13.0 2026-08-18 */
8288
8552
 
8289
8553
  /*
8290
8554
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8337,13 +8601,13 @@
8337
8601
  */
8338
8602
  const AcquireTokenSilentAsync = "acquireTokenSilentAsync";
8339
8603
  /**
8340
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
8341
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
8604
+ * provisionTokenBindingKey API in TokenBindingKeyManager class (msal-browser).
8605
+ * Used to provision token-binding key material and return a key identifier.
8342
8606
  */
8343
8607
  const CryptoOptsGetPublicKeyThumbprint = "cryptoOptsGetPublicKeyThumbprint";
8344
8608
  /**
8345
- * signJwt API in CryptoOpts class (msal-browser).
8346
- * Used to signed a pop token.
8609
+ * signTokenBindingJwt API in CryptoOpts class (msal-browser).
8610
+ * Used to sign token-binding JWTs.
8347
8611
  */
8348
8612
  const CryptoOptsSignJwt = "cryptoOptsSignJwt";
8349
8613
  /**
@@ -8500,6 +8764,9 @@
8500
8764
  const nativePromptNotSupported = "native_prompt_not_supported";
8501
8765
  const invalidBase64String = "invalid_base64_string";
8502
8766
  const invalidPopTokenRequest = "invalid_pop_token_request";
8767
+ const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
8768
+ const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
8769
+ const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
8503
8770
  const failedToBuildHeaders = "failed_to_build_headers";
8504
8771
  const failedToParseHeaders = "failed_to_parse_headers";
8505
8772
  const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
@@ -8556,11 +8823,14 @@
8556
8823
  spaCodeAndNativeAccountIdPresent: spaCodeAndNativeAccountIdPresent,
8557
8824
  stateInteractionTypeMismatch: stateInteractionTypeMismatch,
8558
8825
  timedOut: timedOut,
8826
+ tokenBindingKeyAlgorithmMismatch: tokenBindingKeyAlgorithmMismatch,
8827
+ tokenBindingKeyJwkThumbprintMismatch: tokenBindingKeyJwkThumbprintMismatch,
8559
8828
  unableToAcquireTokenFromNativePlatform: unableToAcquireTokenFromNativePlatform,
8560
8829
  unableToLoadToken: unableToLoadToken,
8561
8830
  unableToParseState: unableToParseState,
8562
8831
  unableToParseTokenRequestCacheError: unableToParseTokenRequestCacheError,
8563
8832
  uninitializedPublicClientApplication: uninitializedPublicClientApplication,
8833
+ unsupportedTokenBindingAlgorithm: unsupportedTokenBindingAlgorithm,
8564
8834
  userCancelled: userCancelled
8565
8835
  });
8566
8836
 
@@ -8898,6 +9168,8 @@
8898
9168
  const HKDF = "HKDF";
8899
9169
  // SHA-256 hashing algorithm
8900
9170
  const S256_HASH_ALG = "SHA-256";
9171
+ // JWK values used by browser-internal WebCrypto helpers.
9172
+ const JSON_WEB_KEY_CURVE_P256 = "P-256";
8901
9173
  const JSON_WEB_KEY_TYPE_EC = "EC";
8902
9174
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
8903
9175
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -8929,6 +9201,14 @@
8929
9201
  const RSA_SIGN_ALGORITHM_OPTIONS = {
8930
9202
  name: PKCS1_V15_KEYGEN_ALG,
8931
9203
  };
9204
+ const ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS = {
9205
+ name: "ECDSA",
9206
+ namedCurve: JSON_WEB_KEY_CURVE_P256,
9207
+ };
9208
+ const ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS = {
9209
+ name: "ECDSA",
9210
+ hash: { name: S256_HASH_ALG },
9211
+ };
8932
9212
  /**
8933
9213
  * Check whether browser crypto is available.
8934
9214
  */
@@ -9027,16 +9307,6 @@
9027
9307
  async function exportJwk(key) {
9028
9308
  return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
9029
9309
  }
9030
- /**
9031
- * Imports key as Json Web Key (JWK), can set extractable and usages.
9032
- * @param key
9033
- * @param extractable
9034
- * @param usages
9035
- * @param algorithm
9036
- */
9037
- async function importJwk(key, extractable, usages, algorithm) {
9038
- return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
9039
- }
9040
9310
  /**
9041
9311
  * Signs given data with given key.
9042
9312
  * @param key
@@ -9192,22 +9462,22 @@
9192
9462
  [JSON_WEB_KEY_TYPE_EC]: ["crv", "kty", "x", "y"],
9193
9463
  [JSON_WEB_KEY_TYPE_RSA]: ["e", "kty", "n"],
9194
9464
  };
9195
- function getJwkThumbprintMembers(publicJwk) {
9465
+ function getJwkThumbprintMembers(publicJwk, correlationId) {
9196
9466
  const kty = publicJwk.kty;
9197
9467
  if (typeof kty !== "string" || kty.length === 0) {
9198
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_KTY_SUBERROR);
9468
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_KTY_SUBERROR);
9199
9469
  }
9200
9470
  const requiredMembers = JWK_THUMBPRINT_REQUIRED_MEMBERS[kty];
9201
9471
  if (!requiredMembers) {
9202
- throw createBrowserAuthError(invalidPublicJwk, "", UNSUPPORTED_JWK_KTY_SUBERROR);
9472
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, UNSUPPORTED_JWK_KTY_SUBERROR);
9203
9473
  }
9204
9474
  return requiredMembers.reduce((thumbprintMembers, memberName) => {
9205
9475
  const memberValue = publicJwk[memberName];
9206
9476
  if (typeof memberValue !== "string") {
9207
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_MEMBER_SUBERROR);
9477
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_MEMBER_SUBERROR);
9208
9478
  }
9209
9479
  if (memberValue.length === 0) {
9210
- throw createBrowserAuthError(invalidPublicJwk, "", EMPTY_JWK_MEMBER_SUBERROR);
9480
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, EMPTY_JWK_MEMBER_SUBERROR);
9211
9481
  }
9212
9482
  thumbprintMembers[memberName] = memberValue;
9213
9483
  return thumbprintMembers;
@@ -9219,8 +9489,8 @@
9219
9489
  * and the SHA-256 digest is returned as a base64url string.
9220
9490
  * @internal
9221
9491
  */
9222
- async function computeJwkThumbprint(publicJwk) {
9223
- const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
9492
+ async function computeJwkThumbprint(publicJwk, correlationId) {
9493
+ const thumbprintMembers = getJwkThumbprintMembers(publicJwk, correlationId);
9224
9494
  // RFC 7638 §3.3: use only required members, sorted lexicographically
9225
9495
  const thumbprintJson = JSON.stringify(thumbprintMembers, Object.keys(thumbprintMembers).sort());
9226
9496
  return hashString(thumbprintJson);
@@ -9954,22 +10224,19 @@
9954
10224
  }
9955
10225
  }
9956
10226
  /**
9957
- * Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the
9958
- * asynchronous storage object.
10227
+ * Get all keys from both in-memory and persistent storage.
9959
10228
  * @param correlationId
9960
10229
  */
9961
10230
  async getKeys(correlationId) {
9962
10231
  const cacheKeys = this.inMemoryCache.getKeys();
9963
- if (cacheKeys.length === 0) {
9964
- try {
9965
- this.logger.verbose("1iqrbq", correlationId);
9966
- return await this.indexedDBCache.getKeys();
9967
- }
9968
- catch (e) {
9969
- this.handleDatabaseAccessError(e, correlationId);
9970
- }
10232
+ try {
10233
+ const persistentCacheKeys = await this.indexedDBCache.getKeys();
10234
+ return Array.from(new Set([...cacheKeys, ...persistentCacheKeys]));
10235
+ }
10236
+ catch (e) {
10237
+ this.handleDatabaseAccessError(e, correlationId);
10238
+ return cacheKeys;
9971
10239
  }
9972
- return cacheKeys;
9973
10240
  }
9974
10241
  /**
9975
10242
  * Returns true or false if the given key is present in the cache.
@@ -10020,6 +10287,152 @@
10020
10287
  }
10021
10288
  }
10022
10289
 
10290
+ /*
10291
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10292
+ * Licensed under the MIT License.
10293
+ */
10294
+ /**
10295
+ * Owns browser token-binding key lifecycle and storage lookup.
10296
+ * @internal
10297
+ */
10298
+ class TokenBindingKeyManager {
10299
+ constructor(logger, performanceClient) {
10300
+ this.logger = logger;
10301
+ this.cache = TokenBindingKeyManager.getTokenBindingKeyStorage(this.logger);
10302
+ this.performanceClient = performanceClient;
10303
+ }
10304
+ static getTokenBindingKeyStorage(logger) {
10305
+ if (!TokenBindingKeyManager.tokenBindingKeyStorage) {
10306
+ TokenBindingKeyManager.tokenBindingKeyStorage =
10307
+ new AsyncMemoryStorage(logger);
10308
+ }
10309
+ return TokenBindingKeyManager.tokenBindingKeyStorage;
10310
+ }
10311
+ /**
10312
+ * Provisions a browser token-binding key and returns its key identifier.
10313
+ * @param request - Key provisioning policy.
10314
+ */
10315
+ async provisionTokenBindingKey(request) {
10316
+ const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10317
+ try {
10318
+ const activeKeyPair = await this.createTokenBindingKey(request);
10319
+ publicKeyThumbMeasurement?.end({
10320
+ success: true,
10321
+ ...this.getTokenBindingKeyTelemetry(activeKeyPair),
10322
+ });
10323
+ return activeKeyPair.keyId;
10324
+ }
10325
+ catch (e) {
10326
+ publicKeyThumbMeasurement?.end({
10327
+ success: false,
10328
+ tokenBindingKeyType: request.tokenBindingKeyType,
10329
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10330
+ });
10331
+ throw e;
10332
+ }
10333
+ }
10334
+ /**
10335
+ * Removes a browser token-binding key by identifier.
10336
+ * @param kid - Token-binding key identifier.
10337
+ * @param correlationId - Request correlation identifier.
10338
+ */
10339
+ async removeTokenBindingKey(kid, correlationId) {
10340
+ await this.cache.removeItem(kid, correlationId);
10341
+ const keyFound = await this.cache.containsKey(kid, correlationId);
10342
+ if (keyFound) {
10343
+ throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10344
+ }
10345
+ }
10346
+ /**
10347
+ * Clears browser token-binding keys from memory and persistent storage.
10348
+ * @param correlationId - Request correlation identifier.
10349
+ */
10350
+ async clearKeystore(correlationId) {
10351
+ this.cache.clearInMemory(correlationId);
10352
+ try {
10353
+ await this.cache.clearPersistent(correlationId);
10354
+ return true;
10355
+ }
10356
+ catch (e) {
10357
+ if (e instanceof Error) {
10358
+ this.logger.error(`1owpn8 ${e.message}`, correlationId);
10359
+ }
10360
+ else {
10361
+ this.logger.error("0yrmwo", correlationId);
10362
+ }
10363
+ return false;
10364
+ }
10365
+ }
10366
+ /**
10367
+ * Gets a token-binding public key as a JWK by identifier.
10368
+ * @param keyId - Token-binding key identifier.
10369
+ * @param correlationId - Request correlation identifier.
10370
+ */
10371
+ async getTokenBindingPublicKeyJwk(keyId, correlationId) {
10372
+ const cachedKeyPair = await this.getTokenBindingKeyPair(keyId, correlationId);
10373
+ return exportJwk(cachedKeyPair.publicKey);
10374
+ }
10375
+ async createTokenBindingKey(request) {
10376
+ const keyGenAlgorithm = this.getTokenBindingKeyGenAlgorithmOptions(request.tokenBindingKeyAlgorithm, request.correlationId);
10377
+ const generatedKeyPair = await this.generateKeyPairAndThumbprint(TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES, keyGenAlgorithm, request.correlationId);
10378
+ await this.cache.setItem(generatedKeyPair.keyId, {
10379
+ ...generatedKeyPair,
10380
+ tokenBindingKeyType: request.tokenBindingKeyType,
10381
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10382
+ }, request.correlationId);
10383
+ return {
10384
+ ...generatedKeyPair,
10385
+ tokenBindingKeyType: request.tokenBindingKeyType,
10386
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10387
+ };
10388
+ }
10389
+ async generateKeyPairAndThumbprint(usages, keyGenAlgorithm, correlationId) {
10390
+ const keyPair = await generateKeyPair(false, usages, keyGenAlgorithm);
10391
+ const publicJwk = await exportJwk(keyPair.publicKey);
10392
+ const keyId = await computeJwkThumbprint(publicJwk, correlationId);
10393
+ return {
10394
+ publicKey: keyPair.publicKey,
10395
+ privateKey: keyPair.privateKey,
10396
+ keyId,
10397
+ };
10398
+ }
10399
+ /** @internal */
10400
+ async getTokenBindingKeyPair(keyId, correlationId) {
10401
+ const cachedKeyPair = await this.cache.getItem(keyId, correlationId);
10402
+ if (!cachedKeyPair) {
10403
+ throw createBrowserAuthError(cryptoKeyNotFound, correlationId);
10404
+ }
10405
+ return cachedKeyPair;
10406
+ }
10407
+ /** @internal */
10408
+ getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10409
+ return {
10410
+ ...(cachedKeyPair.tokenBindingKeyType && {
10411
+ tokenBindingKeyType: cachedKeyPair.tokenBindingKeyType,
10412
+ }),
10413
+ ...(cachedKeyPair.tokenBindingKeyAlgorithm || fallbackAlgorithm
10414
+ ? {
10415
+ tokenBindingKeyAlgorithm: cachedKeyPair.tokenBindingKeyAlgorithm ||
10416
+ fallbackAlgorithm,
10417
+ }
10418
+ : {}),
10419
+ };
10420
+ }
10421
+ getTokenBindingKeyGenAlgorithmOptions(tokenBindingKeyAlgorithm, correlationId) {
10422
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.RS256) {
10423
+ return RSA_KEYGEN_ALGORITHM_OPTIONS;
10424
+ }
10425
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.ES256) {
10426
+ return ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS;
10427
+ }
10428
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10429
+ }
10430
+ }
10431
+ TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
10432
+ "sign",
10433
+ "verify",
10434
+ ];
10435
+
10023
10436
  /*
10024
10437
  * Copyright (c) Microsoft Corporation. All rights reserved.
10025
10438
  * Licensed under the MIT License.
@@ -10033,8 +10446,8 @@
10033
10446
  this.logger = logger;
10034
10447
  // Browser crypto needs to be validated first before any other classes can be set.
10035
10448
  validateCryptoAvailable(skipValidateSubtleCrypto ?? false);
10036
- this.cache = new AsyncMemoryStorage(this.logger);
10037
10449
  this.performanceClient = performanceClient;
10450
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
10038
10451
  }
10039
10452
  /**
10040
10453
  * Creates a new random GUID - used to populate state and nonce.
@@ -10072,114 +10485,45 @@
10072
10485
  encodeKid(inputKid) {
10073
10486
  return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
10074
10487
  }
10075
- /**
10076
- * Generates a keypair, stores it and returns a thumbprint
10077
- * @param request
10078
- */
10079
- async getPublicKeyThumbprint(request) {
10080
- const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10081
- // Generate Keypair
10082
- const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES, RSA_KEYGEN_ALGORITHM_OPTIONS);
10083
- // Generate Thumbprint for Public Key
10084
- const publicKeyJwk = await exportJwk(keyPair.publicKey);
10085
- const publicJwkHash = await computeJwkThumbprint(publicKeyJwk);
10086
- // Generate Thumbprint for Private Key
10087
- const privateKeyJwk = await exportJwk(keyPair.privateKey);
10088
- // Re-import private key to make it unextractable
10089
- const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"], RSA_KEYGEN_ALGORITHM_OPTIONS);
10090
- // Store Keypair data in keystore
10091
- await this.cache.setItem(publicJwkHash, {
10092
- privateKey: unextractablePrivateKey,
10093
- publicKey: keyPair.publicKey,
10094
- requestMethod: request.resourceRequestMethod,
10095
- requestUri: request.resourceRequestUri,
10096
- }, request.correlationId);
10097
- if (publicKeyThumbMeasurement) {
10098
- publicKeyThumbMeasurement.end({
10099
- success: true,
10100
- });
10101
- }
10102
- return publicJwkHash;
10103
- }
10104
10488
  /**
10105
10489
  * Removes cryptographic keypair from key store matching the keyId passed in
10106
10490
  * @param kid
10107
10491
  * @param correlationId
10108
10492
  */
10109
10493
  async removeTokenBindingKey(kid, correlationId) {
10110
- await this.cache.removeItem(kid, correlationId);
10111
- const keyFound = await this.cache.containsKey(kid, correlationId);
10112
- if (keyFound) {
10113
- throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10114
- }
10494
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
10115
10495
  }
10116
10496
  /**
10117
10497
  * Removes all cryptographic keys from IndexedDB storage
10118
10498
  * @param correlationId
10119
10499
  */
10120
10500
  async clearKeystore(correlationId) {
10121
- // Delete in-memory keystores
10122
- this.cache.clearInMemory(correlationId);
10123
- /**
10124
- * There is only one database, so calling clearPersistent on asymmetric keystore takes care of
10125
- * every persistent keystore
10126
- */
10501
+ return this.tokenBindingKeyManager.clearKeystore(correlationId);
10502
+ }
10503
+ /** @internal */
10504
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
10505
+ let telemetry = {};
10506
+ const signTokenBindingJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10127
10507
  try {
10128
- await this.cache.clearPersistent(correlationId);
10129
- return true;
10508
+ const cachedKeyPair = await this.tokenBindingKeyManager.getTokenBindingKeyPair(kid, correlationId);
10509
+ await this.validateTokenBindingJwtHeaderKey(header, kid, correlationId);
10510
+ telemetry = this.tokenBindingKeyManager.getTokenBindingKeyTelemetry(cachedKeyPair, header.alg);
10511
+ const signingAlgorithm = this.getTokenBindingKeySigningAlgorithm(cachedKeyPair, header.alg, correlationId);
10512
+ const tokenString = `${urlEncode(JSON.stringify(header))}.${urlEncode(JSON.stringify(payload))}`;
10513
+ const encodedSignature = await this.signInput(cachedKeyPair, tokenString, signingAlgorithm);
10514
+ signTokenBindingJwtMeasurement?.end({
10515
+ success: true,
10516
+ ...telemetry,
10517
+ });
10518
+ return `${tokenString}.${encodedSignature}`;
10130
10519
  }
10131
10520
  catch (e) {
10132
- if (e instanceof Error) {
10133
- this.logger.error(`1owpn8 ${e.message}`, correlationId);
10134
- }
10135
- else {
10136
- this.logger.error("0yrmwo", correlationId);
10137
- }
10138
- return false;
10139
- }
10140
- }
10141
- /**
10142
- * Signs the given object as a jwt payload with private key retrieved by given kid.
10143
- * @param payload
10144
- * @param kid
10145
- */
10146
- async signJwt(payload, kid, shrOptions, correlationId) {
10147
- const signJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10148
- const cachedKeyPair = await this.cache.getItem(kid, correlationId || "");
10149
- if (!cachedKeyPair) {
10150
- throw createBrowserAuthError(cryptoKeyNotFound, correlationId || "");
10151
- }
10152
- // Get public key as JWK
10153
- const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
10154
- const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
10155
- // Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
10156
- const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
10157
- // Generate header
10158
- const shrHeader = JoseHeader.getShrHeaderString({
10159
- ...shrOptions?.header,
10160
- alg: publicKeyJwk.alg,
10161
- kid: encodedKeyIdThumbprint,
10162
- });
10163
- const encodedShrHeader = urlEncode(shrHeader);
10164
- // Generate payload
10165
- payload.cnf = {
10166
- jwk: JSON.parse(publicKeyJwkString),
10167
- };
10168
- const encodedPayload = urlEncode(JSON.stringify(payload));
10169
- // Form token string
10170
- const tokenString = `${encodedShrHeader}.${encodedPayload}`;
10171
- // Sign token
10172
- const encoder = new TextEncoder();
10173
- const tokenBuffer = encoder.encode(tokenString);
10174
- const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer, RSA_SIGN_ALGORITHM_OPTIONS);
10175
- const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
10176
- const signedJwt = `${tokenString}.${encodedSignature}`;
10177
- if (signJwtMeasurement) {
10178
- signJwtMeasurement.end({
10179
- success: true,
10521
+ signTokenBindingJwtMeasurement?.end({
10522
+ success: false,
10523
+ ...telemetry,
10180
10524
  });
10525
+ throw e;
10181
10526
  }
10182
- return signedJwt;
10183
10527
  }
10184
10528
  /**
10185
10529
  * Returns the SHA-256 hash of an input string
@@ -10188,11 +10532,39 @@
10188
10532
  async hashString(plainText) {
10189
10533
  return hashString(plainText);
10190
10534
  }
10191
- }
10192
- CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
10193
- CryptoOps.EXTRACTABLE = true;
10194
- function getSortedObjectString(obj) {
10195
- return JSON.stringify(obj, Object.keys(obj).sort());
10535
+ async signInput(cachedKeyPair, signingInput, algorithm) {
10536
+ const encoder = new TextEncoder();
10537
+ const signatureBuffer = await sign(cachedKeyPair.privateKey, encoder.encode(signingInput), algorithm);
10538
+ return urlEncodeArr(new Uint8Array(signatureBuffer));
10539
+ }
10540
+ getTokenBindingKeySigningAlgorithm(cachedKeyPair, requestedAlgorithm, correlationId) {
10541
+ const keyAlgorithm = cachedKeyPair.privateKey.algorithm;
10542
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 &&
10543
+ keyAlgorithm.name === RSA_SIGN_ALGORITHM_OPTIONS.name) {
10544
+ return RSA_SIGN_ALGORITHM_OPTIONS;
10545
+ }
10546
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.ES256 &&
10547
+ keyAlgorithm.name ===
10548
+ ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS.name &&
10549
+ keyAlgorithm.namedCurve ===
10550
+ ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS.namedCurve) {
10551
+ return ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS;
10552
+ }
10553
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 ||
10554
+ requestedAlgorithm === JsonWebTokenAlgorithms.ES256) {
10555
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId, tokenBindingKeyAlgorithmMismatch);
10556
+ }
10557
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10558
+ }
10559
+ async validateTokenBindingJwtHeaderKey(header, kid, correlationId) {
10560
+ if (!header.jwk) {
10561
+ return;
10562
+ }
10563
+ const headerKeyId = await computeJwkThumbprint(header.jwk, correlationId);
10564
+ if (headerKeyId !== kid) {
10565
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, tokenBindingKeyJwkThumbprintMismatch);
10566
+ }
10567
+ }
10196
10568
  }
10197
10569
 
10198
10570
  /*
@@ -10787,7 +11159,7 @@
10787
11159
 
10788
11160
  /* eslint-disable header/header */
10789
11161
  const name = "@azure/msal-browser";
10790
- const version = "5.17.3";
11162
+ const version = "5.19.0";
10791
11163
 
10792
11164
  /*
10793
11165
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11680,12 +12052,12 @@
11680
12052
  return parsedAccessToken;
11681
12053
  }
11682
12054
  /**
11683
- * set accessToken credential to the platform cache
11684
- * @param accessToken
12055
+ * Set accessToken credential to the platform cache
12056
+ * @param accessToken - the access token entity to cache
11685
12057
  */
11686
- async setAccessTokenCredential(accessToken, correlationId, kmsi) {
12058
+ async setAccessTokenCredential(accessToken, correlationId, kmsi, additionalCacheKeyHash) {
11687
12059
  this.logger.trace("1pondb", correlationId);
11688
- const accessTokenKey = this.generateCredentialKey(accessToken);
12060
+ const accessTokenKey = this.generateCredentialKey(accessToken, additionalCacheKeyHash);
11689
12061
  const timestamp = Date.now().toString();
11690
12062
  accessToken.lastUpdatedAt = timestamp;
11691
12063
  await this.setUserData(accessTokenKey, JSON.stringify(accessToken), correlationId, timestamp, kmsi);
@@ -11995,11 +12367,13 @@
11995
12367
  }
11996
12368
  /**
11997
12369
  * Generate Credential Key. All changes to the key REQUIRE a schema version update.
11998
- * Cache Key: msal.<schema_version>|<home_account_id>|<environment>|<credential_type>|<client_id or familyId>|<realm>|<scopes>|<scheme>
12370
+ * Cache Key: msal.<schema_version>|<home_account_id>|<environment>|<credential_type>|<client_id or familyId>|<realm>|<scopes>|<scheme>|<additional_cache_key_components_hash>
12371
+ *
11999
12372
  * @param credentialEntity
12373
+ * @param hash - optional precomputed hash of additionalCacheKeyComponents
12000
12374
  * @returns
12001
12375
  */
12002
- generateCredentialKey(credential) {
12376
+ generateCredentialKey(credential, additionalCacheKeyHash) {
12003
12377
  const familyId = (credential.credentialType ===
12004
12378
  CredentialType.REFRESH_TOKEN &&
12005
12379
  credential.familyId) ||
@@ -12019,6 +12393,12 @@
12019
12393
  credential.target || "",
12020
12394
  scheme,
12021
12395
  ];
12396
+ // Append precomputed component-hash segment.
12397
+ if (credential.additionalCacheKeyComponents &&
12398
+ Object.keys(credential.additionalCacheKeyComponents).length > 0 &&
12399
+ additionalCacheKeyHash) {
12400
+ credentialKey.push(additionalCacheKeyHash);
12401
+ }
12022
12402
  return credentialKey.join(CACHE_KEY_SEPARATOR).toLowerCase();
12023
12403
  }
12024
12404
  /**
@@ -12394,7 +12774,7 @@
12394
12774
  * Licensed under the MIT License.
12395
12775
  */
12396
12776
  class BaseInteractionClient {
12397
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider) {
12777
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
12398
12778
  this.config = config;
12399
12779
  this.browserStorage = storageImpl;
12400
12780
  this.browserCrypto = browserCrypto;
@@ -12405,6 +12785,9 @@
12405
12785
  this.correlationId = correlationId;
12406
12786
  this.logger = logger.clone(name, version);
12407
12787
  this.performanceClient = performanceClient;
12788
+ this.tokenBindingKeyManager =
12789
+ tokenBindingKeyManager ||
12790
+ new TokenBindingKeyManager(this.logger, this.performanceClient);
12408
12791
  }
12409
12792
  }
12410
12793
  /**
@@ -12531,6 +12914,11 @@
12531
12914
  * Copyright (c) Microsoft Corporation. All rights reserved.
12532
12915
  * Licensed under the MIT License.
12533
12916
  */
12917
+ const SUPPORTED_AUTHENTICATION_SCHEMES = new Set([
12918
+ AuthenticationScheme$1.BEARER,
12919
+ AuthenticationScheme$1.POP,
12920
+ AuthenticationScheme$1.SSH,
12921
+ ]);
12534
12922
  /**
12535
12923
  * Initializer function for all request APIs
12536
12924
  * @param request
@@ -12555,13 +12943,16 @@
12555
12943
  logger.verbose("1l4fwv", correlationId);
12556
12944
  }
12557
12945
  else {
12946
+ if (!SUPPORTED_AUTHENTICATION_SCHEMES.has(validatedRequest.authenticationScheme)) {
12947
+ throw createClientConfigurationError(unsupportedAuthenticationScheme, correlationId);
12948
+ }
12558
12949
  if (validatedRequest.authenticationScheme ===
12559
12950
  AuthenticationScheme$1.SSH) {
12560
12951
  if (!request.sshJwk) {
12561
- throw createClientConfigurationError(missingSshJwk, "");
12952
+ throw createClientConfigurationError(missingSshJwk, correlationId);
12562
12953
  }
12563
12954
  if (!request.sshKid) {
12564
- throw createClientConfigurationError(missingSshKid, "");
12955
+ throw createClientConfigurationError(missingSshKid, correlationId);
12565
12956
  }
12566
12957
  }
12567
12958
  logger.verbose(`1ecmns ${validatedRequest.authenticationScheme}`, correlationId);
@@ -12746,6 +13137,7 @@
12746
13137
  correlationId: this.correlationId,
12747
13138
  },
12748
13139
  cryptoInterface: this.browserCrypto,
13140
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
12749
13141
  networkInterface: this.networkClient,
12750
13142
  storageInterface: this.browserStorage,
12751
13143
  serverTelemetryManager: serverTelemetryManager,
@@ -13217,13 +13609,13 @@
13217
13609
  * Licensed under the MIT License.
13218
13610
  */
13219
13611
  class PlatformAuthInteractionClient extends BaseInteractionClient {
13220
- constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
13221
- super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13612
+ constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
13613
+ super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
13222
13614
  this.apiId = apiId;
13223
13615
  this.accountId = accountId;
13224
13616
  this.platformAuthProvider = provider;
13225
13617
  this.nativeStorageManager = nativeStorageImpl;
13226
- this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13618
+ this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, this.tokenBindingKeyManager);
13227
13619
  const extensionName = this.platformAuthProvider.getExtensionName();
13228
13620
  this.skus = ServerTelemetryManager.makeExtraSkuString({
13229
13621
  libraryName: BrowserConstants.MSAL_SKU,
@@ -13347,13 +13739,18 @@
13347
13739
  * @returns CommonSilentFlowRequest
13348
13740
  */
13349
13741
  createSilentCacheRequest(request, cachedAccount) {
13350
- return {
13742
+ const silentRequest = {
13351
13743
  authority: request.authority,
13352
13744
  correlationId: this.correlationId,
13353
13745
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
13354
13746
  account: cachedAccount,
13355
13747
  forceRefresh: false,
13356
13748
  };
13749
+ // Preserve FMI partition semantics for silent cache filtering.
13750
+ if (request.attributeTokens) {
13751
+ silentRequest.attributeTokens = request.attributeTokens.split(" ");
13752
+ }
13753
+ return silentRequest;
13357
13754
  }
13358
13755
  /**
13359
13756
  * Fetches the tokens from the cache if un-expired
@@ -13565,7 +13962,7 @@
13565
13962
  return response.shr;
13566
13963
  }
13567
13964
  // Generate SHR in msal js if WAM does not compute it when POP is enabled
13568
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
13965
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13569
13966
  const shrParameters = {
13570
13967
  resourceRequestMethod: request.resourceRequestMethod,
13571
13968
  resourceRequestUri: request.resourceRequestUri,
@@ -13679,7 +14076,12 @@
13679
14076
  : response.expires_in) || 0;
13680
14077
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
13681
14078
  const responseScopes = this.generateScopes(response.scope, request.scope);
13682
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId);
14079
+ const additionalCacheKeyComponents = request.attributeTokens
14080
+ ? {
14081
+ attribute_tokens: request.attributeTokens,
14082
+ }
14083
+ : undefined;
14084
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
13683
14085
  // save idtoken credential in configured browser storage
13684
14086
  if (!!cachedIdToken && storeInCache?.idToken !== false) {
13685
14087
  await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
@@ -13760,11 +14162,18 @@
13760
14162
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
13761
14163
  ? undefined
13762
14164
  : this.config.auth.clientCapabilities;
13763
- // scopes are expected to be received by the native broker as "scope" and will be added to the request below. 'resource' is added in extraParameters for MCP scenarios.
14165
+ /*
14166
+ * scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
14167
+ * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
14168
+ */
13764
14169
  const { scopes, claims } = request;
13765
14170
  const scopeSet = new ScopeSet(scopes || [], this.correlationId);
13766
14171
  scopeSet.appendScopes(OIDC_DEFAULT_SCOPES$1);
13767
14172
  const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
14173
+ const hasAttributeTokens = !!request.attributeTokens?.length;
14174
+ this.performanceClient?.addFields({
14175
+ hasAttributeTokens,
14176
+ }, this.correlationId);
13768
14177
  const validatedRequest = {
13769
14178
  claims: mergedClaims,
13770
14179
  accountId: this.accountId,
@@ -13791,6 +14200,10 @@
13791
14200
  shrClaims: request.shrClaims,
13792
14201
  shrNonce: request.shrNonce,
13793
14202
  };
14203
+ if (hasAttributeTokens) {
14204
+ validatedRequest.attributeTokens =
14205
+ serializeAttributeTokens(request.attributeTokens);
14206
+ }
13794
14207
  // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
13795
14208
  if (validatedRequest.signPopToken && !!request.popKid) {
13796
14209
  throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
@@ -13809,7 +14222,7 @@
13809
14222
  shrNonce: request.shrNonce,
13810
14223
  correlationId: this.correlationId,
13811
14224
  };
13812
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
14225
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13813
14226
  // generate reqCnf if not provided in the request
13814
14227
  let reqCnfData;
13815
14228
  if (!validatedRequest.keyId) {
@@ -13999,7 +14412,8 @@
13999
14412
  // pass the req_cnf for POP
14000
14413
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
14001
14414
  const cryptoOps = new CryptoOps(logger, performanceClient);
14002
- const popTokenGenerator = new PopTokenGenerator(cryptoOps, performanceClient);
14415
+ const tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient);
14416
+ const popTokenGenerator = new PopTokenGenerator(cryptoOps, tokenBindingKeyManager, performanceClient);
14003
14417
  // req_cnf is always sent as a string for SPAs
14004
14418
  let reqCnfData;
14005
14419
  if (!request.popKid) {
@@ -14208,7 +14622,7 @@
14208
14622
  if (decryptedData.accountId) {
14209
14623
  return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
14210
14624
  }
14211
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null);
14625
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
14212
14626
  // Validate response. This function throws a server error if an error is returned by the server.
14213
14627
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
14214
14628
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -15088,8 +15502,8 @@
15088
15502
  * Licensed under the MIT License.
15089
15503
  */
15090
15504
  class PopupClient extends StandardInteractionClient {
15091
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook) {
15092
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
15505
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook, tokenBindingKeyManager) {
15506
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15093
15507
  this.nativeStorage = nativeStorageImpl;
15094
15508
  this.eventHandler = eventHandler;
15095
15509
  this.waitForPopupResponseHook = waitForPopupResponseHook;
@@ -15603,8 +16017,8 @@
15603
16017
  return navigation?.type;
15604
16018
  }
15605
16019
  class RedirectClient extends StandardInteractionClient {
15606
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler) {
15607
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
16020
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, tokenBindingKeyManager) {
16021
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15608
16022
  this.nativeStorage = nativeStorageImpl;
15609
16023
  }
15610
16024
  /**
@@ -16096,8 +16510,8 @@
16096
16510
  * Licensed under the MIT License.
16097
16511
  */
16098
16512
  class SilentIframeClient extends StandardInteractionClient {
16099
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook) {
16100
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
16513
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook, tokenBindingKeyManager) {
16514
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16101
16515
  this.apiId = apiId;
16102
16516
  this.nativeStorage = nativeStorageImpl;
16103
16517
  this.waitForIframeResponseHook = waitForIframeResponseHook;
@@ -16404,8 +16818,8 @@
16404
16818
  * Licensed under the MIT License.
16405
16819
  */
16406
16820
  class SilentAuthCodeClient extends StandardInteractionClient {
16407
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider) {
16408
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
16821
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
16822
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16409
16823
  this.apiId = apiId;
16410
16824
  }
16411
16825
  /**
@@ -16558,10 +16972,15 @@
16558
16972
  this.hybridAuthCodeResponses = new Map();
16559
16973
  // Initialize performance client
16560
16974
  this.performanceClient = this.config.telemetry.client;
16561
- // Initialize the crypto class.
16562
- this.browserCrypto = this.isBrowserEnvironment
16563
- ? new CryptoOps(this.logger, this.performanceClient)
16564
- : DEFAULT_CRYPTO_IMPLEMENTATION;
16975
+ // Initialize environment-specific crypto and token-binding services.
16976
+ if (this.isBrowserEnvironment) {
16977
+ this.browserCrypto = new CryptoOps(this.logger, this.performanceClient);
16978
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
16979
+ }
16980
+ else {
16981
+ this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;
16982
+ this.tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
16983
+ }
16565
16984
  this.eventHandler = new EventHandler(this.logger);
16566
16985
  // Initialize the browser storage class.
16567
16986
  this.browserStorage = this.isBrowserEnvironment
@@ -16714,7 +17133,7 @@
16714
17133
  rootMeasurement.add({
16715
17134
  isPlatformBrokerRequest: true,
16716
17135
  });
16717
- const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.platformAuthProvider, platformBrokerRequest.accountId, this.nativeInternalStorage, platformBrokerRequest.correlationId);
17136
+ const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.platformAuthProvider, platformBrokerRequest.accountId, this.nativeInternalStorage, platformBrokerRequest.correlationId, this.tokenBindingKeyManager);
16718
17137
  redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)();
16719
17138
  }
16720
17139
  else {
@@ -16815,7 +17234,7 @@
16815
17234
  let result;
16816
17235
  if (this.platformAuthProvider &&
16817
17236
  this.canUsePlatformBroker(request)) {
16818
- const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
17237
+ const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
16819
17238
  result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
16820
17239
  if (e instanceof NativeAuthError &&
16821
17240
  isFatalNativeAuthError(e)) {
@@ -17440,21 +17859,32 @@
17440
17859
  // Create idToken entity and store in browser storage
17441
17860
  const idTokenEntity = createIdTokenEntity(result.account.homeAccountId, result.account.environment, result.idToken, this.config.auth.clientId, result.tenantId);
17442
17861
  // Create accessToken entity and store in native internal storage
17862
+ const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
17863
+ const additionalCacheKeyComponents = attributeTokenPartition
17864
+ ? {
17865
+ attribute_tokens: attributeTokenPartition,
17866
+ }
17867
+ : undefined;
17443
17868
  const accessTokenEntity = createAccessTokenEntity(result.account.homeAccountId, result.account.environment, result.accessToken, this.config.auth.clientId, result.tenantId, result.scopes.join(" "), result.expiresOn
17444
17869
  ? toSecondsFromDate(result.expiresOn)
17445
17870
  : 0, result.extExpiresOn
17446
17871
  ? toSecondsFromDate(result.extExpiresOn)
17447
17872
  : 0, base64Decode, request.correlationId || "", undefined, // refreshOn
17448
17873
  result.tokenType, undefined, // userAssertionHash
17449
- request.sshKid);
17874
+ request.sshKid, additionalCacheKeyComponents);
17450
17875
  if (request.resource) {
17451
17876
  accessTokenEntity.resource = request.resource;
17452
17877
  }
17878
+ // Get attribute token partition hash for cache key isolation
17879
+ const components = additionalCacheKeyComponents;
17880
+ const additionalCacheKeyHash = components
17881
+ ? await this.browserCrypto.hashString(JSON.stringify(components))
17882
+ : undefined;
17453
17883
  const kmsi = isKmsi(result.idTokenClaims);
17454
17884
  // Store idToken in browser storage
17455
17885
  await this.browserStorage.setIdTokenCredential(idTokenEntity, result.correlationId, kmsi);
17456
17886
  // Store accessToken in native internal storage
17457
- await this.nativeInternalStorage.setAccessTokenCredential(accessTokenEntity, result.correlationId, kmsi);
17887
+ await this.nativeInternalStorage.setAccessTokenCredential(accessTokenEntity, result.correlationId, kmsi, additionalCacheKeyHash);
17458
17888
  }
17459
17889
  else {
17460
17890
  return this.browserStorage.hydrateCache(result, request);
@@ -17479,7 +17909,7 @@
17479
17909
  if (!this.platformAuthProvider) {
17480
17910
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
17481
17911
  }
17482
- const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.platformAuthProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
17912
+ const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.platformAuthProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
17483
17913
  return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
17484
17914
  }
17485
17915
  /**
@@ -17536,39 +17966,39 @@
17536
17966
  * @param correlationId
17537
17967
  */
17538
17968
  createPopupClient(correlationId) {
17539
- return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForPopupResponse);
17969
+ return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForPopupResponse, this.tokenBindingKeyManager);
17540
17970
  }
17541
17971
  /**
17542
17972
  * Returns new instance of the Redirect Interaction Client
17543
17973
  * @param correlationId
17544
17974
  */
17545
17975
  createRedirectClient(correlationId) {
17546
- return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider);
17976
+ return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17547
17977
  }
17548
17978
  /**
17549
17979
  * Returns new instance of the Silent Iframe Interaction Client
17550
17980
  * @param correlationId
17551
17981
  */
17552
17982
  createSilentIframeClient(correlationId) {
17553
- return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForIframeResponse);
17983
+ return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForIframeResponse, this.tokenBindingKeyManager);
17554
17984
  }
17555
17985
  /**
17556
17986
  * Returns new instance of the Silent Cache Interaction Client
17557
17987
  */
17558
17988
  createSilentCacheClient(correlationId) {
17559
- return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
17989
+ return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17560
17990
  }
17561
17991
  /**
17562
17992
  * Returns new instance of the Silent Refresh Interaction Client
17563
17993
  */
17564
17994
  createSilentRefreshClient(correlationId) {
17565
- return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
17995
+ return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17566
17996
  }
17567
17997
  /**
17568
17998
  * Returns new instance of the Silent AuthCode Interaction Client
17569
17999
  */
17570
18000
  createSilentAuthCodeClient(correlationId) {
17571
- return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider);
18001
+ return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17572
18002
  }
17573
18003
  /**
17574
18004
  * Adds event callbacks to array
@@ -18156,6 +18586,92 @@
18156
18586
  NestedAppAuthUnavailable: "NESTED_APP_AUTH_UNAVAILABLE", // NAA is unavailable in the current context, can retry with standard browser based auth
18157
18587
  };
18158
18588
 
18589
+ /*
18590
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18591
+ * Licensed under the MIT License.
18592
+ */
18593
+ /**
18594
+ * Unified error taxonomy shared by NAA and PWB.
18595
+ *
18596
+ * Each code maps to exactly one of the four base MSAL error classes
18597
+ * (`AuthError`, `ClientAuthError`, `ServerError`,
18598
+ * `InteractionRequiredAuthError`) via `toAuthError` in
18599
+ * `./WebBrokerBridgeErrorMap`.
18600
+ */
18601
+ const WebBrokerBridgeErrorCode = {
18602
+ /* Interaction / auth outcomes */
18603
+ UserInteractionRequired: "user_interaction_required",
18604
+ UserCanceled: "user_canceled",
18605
+ /* Environment / connectivity */
18606
+ NoNetwork: "no_network",
18607
+ AccountUnavailable: "account_unavailable",
18608
+ BridgeDisabled: "bridge_disabled",
18609
+ BridgeUnavailable: "bridge_unavailable",
18610
+ /* Server-side outcomes */
18611
+ TransientError: "transient_error",
18612
+ PersistentError: "persistent_error",
18613
+ /* Broker-channel failures */
18614
+ BridgeTimeout: "bridge_timeout",
18615
+ BridgeHandshakeFailed: "bridge_handshake_failed",
18616
+ BridgeConnectionReset: "bridge_connection_reset",
18617
+ BridgeResponseInvalid: "bridge_response_invalid",
18618
+ PopupWillRedirect: "popup_will_redirect",
18619
+ ShrGenerationError: "shr_generation_error",
18620
+ /* Fallback */
18621
+ Unknown: "unknown",
18622
+ };
18623
+
18624
+ /*
18625
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18626
+ * Licensed under the MIT License.
18627
+ */
18628
+ /**
18629
+ * Lift a normalized `WebBrokerBridgeError` to one of the four base
18630
+ * MSAL error classes. Callers are responsible for lowering
18631
+ * transport-specific errors into `WebBrokerBridgeError` before calling
18632
+ * this function.
18633
+ */
18634
+ function toAuthError(err) {
18635
+ const correlationId = err.correlationId ?? "";
18636
+ switch (err.code) {
18637
+ case WebBrokerBridgeErrorCode.UserInteractionRequired:
18638
+ return new InteractionRequiredAuthError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18639
+ case WebBrokerBridgeErrorCode.TransientError:
18640
+ case WebBrokerBridgeErrorCode.PersistentError:
18641
+ return new ServerError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18642
+ case WebBrokerBridgeErrorCode.UserCanceled:
18643
+ return new ClientAuthError(userCanceled, correlationId);
18644
+ case WebBrokerBridgeErrorCode.NoNetwork:
18645
+ return new ClientAuthError(noNetworkConnectivity$1, correlationId);
18646
+ case WebBrokerBridgeErrorCode.AccountUnavailable:
18647
+ return new ClientAuthError(noAccountFound, correlationId);
18648
+ case WebBrokerBridgeErrorCode.BridgeDisabled:
18649
+ return new ClientAuthError(nestedAppAuthBridgeDisabled, correlationId);
18650
+ case WebBrokerBridgeErrorCode.BridgeUnavailable:
18651
+ /*
18652
+ * NAA parity: pass through inner code when the broker supplied
18653
+ * one, otherwise fall back to the disabled code.
18654
+ */
18655
+ return new ClientAuthError(err.innerErrorCode ||
18656
+ nestedAppAuthBridgeDisabled, correlationId, err.description);
18657
+ /*
18658
+ * PWB broker-channel failures. The common code doubles as the
18659
+ * concrete errorCode on AuthError so the original error identity
18660
+ * can be recovered by round-tripping the string.
18661
+ */
18662
+ case WebBrokerBridgeErrorCode.BridgeTimeout:
18663
+ case WebBrokerBridgeErrorCode.BridgeHandshakeFailed:
18664
+ case WebBrokerBridgeErrorCode.BridgeConnectionReset:
18665
+ case WebBrokerBridgeErrorCode.BridgeResponseInvalid:
18666
+ case WebBrokerBridgeErrorCode.PopupWillRedirect:
18667
+ case WebBrokerBridgeErrorCode.ShrGenerationError:
18668
+ return new AuthError(err.code, correlationId, err.description, err.subError);
18669
+ case WebBrokerBridgeErrorCode.Unknown:
18670
+ default:
18671
+ return new AuthError(err.innerErrorCode || "unknown_error", correlationId, err.description || "An unknown error occurred", err.subError);
18672
+ }
18673
+ }
18674
+
18159
18675
  /*
18160
18676
  * Copyright (c) Microsoft Corporation. All rights reserved.
18161
18677
  * Licensed under the MIT License.
@@ -18178,6 +18694,7 @@
18178
18694
  const correlationId = request.correlationId || this.crypto.createNewGuid();
18179
18695
  const claims = buildMergedClaims$1(request.claims, this.clientCapabilities);
18180
18696
  const scopes = request.scopes || OIDC_DEFAULT_SCOPES$1;
18697
+ const attributeTokens = serializeAttributeTokens(request.attributeTokens);
18181
18698
  const tokenRequest = {
18182
18699
  platformBrokerId: request.account?.homeAccountId,
18183
18700
  clientId: this.clientId,
@@ -18190,6 +18707,7 @@
18190
18707
  authenticationScheme: request.authenticationScheme ||
18191
18708
  AuthenticationScheme$1.BEARER,
18192
18709
  extraParameters: extraParams,
18710
+ attributeTokens,
18193
18711
  };
18194
18712
  return tokenRequest;
18195
18713
  }
@@ -18298,30 +18816,9 @@
18298
18816
  */
18299
18817
  fromBridgeError(error) {
18300
18818
  if (isBridgeError(error)) {
18301
- switch (error.status) {
18302
- case BridgeStatusCode.UserCancel:
18303
- return new ClientAuthError(userCanceled, "");
18304
- case BridgeStatusCode.NoNetwork:
18305
- return new ClientAuthError(noNetworkConnectivity$1, "");
18306
- case BridgeStatusCode.AccountUnavailable:
18307
- return new ClientAuthError(noAccountFound, "");
18308
- case BridgeStatusCode.Disabled:
18309
- return new ClientAuthError(nestedAppAuthBridgeDisabled, "");
18310
- case BridgeStatusCode.NestedAppAuthUnavailable:
18311
- return new ClientAuthError(error.code ||
18312
- nestedAppAuthBridgeDisabled, "", error.description);
18313
- case BridgeStatusCode.TransientError:
18314
- case BridgeStatusCode.PersistentError:
18315
- return new ServerError(error.code || "", "", error.description);
18316
- case BridgeStatusCode.UserInteractionRequired:
18317
- return new InteractionRequiredAuthError(error.code || "", "", error.description);
18318
- default:
18319
- return new AuthError(error.code || "", "", error.description);
18320
- }
18321
- }
18322
- else {
18323
- return new AuthError("unknown_error", "", "An unknown error occurred");
18819
+ return toAuthError(bridgeErrorToWebBrokerBridgeError(error));
18324
18820
  }
18821
+ return new AuthError("unknown_error", "", "An unknown error occurred");
18325
18822
  }
18326
18823
  /**
18327
18824
  * Returns an AuthenticationResult from the given cache items
@@ -18357,6 +18854,52 @@
18357
18854
  };
18358
18855
  return authenticationResult;
18359
18856
  }
18857
+ }
18858
+ /**
18859
+ * Converts NAA `BridgeError` into the shared `WebBrokerBridgeError`
18860
+ * taxonomy.
18861
+ */
18862
+ function bridgeErrorToWebBrokerBridgeError(error) {
18863
+ switch (error.status) {
18864
+ case BridgeStatusCode.UserCancel:
18865
+ return { code: WebBrokerBridgeErrorCode.UserCanceled };
18866
+ case BridgeStatusCode.NoNetwork:
18867
+ return { code: WebBrokerBridgeErrorCode.NoNetwork };
18868
+ case BridgeStatusCode.AccountUnavailable:
18869
+ return { code: WebBrokerBridgeErrorCode.AccountUnavailable };
18870
+ case BridgeStatusCode.Disabled:
18871
+ return { code: WebBrokerBridgeErrorCode.BridgeDisabled };
18872
+ case BridgeStatusCode.NestedAppAuthUnavailable:
18873
+ return {
18874
+ code: WebBrokerBridgeErrorCode.BridgeUnavailable,
18875
+ innerErrorCode: error.code,
18876
+ description: error.description,
18877
+ };
18878
+ case BridgeStatusCode.TransientError:
18879
+ return {
18880
+ code: WebBrokerBridgeErrorCode.TransientError,
18881
+ innerErrorCode: error.code,
18882
+ description: error.description,
18883
+ };
18884
+ case BridgeStatusCode.PersistentError:
18885
+ return {
18886
+ code: WebBrokerBridgeErrorCode.PersistentError,
18887
+ innerErrorCode: error.code,
18888
+ description: error.description,
18889
+ };
18890
+ case BridgeStatusCode.UserInteractionRequired:
18891
+ return {
18892
+ code: WebBrokerBridgeErrorCode.UserInteractionRequired,
18893
+ innerErrorCode: error.code,
18894
+ description: error.description,
18895
+ };
18896
+ default:
18897
+ return {
18898
+ code: WebBrokerBridgeErrorCode.Unknown,
18899
+ innerErrorCode: error.code,
18900
+ description: error.description,
18901
+ };
18902
+ }
18360
18903
  }
18361
18904
 
18362
18905
  /*
@@ -18842,6 +19385,66 @@
18842
19385
  }
18843
19386
  }
18844
19387
 
19388
+ /*
19389
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19390
+ * Licensed under the MIT License.
19391
+ */
19392
+ /**
19393
+ * Correlates outbound requests with inbound responses by `requestId`.
19394
+ */
19395
+ class PendingRequestRegistry {
19396
+ constructor() {
19397
+ this.pending = new Map();
19398
+ }
19399
+ /**
19400
+ * Register a pending request. Returns a promise that resolves when a
19401
+ * response with the matching `requestId` arrives, or rejects if the
19402
+ * caller invokes `reject` for that id.
19403
+ */
19404
+ register(requestId) {
19405
+ return new Promise((resolve, reject) => {
19406
+ this.pending.set(requestId, { resolve, reject });
19407
+ });
19408
+ }
19409
+ /** Resolve a pending request. No-op if `requestId` isn't registered. */
19410
+ resolve(requestId, response) {
19411
+ const entry = this.pending.get(requestId);
19412
+ if (entry === undefined) {
19413
+ return;
19414
+ }
19415
+ this.pending.delete(requestId);
19416
+ entry.resolve(response);
19417
+ }
19418
+ /** Reject a pending request. No-op if `requestId` isn't registered. */
19419
+ reject(requestId, reason) {
19420
+ const entry = this.pending.get(requestId);
19421
+ if (entry === undefined) {
19422
+ return;
19423
+ }
19424
+ this.pending.delete(requestId);
19425
+ entry.reject(reason);
19426
+ }
19427
+ /** True if `requestId` has an in-flight registration. */
19428
+ has(requestId) {
19429
+ return this.pending.has(requestId);
19430
+ }
19431
+ /**
19432
+ * Register, then invoke `send` synchronously. If `send` throws, the
19433
+ * pending entry is cleared and the promise rejects with the thrown
19434
+ * error.
19435
+ */
19436
+ async sendAndAwait(message, send) {
19437
+ const promise = this.register(message.requestId);
19438
+ try {
19439
+ send(message);
19440
+ }
19441
+ catch (err) {
19442
+ this.reject(message.requestId, err);
19443
+ }
19444
+ return promise;
19445
+ }
19446
+ }
19447
+
18845
19448
  /*
18846
19449
  * Copyright (c) Microsoft Corporation. All rights reserved.
18847
19450
  * Licensed under the MIT License.
@@ -18869,28 +19472,14 @@
18869
19472
  window.nestedAppAuthBridge.addEventListener("message", (response) => {
18870
19473
  const responsePayload = typeof response === "string" ? response : response.data;
18871
19474
  const responseEnvelope = JSON.parse(responsePayload);
18872
- const request = BridgeProxy.bridgeRequests.find((element) => element.requestId === responseEnvelope.requestId);
18873
- if (request !== undefined) {
18874
- BridgeProxy.bridgeRequests.splice(BridgeProxy.bridgeRequests.indexOf(request), 1);
18875
- if (responseEnvelope.success) {
18876
- request.resolve(responseEnvelope);
18877
- }
18878
- else {
18879
- request.reject(responseEnvelope.error);
18880
- }
19475
+ if (responseEnvelope.success) {
19476
+ BridgeProxy.pendingRegistry.resolve(responseEnvelope.requestId, responseEnvelope);
19477
+ }
19478
+ else {
19479
+ BridgeProxy.pendingRegistry.reject(responseEnvelope.requestId, responseEnvelope.error);
18881
19480
  }
18882
19481
  });
18883
- const bridgeResponse = await new Promise((resolve, reject) => {
18884
- const message = BridgeProxy.buildRequest("GetInitContext");
18885
- const request = {
18886
- requestId: message.requestId,
18887
- method: message.method,
18888
- resolve: resolve,
18889
- reject: reject,
18890
- };
18891
- BridgeProxy.bridgeRequests.push(request);
18892
- window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
18893
- });
19482
+ const bridgeResponse = await BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest("GetInitContext"));
18894
19483
  return BridgeProxy.validateBridgeResultOrThrow(bridgeResponse.initContext);
18895
19484
  }
18896
19485
  catch (error) {
@@ -18946,18 +19535,22 @@
18946
19535
  * @returns a promise that resolves to a response of provided type or rejects with a BridgeError
18947
19536
  */
18948
19537
  sendRequest(method, requestParams) {
18949
- const message = BridgeProxy.buildRequest(method, requestParams);
18950
- const promise = new Promise((resolve, reject) => {
18951
- const request = {
18952
- requestId: message.requestId,
18953
- method: message.method,
18954
- resolve: resolve,
18955
- reject: reject,
18956
- };
18957
- BridgeProxy.bridgeRequests.push(request);
19538
+ return BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest(method, requestParams));
19539
+ }
19540
+ /**
19541
+ * Registers `message.requestId` with the shared pending-request
19542
+ * registry, then posts the envelope over the host bridge. Resolves
19543
+ * with the matching response envelope; rejects with the raw
19544
+ * `BridgeError` payload.
19545
+ */
19546
+ static sendRequestViaRegistry(message) {
19547
+ const correlationKey = {
19548
+ requestId: message.requestId,
19549
+ type: message.method,
19550
+ };
19551
+ return BridgeProxy.pendingRegistry.sendAndAwait(correlationKey, () => {
18958
19552
  window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
18959
19553
  });
18960
- return promise;
18961
19554
  }
18962
19555
  static validateBridgeResultOrThrow(input) {
18963
19556
  if (input === undefined) {
@@ -18989,7 +19582,11 @@
18989
19582
  return new BridgeProxy(response.sdkName, response.sdkVersion, response.accountContext, response.capabilities);
18990
19583
  }
18991
19584
  }
18992
- BridgeProxy.bridgeRequests = [];
19585
+ /**
19586
+ * Correlates outbound bridge requests with inbound responses by
19587
+ * `requestId`
19588
+ */
19589
+ BridgeProxy.pendingRegistry = new PendingRequestRegistry();
18993
19590
 
18994
19591
  /*
18995
19592
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19758,7 +20355,8 @@
19758
20355
  const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
19759
20356
  this.logger = new Logger(loggerOptions, name, version);
19760
20357
  this.cryptoOps = new CryptoOps(this.logger);
19761
- this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, new StubPerformanceClient());
20358
+ const tokenBindingKeyManager = new TokenBindingKeyManager(this.logger);
20359
+ this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, tokenBindingKeyManager, new StubPerformanceClient());
19762
20360
  this.shrParameters = shrParameters;
19763
20361
  }
19764
20362
  /**