@azure/msal-browser 5.18.0 → 5.20.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 (334) 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 +6 -6
  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 +15 -5
  18. package/dist/cache/LocalStorage.mjs.map +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/SessionStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.mjs +3 -2
  22. package/dist/cache/TokenCache.mjs.map +1 -1
  23. package/dist/config/Configuration.mjs +1 -1
  24. package/dist/controllers/NestedAppAuthController.mjs +8 -4
  25. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  26. package/dist/controllers/StandardController.mjs +24 -18
  27. package/dist/controllers/StandardController.mjs.map +1 -1
  28. package/dist/crypto/BrowserCrypto.mjs +19 -19
  29. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  30. package/dist/crypto/CryptoOps.mjs +62 -103
  31. package/dist/crypto/CryptoOps.mjs.map +1 -1
  32. package/dist/crypto/PkceGenerator.mjs +1 -1
  33. package/dist/crypto/SignedHttpRequest.mjs +4 -2
  34. package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
  35. package/dist/crypto/TokenBindingKeyManager.mjs +157 -0
  36. package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -0
  37. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  38. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  39. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +2 -2
  40. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  41. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  57. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  58. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  59. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  60. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  61. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  62. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  63. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  64. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  65. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  66. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  67. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  68. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  69. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  70. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  71. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  72. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  73. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  74. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +4 -4
  75. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs.map +1 -1
  76. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +4 -3
  77. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs.map +1 -1
  78. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  79. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  80. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  81. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  82. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  83. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  84. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  85. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  86. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  87. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  88. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  89. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  90. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  91. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  92. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  93. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  94. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  95. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  96. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  97. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  98. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  99. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  100. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  101. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  102. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  103. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  104. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  105. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +2 -1
  106. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs.map +1 -1
  107. package/dist/custom_auth/index.mjs +1 -1
  108. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  109. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  110. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  111. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  112. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  113. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  114. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  115. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  116. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  117. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  118. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  119. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  120. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  121. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  122. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  123. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  124. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  125. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  126. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  127. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  128. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  129. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  130. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  131. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  132. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  133. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  134. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  135. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  136. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  137. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  138. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  139. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  140. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  141. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  142. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  143. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  144. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  145. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  146. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  147. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  148. package/dist/encode/Base64Decode.mjs +1 -1
  149. package/dist/encode/Base64Encode.mjs +1 -1
  150. package/dist/error/BrowserAuthError.mjs +1 -1
  151. package/dist/error/BrowserAuthErrorCodes.mjs +5 -2
  152. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  153. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  154. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  155. package/dist/error/NativeAuthError.mjs +1 -1
  156. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  157. package/dist/error/NestedAppAuthError.mjs +1 -1
  158. package/dist/event/EventHandler.mjs +1 -1
  159. package/dist/event/EventMessage.mjs +1 -1
  160. package/dist/event/EventType.mjs +1 -1
  161. package/dist/index.mjs +1 -1
  162. package/dist/index.mjs.map +1 -1
  163. package/dist/interaction_client/BaseInteractionClient.mjs +6 -2
  164. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  165. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  166. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +6 -6
  167. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  168. package/dist/interaction_client/PopupClient.mjs +9 -5
  169. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  170. package/dist/interaction_client/RedirectClient.mjs +8 -3
  171. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  172. package/dist/interaction_client/SilentAuthCodeClient.mjs +6 -3
  173. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  174. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  175. package/dist/interaction_client/SilentIframeClient.mjs +8 -5
  176. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  177. package/dist/interaction_client/SilentRefreshClient.mjs +4 -2
  178. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  179. package/dist/interaction_client/StandardInteractionClient.mjs +2 -1
  180. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  181. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  182. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  183. package/dist/log-strings-mapping.json +243 -247
  184. package/dist/naa/BridgeError.mjs +1 -1
  185. package/dist/naa/BridgeProxy.mjs +27 -32
  186. package/dist/naa/BridgeProxy.mjs.map +1 -1
  187. package/dist/naa/BridgeStatusCode.mjs +1 -1
  188. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +52 -25
  189. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
  190. package/dist/navigation/NavigationClient.mjs +1 -1
  191. package/dist/network/FetchClient.mjs +1 -1
  192. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  193. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  194. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  195. package/dist/packageMetadata.mjs +2 -2
  196. package/dist/popup_relay/constants.mjs +1 -1
  197. package/dist/popup_relay/index.mjs +1 -1
  198. package/dist/popup_relay/relayClient.mjs +1 -1
  199. package/dist/protocol/Authorize.mjs +12 -16
  200. package/dist/protocol/Authorize.mjs.map +1 -1
  201. package/dist/redirect_bridge/index.mjs +1 -1
  202. package/dist/request/RequestHelpers.mjs +71 -10
  203. package/dist/request/RequestHelpers.mjs.map +1 -1
  204. package/dist/response/ResponseHandler.mjs +1 -1
  205. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  206. package/dist/telemetry/BrowserPerformanceEvents.mjs +5 -5
  207. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  208. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  209. package/dist/utils/BrowserConstants.mjs +1 -1
  210. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  211. package/dist/utils/BrowserUtils.mjs +1 -1
  212. package/dist/utils/Helpers.mjs +1 -1
  213. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  214. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +64 -0
  215. package/dist/webBrokerBridge/PendingRequestRegistry.mjs.map +1 -0
  216. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +39 -0
  217. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs.map +1 -0
  218. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +58 -0
  219. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs.map +1 -0
  220. package/lib/custom-auth-path/log-strings-mapping.json +39 -43
  221. package/lib/custom-auth-path/msal-custom-auth.cjs +2873 -2249
  222. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  223. package/lib/custom-auth-path/msal-custom-auth.js +2873 -2249
  224. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  225. package/lib/log-strings-mapping.json +11 -15
  226. package/lib/msal-browser.cjs +1243 -503
  227. package/lib/msal-browser.cjs.map +1 -1
  228. package/lib/msal-browser.js +1243 -503
  229. package/lib/msal-browser.js.map +1 -1
  230. package/lib/msal-browser.min.js +2 -2
  231. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  232. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  233. package/lib/popup-relay/msal-popup-relay.js +2 -2
  234. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  235. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  236. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  237. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  238. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  239. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  240. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  241. package/package.json +2 -2
  242. package/src/cache/AsyncMemoryStorage.ts +7 -13
  243. package/src/cache/BrowserCacheManager.ts +12 -4
  244. package/src/cache/LocalStorage.ts +14 -4
  245. package/src/cache/TokenCache.ts +3 -1
  246. package/src/controllers/NestedAppAuthController.ts +10 -2
  247. package/src/controllers/StandardController.ts +46 -16
  248. package/src/controllers/UnknownOperatingContextController.ts +11 -2
  249. package/src/crypto/BrowserCrypto.ts +10 -8
  250. package/src/crypto/CryptoOps.ts +138 -178
  251. package/src/crypto/SignedHttpRequest.ts +3 -0
  252. package/src/crypto/TokenBindingKeyManager.ts +299 -0
  253. package/src/custom_auth/controller/CustomAuthStandardController.ts +2 -1
  254. package/src/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.ts +8 -3
  255. package/src/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.ts +7 -3
  256. package/src/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.ts +1 -0
  257. package/src/error/BrowserAuthErrorCodes.ts +6 -0
  258. package/src/index.ts +1 -0
  259. package/src/interaction_client/BaseInteractionClient.ts +8 -1
  260. package/src/interaction_client/PlatformAuthInteractionClient.ts +9 -3
  261. package/src/interaction_client/PopupClient.ts +24 -4
  262. package/src/interaction_client/RedirectClient.ts +20 -2
  263. package/src/interaction_client/SilentAuthCodeClient.ts +13 -2
  264. package/src/interaction_client/SilentIframeClient.ts +16 -7
  265. package/src/interaction_client/SilentRefreshClient.ts +11 -1
  266. package/src/interaction_client/StandardInteractionClient.ts +1 -0
  267. package/src/naa/BridgeProxy.ts +38 -44
  268. package/src/naa/mapping/NestedAppAuthAdapter.ts +57 -55
  269. package/src/packageMetadata.ts +1 -1
  270. package/src/protocol/Authorize.ts +15 -24
  271. package/src/request/RequestHelpers.ts +124 -13
  272. package/src/telemetry/BrowserPerformanceEvents.ts +4 -4
  273. package/src/webBrokerBridge/PendingRequestRegistry.ts +2 -5
  274. package/src/webBrokerBridge/adapter/CrossVersionRequestAdapter.ts +186 -0
  275. package/src/webBrokerBridge/index.ts +11 -0
  276. package/types/cache/AsyncMemoryStorage.d.ts +1 -2
  277. package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
  278. package/types/cache/BrowserCacheManager.d.ts +3 -3
  279. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  280. package/types/cache/LocalStorage.d.ts.map +1 -1
  281. package/types/cache/TokenCache.d.ts.map +1 -1
  282. package/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  283. package/types/controllers/StandardController.d.ts +2 -1
  284. package/types/controllers/StandardController.d.ts.map +1 -1
  285. package/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
  286. package/types/crypto/BrowserCrypto.d.ts +2 -2
  287. package/types/crypto/BrowserCrypto.d.ts.map +1 -1
  288. package/types/crypto/CryptoOps.d.ts +7 -21
  289. package/types/crypto/CryptoOps.d.ts.map +1 -1
  290. package/types/crypto/SignedHttpRequest.d.ts.map +1 -1
  291. package/types/crypto/TokenBindingKeyManager.d.ts +83 -0
  292. package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -0
  293. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  294. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  295. package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts +2 -2
  296. package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts.map +1 -1
  297. package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts +4 -3
  298. package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts.map +1 -1
  299. package/types/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.d.ts.map +1 -1
  300. package/types/error/BrowserAuthErrorCodes.d.ts +3 -0
  301. package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  302. package/types/index.d.ts +3 -0
  303. package/types/index.d.ts.map +1 -1
  304. package/types/interaction_client/BaseInteractionClient.d.ts +3 -2
  305. package/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  306. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +2 -2
  307. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  308. package/types/interaction_client/PopupClient.d.ts +2 -2
  309. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  310. package/types/interaction_client/RedirectClient.d.ts +2 -2
  311. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  312. package/types/interaction_client/SilentAuthCodeClient.d.ts +2 -2
  313. package/types/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  314. package/types/interaction_client/SilentIframeClient.d.ts +2 -2
  315. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  316. package/types/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  317. package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  318. package/types/naa/BridgeProxy.d.ts +14 -2
  319. package/types/naa/BridgeProxy.d.ts.map +1 -1
  320. package/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  321. package/types/packageMetadata.d.ts +1 -1
  322. package/types/protocol/Authorize.d.ts.map +1 -1
  323. package/types/request/RequestHelpers.d.ts +11 -1
  324. package/types/request/RequestHelpers.d.ts.map +1 -1
  325. package/types/telemetry/BrowserPerformanceEvents.d.ts +4 -4
  326. package/types/webBrokerBridge/PendingRequestRegistry.d.ts +2 -2
  327. package/types/webBrokerBridge/PendingRequestRegistry.d.ts.map +1 -1
  328. package/types/webBrokerBridge/adapter/CrossVersionRequestAdapter.d.ts +66 -0
  329. package/types/webBrokerBridge/adapter/CrossVersionRequestAdapter.d.ts.map +1 -0
  330. package/types/webBrokerBridge/index.d.ts +2 -0
  331. package/types/webBrokerBridge/index.d.ts.map +1 -1
  332. package/src/naa/BridgeRequest.ts +0 -16
  333. package/types/naa/BridgeRequest.d.ts +0 -8
  334. package/types/naa/BridgeRequest.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v5.18.0 2026-08-04 */
1
+ /*! @azure/msal-browser v5.20.0 2026-08-28 */
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.12.0 2026-08-04 */
9
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -43,6 +43,7 @@
43
43
  const CLIENT_ASSERTION_TYPE = "client_assertion_type";
44
44
  const TOKEN_TYPE = "token_type";
45
45
  const REQ_CNF = "req_cnf";
46
+ const DPOP_JKT = "dpop_jkt";
46
47
  const RETURN_SPA_CODE = "return_spa_code";
47
48
  const NATIVE_BROKER = "nativebroker";
48
49
  const LOGOUT_HINT = "logout_hint";
@@ -59,7 +60,7 @@
59
60
  const CLI_DATA = "clidata";
60
61
  const ATTRIBUTE_TOKENS = "attribute_tokens";
61
62
 
62
- /*! @azure/msal-common v16.12.0 2026-08-04 */
63
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
63
64
  /*
64
65
  * Copyright (c) Microsoft Corporation. All rights reserved.
65
66
  * Licensed under the MIT License.
@@ -71,7 +72,6 @@
71
72
  const DEFAULT_COMMON_TENANT = "common";
72
73
  // ADFS String
73
74
  const ADFS = "adfs";
74
- const DSTS = "dstsv2";
75
75
  // Default AAD Instance Discovery Endpoint
76
76
  const AAD_INSTANCE_DISCOVERY_ENDPT = `${DEFAULT_AUTHORITY}discovery/instance?api-version=1.1&authorization_endpoint=`;
77
77
  // CIAM URL
@@ -124,6 +124,7 @@
124
124
  const HeaderNames = {
125
125
  CONTENT_TYPE: "Content-Type",
126
126
  CONTENT_LENGTH: "Content-Length",
127
+ DPOP: "DPoP",
127
128
  RETRY_AFTER: "Retry-After",
128
129
  CCS_HEADER: "X-AnchorMailbox",
129
130
  WWWAuthenticate: "WWW-Authenticate",
@@ -154,6 +155,7 @@
154
155
  ID_TOKEN: "id_token",
155
156
  SIGNIN_STATE: "signin_state",
156
157
  LOGIN_HINT: "login_hint",
158
+ TENANT_REGION_SUB_SCOPE: "tenant_region_sub_scope",
157
159
  };
158
160
  /**
159
161
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
@@ -238,6 +240,7 @@
238
240
  const AuthenticationScheme$1 = {
239
241
  BEARER: "Bearer",
240
242
  POP: "pop",
243
+ DPOP: "DPoP",
241
244
  SSH: "ssh-cert",
242
245
  };
243
246
  /**
@@ -291,11 +294,12 @@
291
294
  Jwt: "JWT",
292
295
  Jwk: "JWK",
293
296
  Pop: "pop",
297
+ Dpop: "dpop+jwt",
294
298
  };
295
299
  // Token renewal offset default in seconds
296
300
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
297
301
 
298
- /*! @azure/msal-common v16.12.0 2026-08-04 */
302
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
299
303
  /*
300
304
  * Copyright (c) Microsoft Corporation. All rights reserved.
301
305
  * Licensed under the MIT License.
@@ -324,7 +328,7 @@
324
328
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
325
329
  }
326
330
 
327
- /*! @azure/msal-common v16.12.0 2026-08-04 */
331
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
328
332
 
329
333
  /*
330
334
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -347,7 +351,7 @@
347
351
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
348
352
  }
349
353
 
350
- /*! @azure/msal-common v16.12.0 2026-08-04 */
354
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
351
355
  /*
352
356
  * Copyright (c) Microsoft Corporation. All rights reserved.
353
357
  * Licensed under the MIT License.
@@ -376,6 +380,7 @@
376
380
  const noAccountFound = "no_account_found";
377
381
  const noCryptoObject = "no_crypto_object";
378
382
  const unexpectedCredentialType = "unexpected_credential_type";
383
+ const dpopTokenTypeMismatch = "dpop_token_type_mismatch";
379
384
  const tokenRefreshRequired = "token_refresh_required";
380
385
  const tokenClaimsCnfRequiredForSignedJwt = "token_claims_cnf_required_for_signedjwt";
381
386
  const authorizationCodeMissingFromServerResponse = "authorization_code_missing_from_server_response";
@@ -398,6 +403,7 @@
398
403
  cannotRemoveEmptyScope: cannotRemoveEmptyScope,
399
404
  clientInfoDecodingError: clientInfoDecodingError,
400
405
  clientInfoEmptyError: clientInfoEmptyError,
406
+ dpopTokenTypeMismatch: dpopTokenTypeMismatch,
401
407
  emptyInputScopeSet: emptyInputScopeSet,
402
408
  endSessionEndpointNotSupported: endSessionEndpointNotSupported,
403
409
  endpointResolutionError: endpointResolutionError,
@@ -431,7 +437,7 @@
431
437
  userCanceled: userCanceled
432
438
  });
433
439
 
434
- /*! @azure/msal-common v16.12.0 2026-08-04 */
440
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
435
441
 
436
442
  /*
437
443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -469,7 +475,7 @@
469
475
  };
470
476
  }
471
477
 
472
- /*! @azure/msal-common v16.12.0 2026-08-04 */
478
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
473
479
 
474
480
  /*
475
481
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -535,7 +541,7 @@
535
541
  return matches[2];
536
542
  }
537
543
 
538
- /*! @azure/msal-common v16.12.0 2026-08-04 */
544
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
539
545
 
540
546
  /*
541
547
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -623,7 +629,7 @@
623
629
  return updatedAccountInfo;
624
630
  }
625
631
 
626
- /*! @azure/msal-common v16.12.0 2026-08-04 */
632
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
627
633
  /*
628
634
  * Copyright (c) Microsoft Corporation. All rights reserved.
629
635
  * Licensed under the MIT License.
@@ -634,11 +640,10 @@
634
640
  const AuthorityType = {
635
641
  Default: 0,
636
642
  Adfs: 1,
637
- Dsts: 2,
638
643
  Ciam: 3,
639
644
  };
640
645
 
641
- /*! @azure/msal-common v16.12.0 2026-08-04 */
646
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
642
647
  /*
643
648
  * Copyright (c) Microsoft Corporation. All rights reserved.
644
649
  * Licensed under the MIT License.
@@ -660,7 +665,7 @@
660
665
  return null;
661
666
  }
662
667
 
663
- /*! @azure/msal-common v16.12.0 2026-08-04 */
668
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
664
669
  /*
665
670
  * Copyright (c) Microsoft Corporation. All rights reserved.
666
671
  * Licensed under the MIT License.
@@ -684,7 +689,7 @@
684
689
  EAR: "EAR",
685
690
  };
686
691
 
687
- /*! @azure/msal-common v16.12.0 2026-08-04 */
692
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
688
693
  /**
689
694
  * Returns the AccountInfo interface for this account.
690
695
  * @internal
@@ -839,8 +844,8 @@
839
844
  * @param authType
840
845
  */
841
846
  function generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, correlationId, idTokenClaims) {
842
- // since ADFS/DSTS do not have tid and does not set client_info
843
- if (!(authType === AuthorityType.Adfs || authType === AuthorityType.Dsts)) {
847
+ // ADFS does not have tid and does not set client_info
848
+ if (authType !== AuthorityType.Adfs) {
844
849
  // for cases where there is clientInfo
845
850
  if (serverClientInfo) {
846
851
  try {
@@ -873,7 +878,7 @@
873
878
  entity.hasOwnProperty("authorityType"));
874
879
  }
875
880
 
876
- /*! @azure/msal-common v16.12.0 2026-08-04 */
881
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
877
882
  /*
878
883
  * Copyright (c) Microsoft Corporation. All rights reserved.
879
884
  * Licensed under the MIT License.
@@ -890,7 +895,7 @@
890
895
  unexpectedError: unexpectedError
891
896
  });
892
897
 
893
- /*! @azure/msal-common v16.12.0 2026-08-04 */
898
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
894
899
 
895
900
  /*
896
901
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -910,7 +915,7 @@
910
915
  return new ClientConfigurationError(errorCode, correlationId);
911
916
  }
912
917
 
913
- /*! @azure/msal-common v16.12.0 2026-08-04 */
918
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
914
919
  /*
915
920
  * Copyright (c) Microsoft Corporation. All rights reserved.
916
921
  * Licensed under the MIT License.
@@ -931,6 +936,7 @@
931
936
  const untrustedAuthority = "untrusted_authority";
932
937
  const missingSshJwk = "missing_ssh_jwk";
933
938
  const missingSshKid = "missing_ssh_kid";
939
+ const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
934
940
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
935
941
  const invalidAuthenticationHeader = "invalid_authentication_header";
936
942
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
@@ -941,7 +947,9 @@
941
947
  const issuerValidationFailed = "issuer_validation_failed";
942
948
  const invalidResponseMode = "invalid_response_mode";
943
949
  const invalidDpopHtm = "invalid_dpop_htm";
944
- const invalidDpopHtu = "invalid_dpop_htu";
950
+ const invalidDpopHtu = "invalid_dpop_htu";
951
+ const invalidDpopNonce = "invalid_dpop_nonce";
952
+ const dpopMissingResourceContext = "dpop_missing_resource_context";
945
953
 
946
954
  var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
947
955
  __proto__: null,
@@ -950,6 +958,7 @@
950
958
  cannotAllowPlatformBroker: cannotAllowPlatformBroker,
951
959
  cannotSetOIDCOptions: cannotSetOIDCOptions,
952
960
  claimsRequestParsingError: claimsRequestParsingError,
961
+ dpopMissingResourceContext: dpopMissingResourceContext,
953
962
  emptyInputScopesError: emptyInputScopesError,
954
963
  invalidAuthenticationHeader: invalidAuthenticationHeader,
955
964
  invalidAuthorityMetadata: invalidAuthorityMetadata,
@@ -958,6 +967,7 @@
958
967
  invalidCodeChallengeMethod: invalidCodeChallengeMethod,
959
968
  invalidDpopHtm: invalidDpopHtm,
960
969
  invalidDpopHtu: invalidDpopHtu,
970
+ invalidDpopNonce: invalidDpopNonce,
961
971
  invalidPlatformBrokerConfiguration: invalidPlatformBrokerConfiguration,
962
972
  invalidRequestMethodForEAR: invalidRequestMethodForEAR,
963
973
  invalidResponseMode: invalidResponseMode,
@@ -969,12 +979,13 @@
969
979
  pkceParamsMissing: pkceParamsMissing,
970
980
  redirectUriEmpty: redirectUriEmpty,
971
981
  tokenRequestEmpty: tokenRequestEmpty,
982
+ unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
972
983
  untrustedAuthority: untrustedAuthority,
973
984
  urlEmptyError: urlEmptyError,
974
985
  urlParseError: urlParseError
975
986
  });
976
987
 
977
- /*! @azure/msal-common v16.12.0 2026-08-04 */
988
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
978
989
 
979
990
  /*
980
991
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1032,7 +1043,7 @@
1032
1043
  }
1033
1044
  }
1034
1045
 
1035
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1046
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1036
1047
  /*
1037
1048
  * Copyright (c) Microsoft Corporation. All rights reserved.
1038
1049
  * Licensed under the MIT License.
@@ -1044,7 +1055,7 @@
1044
1055
  response.hasOwnProperty("jwks_uri"));
1045
1056
  }
1046
1057
 
1047
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1058
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1048
1059
  /*
1049
1060
  * Copyright (c) Microsoft Corporation. All rights reserved.
1050
1061
  * Licensed under the MIT License.
@@ -1124,7 +1135,7 @@
1124
1135
  }
1125
1136
  }
1126
1137
 
1127
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1138
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1128
1139
 
1129
1140
  /*
1130
1141
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1282,7 +1293,7 @@
1282
1293
  }
1283
1294
  }
1284
1295
 
1285
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1296
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1286
1297
 
1287
1298
  /*
1288
1299
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1291,10 +1302,7 @@
1291
1302
  // Build endpoint metadata dynamically to avoid string duplication
1292
1303
  const endpointHosts = [
1293
1304
  { host: "login.microsoftonline.com" },
1294
- {
1295
- host: "login.chinacloudapi.cn",
1296
- issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
1297
- },
1305
+ { host: "login.partner.microsoftonline.cn" },
1298
1306
  { host: "login.microsoftonline.us" },
1299
1307
  { host: "login.sovcloud-identity.fr" },
1300
1308
  { host: "login.sovcloud-identity.de" },
@@ -1368,15 +1376,6 @@
1368
1376
  preferred_cache: "login.sovcloud-identity.sg",
1369
1377
  aliases: ["login.sovcloud-identity.sg"],
1370
1378
  },
1371
- {
1372
- preferred_network: "login.windows-ppe.net",
1373
- preferred_cache: "login.windows-ppe.net",
1374
- aliases: [
1375
- "login.windows-ppe.net",
1376
- "sts.windows-ppe.net",
1377
- "login.microsoft-ppe.com",
1378
- ],
1379
- },
1380
1379
  ],
1381
1380
  },
1382
1381
  };
@@ -1448,7 +1447,7 @@
1448
1447
  return null;
1449
1448
  }
1450
1449
 
1451
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1450
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1452
1451
  /*
1453
1452
  * Copyright (c) Microsoft Corporation. All rights reserved.
1454
1453
  * Licensed under the MIT License.
@@ -1458,8 +1457,6 @@
1458
1457
  None: "none",
1459
1458
  // Microsoft Azure public cloud
1460
1459
  AzurePublic: "https://login.microsoftonline.com",
1461
- // Microsoft PPE
1462
- AzurePpe: "https://login.windows-ppe.net",
1463
1460
  // Microsoft Chinese national/regional cloud
1464
1461
  AzureChina: "https://login.chinacloudapi.cn",
1465
1462
  // Microsoft German national/regional cloud ("Black Forest")
@@ -1468,7 +1465,7 @@
1468
1465
  AzureUsGovernment: "https://login.microsoftonline.us",
1469
1466
  };
1470
1467
 
1471
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1468
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1472
1469
  /*
1473
1470
  * Copyright (c) Microsoft Corporation. All rights reserved.
1474
1471
  * Licensed under the MIT License.
@@ -1478,7 +1475,7 @@
1478
1475
  response.hasOwnProperty("metadata"));
1479
1476
  }
1480
1477
 
1481
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1478
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1482
1479
  /*
1483
1480
  * Copyright (c) Microsoft Corporation. All rights reserved.
1484
1481
  * Licensed under the MIT License.
@@ -1488,7 +1485,7 @@
1488
1485
  response.hasOwnProperty("error_description"));
1489
1486
  }
1490
1487
 
1491
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1488
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1492
1489
  /*
1493
1490
  * Copyright (c) Microsoft Corporation. All rights reserved.
1494
1491
  * Licensed under the MIT License.
@@ -1559,7 +1556,7 @@
1559
1556
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1560
1557
  const SetUserData = "setUserData";
1561
1558
 
1562
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1559
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1563
1560
  /*
1564
1561
  * Copyright (c) Microsoft Corporation. All rights reserved.
1565
1562
  * Licensed under the MIT License.
@@ -1652,7 +1649,7 @@
1652
1649
  };
1653
1650
  };
1654
1651
 
1655
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1652
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1656
1653
 
1657
1654
  /*
1658
1655
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1763,7 +1760,7 @@
1763
1760
  },
1764
1761
  };
1765
1762
 
1766
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1763
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1767
1764
  /*
1768
1765
  * Copyright (c) Microsoft Corporation. All rights reserved.
1769
1766
  * Licensed under the MIT License.
@@ -1828,7 +1825,7 @@
1828
1825
  return cachedAtSec > nowSeconds();
1829
1826
  }
1830
1827
 
1831
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1828
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1832
1829
 
1833
1830
  /*
1834
1831
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1885,6 +1882,7 @@
1885
1882
  if (refreshOn) {
1886
1883
  atEntity.refreshOn = refreshOn.toString();
1887
1884
  }
1885
+ const normalizedTokenType = atEntity.tokenType?.toLowerCase();
1888
1886
  /*
1889
1887
  * Create Access Token With Auth Scheme instead of regular access token
1890
1888
  * Cast to lower to handle "bearer" from ADFS
@@ -1893,7 +1891,7 @@
1893
1891
  AuthenticationScheme$1.BEARER.toLowerCase()) {
1894
1892
  atEntity.credentialType =
1895
1893
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
1896
- switch (atEntity.tokenType) {
1894
+ switch (normalizedTokenType) {
1897
1895
  case AuthenticationScheme$1.POP:
1898
1896
  // Make sure keyId is present and add it to credential
1899
1897
  const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
@@ -1902,6 +1900,12 @@
1902
1900
  }
1903
1901
  atEntity.keyId = tokenClaims.cnf.kid;
1904
1902
  break;
1903
+ case "dpop":
1904
+ if (!keyId) {
1905
+ throw createClientAuthError(keyIdMissing, correlationId);
1906
+ }
1907
+ atEntity.keyId = keyId;
1908
+ break;
1905
1909
  case AuthenticationScheme$1.SSH:
1906
1910
  atEntity.keyId = keyId;
1907
1911
  }
@@ -2108,7 +2112,7 @@
2108
2112
  return [...attributeTokens].sort().join(" ");
2109
2113
  }
2110
2114
 
2111
- /*! @azure/msal-common v16.12.0 2026-08-04 */
2115
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
2112
2116
 
2113
2117
  /*
2114
2118
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2152,8 +2156,6 @@
2152
2156
  switch (pathSegments[0].toLowerCase()) {
2153
2157
  case ADFS:
2154
2158
  return AuthorityType.Adfs;
2155
- case DSTS:
2156
- return AuthorityType.Dsts;
2157
2159
  }
2158
2160
  }
2159
2161
  return AuthorityType.Default;
@@ -3078,7 +3080,7 @@
3078
3080
  };
3079
3081
  }
3080
3082
 
3081
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3083
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3082
3084
 
3083
3085
  /*
3084
3086
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3112,7 +3114,7 @@
3112
3114
  }
3113
3115
  }
3114
3116
 
3115
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3117
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3116
3118
 
3117
3119
  /*
3118
3120
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3308,7 +3310,7 @@
3308
3310
  }
3309
3311
  }
3310
3312
 
3311
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3313
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3312
3314
 
3313
3315
  /*
3314
3316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3602,11 +3604,15 @@
3602
3604
  }
3603
3605
  /**
3604
3606
  * Default optional idToken claims requested on all auth requests.
3605
- * signin_state enables KMSI detection; login_hint enables login hint propagation.
3607
+ * signin_state enables KMSI detection; login_hint enables login hint propagation;
3608
+ * tenant_region_sub_scope identifies the sovereign enclave a tenant belongs to.
3606
3609
  */
3607
3610
  const DEFAULT_ID_TOKEN_CLAIMS = {
3608
3611
  [ClaimsRequestKeys.SIGNIN_STATE]: { essential: false },
3609
3612
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
3613
+ [ClaimsRequestKeys.TENANT_REGION_SUB_SCOPE]: {
3614
+ essential: false,
3615
+ },
3610
3616
  };
3611
3617
  /**
3612
3618
  * Parses a claims JSON string into an object, throwing a ClientConfigurationError
@@ -3625,7 +3631,7 @@
3625
3631
  // Malformed JSON
3626
3632
  throw createClientConfigurationError(invalidClaims, correlationId);
3627
3633
  }
3628
- if (!isPlainObject(parsed)) {
3634
+ if (!isPlainObject$1(parsed)) {
3629
3635
  // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
3630
3636
  throw createClientConfigurationError(invalidClaims, correlationId);
3631
3637
  }
@@ -3636,7 +3642,7 @@
3636
3642
  * @param value - The value to test
3637
3643
  * @returns True when value is a plain object that can be deep-merged
3638
3644
  */
3639
- function isPlainObject(value) {
3645
+ function isPlainObject$1(value) {
3640
3646
  return typeof value === "object" && value !== null && !Array.isArray(value);
3641
3647
  }
3642
3648
  /**
@@ -3653,7 +3659,7 @@
3653
3659
  const merged = { ...baseClaims };
3654
3660
  for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
3655
3661
  const baseValue = merged[key];
3656
- if (isPlainObject(baseValue) && isPlainObject(mergeInValue)) {
3662
+ if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
3657
3663
  merged[key] = deepMergeClaims(baseValue, mergeInValue);
3658
3664
  }
3659
3665
  else {
@@ -3665,8 +3671,8 @@
3665
3671
  /**
3666
3672
  * Parses claims JSON, optionally deep-merges a second client-originated claims string
3667
3673
  * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
3668
- * default optional idToken claims (signin_state, login_hint), and appends client
3669
- * capabilities (xms_cc) to the access_token section.
3674
+ * default optional idToken claims (signin_state, login_hint, tenant_region_sub_scope), and appends client
3675
+ * capabilities (xms_cc) to the access_token section
3670
3676
  * Does not overwrite idToken claims already specified by the caller.
3671
3677
  * @param claims - Existing claims JSON string from the request (may be undefined)
3672
3678
  * @param clientCapabilities - Client capabilities array from configuration
@@ -3790,7 +3796,7 @@
3790
3796
  }
3791
3797
  }
3792
3798
 
3793
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3799
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3794
3800
 
3795
3801
  /*
3796
3802
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3912,12 +3918,20 @@
3912
3918
  }
3913
3919
  }
3914
3920
 
3915
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3921
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3916
3922
 
3917
3923
  /*
3918
3924
  * Copyright (c) Microsoft Corporation. All rights reserved.
3919
3925
  * Licensed under the MIT License.
3920
3926
  */
3927
+ /**
3928
+ * Shared JOSE algorithm literals used by MSAL package internals.
3929
+ * @internal
3930
+ */
3931
+ const JsonWebTokenAlgorithms = {
3932
+ ES256: "ES256",
3933
+ RS256: "RS256",
3934
+ };
3921
3935
  /**
3922
3936
  * Default crypto implementation used when a platform-specific implementation has
3923
3937
  * not been provided.
@@ -3938,24 +3952,44 @@
3938
3952
  encodeKid: () => {
3939
3953
  throw createClientAuthError(methodNotImplemented, "");
3940
3954
  },
3941
- async getPublicKeyThumbprint() {
3942
- throw createClientAuthError(methodNotImplemented, "");
3943
- },
3944
- async removeTokenBindingKey() {
3945
- throw createClientAuthError(methodNotImplemented, "");
3955
+ async removeTokenBindingKey(kid, correlationId) {
3956
+ throw createClientAuthError(methodNotImplemented, correlationId);
3946
3957
  },
3947
- async clearKeystore() {
3948
- throw createClientAuthError(methodNotImplemented, "");
3958
+ async clearKeystore(correlationId) {
3959
+ throw createClientAuthError(methodNotImplemented, correlationId);
3949
3960
  },
3950
- async signJwt() {
3951
- throw createClientAuthError(methodNotImplemented, "");
3961
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
3962
+ throw createClientAuthError(methodNotImplemented, correlationId);
3952
3963
  },
3953
3964
  async hashString() {
3954
3965
  throw createClientAuthError(methodNotImplemented, "");
3955
3966
  },
3956
3967
  };
3957
3968
 
3958
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3969
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3970
+
3971
+ /*
3972
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3973
+ * Licensed under the MIT License.
3974
+ */
3975
+ /**
3976
+ * Default token-binding key manager used when a platform-specific implementation
3977
+ * has not been provided.
3978
+ * @internal
3979
+ */
3980
+ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3981
+ async provisionTokenBindingKey(request) {
3982
+ throw createClientAuthError(methodNotImplemented, request.correlationId);
3983
+ },
3984
+ async removeTokenBindingKey(_kid, correlationId) {
3985
+ throw createClientAuthError(methodNotImplemented, correlationId);
3986
+ },
3987
+ async getTokenBindingPublicKeyJwk(_kid, correlationId) {
3988
+ throw createClientAuthError(methodNotImplemented, correlationId);
3989
+ },
3990
+ };
3991
+
3992
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3959
3993
  /*
3960
3994
  * Copyright (c) Microsoft Corporation. All rights reserved.
3961
3995
  * Licensed under the MIT License.
@@ -4244,12 +4278,12 @@
4244
4278
  }
4245
4279
  }
4246
4280
 
4247
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4281
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4248
4282
  /* eslint-disable header/header */
4249
4283
  const name$1 = "@azure/msal-common";
4250
- const version$1 = "16.12.0";
4284
+ const version$1 = "16.14.0";
4251
4285
 
4252
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4286
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4253
4287
  /*
4254
4288
  * Copyright (c) Microsoft Corporation. All rights reserved.
4255
4289
  * Licensed under the MIT License.
@@ -4257,7 +4291,7 @@
4257
4291
  const cacheQuotaExceeded = "cache_quota_exceeded";
4258
4292
  const cacheErrorUnknown = "cache_error_unknown";
4259
4293
 
4260
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4294
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4261
4295
 
4262
4296
  /*
4263
4297
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4295,7 +4329,7 @@
4295
4329
  }
4296
4330
  }
4297
4331
 
4298
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4332
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4299
4333
 
4300
4334
  /*
4301
4335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4306,9 +4340,10 @@
4306
4340
  * @internal
4307
4341
  */
4308
4342
  class CacheManager {
4309
- constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
4343
+ constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions, tokenBindingKeyManager) {
4310
4344
  this.clientId = clientId;
4311
4345
  this.cryptoImpl = cryptoImpl;
4346
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
4312
4347
  this.commonLogger = logger.clone(name$1, version$1);
4313
4348
  this.staticAuthorityOptions = staticAuthorityOptions;
4314
4349
  this.performanceClient = performanceClient;
@@ -4656,16 +4691,9 @@
4656
4691
  // Access Token with Auth Scheme specific matching
4657
4692
  if (entity.credentialType ===
4658
4693
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
4659
- if (!!filter.tokenType &&
4660
- !this.matchTokenType(entity, filter.tokenType)) {
4694
+ if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
4661
4695
  return false;
4662
4696
  }
4663
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
4664
- if (filter.tokenType === AuthenticationScheme$1.SSH) {
4665
- if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
4666
- return false;
4667
- }
4668
- }
4669
4697
  }
4670
4698
  // Additional cache key components matching (bidirectional isolation)
4671
4699
  const entityComponents = entity.additionalCacheKeyComponents;
@@ -4804,19 +4832,24 @@
4804
4832
  }
4805
4833
  this.removeItem(key, correlationId);
4806
4834
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4807
- // Remove Token Binding Key from key store for PoP Tokens Credentials
4835
+ // Remove Token Binding Key from key store for token-bound access token credentials
4808
4836
  if (credential.credentialType.toLowerCase() ===
4809
4837
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
4810
- if (credential.tokenType === AuthenticationScheme$1.POP) {
4811
- const accessTokenWithAuthSchemeEntity = credential;
4812
- const kid = accessTokenWithAuthSchemeEntity.keyId;
4813
- if (kid) {
4814
- void this.cryptoImpl
4815
- .removeTokenBindingKey(kid, correlationId)
4816
- .catch(() => {
4817
- this.commonLogger.error(`0cx291 ${kid}`, correlationId);
4818
- this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4819
- });
4838
+ const tokenType = credential.tokenType?.toLowerCase();
4839
+ switch (tokenType) {
4840
+ case AuthenticationScheme$1.POP:
4841
+ case AuthenticationScheme$1.DPOP.toLowerCase(): {
4842
+ const accessTokenWithAuthSchemeEntity = credential;
4843
+ const kid = accessTokenWithAuthSchemeEntity.keyId;
4844
+ if (kid) {
4845
+ void this.tokenBindingKeyManager
4846
+ .removeTokenBindingKey(kid, correlationId)
4847
+ .catch(() => {
4848
+ this.commonLogger.error("0id34f", correlationId);
4849
+ this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4850
+ });
4851
+ }
4852
+ break;
4820
4853
  }
4821
4854
  }
4822
4855
  }
@@ -4982,7 +5015,9 @@
4982
5015
  realm: targetRealm || account.tenantId,
4983
5016
  target: scopes,
4984
5017
  tokenType: authScheme,
4985
- keyId: request.sshKid,
5018
+ keyId: authScheme === AuthenticationScheme$1.SSH
5019
+ ? request.sshKid
5020
+ : undefined,
4986
5021
  additionalCacheKeyComponents: additionalCacheKeyComponents,
4987
5022
  };
4988
5023
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5344,7 +5379,28 @@
5344
5379
  * @param tokenType
5345
5380
  */
5346
5381
  matchTokenType(entity, tokenType) {
5347
- return !!(entity.tokenType && entity.tokenType === tokenType);
5382
+ return !!(entity.tokenType &&
5383
+ entity.tokenType.toLowerCase() === tokenType.toLowerCase());
5384
+ }
5385
+ matchAccessTokenWithAuthScheme(entity, filter) {
5386
+ const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
5387
+ if (!!filter.tokenType &&
5388
+ !this.matchTokenType(entity, filter.tokenType)) {
5389
+ return false;
5390
+ }
5391
+ switch (normalizedFilterTokenType) {
5392
+ case "dpop":
5393
+ case AuthenticationScheme$1.SSH:
5394
+ return this.matchKeyBoundAccessToken(entity, filter);
5395
+ default:
5396
+ return true;
5397
+ }
5398
+ }
5399
+ matchKeyBoundAccessToken(entity, filter) {
5400
+ if (!filter.keyId) {
5401
+ return true;
5402
+ }
5403
+ return this.matchKeyId(entity, filter.keyId);
5348
5404
  }
5349
5405
  /**
5350
5406
  * Returns true if the credential's keyId matches the one in the request, false otherwise
@@ -5461,7 +5517,7 @@
5461
5517
  }
5462
5518
  }
5463
5519
 
5464
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5520
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5465
5521
  /*
5466
5522
  * Copyright (c) Microsoft Corporation. All rights reserved.
5467
5523
  * Licensed under the MIT License.
@@ -5526,7 +5582,7 @@
5526
5582
  "fetchRetryCount",
5527
5583
  ]);
5528
5584
 
5529
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5585
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5530
5586
 
5531
5587
  /*
5532
5588
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5584,7 +5640,7 @@
5584
5640
  }
5585
5641
  }
5586
5642
 
5587
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5643
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5588
5644
 
5589
5645
  /*
5590
5646
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5638,19 +5694,21 @@
5638
5694
  * @returns Configuration
5639
5695
  * @internal
5640
5696
  */
5641
- 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, }) {
5697
+ 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, }) {
5642
5698
  const loggerOptions = {
5643
5699
  ...DEFAULT_LOGGER_IMPLEMENTATION,
5644
5700
  ...userLoggerOption,
5645
5701
  };
5702
+ const resolvedTokenBindingKeyManager = tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER;
5646
5703
  return {
5647
5704
  authOptions: buildAuthOptions(userAuthOptions),
5648
5705
  systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
5649
5706
  loggerOptions: loggerOptions,
5650
5707
  storageInterface: storageImplementation ||
5651
- new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
5708
+ new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient(), undefined, resolvedTokenBindingKeyManager),
5652
5709
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
5653
5710
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
5711
+ tokenBindingKeyManager: resolvedTokenBindingKeyManager,
5654
5712
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
5655
5713
  libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
5656
5714
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
@@ -5680,7 +5738,7 @@
5680
5738
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5681
5739
  }
5682
5740
 
5683
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5741
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5684
5742
  /*
5685
5743
  * Copyright (c) Microsoft Corporation. All rights reserved.
5686
5744
  * Licensed under the MIT License.
@@ -5707,7 +5765,129 @@
5707
5765
  }
5708
5766
  }
5709
5767
 
5710
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5768
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5769
+
5770
+ /*
5771
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5772
+ * Licensed under the MIT License.
5773
+ */
5774
+ /**
5775
+ * Error thrown when there is an error in the client code running on the browser.
5776
+ */
5777
+ class JoseHeaderError extends AuthError {
5778
+ constructor(errorCode, correlationId, errorMessage) {
5779
+ super(errorCode, correlationId, errorMessage);
5780
+ this.name = "JoseHeaderError";
5781
+ Object.setPrototypeOf(this, JoseHeaderError.prototype);
5782
+ }
5783
+ }
5784
+ /** Returns JoseHeaderError object */
5785
+ function createJoseHeaderError(code, correlationId) {
5786
+ return new JoseHeaderError(code, correlationId);
5787
+ }
5788
+
5789
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5790
+ /*
5791
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5792
+ * Licensed under the MIT License.
5793
+ */
5794
+ /**
5795
+ * Checks whether a value is a plain JSON-like object.
5796
+ * Allows objects with null prototypes, but rejects arrays and object subclasses.
5797
+ */
5798
+ function isPlainObject(value) {
5799
+ if (typeof value !== "object" ||
5800
+ value === null ||
5801
+ Object.prototype.toString.call(value) !== "[object Object]") {
5802
+ return false;
5803
+ }
5804
+ if (Object.getPrototypeOf(value) === null) {
5805
+ return true;
5806
+ }
5807
+ let proto = value;
5808
+ while (Object.getPrototypeOf(proto) !== null) {
5809
+ proto = Object.getPrototypeOf(proto);
5810
+ }
5811
+ return Object.getPrototypeOf(value) === proto;
5812
+ }
5813
+
5814
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5815
+ /*
5816
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5817
+ * Licensed under the MIT License.
5818
+ */
5819
+ const missingKidError = "missing_kid_error";
5820
+ const missingAlgError = "missing_alg_error";
5821
+ const missingJwkError = "missing_jwk_error";
5822
+ const invalidJwkError = "invalid_jwk_error";
5823
+
5824
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5825
+
5826
+ /*
5827
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5828
+ * Licensed under the MIT License.
5829
+ */
5830
+ /** @internal */
5831
+ class JoseHeader {
5832
+ constructor(options, correlationId) {
5833
+ if (typeof options.alg !== "string" || !options.alg) {
5834
+ throw createJoseHeaderError(missingAlgError, correlationId);
5835
+ }
5836
+ this.typ = options.typ;
5837
+ this.alg = options.alg;
5838
+ this.kid = options.kid;
5839
+ this.jwk = options.jwk;
5840
+ }
5841
+ /**
5842
+ * Builds SignedHttpRequest formatted JOSE Header from the
5843
+ * JOSE Header options provided or previously set on the object.
5844
+ * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
5845
+ * @param shrHeaderOptions
5846
+ * @param correlationId
5847
+ * @returns
5848
+ */
5849
+ static getShrHeader(shrHeaderOptions, correlationId) {
5850
+ // KeyID is required on the SHR header
5851
+ if (!shrHeaderOptions.kid) {
5852
+ throw createJoseHeaderError(missingKidError, correlationId);
5853
+ }
5854
+ // Alg is required on the SHR header
5855
+ if (!shrHeaderOptions.alg) {
5856
+ throw createJoseHeaderError(missingAlgError, correlationId);
5857
+ }
5858
+ return new JoseHeader({
5859
+ // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
5860
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
5861
+ kid: shrHeaderOptions.kid,
5862
+ alg: shrHeaderOptions.alg,
5863
+ }, correlationId);
5864
+ }
5865
+ /**
5866
+ * Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
5867
+ * Throws if public JWK or algorithm aren't provided since they are required for DPoP.
5868
+ * @param dpopHeaderOptions
5869
+ * @param correlationId
5870
+ * @returns
5871
+ */
5872
+ static getDpopHeader(dpopHeaderOptions, correlationId) {
5873
+ if (!isPlainObject(dpopHeaderOptions.jwk)) {
5874
+ throw createJoseHeaderError(missingJwkError, correlationId);
5875
+ }
5876
+ if (!dpopHeaderOptions.alg) {
5877
+ throw createJoseHeaderError(missingAlgError, correlationId);
5878
+ }
5879
+ if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
5880
+ throw createJoseHeaderError(invalidJwkError, correlationId);
5881
+ }
5882
+ return new JoseHeader({
5883
+ typ: JsonWebTokenTypes$1.Dpop,
5884
+ alg: dpopHeaderOptions.alg,
5885
+ jwk: dpopHeaderOptions.jwk,
5886
+ }, correlationId);
5887
+ }
5888
+ }
5889
+
5890
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5711
5891
 
5712
5892
  /*
5713
5893
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5715,10 +5895,13 @@
5715
5895
  */
5716
5896
  const KeyLocation = {
5717
5897
  SW: "sw"};
5898
+ const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
5899
+ const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
5718
5900
  /** @internal */
5719
5901
  class PopTokenGenerator {
5720
- constructor(cryptoUtils, performanceClient) {
5902
+ constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
5721
5903
  this.cryptoUtils = cryptoUtils;
5904
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5722
5905
  this.performanceClient = performanceClient;
5723
5906
  }
5724
5907
  /**
@@ -5741,7 +5924,11 @@
5741
5924
  * @returns
5742
5925
  */
5743
5926
  async generateKid(request) {
5744
- const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
5927
+ const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
5928
+ correlationId: request.correlationId,
5929
+ tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
5930
+ tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
5931
+ });
5745
5932
  return {
5746
5933
  kid: kidThumbprint,
5747
5934
  xms_ksl: KeyLocation.SW,
@@ -5771,7 +5958,17 @@
5771
5958
  ? new UrlString(resourceRequestUri, request.correlationId)
5772
5959
  : undefined;
5773
5960
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
5774
- return this.cryptoUtils.signJwt({
5961
+ const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
5962
+ const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
5963
+ const shrAlgorithm = shrOptions?.header?.alg ||
5964
+ publicKeyJwk.alg ||
5965
+ SHR_TOKEN_BINDING_KEY_ALGORITHM;
5966
+ const shrHeader = JoseHeader.getShrHeader({
5967
+ ...shrOptions?.header,
5968
+ alg: shrAlgorithm,
5969
+ kid: encodedKeyIdThumbprint,
5970
+ }, request.correlationId);
5971
+ const shrPayload = {
5775
5972
  at: payload,
5776
5973
  ts: nowSeconds(),
5777
5974
  m: resourceRequestMethod?.toUpperCase(),
@@ -5783,11 +5980,160 @@
5783
5980
  : undefined,
5784
5981
  client_claims: shrClaims || undefined,
5785
5982
  ...claims,
5786
- }, keyId, shrOptions, request.correlationId);
5983
+ cnf: {
5984
+ jwk: publicKeyJwk,
5985
+ },
5986
+ };
5987
+ return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
5988
+ }
5989
+ }
5990
+
5991
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5992
+
5993
+ /*
5994
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5995
+ * Licensed under the MIT License.
5996
+ */
5997
+ const DPOP_HTM_REGEX = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
5998
+ const DPOP_TOKEN_BINDING_KEY_TYPE = "dpop";
5999
+ const DPOP_JWT_HEADER_ALGORITHM = JsonWebTokenAlgorithms.ES256;
6000
+ function buildProofHeader(publicJwk, correlationId) {
6001
+ return JoseHeader.getDpopHeader({
6002
+ alg: DPOP_JWT_HEADER_ALGORITHM,
6003
+ jwk: publicJwk,
6004
+ }, correlationId);
6005
+ }
6006
+ function normalizeHtm(htm, correlationId) {
6007
+ if (typeof htm !== "string" || !DPOP_HTM_REGEX.test(htm)) {
6008
+ throw createClientConfigurationError(invalidDpopHtm, correlationId);
6009
+ }
6010
+ return htm.toUpperCase();
6011
+ }
6012
+ /**
6013
+ * Normalizes a URL for use as the DPoP htu claim.
6014
+ * Per RFC 9449 §4.2, htu is the target URI without query and fragment components.
6015
+ * WHATWG URL serialization handles RFC 3986 syntax- and scheme-based normalization
6016
+ * such as lowercasing scheme/host and eliding default ports.
6017
+ */
6018
+ function normalizeHtu(url, correlationId) {
6019
+ let parsedUrl;
6020
+ try {
6021
+ parsedUrl = new URL(url);
6022
+ }
6023
+ catch {
6024
+ throw createClientConfigurationError(urlParseError, correlationId);
6025
+ }
6026
+ if (!/^https:\/\//i.test(url) ||
6027
+ parsedUrl.protocol !== "https:" ||
6028
+ parsedUrl.username ||
6029
+ parsedUrl.password) {
6030
+ throw createClientConfigurationError(invalidDpopHtu, correlationId);
6031
+ }
6032
+ parsedUrl.search = "";
6033
+ parsedUrl.hash = "";
6034
+ return parsedUrl.href;
6035
+ }
6036
+ function validateDpopNonce(nonce, correlationId) {
6037
+ if (nonce !== undefined && nonce.trim().length === 0) {
6038
+ throw createClientConfigurationError(invalidDpopNonce, correlationId);
6039
+ }
6040
+ }
6041
+ /**
6042
+ * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6043
+ * resource-endpoint proof bindings.
6044
+ *
6045
+ * Not exported from any public package entry point.
6046
+ * This helper is internal-only until DPoP is wired into acquisition flows
6047
+ * in a subsequent work item.
6048
+ *
6049
+ * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6050
+ * @internal
6051
+ */
6052
+ class DpopProofGenerator {
6053
+ constructor(cryptoUtils, tokenBindingKeyManager) {
6054
+ this.cryptoUtils = cryptoUtils;
6055
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6056
+ }
6057
+ /**
6058
+ * Provisions a fresh DPoP key and returns the RFC 7638 JWK thumbprint used
6059
+ * as `dpop_jkt`.
6060
+ */
6061
+ async generateJkt(correlationId = "") {
6062
+ return this.tokenBindingKeyManager.provisionTokenBindingKey({
6063
+ tokenBindingKeyType: DPOP_TOKEN_BINDING_KEY_TYPE,
6064
+ tokenBindingKeyAlgorithm: DPOP_JWT_HEADER_ALGORITHM,
6065
+ correlationId,
6066
+ });
6067
+ }
6068
+ /**
6069
+ * Builds RFC 9449 claims for a token-endpoint DPoP proof.
6070
+ * - htm is always "POST" because token endpoint requests use HTTP POST (RFC 9449 §5).
6071
+ * - htu is the normalized token endpoint URI (query and fragment stripped).
6072
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6073
+ */
6074
+ buildTokenProofClaims(params, correlationId = "") {
6075
+ validateDpopNonce(params.nonce, correlationId);
6076
+ const claims = {
6077
+ jti: this.cryptoUtils.createNewGuid(),
6078
+ htm: "POST",
6079
+ htu: normalizeHtu(params.tokenEndpoint, correlationId),
6080
+ iat: nowSeconds(),
6081
+ };
6082
+ if (params.nonce !== undefined) {
6083
+ claims.nonce = params.nonce;
6084
+ }
6085
+ return claims;
6086
+ }
6087
+ /**
6088
+ * Builds and signs a compact DPoP proof JWT for a token-endpoint request.
6089
+ */
6090
+ async generateTokenProof(params, keyId, correlationId = "") {
6091
+ return this.generateProof(this.buildTokenProofClaims(params, correlationId), keyId, correlationId);
6092
+ }
6093
+ /**
6094
+ * Builds RFC 9449 claims for a resource-endpoint DPoP proof.
6095
+ * - htm is uppercased per RFC 9449 §4.2.
6096
+ * - htu is the normalized resource URI (query and fragment stripped).
6097
+ * - ath is the base64url-encoded SHA-256 hash of the ASCII access token.
6098
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6099
+ */
6100
+ buildResourceProofClaims(params, correlationId = "") {
6101
+ validateDpopNonce(params.nonce, correlationId);
6102
+ const claims = {
6103
+ jti: this.cryptoUtils.createNewGuid(),
6104
+ htm: normalizeHtm(params.htm, correlationId),
6105
+ htu: normalizeHtu(params.htu, correlationId),
6106
+ ath: params.ath,
6107
+ iat: nowSeconds(),
6108
+ };
6109
+ if (params.nonce !== undefined) {
6110
+ claims.nonce = params.nonce;
6111
+ }
6112
+ return claims;
6113
+ }
6114
+ /**
6115
+ * Builds and signs a compact DPoP proof JWT for a resource request.
6116
+ */
6117
+ async generateResourceProof(params, keyId, correlationId = "") {
6118
+ const { htu, htm, nonce } = params;
6119
+ if (!htu || !htm) {
6120
+ throw createClientConfigurationError(dpopMissingResourceContext, correlationId);
6121
+ }
6122
+ const ath = await this.cryptoUtils.hashString(params.accessToken);
6123
+ return this.generateProof(this.buildResourceProofClaims({
6124
+ htu,
6125
+ htm,
6126
+ ath,
6127
+ nonce,
6128
+ }, correlationId), keyId, correlationId);
6129
+ }
6130
+ async generateProof(claims, keyId, correlationId) {
6131
+ const publicJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, correlationId);
6132
+ return this.cryptoUtils.signTokenBindingJwt(buildProofHeader(publicJwk, correlationId), claims, keyId, correlationId);
5787
6133
  }
5788
6134
  }
5789
6135
 
5790
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6136
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5791
6137
  /*
5792
6138
  * Copyright (c) Microsoft Corporation. All rights reserved.
5793
6139
  * Licensed under the MIT License.
@@ -5851,7 +6197,7 @@
5851
6197
  uiNotAllowed: uiNotAllowed
5852
6198
  });
5853
6199
 
5854
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6200
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5855
6201
 
5856
6202
  /*
5857
6203
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5918,7 +6264,7 @@
5918
6264
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
5919
6265
  }
5920
6266
 
5921
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6267
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5922
6268
 
5923
6269
  /*
5924
6270
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5937,7 +6283,7 @@
5937
6283
  }
5938
6284
  }
5939
6285
 
5940
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6286
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5941
6287
 
5942
6288
  /*
5943
6289
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6008,7 +6354,7 @@
6008
6354
  }
6009
6355
  }
6010
6356
 
6011
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6357
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6012
6358
 
6013
6359
  /*
6014
6360
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6019,10 +6365,11 @@
6019
6365
  * @internal
6020
6366
  */
6021
6367
  class ResponseHandler {
6022
- constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
6368
+ constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
6023
6369
  this.clientId = clientId;
6024
6370
  this.cacheStorage = cacheStorage;
6025
6371
  this.cryptoObj = cryptoObj;
6372
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6026
6373
  this.logger = logger;
6027
6374
  this.performanceClient = performanceClient;
6028
6375
  this.serializableCache = serializableCache;
@@ -6096,7 +6443,21 @@
6096
6443
  }
6097
6444
  // Add keyId from request to serverTokenResponse if defined
6098
6445
  serverTokenResponse.key_id =
6099
- serverTokenResponse.key_id || request.sshKid || undefined;
6446
+ serverTokenResponse.key_id ||
6447
+ request.dpopJkt ||
6448
+ request.sshKid ||
6449
+ undefined;
6450
+ if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
6451
+ if (serverTokenResponse.token_type?.toLowerCase() !==
6452
+ AuthenticationScheme$1.DPOP.toLowerCase()) {
6453
+ this.performanceClient?.addFields({
6454
+ dpopTokenTypeMismatch: serverTokenResponse.token_type,
6455
+ }, request.correlationId);
6456
+ throw createClientAuthError(dpopTokenTypeMismatch, request.correlationId);
6457
+ }
6458
+ serverTokenResponse.token_type =
6459
+ AuthenticationScheme$1.DPOP;
6460
+ }
6100
6461
  // Compute components once for entity storage (fallback if hash not provided by client)
6101
6462
  const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6102
6463
  const cacheKeyComponents = additionalCacheKeyComponents ??
@@ -6131,7 +6492,12 @@
6131
6492
  this.performanceClient?.addFields({
6132
6493
  acntLoggedOut: true,
6133
6494
  }, request.correlationId);
6134
- return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, undefined, serverRequestId);
6495
+ return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6496
+ idTokenClaims,
6497
+ requestState: requestStateObj,
6498
+ requestId: serverRequestId,
6499
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6500
+ });
6135
6501
  }
6136
6502
  }
6137
6503
  await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
@@ -6144,7 +6510,13 @@
6144
6510
  await this.persistencePlugin.afterCacheAccess(cacheContext);
6145
6511
  }
6146
6512
  }
6147
- return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, serverTokenResponse, serverRequestId);
6513
+ return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6514
+ idTokenClaims,
6515
+ requestState: requestStateObj,
6516
+ serverTokenResponse,
6517
+ requestId: serverRequestId,
6518
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6519
+ });
6148
6520
  }
6149
6521
  /**
6150
6522
  * Generates CacheRecord
@@ -6240,14 +6612,17 @@
6240
6612
  * @param fromTokenCache
6241
6613
  * @param stateString
6242
6614
  */
6243
- static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, idTokenClaims, requestState, serverTokenResponse, requestId) {
6615
+ static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
6616
+ const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
6244
6617
  let accessToken = "";
6245
6618
  let responseScopes = [];
6246
6619
  let expiresOn = null;
6247
6620
  let extExpiresOn;
6248
6621
  let refreshOn;
6249
6622
  let familyId = "";
6623
+ let dpopProof;
6250
6624
  if (cacheRecord.accessToken) {
6625
+ const accessTokenType = cacheRecord.accessToken.tokenType?.toLowerCase();
6251
6626
  /*
6252
6627
  * if the request object has `popKid` property, `signPopToken` will be set to false and
6253
6628
  * the token will be returned unsigned
@@ -6255,7 +6630,7 @@
6255
6630
  if (cacheRecord.accessToken.tokenType ===
6256
6631
  AuthenticationScheme$1.POP &&
6257
6632
  !request.popKid) {
6258
- const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
6633
+ const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
6259
6634
  const { secret, keyId } = cacheRecord.accessToken;
6260
6635
  if (!keyId) {
6261
6636
  throw createClientAuthError(keyIdMissing, request.correlationId);
@@ -6265,6 +6640,18 @@
6265
6640
  else {
6266
6641
  accessToken = cacheRecord.accessToken.secret;
6267
6642
  }
6643
+ if (accessTokenType ===
6644
+ AuthenticationScheme$1.DPOP.toLowerCase()) {
6645
+ if (!cacheRecord.accessToken.keyId) {
6646
+ throw createClientAuthError(keyIdMissing, request.correlationId);
6647
+ }
6648
+ const dpopProofGenerator = new DpopProofGenerator(cryptoObj, tokenBindingKeyManager);
6649
+ dpopProof = await dpopProofGenerator.generateResourceProof({
6650
+ htu: request.resourceRequestUri,
6651
+ htm: request.resourceRequestMethod,
6652
+ accessToken: cacheRecord.accessToken.secret,
6653
+ }, cacheRecord.accessToken.keyId, request.correlationId);
6654
+ }
6268
6655
  responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target, request.correlationId).asArray();
6269
6656
  // Access token expiresOn cached in seconds, converting to Date for AuthenticationResult
6270
6657
  expiresOn = toDateFromSeconds(cacheRecord.accessToken.expiresOn);
@@ -6281,6 +6668,15 @@
6281
6668
  }
6282
6669
  const uid = idTokenClaims?.oid || idTokenClaims?.sub || "";
6283
6670
  const tid = idTokenClaims?.tid || "";
6671
+ /*
6672
+ * Surface the sovereign enclave for telemetry. This runs for both freshly acquired
6673
+ * and cache-served tokens because SilentFlowClient shares this method, so the field
6674
+ * is present on silent requests that never hit the network.
6675
+ */
6676
+ const regionSubScope = idTokenClaims?.tenant_region_sub_scope;
6677
+ if (typeof regionSubScope === "string") {
6678
+ performanceClient?.addFields({ regionSubScope }, request.correlationId);
6679
+ }
6284
6680
  // for hybrid + native bridge enablement, send back the native account Id
6285
6681
  if (serverTokenResponse?.spa_accountid && !!cacheRecord.account) {
6286
6682
  // Set on deprecated top-level for downgrade compat
@@ -6309,6 +6705,7 @@
6309
6705
  idToken: cacheRecord?.idToken?.secret || "",
6310
6706
  idTokenClaims: idTokenClaims || {},
6311
6707
  accessToken: accessToken,
6708
+ dpopProof,
6312
6709
  fromCache: fromTokenCache,
6313
6710
  expiresOn: expiresOn,
6314
6711
  extExpiresOn: extExpiresOn,
@@ -6316,7 +6713,10 @@
6316
6713
  correlationId: request.correlationId,
6317
6714
  requestId: requestId || "",
6318
6715
  familyId: familyId,
6319
- tokenType: cacheRecord.accessToken?.tokenType || "",
6716
+ tokenType: cacheRecord.accessToken?.tokenType?.toLowerCase() ===
6717
+ AuthenticationScheme$1.DPOP.toLowerCase()
6718
+ ? AuthenticationScheme$1.DPOP
6719
+ : cacheRecord.accessToken?.tokenType || "",
6320
6720
  state: requestState ? requestState.userRequestState : "",
6321
6721
  cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || "",
6322
6722
  msGraphHost: cacheRecord.account?.msGraphHost || "",
@@ -6367,7 +6767,7 @@
6367
6767
  return baseAccount;
6368
6768
  }
6369
6769
 
6370
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6770
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6371
6771
  /*
6372
6772
  * Copyright (c) Microsoft Corporation. All rights reserved.
6373
6773
  * Licensed under the MIT License.
@@ -6377,7 +6777,7 @@
6377
6777
  UPN: "UPN",
6378
6778
  };
6379
6779
 
6380
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6780
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6381
6781
  /*
6382
6782
  * Copyright (c) Microsoft Corporation. All rights reserved.
6383
6783
  * Licensed under the MIT License.
@@ -6396,7 +6796,7 @@
6396
6796
  }
6397
6797
  }
6398
6798
 
6399
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6799
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6400
6800
 
6401
6801
  /*
6402
6802
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6420,7 +6820,7 @@
6420
6820
  };
6421
6821
  }
6422
6822
 
6423
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6823
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6424
6824
 
6425
6825
  /*
6426
6826
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6506,7 +6906,7 @@
6506
6906
  }
6507
6907
  }
6508
6908
 
6509
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6909
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6510
6910
 
6511
6911
  /*
6512
6912
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6537,7 +6937,7 @@
6537
6937
  return new NetworkError(error, httpStatus, responseHeaders);
6538
6938
  }
6539
6939
 
6540
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6940
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6541
6941
 
6542
6942
  /*
6543
6943
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6567,6 +6967,23 @@
6567
6967
  }
6568
6968
  return headers;
6569
6969
  }
6970
+ /**
6971
+ * Adds the DPoP proof header for token endpoint requests when DPoP is requested.
6972
+ * @internal
6973
+ */
6974
+ async function addDpopTokenProofHeader(headers, request, tokenEndpoint, cryptoUtils, tokenBindingKeyManager) {
6975
+ if (request.authenticationScheme !== AuthenticationScheme$1.DPOP) {
6976
+ return;
6977
+ }
6978
+ const dpopProofGenerator = new DpopProofGenerator(cryptoUtils, tokenBindingKeyManager);
6979
+ const keyId = request.dpopJkt;
6980
+ if (!keyId?.trim()) {
6981
+ throw createClientAuthError(keyIdMissing, request.correlationId);
6982
+ }
6983
+ headers[HeaderNames.DPOP] = await dpopProofGenerator.generateTokenProof({
6984
+ tokenEndpoint,
6985
+ }, keyId, request.correlationId);
6986
+ }
6570
6987
  /**
6571
6988
  * Creates query string for the /token request
6572
6989
  * @param request
@@ -6653,7 +7070,7 @@
6653
7070
  return response;
6654
7071
  }
6655
7072
 
6656
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7073
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6657
7074
 
6658
7075
  /*
6659
7076
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6703,7 +7120,7 @@
6703
7120
  const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
6704
7121
  // Retrieve requestId from response headers
6705
7122
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
6706
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7123
+ 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);
6707
7124
  // Validate response. This function throws a server error if an error is returned by the server.
6708
7125
  responseHandler.validateTokenResponse(response.body, request.correlationId);
6709
7126
  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);
@@ -6745,6 +7162,7 @@
6745
7162
  }
6746
7163
  }
6747
7164
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, ccsCredential || request.ccsCredential);
7165
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
6748
7166
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
6749
7167
  return invokeAsync(executePostToTokenEndpoint, AuthorizationCodeClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, this.cacheManager, this.networkClient, this.logger, this.performanceClient, serverTelemetryManager);
6750
7168
  }
@@ -6804,7 +7222,7 @@
6804
7222
  addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
6805
7223
  addClientInfo(parameters);
6806
7224
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
6807
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7225
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
6808
7226
  let reqCnfData;
6809
7227
  if (!request.popKid) {
6810
7228
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -6916,7 +7334,7 @@
6916
7334
  }
6917
7335
  }
6918
7336
 
6919
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7337
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6920
7338
 
6921
7339
  /*
6922
7340
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7143,76 +7561,7 @@
7143
7561
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7144
7562
  }
7145
7563
 
7146
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7147
-
7148
- /*
7149
- * Copyright (c) Microsoft Corporation. All rights reserved.
7150
- * Licensed under the MIT License.
7151
- */
7152
- /**
7153
- * Error thrown when there is an error in the client code running on the browser.
7154
- */
7155
- class JoseHeaderError extends AuthError {
7156
- constructor(errorCode, correlationId, errorMessage) {
7157
- super(errorCode, correlationId, errorMessage);
7158
- this.name = "JoseHeaderError";
7159
- Object.setPrototypeOf(this, JoseHeaderError.prototype);
7160
- }
7161
- }
7162
- /** Returns JoseHeaderError object */
7163
- function createJoseHeaderError(code, correlationId) {
7164
- return new JoseHeaderError(code, correlationId);
7165
- }
7166
-
7167
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7168
- /*
7169
- * Copyright (c) Microsoft Corporation. All rights reserved.
7170
- * Licensed under the MIT License.
7171
- */
7172
- const missingKidError = "missing_kid_error";
7173
- const missingAlgError = "missing_alg_error";
7174
-
7175
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7176
-
7177
- /*
7178
- * Copyright (c) Microsoft Corporation. All rights reserved.
7179
- * Licensed under the MIT License.
7180
- */
7181
- /** @internal */
7182
- class JoseHeader {
7183
- constructor(options) {
7184
- this.typ = options.typ;
7185
- this.alg = options.alg;
7186
- this.kid = options.kid;
7187
- }
7188
- /**
7189
- * Builds SignedHttpRequest formatted JOSE Header from the
7190
- * JOSE Header options provided or previously set on the object and returns
7191
- * the stringified header object.
7192
- * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
7193
- * @param shrHeaderOptions
7194
- * @returns
7195
- */
7196
- static getShrHeaderString(shrHeaderOptions) {
7197
- // KeyID is required on the SHR header
7198
- if (!shrHeaderOptions.kid) {
7199
- throw createJoseHeaderError(missingKidError, "");
7200
- }
7201
- // Alg is required on the SHR header
7202
- if (!shrHeaderOptions.alg) {
7203
- throw createJoseHeaderError(missingAlgError, "");
7204
- }
7205
- const shrHeader = new JoseHeader({
7206
- // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
7207
- typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
7208
- kid: shrHeaderOptions.kid,
7209
- alg: shrHeaderOptions.alg,
7210
- });
7211
- return JSON.stringify(shrHeader);
7212
- }
7213
- }
7214
-
7215
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7564
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7216
7565
 
7217
7566
  /*
7218
7567
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7761,7 +8110,7 @@
7761
8110
  }
7762
8111
  }
7763
8112
 
7764
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8113
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7765
8114
 
7766
8115
  /*
7767
8116
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7796,7 +8145,7 @@
7796
8145
  const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
7797
8146
  // Retrieve requestId from response headers
7798
8147
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
7799
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
8148
+ 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);
7800
8149
  responseHandler.validateTokenResponse(response.body, request.correlationId);
7801
8150
  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);
7802
8151
  }
@@ -7872,6 +8221,12 @@
7872
8221
  type: CcsCredentialType.HOME_ACCOUNT_ID,
7873
8222
  },
7874
8223
  };
8224
+ if (refreshTokenRequest.authenticationScheme ===
8225
+ AuthenticationScheme$1.DPOP &&
8226
+ !refreshTokenRequest.dpopJkt) {
8227
+ const dpopProofGenerator = new DpopProofGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager);
8228
+ refreshTokenRequest.dpopJkt = await dpopProofGenerator.generateJkt(request.correlationId);
8229
+ }
7875
8230
  try {
7876
8231
  return await invokeAsync(this.acquireToken.bind(this), RefreshTokenClientAcquireToken, this.logger, this.performanceClient, request.correlationId)(refreshTokenRequest, apiId);
7877
8232
  }
@@ -7897,6 +8252,7 @@
7897
8252
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
7898
8253
  const requestBody = await invokeAsync(this.createTokenRequestBody.bind(this), RefreshTokenClientCreateTokenRequestBody, this.logger, this.performanceClient, request.correlationId)(request);
7899
8254
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, request.ccsCredential);
8255
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
7900
8256
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
7901
8257
  return invokeAsync(executePostToTokenEndpoint, RefreshTokenClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, this.cacheManager, this.networkClient, this.logger, this.performanceClient, this.serverTelemetryManager);
7902
8258
  }
@@ -7937,7 +8293,7 @@
7937
8293
  addClientAssertionType(parameters, clientAssertion.assertionType);
7938
8294
  }
7939
8295
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
7940
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
8296
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7941
8297
  let reqCnfData;
7942
8298
  if (!request.popKid) {
7943
8299
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7988,7 +8344,7 @@
7988
8344
  }
7989
8345
  }
7990
8346
 
7991
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8347
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7992
8348
 
7993
8349
  /*
7994
8350
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8281,7 +8637,7 @@
8281
8637
  clearNativeBrokerErrorCode() { }
8282
8638
  }
8283
8639
 
8284
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8640
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8285
8641
 
8286
8642
  /*
8287
8643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8350,6 +8706,22 @@
8350
8706
  lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
8351
8707
  // don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
8352
8708
  }
8709
+ const cachedAccessTokenType = cachedAccessToken.tokenType?.toLowerCase();
8710
+ if (cachedAccessTokenType === AuthenticationScheme$1.DPOP.toLowerCase()) {
8711
+ if (!cachedAccessToken.keyId) {
8712
+ this.logger.info("1enswf", request.correlationId);
8713
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
8714
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
8715
+ }
8716
+ try {
8717
+ await this.config.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(cachedAccessToken.keyId, request.correlationId);
8718
+ }
8719
+ catch {
8720
+ this.logger.info("14djth", request.correlationId);
8721
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
8722
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
8723
+ }
8724
+ }
8353
8725
  const environment = request.authority || this.authority.getPreferredCache();
8354
8726
  const cacheRecord = {
8355
8727
  account: this.cacheManager.getAccount(this.cacheManager.generateAccountKey(request.account), request.correlationId),
@@ -8385,11 +8757,14 @@
8385
8757
  if (cacheRecord.idToken) {
8386
8758
  idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
8387
8759
  }
8388
- return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
8760
+ return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
8761
+ idTokenClaims,
8762
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
8763
+ });
8389
8764
  }
8390
8765
  }
8391
8766
 
8392
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8767
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8393
8768
 
8394
8769
  /*
8395
8770
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8405,7 +8780,7 @@
8405
8780
  },
8406
8781
  };
8407
8782
 
8408
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8783
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8409
8784
 
8410
8785
  /*
8411
8786
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8458,13 +8833,13 @@
8458
8833
  */
8459
8834
  const AcquireTokenSilentAsync = "acquireTokenSilentAsync";
8460
8835
  /**
8461
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
8462
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
8836
+ * provisionTokenBindingKey API in TokenBindingKeyManager class (msal-browser).
8837
+ * Used to provision token-binding key material and return a key identifier.
8463
8838
  */
8464
8839
  const CryptoOptsGetPublicKeyThumbprint = "cryptoOptsGetPublicKeyThumbprint";
8465
8840
  /**
8466
- * signJwt API in CryptoOpts class (msal-browser).
8467
- * Used to signed a pop token.
8841
+ * signTokenBindingJwt API in CryptoOpts class (msal-browser).
8842
+ * Used to sign token-binding JWTs.
8468
8843
  */
8469
8844
  const CryptoOptsSignJwt = "cryptoOptsSignJwt";
8470
8845
  /**
@@ -8621,6 +8996,9 @@
8621
8996
  const nativePromptNotSupported = "native_prompt_not_supported";
8622
8997
  const invalidBase64String = "invalid_base64_string";
8623
8998
  const invalidPopTokenRequest = "invalid_pop_token_request";
8999
+ const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
9000
+ const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
9001
+ const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
8624
9002
  const failedToBuildHeaders = "failed_to_build_headers";
8625
9003
  const failedToParseHeaders = "failed_to_parse_headers";
8626
9004
  const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
@@ -8677,11 +9055,14 @@
8677
9055
  spaCodeAndNativeAccountIdPresent: spaCodeAndNativeAccountIdPresent,
8678
9056
  stateInteractionTypeMismatch: stateInteractionTypeMismatch,
8679
9057
  timedOut: timedOut,
9058
+ tokenBindingKeyAlgorithmMismatch: tokenBindingKeyAlgorithmMismatch,
9059
+ tokenBindingKeyJwkThumbprintMismatch: tokenBindingKeyJwkThumbprintMismatch,
8680
9060
  unableToAcquireTokenFromNativePlatform: unableToAcquireTokenFromNativePlatform,
8681
9061
  unableToLoadToken: unableToLoadToken,
8682
9062
  unableToParseState: unableToParseState,
8683
9063
  unableToParseTokenRequestCacheError: unableToParseTokenRequestCacheError,
8684
9064
  uninitializedPublicClientApplication: uninitializedPublicClientApplication,
9065
+ unsupportedTokenBindingAlgorithm: unsupportedTokenBindingAlgorithm,
8685
9066
  userCancelled: userCancelled
8686
9067
  });
8687
9068
 
@@ -9019,6 +9400,8 @@
9019
9400
  const HKDF = "HKDF";
9020
9401
  // SHA-256 hashing algorithm
9021
9402
  const S256_HASH_ALG = "SHA-256";
9403
+ // JWK values used by browser-internal WebCrypto helpers.
9404
+ const JSON_WEB_KEY_CURVE_P256 = "P-256";
9022
9405
  const JSON_WEB_KEY_TYPE_EC = "EC";
9023
9406
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
9024
9407
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -9050,6 +9433,14 @@
9050
9433
  const RSA_SIGN_ALGORITHM_OPTIONS = {
9051
9434
  name: PKCS1_V15_KEYGEN_ALG,
9052
9435
  };
9436
+ const ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS = {
9437
+ name: "ECDSA",
9438
+ namedCurve: JSON_WEB_KEY_CURVE_P256,
9439
+ };
9440
+ const ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS = {
9441
+ name: "ECDSA",
9442
+ hash: { name: S256_HASH_ALG },
9443
+ };
9053
9444
  /**
9054
9445
  * Check whether browser crypto is available.
9055
9446
  */
@@ -9148,16 +9539,6 @@
9148
9539
  async function exportJwk(key) {
9149
9540
  return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
9150
9541
  }
9151
- /**
9152
- * Imports key as Json Web Key (JWK), can set extractable and usages.
9153
- * @param key
9154
- * @param extractable
9155
- * @param usages
9156
- * @param algorithm
9157
- */
9158
- async function importJwk(key, extractable, usages, algorithm) {
9159
- return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
9160
- }
9161
9542
  /**
9162
9543
  * Signs given data with given key.
9163
9544
  * @param key
@@ -9313,22 +9694,22 @@
9313
9694
  [JSON_WEB_KEY_TYPE_EC]: ["crv", "kty", "x", "y"],
9314
9695
  [JSON_WEB_KEY_TYPE_RSA]: ["e", "kty", "n"],
9315
9696
  };
9316
- function getJwkThumbprintMembers(publicJwk) {
9697
+ function getJwkThumbprintMembers(publicJwk, correlationId) {
9317
9698
  const kty = publicJwk.kty;
9318
9699
  if (typeof kty !== "string" || kty.length === 0) {
9319
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_KTY_SUBERROR);
9700
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_KTY_SUBERROR);
9320
9701
  }
9321
9702
  const requiredMembers = JWK_THUMBPRINT_REQUIRED_MEMBERS[kty];
9322
9703
  if (!requiredMembers) {
9323
- throw createBrowserAuthError(invalidPublicJwk, "", UNSUPPORTED_JWK_KTY_SUBERROR);
9704
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, UNSUPPORTED_JWK_KTY_SUBERROR);
9324
9705
  }
9325
9706
  return requiredMembers.reduce((thumbprintMembers, memberName) => {
9326
9707
  const memberValue = publicJwk[memberName];
9327
9708
  if (typeof memberValue !== "string") {
9328
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_MEMBER_SUBERROR);
9709
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_MEMBER_SUBERROR);
9329
9710
  }
9330
9711
  if (memberValue.length === 0) {
9331
- throw createBrowserAuthError(invalidPublicJwk, "", EMPTY_JWK_MEMBER_SUBERROR);
9712
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, EMPTY_JWK_MEMBER_SUBERROR);
9332
9713
  }
9333
9714
  thumbprintMembers[memberName] = memberValue;
9334
9715
  return thumbprintMembers;
@@ -9340,8 +9721,8 @@
9340
9721
  * and the SHA-256 digest is returned as a base64url string.
9341
9722
  * @internal
9342
9723
  */
9343
- async function computeJwkThumbprint(publicJwk) {
9344
- const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
9724
+ async function computeJwkThumbprint(publicJwk, correlationId) {
9725
+ const thumbprintMembers = getJwkThumbprintMembers(publicJwk, correlationId);
9345
9726
  // RFC 7638 §3.3: use only required members, sorted lexicographically
9346
9727
  const thumbprintJson = JSON.stringify(thumbprintMembers, Object.keys(thumbprintMembers).sort());
9347
9728
  return hashString(thumbprintJson);
@@ -10075,71 +10456,214 @@
10075
10456
  }
10076
10457
  }
10077
10458
  /**
10078
- * 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
10079
- * asynchronous storage object.
10080
- * @param correlationId
10459
+ * Get all keys from both in-memory and persistent storage.
10460
+ * @param correlationId
10461
+ */
10462
+ async getKeys(correlationId) {
10463
+ const cacheKeys = this.inMemoryCache.getKeys();
10464
+ try {
10465
+ const persistentCacheKeys = await this.indexedDBCache.getKeys();
10466
+ return Array.from(new Set([...cacheKeys, ...persistentCacheKeys]));
10467
+ }
10468
+ catch (e) {
10469
+ this.handleDatabaseAccessError(e, correlationId);
10470
+ return cacheKeys;
10471
+ }
10472
+ }
10473
+ /**
10474
+ * Returns true or false if the given key is present in the cache.
10475
+ * @param key
10476
+ * @param correlationId
10477
+ */
10478
+ async containsKey(key, correlationId) {
10479
+ const containsKey = this.inMemoryCache.containsKey(key);
10480
+ if (!containsKey) {
10481
+ try {
10482
+ this.logger.verbose("03zl2j", correlationId);
10483
+ return await this.indexedDBCache.containsKey(key);
10484
+ }
10485
+ catch (e) {
10486
+ this.handleDatabaseAccessError(e, correlationId);
10487
+ }
10488
+ }
10489
+ return containsKey;
10490
+ }
10491
+ /**
10492
+ * Clears in-memory Map
10493
+ * @param correlationId
10494
+ */
10495
+ clearInMemory(correlationId) {
10496
+ // InMemory cache is a Map instance, clear is straightforward
10497
+ this.logger.verbose("03r21p", correlationId);
10498
+ this.inMemoryCache.clear();
10499
+ this.logger.verbose("0uksk1", correlationId);
10500
+ }
10501
+ /**
10502
+ * Tries to delete the IndexedDB database
10503
+ * @param correlationId
10504
+ * @returns
10505
+ */
10506
+ async clearPersistent(correlationId) {
10507
+ try {
10508
+ this.logger.verbose("0rdqut", correlationId);
10509
+ const dbDeleted = await this.indexedDBCache.deleteDatabase();
10510
+ if (dbDeleted) {
10511
+ this.logger.verbose("149ouc", correlationId);
10512
+ }
10513
+ return dbDeleted;
10514
+ }
10515
+ catch (e) {
10516
+ this.handleDatabaseAccessError(e, correlationId);
10517
+ return false;
10518
+ }
10519
+ }
10520
+ }
10521
+
10522
+ /*
10523
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10524
+ * Licensed under the MIT License.
10525
+ */
10526
+ /**
10527
+ * Owns browser token-binding key lifecycle and storage lookup.
10528
+ * @internal
10529
+ */
10530
+ class TokenBindingKeyManager {
10531
+ constructor(logger, performanceClient) {
10532
+ this.logger = logger;
10533
+ this.cache = TokenBindingKeyManager.getTokenBindingKeyStorage(this.logger);
10534
+ this.performanceClient = performanceClient;
10535
+ }
10536
+ static getTokenBindingKeyStorage(logger) {
10537
+ if (!TokenBindingKeyManager.tokenBindingKeyStorage) {
10538
+ TokenBindingKeyManager.tokenBindingKeyStorage =
10539
+ new AsyncMemoryStorage(logger);
10540
+ }
10541
+ return TokenBindingKeyManager.tokenBindingKeyStorage;
10542
+ }
10543
+ /**
10544
+ * Provisions a browser token-binding key and returns its key identifier.
10545
+ * @param request - Key provisioning policy.
10546
+ */
10547
+ async provisionTokenBindingKey(request) {
10548
+ const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10549
+ try {
10550
+ const activeKeyPair = await this.createTokenBindingKey(request);
10551
+ publicKeyThumbMeasurement?.end({
10552
+ success: true,
10553
+ ...this.getTokenBindingKeyTelemetry(activeKeyPair),
10554
+ });
10555
+ return activeKeyPair.keyId;
10556
+ }
10557
+ catch (e) {
10558
+ publicKeyThumbMeasurement?.end({
10559
+ success: false,
10560
+ tokenBindingKeyType: request.tokenBindingKeyType,
10561
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10562
+ });
10563
+ throw e;
10564
+ }
10565
+ }
10566
+ /**
10567
+ * Removes a browser token-binding key by identifier.
10568
+ * @param kid - Token-binding key identifier.
10569
+ * @param correlationId - Request correlation identifier.
10570
+ */
10571
+ async removeTokenBindingKey(kid, correlationId) {
10572
+ await this.cache.removeItem(kid, correlationId);
10573
+ const keyFound = await this.cache.containsKey(kid, correlationId);
10574
+ if (keyFound) {
10575
+ throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10576
+ }
10577
+ }
10578
+ /**
10579
+ * Clears browser token-binding keys from memory and persistent storage.
10580
+ * @param correlationId - Request correlation identifier.
10081
10581
  */
10082
- async getKeys(correlationId) {
10083
- const cacheKeys = this.inMemoryCache.getKeys();
10084
- if (cacheKeys.length === 0) {
10085
- try {
10086
- this.logger.verbose("1iqrbq", correlationId);
10087
- return await this.indexedDBCache.getKeys();
10582
+ async clearKeystore(correlationId) {
10583
+ this.cache.clearInMemory(correlationId);
10584
+ try {
10585
+ await this.cache.clearPersistent(correlationId);
10586
+ return true;
10587
+ }
10588
+ catch (e) {
10589
+ if (e instanceof Error) {
10590
+ this.logger.error(`1owpn8 ${e.message}`, correlationId);
10088
10591
  }
10089
- catch (e) {
10090
- this.handleDatabaseAccessError(e, correlationId);
10592
+ else {
10593
+ this.logger.error("0yrmwo", correlationId);
10091
10594
  }
10595
+ return false;
10092
10596
  }
10093
- return cacheKeys;
10094
10597
  }
10095
10598
  /**
10096
- * Returns true or false if the given key is present in the cache.
10097
- * @param key
10098
- * @param correlationId
10599
+ * Gets a token-binding public key as a JWK by identifier.
10600
+ * @param keyId - Token-binding key identifier.
10601
+ * @param correlationId - Request correlation identifier.
10099
10602
  */
10100
- async containsKey(key, correlationId) {
10101
- const containsKey = this.inMemoryCache.containsKey(key);
10102
- if (!containsKey) {
10103
- try {
10104
- this.logger.verbose("03zl2j", correlationId);
10105
- return await this.indexedDBCache.containsKey(key);
10106
- }
10107
- catch (e) {
10108
- this.handleDatabaseAccessError(e, correlationId);
10109
- }
10603
+ async getTokenBindingPublicKeyJwk(keyId, correlationId) {
10604
+ const cachedKeyPair = await this.getTokenBindingKeyPair(keyId, correlationId);
10605
+ return exportJwk(cachedKeyPair.publicKey);
10606
+ }
10607
+ async createTokenBindingKey(request) {
10608
+ const keyGenAlgorithm = this.getTokenBindingKeyGenAlgorithmOptions(request.tokenBindingKeyAlgorithm, request.correlationId);
10609
+ const generatedKeyPair = await this.generateKeyPairAndThumbprint(TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES, keyGenAlgorithm, request.correlationId);
10610
+ await this.cache.setItem(generatedKeyPair.keyId, {
10611
+ ...generatedKeyPair,
10612
+ tokenBindingKeyType: request.tokenBindingKeyType,
10613
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10614
+ }, request.correlationId);
10615
+ return {
10616
+ ...generatedKeyPair,
10617
+ tokenBindingKeyType: request.tokenBindingKeyType,
10618
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10619
+ };
10620
+ }
10621
+ async generateKeyPairAndThumbprint(usages, keyGenAlgorithm, correlationId) {
10622
+ const keyPair = await generateKeyPair(false, usages, keyGenAlgorithm);
10623
+ const publicJwk = await exportJwk(keyPair.publicKey);
10624
+ const keyId = await computeJwkThumbprint(publicJwk, correlationId);
10625
+ return {
10626
+ publicKey: keyPair.publicKey,
10627
+ privateKey: keyPair.privateKey,
10628
+ keyId,
10629
+ };
10630
+ }
10631
+ /** @internal */
10632
+ async getTokenBindingKeyPair(keyId, correlationId) {
10633
+ const cachedKeyPair = await this.cache.getItem(keyId, correlationId);
10634
+ if (!cachedKeyPair) {
10635
+ throw createBrowserAuthError(cryptoKeyNotFound, correlationId);
10110
10636
  }
10111
- return containsKey;
10637
+ return cachedKeyPair;
10112
10638
  }
10113
- /**
10114
- * Clears in-memory Map
10115
- * @param correlationId
10116
- */
10117
- clearInMemory(correlationId) {
10118
- // InMemory cache is a Map instance, clear is straightforward
10119
- this.logger.verbose("03r21p", correlationId);
10120
- this.inMemoryCache.clear();
10121
- this.logger.verbose("0uksk1", correlationId);
10639
+ /** @internal */
10640
+ getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10641
+ return {
10642
+ ...(cachedKeyPair.tokenBindingKeyType && {
10643
+ tokenBindingKeyType: cachedKeyPair.tokenBindingKeyType,
10644
+ }),
10645
+ ...(cachedKeyPair.tokenBindingKeyAlgorithm || fallbackAlgorithm
10646
+ ? {
10647
+ tokenBindingKeyAlgorithm: cachedKeyPair.tokenBindingKeyAlgorithm ||
10648
+ fallbackAlgorithm,
10649
+ }
10650
+ : {}),
10651
+ };
10122
10652
  }
10123
- /**
10124
- * Tries to delete the IndexedDB database
10125
- * @param correlationId
10126
- * @returns
10127
- */
10128
- async clearPersistent(correlationId) {
10129
- try {
10130
- this.logger.verbose("0rdqut", correlationId);
10131
- const dbDeleted = await this.indexedDBCache.deleteDatabase();
10132
- if (dbDeleted) {
10133
- this.logger.verbose("149ouc", correlationId);
10134
- }
10135
- return dbDeleted;
10653
+ getTokenBindingKeyGenAlgorithmOptions(tokenBindingKeyAlgorithm, correlationId) {
10654
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.RS256) {
10655
+ return RSA_KEYGEN_ALGORITHM_OPTIONS;
10136
10656
  }
10137
- catch (e) {
10138
- this.handleDatabaseAccessError(e, correlationId);
10139
- return false;
10657
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.ES256) {
10658
+ return ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS;
10140
10659
  }
10660
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10141
10661
  }
10142
- }
10662
+ }
10663
+ TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
10664
+ "sign",
10665
+ "verify",
10666
+ ];
10143
10667
 
10144
10668
  /*
10145
10669
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10154,8 +10678,8 @@
10154
10678
  this.logger = logger;
10155
10679
  // Browser crypto needs to be validated first before any other classes can be set.
10156
10680
  validateCryptoAvailable(skipValidateSubtleCrypto ?? false);
10157
- this.cache = new AsyncMemoryStorage(this.logger);
10158
10681
  this.performanceClient = performanceClient;
10682
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
10159
10683
  }
10160
10684
  /**
10161
10685
  * Creates a new random GUID - used to populate state and nonce.
@@ -10193,114 +10717,45 @@
10193
10717
  encodeKid(inputKid) {
10194
10718
  return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
10195
10719
  }
10196
- /**
10197
- * Generates a keypair, stores it and returns a thumbprint
10198
- * @param request
10199
- */
10200
- async getPublicKeyThumbprint(request) {
10201
- const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10202
- // Generate Keypair
10203
- const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES, RSA_KEYGEN_ALGORITHM_OPTIONS);
10204
- // Generate Thumbprint for Public Key
10205
- const publicKeyJwk = await exportJwk(keyPair.publicKey);
10206
- const publicJwkHash = await computeJwkThumbprint(publicKeyJwk);
10207
- // Generate Thumbprint for Private Key
10208
- const privateKeyJwk = await exportJwk(keyPair.privateKey);
10209
- // Re-import private key to make it unextractable
10210
- const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"], RSA_KEYGEN_ALGORITHM_OPTIONS);
10211
- // Store Keypair data in keystore
10212
- await this.cache.setItem(publicJwkHash, {
10213
- privateKey: unextractablePrivateKey,
10214
- publicKey: keyPair.publicKey,
10215
- requestMethod: request.resourceRequestMethod,
10216
- requestUri: request.resourceRequestUri,
10217
- }, request.correlationId);
10218
- if (publicKeyThumbMeasurement) {
10219
- publicKeyThumbMeasurement.end({
10220
- success: true,
10221
- });
10222
- }
10223
- return publicJwkHash;
10224
- }
10225
10720
  /**
10226
10721
  * Removes cryptographic keypair from key store matching the keyId passed in
10227
10722
  * @param kid
10228
10723
  * @param correlationId
10229
10724
  */
10230
10725
  async removeTokenBindingKey(kid, correlationId) {
10231
- await this.cache.removeItem(kid, correlationId);
10232
- const keyFound = await this.cache.containsKey(kid, correlationId);
10233
- if (keyFound) {
10234
- throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10235
- }
10726
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
10236
10727
  }
10237
10728
  /**
10238
10729
  * Removes all cryptographic keys from IndexedDB storage
10239
10730
  * @param correlationId
10240
10731
  */
10241
10732
  async clearKeystore(correlationId) {
10242
- // Delete in-memory keystores
10243
- this.cache.clearInMemory(correlationId);
10244
- /**
10245
- * There is only one database, so calling clearPersistent on asymmetric keystore takes care of
10246
- * every persistent keystore
10247
- */
10733
+ return this.tokenBindingKeyManager.clearKeystore(correlationId);
10734
+ }
10735
+ /** @internal */
10736
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
10737
+ let telemetry = {};
10738
+ const signTokenBindingJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10248
10739
  try {
10249
- await this.cache.clearPersistent(correlationId);
10250
- return true;
10740
+ const cachedKeyPair = await this.tokenBindingKeyManager.getTokenBindingKeyPair(kid, correlationId);
10741
+ await this.validateTokenBindingJwtHeaderKey(header, kid, correlationId);
10742
+ telemetry = this.tokenBindingKeyManager.getTokenBindingKeyTelemetry(cachedKeyPair, header.alg);
10743
+ const signingAlgorithm = this.getTokenBindingKeySigningAlgorithm(cachedKeyPair, header.alg, correlationId);
10744
+ const tokenString = `${urlEncode(JSON.stringify(header))}.${urlEncode(JSON.stringify(payload))}`;
10745
+ const encodedSignature = await this.signInput(cachedKeyPair, tokenString, signingAlgorithm);
10746
+ signTokenBindingJwtMeasurement?.end({
10747
+ success: true,
10748
+ ...telemetry,
10749
+ });
10750
+ return `${tokenString}.${encodedSignature}`;
10251
10751
  }
10252
10752
  catch (e) {
10253
- if (e instanceof Error) {
10254
- this.logger.error(`1owpn8 ${e.message}`, correlationId);
10255
- }
10256
- else {
10257
- this.logger.error("0yrmwo", correlationId);
10258
- }
10259
- return false;
10260
- }
10261
- }
10262
- /**
10263
- * Signs the given object as a jwt payload with private key retrieved by given kid.
10264
- * @param payload
10265
- * @param kid
10266
- */
10267
- async signJwt(payload, kid, shrOptions, correlationId) {
10268
- const signJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10269
- const cachedKeyPair = await this.cache.getItem(kid, correlationId || "");
10270
- if (!cachedKeyPair) {
10271
- throw createBrowserAuthError(cryptoKeyNotFound, correlationId || "");
10272
- }
10273
- // Get public key as JWK
10274
- const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
10275
- const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
10276
- // Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
10277
- const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
10278
- // Generate header
10279
- const shrHeader = JoseHeader.getShrHeaderString({
10280
- ...shrOptions?.header,
10281
- alg: publicKeyJwk.alg,
10282
- kid: encodedKeyIdThumbprint,
10283
- });
10284
- const encodedShrHeader = urlEncode(shrHeader);
10285
- // Generate payload
10286
- payload.cnf = {
10287
- jwk: JSON.parse(publicKeyJwkString),
10288
- };
10289
- const encodedPayload = urlEncode(JSON.stringify(payload));
10290
- // Form token string
10291
- const tokenString = `${encodedShrHeader}.${encodedPayload}`;
10292
- // Sign token
10293
- const encoder = new TextEncoder();
10294
- const tokenBuffer = encoder.encode(tokenString);
10295
- const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer, RSA_SIGN_ALGORITHM_OPTIONS);
10296
- const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
10297
- const signedJwt = `${tokenString}.${encodedSignature}`;
10298
- if (signJwtMeasurement) {
10299
- signJwtMeasurement.end({
10300
- success: true,
10753
+ signTokenBindingJwtMeasurement?.end({
10754
+ success: false,
10755
+ ...telemetry,
10301
10756
  });
10757
+ throw e;
10302
10758
  }
10303
- return signedJwt;
10304
10759
  }
10305
10760
  /**
10306
10761
  * Returns the SHA-256 hash of an input string
@@ -10309,11 +10764,39 @@
10309
10764
  async hashString(plainText) {
10310
10765
  return hashString(plainText);
10311
10766
  }
10312
- }
10313
- CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
10314
- CryptoOps.EXTRACTABLE = true;
10315
- function getSortedObjectString(obj) {
10316
- return JSON.stringify(obj, Object.keys(obj).sort());
10767
+ async signInput(cachedKeyPair, signingInput, algorithm) {
10768
+ const encoder = new TextEncoder();
10769
+ const signatureBuffer = await sign(cachedKeyPair.privateKey, encoder.encode(signingInput), algorithm);
10770
+ return urlEncodeArr(new Uint8Array(signatureBuffer));
10771
+ }
10772
+ getTokenBindingKeySigningAlgorithm(cachedKeyPair, requestedAlgorithm, correlationId) {
10773
+ const keyAlgorithm = cachedKeyPair.privateKey.algorithm;
10774
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 &&
10775
+ keyAlgorithm.name === RSA_SIGN_ALGORITHM_OPTIONS.name) {
10776
+ return RSA_SIGN_ALGORITHM_OPTIONS;
10777
+ }
10778
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.ES256 &&
10779
+ keyAlgorithm.name ===
10780
+ ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS.name &&
10781
+ keyAlgorithm.namedCurve ===
10782
+ ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS.namedCurve) {
10783
+ return ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS;
10784
+ }
10785
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 ||
10786
+ requestedAlgorithm === JsonWebTokenAlgorithms.ES256) {
10787
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId, tokenBindingKeyAlgorithmMismatch);
10788
+ }
10789
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10790
+ }
10791
+ async validateTokenBindingJwtHeaderKey(header, kid, correlationId) {
10792
+ if (!header.jwk) {
10793
+ return;
10794
+ }
10795
+ const headerKeyId = await computeJwkThumbprint(header.jwk, correlationId);
10796
+ if (headerKeyId !== kid) {
10797
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, tokenBindingKeyJwkThumbprintMismatch);
10798
+ }
10799
+ }
10317
10800
  }
10318
10801
 
10319
10802
  /*
@@ -10821,10 +11304,20 @@
10821
11304
  }
10822
11305
  if (context && context !== this.clientId) {
10823
11306
  this.logger.trace(`04rtdy ${context}`, correlationId);
10824
- perfMeasurement.end({
10825
- success: false,
10826
- errorCode: "contextMismatch",
10827
- });
11307
+ /*
11308
+ * Discarded rather than ended: this is expected routing, not a failure.
11309
+ * BroadcastChannel has no server-side filtering, so every MSAL instance on
11310
+ * the origin receives every message and drops the ones scoped to another
11311
+ * clientId. With N instances sharing an origin each write produces N-1 of
11312
+ * these no-ops, so emitting them scales O(N^2) - and because they were
11313
+ * previously reported with success: false they bypassed both the 1% misc
11314
+ * sampler and the observability trimming in the 1P telemetry reporter,
11315
+ * shipping at full payload. On origins hosting many embedded first-party
11316
+ * apps that dwarfed all other MSAL telemetry combined. These events carry
11317
+ * no diagnostic value, so drop the measurement entirely. Genuine faults
11318
+ * such as the noKey case above are still reported.
11319
+ */
11320
+ perfMeasurement.discard();
10828
11321
  return;
10829
11322
  }
10830
11323
  if (!value) {
@@ -10908,7 +11401,7 @@
10908
11401
 
10909
11402
  /* eslint-disable header/header */
10910
11403
  const name = "@azure/msal-browser";
10911
- const version = "5.18.0";
11404
+ const version = "5.20.0";
10912
11405
 
10913
11406
  /*
10914
11407
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10943,8 +11436,8 @@
10943
11436
  * This class implements the cache storage interface for MSAL through browser local or session storage.
10944
11437
  */
10945
11438
  class BrowserCacheManager extends CacheManager {
10946
- constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions) {
10947
- super(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions);
11439
+ constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
11440
+ super(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions, tokenBindingKeyManager);
10948
11441
  this.cacheConfig = cacheConfig;
10949
11442
  this.logger = logger;
10950
11443
  this.internalStorage = new MemoryStorage();
@@ -12362,12 +12855,12 @@
12362
12855
  }
12363
12856
  return new MemoryStorage();
12364
12857
  }
12365
- const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler) => {
12858
+ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) => {
12366
12859
  const cacheOptions = {
12367
12860
  cacheLocation: BrowserCacheLocation.MemoryStorage,
12368
12861
  cacheRetentionDays: 5,
12369
12862
  };
12370
- return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler);
12863
+ return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager);
12371
12864
  };
12372
12865
 
12373
12866
  /*
@@ -12523,7 +13016,7 @@
12523
13016
  * Licensed under the MIT License.
12524
13017
  */
12525
13018
  class BaseInteractionClient {
12526
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider) {
13019
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
12527
13020
  this.config = config;
12528
13021
  this.browserStorage = storageImpl;
12529
13022
  this.browserCrypto = browserCrypto;
@@ -12534,6 +13027,9 @@
12534
13027
  this.correlationId = correlationId;
12535
13028
  this.logger = logger.clone(name, version);
12536
13029
  this.performanceClient = performanceClient;
13030
+ this.tokenBindingKeyManager =
13031
+ tokenBindingKeyManager ||
13032
+ new TokenBindingKeyManager(this.logger, this.performanceClient);
12537
13033
  }
12538
13034
  }
12539
13035
  /**
@@ -12660,6 +13156,63 @@
12660
13156
  * Copyright (c) Microsoft Corporation. All rights reserved.
12661
13157
  * Licensed under the MIT License.
12662
13158
  */
13159
+ const SUPPORTED_AUTHENTICATION_SCHEMES = new Set([
13160
+ AuthenticationScheme$1.BEARER,
13161
+ AuthenticationScheme$1.POP,
13162
+ AuthenticationScheme$1.DPOP,
13163
+ AuthenticationScheme$1.SSH,
13164
+ ]);
13165
+ function validateSshRequest(request, correlationId) {
13166
+ if (!request.sshJwk) {
13167
+ throw createClientConfigurationError(missingSshJwk, correlationId);
13168
+ }
13169
+ if (!request.sshKid) {
13170
+ throw createClientConfigurationError(missingSshKid, correlationId);
13171
+ }
13172
+ }
13173
+ function validateDpopRequest(request, correlationId) {
13174
+ if (!request.resourceRequestMethod?.trim() ||
13175
+ !request.resourceRequestUri?.trim()) {
13176
+ throw createClientConfigurationError(dpopMissingResourceContext, correlationId);
13177
+ }
13178
+ }
13179
+ /**
13180
+ * Resolves the token-binding parameters needed before building authorize or token requests.
13181
+ * Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
13182
+ * a reqCnf confirmation claim. Requests that do not require request-time token binding return
13183
+ * no additional parameters.
13184
+ */
13185
+ async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
13186
+ switch (request.authenticationScheme) {
13187
+ case AuthenticationScheme$1.DPOP:
13188
+ if (request.platformBroker) {
13189
+ return {};
13190
+ }
13191
+ if (request.dpopJkt) {
13192
+ return { dpopJkt: request.dpopJkt };
13193
+ }
13194
+ return {
13195
+ dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
13196
+ tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
13197
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
13198
+ correlationId: request.correlationId,
13199
+ }),
13200
+ };
13201
+ case AuthenticationScheme$1.POP:
13202
+ if (!request.platformBroker) {
13203
+ return {};
13204
+ }
13205
+ const cryptoOps = new CryptoOps(logger, performanceClient);
13206
+ if (request.popKid) {
13207
+ return { reqCnf: cryptoOps.encodeKid(request.popKid) };
13208
+ }
13209
+ const popTokenGenerator = new PopTokenGenerator(cryptoOps, tokenBindingKeyManager, performanceClient);
13210
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, logger, performanceClient, request.correlationId)(request, logger);
13211
+ return { reqCnf: generatedReqCnfData.reqCnfString };
13212
+ default:
13213
+ return {};
13214
+ }
13215
+ }
12663
13216
  /**
12664
13217
  * Initializer function for all request APIs
12665
13218
  * @param request
@@ -12684,13 +13237,16 @@
12684
13237
  logger.verbose("1l4fwv", correlationId);
12685
13238
  }
12686
13239
  else {
12687
- if (validatedRequest.authenticationScheme ===
12688
- AuthenticationScheme$1.SSH) {
12689
- if (!request.sshJwk) {
12690
- throw createClientConfigurationError(missingSshJwk, "");
12691
- }
12692
- if (!request.sshKid) {
12693
- throw createClientConfigurationError(missingSshKid, "");
13240
+ if (!SUPPORTED_AUTHENTICATION_SCHEMES.has(validatedRequest.authenticationScheme)) {
13241
+ throw createClientConfigurationError(unsupportedAuthenticationScheme, correlationId);
13242
+ }
13243
+ switch (validatedRequest.authenticationScheme) {
13244
+ case AuthenticationScheme$1.SSH:
13245
+ validateSshRequest(request, correlationId);
13246
+ break;
13247
+ case AuthenticationScheme$1.DPOP: {
13248
+ validateDpopRequest(request, correlationId);
13249
+ break;
12694
13250
  }
12695
13251
  }
12696
13252
  logger.verbose(`1ecmns ${validatedRequest.authenticationScheme}`, correlationId);
@@ -12875,6 +13431,7 @@
12875
13431
  correlationId: this.correlationId,
12876
13432
  },
12877
13433
  cryptoInterface: this.browserCrypto,
13434
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
12878
13435
  networkInterface: this.networkClient,
12879
13436
  storageInterface: this.browserStorage,
12880
13437
  serverTelemetryManager: serverTelemetryManager,
@@ -13346,13 +13903,13 @@
13346
13903
  * Licensed under the MIT License.
13347
13904
  */
13348
13905
  class PlatformAuthInteractionClient extends BaseInteractionClient {
13349
- constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
13350
- super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13906
+ constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
13907
+ super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
13351
13908
  this.apiId = apiId;
13352
13909
  this.accountId = accountId;
13353
13910
  this.platformAuthProvider = provider;
13354
13911
  this.nativeStorageManager = nativeStorageImpl;
13355
- this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13912
+ this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, this.tokenBindingKeyManager);
13356
13913
  const extensionName = this.platformAuthProvider.getExtensionName();
13357
13914
  this.skus = ServerTelemetryManager.makeExtraSkuString({
13358
13915
  libraryName: BrowserConstants.MSAL_SKU,
@@ -13699,7 +14256,7 @@
13699
14256
  return response.shr;
13700
14257
  }
13701
14258
  // Generate SHR in msal js if WAM does not compute it when POP is enabled
13702
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
14259
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13703
14260
  const shrParameters = {
13704
14261
  resourceRequestMethod: request.resourceRequestMethod,
13705
14262
  resourceRequestUri: request.resourceRequestUri,
@@ -13959,7 +14516,7 @@
13959
14516
  shrNonce: request.shrNonce,
13960
14517
  correlationId: this.correlationId,
13961
14518
  };
13962
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
14519
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13963
14520
  // generate reqCnf if not provided in the request
13964
14521
  let reqCnfData;
13965
14522
  if (!validatedRequest.keyId) {
@@ -14147,21 +14704,16 @@
14147
14704
  isPlatformAuthorizeRequest: true,
14148
14705
  }, request.correlationId);
14149
14706
  // pass the req_cnf for POP
14150
- if (request.authenticationScheme === AuthenticationScheme$1.POP) {
14151
- const cryptoOps = new CryptoOps(logger, performanceClient);
14152
- const popTokenGenerator = new PopTokenGenerator(cryptoOps, performanceClient);
14153
- // req_cnf is always sent as a string for SPAs
14154
- let reqCnfData;
14155
- if (!request.popKid) {
14156
- const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, logger, performanceClient, request.correlationId)(request, logger);
14157
- reqCnfData = generatedReqCnfData.reqCnfString;
14158
- }
14159
- else {
14160
- reqCnfData = cryptoOps.encodeKid(request.popKid);
14161
- }
14162
- addPopToken(parameters, reqCnfData);
14707
+ if (request.authenticationScheme ===
14708
+ AuthenticationScheme$1.POP &&
14709
+ request.reqCnf) {
14710
+ addPopToken(parameters, request.reqCnf);
14163
14711
  }
14164
14712
  }
14713
+ if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
14714
+ request.dpopJkt) {
14715
+ parameters.set(DPOP_JKT, request.dpopJkt);
14716
+ }
14165
14717
  instrumentBrokerParams(parameters, request.correlationId, performanceClient);
14166
14718
  return parameters;
14167
14719
  }
@@ -14358,7 +14910,7 @@
14358
14910
  if (decryptedData.accountId) {
14359
14911
  return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
14360
14912
  }
14361
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null);
14913
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
14362
14914
  // Validate response. This function throws a server error if an error is returned by the server.
14363
14915
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
14364
14916
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -15238,8 +15790,8 @@
15238
15790
  * Licensed under the MIT License.
15239
15791
  */
15240
15792
  class PopupClient extends StandardInteractionClient {
15241
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook) {
15242
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
15793
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook, tokenBindingKeyManager) {
15794
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15243
15795
  this.nativeStorage = nativeStorageImpl;
15244
15796
  this.eventHandler = eventHandler;
15245
15797
  this.waitForPopupResponseHook = waitForPopupResponseHook;
@@ -15353,9 +15905,11 @@
15353
15905
  const serverTelemetryManager = initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
15354
15906
  const pkce = pkceCodes ||
15355
15907
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
15908
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15356
15909
  const popupRequest = {
15357
15910
  ...request,
15358
15911
  codeChallenge: pkce.challenge,
15912
+ ...tokenBindingParams,
15359
15913
  };
15360
15914
  try {
15361
15915
  // Initialize the client
@@ -15389,7 +15943,7 @@
15389
15943
  // Wait for the redirect bridge response
15390
15944
  const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
15391
15945
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
15392
- return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
15946
+ return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
15393
15947
  }
15394
15948
  }
15395
15949
  catch (e) {
@@ -15413,10 +15967,12 @@
15413
15967
  const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
15414
15968
  const pkce = pkceCodes ||
15415
15969
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
15970
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15416
15971
  const popupRequest = {
15417
15972
  ...request,
15418
15973
  earJwk: earJwk,
15419
15974
  codeChallenge: pkce.challenge,
15975
+ ...tokenBindingParams,
15420
15976
  };
15421
15977
  const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
15422
15978
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
@@ -15753,8 +16309,8 @@
15753
16309
  return navigation?.type;
15754
16310
  }
15755
16311
  class RedirectClient extends StandardInteractionClient {
15756
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler) {
15757
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
16312
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, tokenBindingKeyManager) {
16313
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15758
16314
  this.nativeStorage = nativeStorageImpl;
15759
16315
  }
15760
16316
  /**
@@ -15803,9 +16359,11 @@
15803
16359
  const correlationId = request.correlationId;
15804
16360
  const serverTelemetryManager = initializeServerTelemetryManager(ApiId.acquireTokenRedirect, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
15805
16361
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16362
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15806
16363
  const redirectRequest = {
15807
16364
  ...request,
15808
16365
  codeChallenge: pkceCodes.challenge,
16366
+ ...tokenBindingParams,
15809
16367
  };
15810
16368
  this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
15811
16369
  try {
@@ -15845,10 +16403,12 @@
15845
16403
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
15846
16404
  const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
15847
16405
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16406
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15848
16407
  const redirectRequest = {
15849
16408
  ...request,
15850
16409
  earJwk: earJwk,
15851
16410
  codeChallenge: pkceCodes.challenge,
16411
+ ...tokenBindingParams,
15852
16412
  };
15853
16413
  this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
15854
16414
  const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
@@ -16246,8 +16806,8 @@
16246
16806
  * Licensed under the MIT License.
16247
16807
  */
16248
16808
  class SilentIframeClient extends StandardInteractionClient {
16249
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook) {
16250
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
16809
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook, tokenBindingKeyManager) {
16810
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16251
16811
  this.apiId = apiId;
16252
16812
  this.nativeStorage = nativeStorageImpl;
16253
16813
  this.waitForIframeResponseHook = waitForIframeResponseHook;
@@ -16418,8 +16978,8 @@
16418
16978
  * @param userRequestScopes
16419
16979
  */
16420
16980
  async silentTokenHelper(authClient, request) {
16421
- const { serverParams, pkceCodes } = await this.silentAuthorizeHelper(authClient, request);
16422
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
16981
+ const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
16982
+ return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
16423
16983
  }
16424
16984
  /**
16425
16985
  * Shared helper that generates PKCE codes, builds the /authorize URL,
@@ -16430,9 +16990,11 @@
16430
16990
  async silentAuthorizeHelper(authClient, request) {
16431
16991
  const correlationId = request.correlationId;
16432
16992
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16993
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16433
16994
  const silentRequest = {
16434
16995
  ...request,
16435
16996
  codeChallenge: pkceCodes.challenge,
16997
+ ...tokenBindingParams,
16436
16998
  };
16437
16999
  // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
16438
17000
  const iframe = createHiddenIframe();
@@ -16486,9 +17048,11 @@
16486
17048
  */
16487
17049
  async acquireToken(request) {
16488
17050
  const baseRequest = await invokeAsync(initializeBaseRequest, InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger, this.correlationId);
17051
+ const tokenBindingParams = await getTokenBindingRequestParams(baseRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16489
17052
  const silentRequest = {
16490
17053
  ...request,
16491
17054
  ...baseRequest,
17055
+ ...tokenBindingParams,
16492
17056
  };
16493
17057
  if (request.redirectUri) {
16494
17058
  // Make sure any passed redirectUri is converted to an absolute URL - redirectUri is not a required parameter for refresh token redemption so only include if explicitly provided
@@ -16554,8 +17118,8 @@
16554
17118
  * Licensed under the MIT License.
16555
17119
  */
16556
17120
  class SilentAuthCodeClient extends StandardInteractionClient {
16557
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider) {
16558
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
17121
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
17122
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16559
17123
  this.apiId = apiId;
16560
17124
  }
16561
17125
  /**
@@ -16576,10 +17140,12 @@
16576
17140
  this.correlationId);
16577
17141
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
16578
17142
  try {
17143
+ const tokenBindingParams = await getTokenBindingRequestParams(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16579
17144
  // Create auth code request (PKCE not needed)
16580
17145
  const authCodeRequest = {
16581
17146
  ...silentRequest,
16582
17147
  code: request.code,
17148
+ ...tokenBindingParams,
16583
17149
  };
16584
17150
  // Initialize the client
16585
17151
  const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)({
@@ -16708,21 +17274,26 @@
16708
17274
  this.hybridAuthCodeResponses = new Map();
16709
17275
  // Initialize performance client
16710
17276
  this.performanceClient = this.config.telemetry.client;
16711
- // Initialize the crypto class.
16712
- this.browserCrypto = this.isBrowserEnvironment
16713
- ? new CryptoOps(this.logger, this.performanceClient)
16714
- : DEFAULT_CRYPTO_IMPLEMENTATION;
17277
+ // Initialize environment-specific crypto and token-binding services.
17278
+ if (this.isBrowserEnvironment) {
17279
+ this.browserCrypto = new CryptoOps(this.logger, this.performanceClient);
17280
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
17281
+ }
17282
+ else {
17283
+ this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;
17284
+ this.tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
17285
+ }
16715
17286
  this.eventHandler = new EventHandler(this.logger);
16716
17287
  // Initialize the browser storage class.
16717
17288
  this.browserStorage = this.isBrowserEnvironment
16718
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
16719
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
17289
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth), this.tokenBindingKeyManager)
17290
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler, undefined, this.tokenBindingKeyManager);
16720
17291
  // initialize in memory storage for native flows
16721
17292
  const nativeCacheOptions = {
16722
17293
  cacheLocation: BrowserCacheLocation.MemoryStorage,
16723
17294
  cacheRetentionDays: 5,
16724
17295
  };
16725
- this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler);
17296
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, undefined, this.tokenBindingKeyManager);
16726
17297
  this.activeSilentTokenRequests = new Map();
16727
17298
  // Register listener functions
16728
17299
  this.trackStateChange = this.trackStateChange.bind(this);
@@ -16864,7 +17435,7 @@
16864
17435
  rootMeasurement.add({
16865
17436
  isPlatformBrokerRequest: true,
16866
17437
  });
16867
- 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);
17438
+ 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);
16868
17439
  redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)();
16869
17440
  }
16870
17441
  else {
@@ -16965,7 +17536,7 @@
16965
17536
  let result;
16966
17537
  if (this.platformAuthProvider &&
16967
17538
  this.canUsePlatformBroker(request)) {
16968
- 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);
17539
+ 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);
16969
17540
  result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
16970
17541
  if (e instanceof NativeAuthError &&
16971
17542
  isFatalNativeAuthError(e)) {
@@ -17640,7 +18211,7 @@
17640
18211
  if (!this.platformAuthProvider) {
17641
18212
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
17642
18213
  }
17643
- 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);
18214
+ 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);
17644
18215
  return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
17645
18216
  }
17646
18217
  /**
@@ -17697,39 +18268,39 @@
17697
18268
  * @param correlationId
17698
18269
  */
17699
18270
  createPopupClient(correlationId) {
17700
- 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);
18271
+ 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);
17701
18272
  }
17702
18273
  /**
17703
18274
  * Returns new instance of the Redirect Interaction Client
17704
18275
  * @param correlationId
17705
18276
  */
17706
18277
  createRedirectClient(correlationId) {
17707
- return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider);
18278
+ return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17708
18279
  }
17709
18280
  /**
17710
18281
  * Returns new instance of the Silent Iframe Interaction Client
17711
18282
  * @param correlationId
17712
18283
  */
17713
18284
  createSilentIframeClient(correlationId) {
17714
- 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);
18285
+ 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);
17715
18286
  }
17716
18287
  /**
17717
18288
  * Returns new instance of the Silent Cache Interaction Client
17718
18289
  */
17719
18290
  createSilentCacheClient(correlationId) {
17720
- return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
18291
+ return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17721
18292
  }
17722
18293
  /**
17723
18294
  * Returns new instance of the Silent Refresh Interaction Client
17724
18295
  */
17725
18296
  createSilentRefreshClient(correlationId) {
17726
- return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
18297
+ return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17727
18298
  }
17728
18299
  /**
17729
18300
  * Returns new instance of the Silent AuthCode Interaction Client
17730
18301
  */
17731
18302
  createSilentAuthCodeClient(correlationId) {
17732
- return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider);
18303
+ return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17733
18304
  }
17734
18305
  /**
17735
18306
  * Adds event callbacks to array
@@ -18317,6 +18888,92 @@
18317
18888
  NestedAppAuthUnavailable: "NESTED_APP_AUTH_UNAVAILABLE", // NAA is unavailable in the current context, can retry with standard browser based auth
18318
18889
  };
18319
18890
 
18891
+ /*
18892
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18893
+ * Licensed under the MIT License.
18894
+ */
18895
+ /**
18896
+ * Unified error taxonomy shared by NAA and PWB.
18897
+ *
18898
+ * Each code maps to exactly one of the four base MSAL error classes
18899
+ * (`AuthError`, `ClientAuthError`, `ServerError`,
18900
+ * `InteractionRequiredAuthError`) via `toAuthError` in
18901
+ * `./WebBrokerBridgeErrorMap`.
18902
+ */
18903
+ const WebBrokerBridgeErrorCode = {
18904
+ /* Interaction / auth outcomes */
18905
+ UserInteractionRequired: "user_interaction_required",
18906
+ UserCanceled: "user_canceled",
18907
+ /* Environment / connectivity */
18908
+ NoNetwork: "no_network",
18909
+ AccountUnavailable: "account_unavailable",
18910
+ BridgeDisabled: "bridge_disabled",
18911
+ BridgeUnavailable: "bridge_unavailable",
18912
+ /* Server-side outcomes */
18913
+ TransientError: "transient_error",
18914
+ PersistentError: "persistent_error",
18915
+ /* Broker-channel failures */
18916
+ BridgeTimeout: "bridge_timeout",
18917
+ BridgeHandshakeFailed: "bridge_handshake_failed",
18918
+ BridgeConnectionReset: "bridge_connection_reset",
18919
+ BridgeResponseInvalid: "bridge_response_invalid",
18920
+ PopupWillRedirect: "popup_will_redirect",
18921
+ ShrGenerationError: "shr_generation_error",
18922
+ /* Fallback */
18923
+ Unknown: "unknown",
18924
+ };
18925
+
18926
+ /*
18927
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18928
+ * Licensed under the MIT License.
18929
+ */
18930
+ /**
18931
+ * Lift a normalized `WebBrokerBridgeError` to one of the four base
18932
+ * MSAL error classes. Callers are responsible for lowering
18933
+ * transport-specific errors into `WebBrokerBridgeError` before calling
18934
+ * this function.
18935
+ */
18936
+ function toAuthError(err) {
18937
+ const correlationId = err.correlationId ?? "";
18938
+ switch (err.code) {
18939
+ case WebBrokerBridgeErrorCode.UserInteractionRequired:
18940
+ return new InteractionRequiredAuthError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18941
+ case WebBrokerBridgeErrorCode.TransientError:
18942
+ case WebBrokerBridgeErrorCode.PersistentError:
18943
+ return new ServerError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18944
+ case WebBrokerBridgeErrorCode.UserCanceled:
18945
+ return new ClientAuthError(userCanceled, correlationId);
18946
+ case WebBrokerBridgeErrorCode.NoNetwork:
18947
+ return new ClientAuthError(noNetworkConnectivity$1, correlationId);
18948
+ case WebBrokerBridgeErrorCode.AccountUnavailable:
18949
+ return new ClientAuthError(noAccountFound, correlationId);
18950
+ case WebBrokerBridgeErrorCode.BridgeDisabled:
18951
+ return new ClientAuthError(nestedAppAuthBridgeDisabled, correlationId);
18952
+ case WebBrokerBridgeErrorCode.BridgeUnavailable:
18953
+ /*
18954
+ * NAA parity: pass through inner code when the broker supplied
18955
+ * one, otherwise fall back to the disabled code.
18956
+ */
18957
+ return new ClientAuthError(err.innerErrorCode ||
18958
+ nestedAppAuthBridgeDisabled, correlationId, err.description);
18959
+ /*
18960
+ * PWB broker-channel failures. The common code doubles as the
18961
+ * concrete errorCode on AuthError so the original error identity
18962
+ * can be recovered by round-tripping the string.
18963
+ */
18964
+ case WebBrokerBridgeErrorCode.BridgeTimeout:
18965
+ case WebBrokerBridgeErrorCode.BridgeHandshakeFailed:
18966
+ case WebBrokerBridgeErrorCode.BridgeConnectionReset:
18967
+ case WebBrokerBridgeErrorCode.BridgeResponseInvalid:
18968
+ case WebBrokerBridgeErrorCode.PopupWillRedirect:
18969
+ case WebBrokerBridgeErrorCode.ShrGenerationError:
18970
+ return new AuthError(err.code, correlationId, err.description, err.subError);
18971
+ case WebBrokerBridgeErrorCode.Unknown:
18972
+ default:
18973
+ return new AuthError(err.innerErrorCode || "unknown_error", correlationId, err.description || "An unknown error occurred", err.subError);
18974
+ }
18975
+ }
18976
+
18320
18977
  /*
18321
18978
  * Copyright (c) Microsoft Corporation. All rights reserved.
18322
18979
  * Licensed under the MIT License.
@@ -18461,30 +19118,9 @@
18461
19118
  */
18462
19119
  fromBridgeError(error) {
18463
19120
  if (isBridgeError(error)) {
18464
- switch (error.status) {
18465
- case BridgeStatusCode.UserCancel:
18466
- return new ClientAuthError(userCanceled, "");
18467
- case BridgeStatusCode.NoNetwork:
18468
- return new ClientAuthError(noNetworkConnectivity$1, "");
18469
- case BridgeStatusCode.AccountUnavailable:
18470
- return new ClientAuthError(noAccountFound, "");
18471
- case BridgeStatusCode.Disabled:
18472
- return new ClientAuthError(nestedAppAuthBridgeDisabled, "");
18473
- case BridgeStatusCode.NestedAppAuthUnavailable:
18474
- return new ClientAuthError(error.code ||
18475
- nestedAppAuthBridgeDisabled, "", error.description);
18476
- case BridgeStatusCode.TransientError:
18477
- case BridgeStatusCode.PersistentError:
18478
- return new ServerError(error.code || "", "", error.description);
18479
- case BridgeStatusCode.UserInteractionRequired:
18480
- return new InteractionRequiredAuthError(error.code || "", "", error.description);
18481
- default:
18482
- return new AuthError(error.code || "", "", error.description);
18483
- }
18484
- }
18485
- else {
18486
- return new AuthError("unknown_error", "", "An unknown error occurred");
19121
+ return toAuthError(bridgeErrorToWebBrokerBridgeError(error));
18487
19122
  }
19123
+ return new AuthError("unknown_error", "", "An unknown error occurred");
18488
19124
  }
18489
19125
  /**
18490
19126
  * Returns an AuthenticationResult from the given cache items
@@ -18520,6 +19156,52 @@
18520
19156
  };
18521
19157
  return authenticationResult;
18522
19158
  }
19159
+ }
19160
+ /**
19161
+ * Converts NAA `BridgeError` into the shared `WebBrokerBridgeError`
19162
+ * taxonomy.
19163
+ */
19164
+ function bridgeErrorToWebBrokerBridgeError(error) {
19165
+ switch (error.status) {
19166
+ case BridgeStatusCode.UserCancel:
19167
+ return { code: WebBrokerBridgeErrorCode.UserCanceled };
19168
+ case BridgeStatusCode.NoNetwork:
19169
+ return { code: WebBrokerBridgeErrorCode.NoNetwork };
19170
+ case BridgeStatusCode.AccountUnavailable:
19171
+ return { code: WebBrokerBridgeErrorCode.AccountUnavailable };
19172
+ case BridgeStatusCode.Disabled:
19173
+ return { code: WebBrokerBridgeErrorCode.BridgeDisabled };
19174
+ case BridgeStatusCode.NestedAppAuthUnavailable:
19175
+ return {
19176
+ code: WebBrokerBridgeErrorCode.BridgeUnavailable,
19177
+ innerErrorCode: error.code,
19178
+ description: error.description,
19179
+ };
19180
+ case BridgeStatusCode.TransientError:
19181
+ return {
19182
+ code: WebBrokerBridgeErrorCode.TransientError,
19183
+ innerErrorCode: error.code,
19184
+ description: error.description,
19185
+ };
19186
+ case BridgeStatusCode.PersistentError:
19187
+ return {
19188
+ code: WebBrokerBridgeErrorCode.PersistentError,
19189
+ innerErrorCode: error.code,
19190
+ description: error.description,
19191
+ };
19192
+ case BridgeStatusCode.UserInteractionRequired:
19193
+ return {
19194
+ code: WebBrokerBridgeErrorCode.UserInteractionRequired,
19195
+ innerErrorCode: error.code,
19196
+ description: error.description,
19197
+ };
19198
+ default:
19199
+ return {
19200
+ code: WebBrokerBridgeErrorCode.Unknown,
19201
+ innerErrorCode: error.code,
19202
+ description: error.description,
19203
+ };
19204
+ }
18523
19205
  }
18524
19206
 
18525
19207
  /*
@@ -18565,11 +19247,14 @@
18565
19247
  this.browserCrypto = operatingContext.isBrowserEnvironment()
18566
19248
  ? new CryptoOps(this.logger, this.performanceClient, true)
18567
19249
  : DEFAULT_CRYPTO_IMPLEMENTATION;
19250
+ const tokenBindingKeyManager = operatingContext.isBrowserEnvironment()
19251
+ ? new TokenBindingKeyManager(this.logger, this.performanceClient)
19252
+ : DEFAULT_TOKEN_BINDING_KEY_MANAGER;
18568
19253
  this.eventHandler = new EventHandler(this.logger);
18569
19254
  // Initialize the browser storage class.
18570
19255
  this.browserStorage = this.operatingContext.isBrowserEnvironment()
18571
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
18572
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
19256
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth), tokenBindingKeyManager)
19257
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler, undefined, tokenBindingKeyManager);
18573
19258
  this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
18574
19259
  // Set the active account if available
18575
19260
  const accountContext = this.bridgeProxy.getAccountContext();
@@ -19005,6 +19690,66 @@
19005
19690
  }
19006
19691
  }
19007
19692
 
19693
+ /*
19694
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19695
+ * Licensed under the MIT License.
19696
+ */
19697
+ /**
19698
+ * Correlates outbound requests with inbound responses by `requestId`.
19699
+ */
19700
+ class PendingRequestRegistry {
19701
+ constructor() {
19702
+ this.pending = new Map();
19703
+ }
19704
+ /**
19705
+ * Register a pending request. Returns a promise that resolves when a
19706
+ * response with the matching `requestId` arrives, or rejects if the
19707
+ * caller invokes `reject` for that id.
19708
+ */
19709
+ register(requestId) {
19710
+ return new Promise((resolve, reject) => {
19711
+ this.pending.set(requestId, { resolve, reject });
19712
+ });
19713
+ }
19714
+ /** Resolve a pending request. No-op if `requestId` isn't registered. */
19715
+ resolve(requestId, response) {
19716
+ const entry = this.pending.get(requestId);
19717
+ if (entry === undefined) {
19718
+ return;
19719
+ }
19720
+ this.pending.delete(requestId);
19721
+ entry.resolve(response);
19722
+ }
19723
+ /** Reject a pending request. No-op if `requestId` isn't registered. */
19724
+ reject(requestId, reason) {
19725
+ const entry = this.pending.get(requestId);
19726
+ if (entry === undefined) {
19727
+ return;
19728
+ }
19729
+ this.pending.delete(requestId);
19730
+ entry.reject(reason);
19731
+ }
19732
+ /** True if `requestId` has an in-flight registration. */
19733
+ has(requestId) {
19734
+ return this.pending.has(requestId);
19735
+ }
19736
+ /**
19737
+ * Register, then invoke `send` synchronously. If `send` throws, the
19738
+ * pending entry is cleared and the promise rejects with the thrown
19739
+ * error.
19740
+ */
19741
+ async sendAndAwait(message, send) {
19742
+ const promise = this.register(message.requestId);
19743
+ try {
19744
+ send(message);
19745
+ }
19746
+ catch (err) {
19747
+ this.reject(message.requestId, err);
19748
+ }
19749
+ return promise;
19750
+ }
19751
+ }
19752
+
19008
19753
  /*
19009
19754
  * Copyright (c) Microsoft Corporation. All rights reserved.
19010
19755
  * Licensed under the MIT License.
@@ -19032,28 +19777,14 @@
19032
19777
  window.nestedAppAuthBridge.addEventListener("message", (response) => {
19033
19778
  const responsePayload = typeof response === "string" ? response : response.data;
19034
19779
  const responseEnvelope = JSON.parse(responsePayload);
19035
- const request = BridgeProxy.bridgeRequests.find((element) => element.requestId === responseEnvelope.requestId);
19036
- if (request !== undefined) {
19037
- BridgeProxy.bridgeRequests.splice(BridgeProxy.bridgeRequests.indexOf(request), 1);
19038
- if (responseEnvelope.success) {
19039
- request.resolve(responseEnvelope);
19040
- }
19041
- else {
19042
- request.reject(responseEnvelope.error);
19043
- }
19780
+ if (responseEnvelope.success) {
19781
+ BridgeProxy.pendingRegistry.resolve(responseEnvelope.requestId, responseEnvelope);
19782
+ }
19783
+ else {
19784
+ BridgeProxy.pendingRegistry.reject(responseEnvelope.requestId, responseEnvelope.error);
19044
19785
  }
19045
19786
  });
19046
- const bridgeResponse = await new Promise((resolve, reject) => {
19047
- const message = BridgeProxy.buildRequest("GetInitContext");
19048
- const request = {
19049
- requestId: message.requestId,
19050
- method: message.method,
19051
- resolve: resolve,
19052
- reject: reject,
19053
- };
19054
- BridgeProxy.bridgeRequests.push(request);
19055
- window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
19056
- });
19787
+ const bridgeResponse = await BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest("GetInitContext"));
19057
19788
  return BridgeProxy.validateBridgeResultOrThrow(bridgeResponse.initContext);
19058
19789
  }
19059
19790
  catch (error) {
@@ -19109,18 +19840,22 @@
19109
19840
  * @returns a promise that resolves to a response of provided type or rejects with a BridgeError
19110
19841
  */
19111
19842
  sendRequest(method, requestParams) {
19112
- const message = BridgeProxy.buildRequest(method, requestParams);
19113
- const promise = new Promise((resolve, reject) => {
19114
- const request = {
19115
- requestId: message.requestId,
19116
- method: message.method,
19117
- resolve: resolve,
19118
- reject: reject,
19119
- };
19120
- BridgeProxy.bridgeRequests.push(request);
19843
+ return BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest(method, requestParams));
19844
+ }
19845
+ /**
19846
+ * Registers `message.requestId` with the shared pending-request
19847
+ * registry, then posts the envelope over the host bridge. Resolves
19848
+ * with the matching response envelope; rejects with the raw
19849
+ * `BridgeError` payload.
19850
+ */
19851
+ static sendRequestViaRegistry(message) {
19852
+ const correlationKey = {
19853
+ requestId: message.requestId,
19854
+ type: message.method,
19855
+ };
19856
+ return BridgeProxy.pendingRegistry.sendAndAwait(correlationKey, () => {
19121
19857
  window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
19122
19858
  });
19123
- return promise;
19124
19859
  }
19125
19860
  static validateBridgeResultOrThrow(input) {
19126
19861
  if (input === undefined) {
@@ -19152,7 +19887,11 @@
19152
19887
  return new BridgeProxy(response.sdkName, response.sdkVersion, response.accountContext, response.capabilities);
19153
19888
  }
19154
19889
  }
19155
- BridgeProxy.bridgeRequests = [];
19890
+ /**
19891
+ * Correlates outbound bridge requests with inbound responses by
19892
+ * `requestId`
19893
+ */
19894
+ BridgeProxy.pendingRegistry = new PendingRequestRegistry();
19156
19895
 
19157
19896
  /*
19158
19897
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19688,7 +20427,7 @@
19688
20427
  };
19689
20428
  const logger = new Logger(browserConfig.system.loggerOptions || {}, name, version);
19690
20429
  const cryptoOps = new CryptoOps(logger, browserConfig.telemetry.client);
19691
- const storage = new BrowserCacheManager(browserConfig.auth.clientId, browserConfig.cache, cryptoOps, logger, browserConfig.telemetry.client, new EventHandler(logger), buildStaticAuthorityOptions(browserConfig.auth));
20430
+ const storage = new BrowserCacheManager(browserConfig.auth.clientId, browserConfig.cache, cryptoOps, logger, browserConfig.telemetry.client, new EventHandler(logger), buildStaticAuthorityOptions(browserConfig.auth), new TokenBindingKeyManager(logger, browserConfig.telemetry.client));
19692
20431
  await storage.initialize(correlationId);
19693
20432
  const authorityString = request.authority || browserConfig.auth.authority;
19694
20433
  const authority = await createDiscoveredInstance(Authority.generateAuthority(authorityString, request.azureCloudOptions), browserConfig.system.networkClient, storage, authorityOptions, logger, correlationId, performanceClient);
@@ -19921,7 +20660,8 @@
19921
20660
  const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
19922
20661
  this.logger = new Logger(loggerOptions, name, version);
19923
20662
  this.cryptoOps = new CryptoOps(this.logger);
19924
- this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, new StubPerformanceClient());
20663
+ const tokenBindingKeyManager = new TokenBindingKeyManager(this.logger);
20664
+ this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, tokenBindingKeyManager, new StubPerformanceClient());
19925
20665
  this.shrParameters = shrParameters;
19926
20666
  }
19927
20667
  /**