@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,8 +1,8 @@
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
  'use strict';
4
4
 
5
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -39,6 +39,7 @@ const CLIENT_ASSERTION = "client_assertion";
39
39
  const CLIENT_ASSERTION_TYPE = "client_assertion_type";
40
40
  const TOKEN_TYPE = "token_type";
41
41
  const REQ_CNF = "req_cnf";
42
+ const DPOP_JKT = "dpop_jkt";
42
43
  const RETURN_SPA_CODE = "return_spa_code";
43
44
  const NATIVE_BROKER = "nativebroker";
44
45
  const LOGOUT_HINT = "logout_hint";
@@ -55,7 +56,7 @@ const RESOURCE = "resource";
55
56
  const CLI_DATA = "clidata";
56
57
  const ATTRIBUTE_TOKENS = "attribute_tokens";
57
58
 
58
- /*! @azure/msal-common v16.12.0 2026-08-04 */
59
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
59
60
  /*
60
61
  * Copyright (c) Microsoft Corporation. All rights reserved.
61
62
  * Licensed under the MIT License.
@@ -67,7 +68,6 @@ const DEFAULT_AUTHORITY_HOST = "login.microsoftonline.com";
67
68
  const DEFAULT_COMMON_TENANT = "common";
68
69
  // ADFS String
69
70
  const ADFS = "adfs";
70
- const DSTS = "dstsv2";
71
71
  // Default AAD Instance Discovery Endpoint
72
72
  const AAD_INSTANCE_DISCOVERY_ENDPT = `${DEFAULT_AUTHORITY}discovery/instance?api-version=1.1&authorization_endpoint=`;
73
73
  // CIAM URL
@@ -120,6 +120,7 @@ const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES$1, EMAIL_SCOPE];
120
120
  const HeaderNames = {
121
121
  CONTENT_TYPE: "Content-Type",
122
122
  CONTENT_LENGTH: "Content-Length",
123
+ DPOP: "DPoP",
123
124
  RETRY_AFTER: "Retry-After",
124
125
  CCS_HEADER: "X-AnchorMailbox",
125
126
  WWWAuthenticate: "WWW-Authenticate",
@@ -150,6 +151,7 @@ const ClaimsRequestKeys = {
150
151
  ID_TOKEN: "id_token",
151
152
  SIGNIN_STATE: "signin_state",
152
153
  LOGIN_HINT: "login_hint",
154
+ TENANT_REGION_SUB_SCOPE: "tenant_region_sub_scope",
153
155
  };
154
156
  /**
155
157
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
@@ -234,6 +236,7 @@ const SERVER_TELEM_UNKNOWN_ERROR = "unknown_error";
234
236
  const AuthenticationScheme$1 = {
235
237
  BEARER: "Bearer",
236
238
  POP: "pop",
239
+ DPOP: "DPoP",
237
240
  SSH: "ssh-cert",
238
241
  };
239
242
  /**
@@ -287,11 +290,12 @@ const JsonWebTokenTypes$1 = {
287
290
  Jwt: "JWT",
288
291
  Jwk: "JWK",
289
292
  Pop: "pop",
293
+ Dpop: "dpop+jwt",
290
294
  };
291
295
  // Token renewal offset default in seconds
292
296
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
293
297
 
294
- /*! @azure/msal-common v16.12.0 2026-08-04 */
298
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
295
299
  /*
296
300
  * Copyright (c) Microsoft Corporation. All rights reserved.
297
301
  * Licensed under the MIT License.
@@ -320,7 +324,7 @@ function createAuthError(code, correlationId, additionalMessage) {
320
324
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
321
325
  }
322
326
 
323
- /*! @azure/msal-common v16.12.0 2026-08-04 */
327
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
324
328
 
325
329
  /*
326
330
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -343,7 +347,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
343
347
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
344
348
  }
345
349
 
346
- /*! @azure/msal-common v16.12.0 2026-08-04 */
350
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
347
351
  /*
348
352
  * Copyright (c) Microsoft Corporation. All rights reserved.
349
353
  * Licensed under the MIT License.
@@ -372,6 +376,7 @@ const invalidCacheEnvironment = "invalid_cache_environment";
372
376
  const noAccountFound = "no_account_found";
373
377
  const noCryptoObject = "no_crypto_object";
374
378
  const unexpectedCredentialType = "unexpected_credential_type";
379
+ const dpopTokenTypeMismatch = "dpop_token_type_mismatch";
375
380
  const tokenRefreshRequired = "token_refresh_required";
376
381
  const tokenClaimsCnfRequiredForSignedJwt = "token_claims_cnf_required_for_signedjwt";
377
382
  const authorizationCodeMissingFromServerResponse = "authorization_code_missing_from_server_response";
@@ -394,6 +399,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
394
399
  cannotRemoveEmptyScope: cannotRemoveEmptyScope,
395
400
  clientInfoDecodingError: clientInfoDecodingError,
396
401
  clientInfoEmptyError: clientInfoEmptyError,
402
+ dpopTokenTypeMismatch: dpopTokenTypeMismatch,
397
403
  emptyInputScopeSet: emptyInputScopeSet,
398
404
  endSessionEndpointNotSupported: endSessionEndpointNotSupported,
399
405
  endpointResolutionError: endpointResolutionError,
@@ -427,7 +433,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
427
433
  userCanceled: userCanceled
428
434
  });
429
435
 
430
- /*! @azure/msal-common v16.12.0 2026-08-04 */
436
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
431
437
 
432
438
  /*
433
439
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -465,7 +471,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
465
471
  };
466
472
  }
467
473
 
468
- /*! @azure/msal-common v16.12.0 2026-08-04 */
474
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
469
475
 
470
476
  /*
471
477
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -531,7 +537,7 @@ function getJWSPayload(authToken, correlationId) {
531
537
  return matches[2];
532
538
  }
533
539
 
534
- /*! @azure/msal-common v16.12.0 2026-08-04 */
540
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
535
541
 
536
542
  /*
537
543
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -619,7 +625,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
619
625
  return updatedAccountInfo;
620
626
  }
621
627
 
622
- /*! @azure/msal-common v16.12.0 2026-08-04 */
628
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
623
629
  /*
624
630
  * Copyright (c) Microsoft Corporation. All rights reserved.
625
631
  * Licensed under the MIT License.
@@ -630,11 +636,10 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
630
636
  const AuthorityType = {
631
637
  Default: 0,
632
638
  Adfs: 1,
633
- Dsts: 2,
634
639
  Ciam: 3,
635
640
  };
636
641
 
637
- /*! @azure/msal-common v16.12.0 2026-08-04 */
642
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
638
643
  /*
639
644
  * Copyright (c) Microsoft Corporation. All rights reserved.
640
645
  * Licensed under the MIT License.
@@ -656,7 +661,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
656
661
  return null;
657
662
  }
658
663
 
659
- /*! @azure/msal-common v16.12.0 2026-08-04 */
664
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
660
665
  /*
661
666
  * Copyright (c) Microsoft Corporation. All rights reserved.
662
667
  * Licensed under the MIT License.
@@ -680,7 +685,7 @@ const ProtocolMode = {
680
685
  EAR: "EAR",
681
686
  };
682
687
 
683
- /*! @azure/msal-common v16.12.0 2026-08-04 */
688
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
684
689
  /**
685
690
  * Returns the AccountInfo interface for this account.
686
691
  * @internal
@@ -835,8 +840,8 @@ function createAccountEntityFromAccountInfo(accountInfo, cloudGraphHostName, msG
835
840
  * @param authType
836
841
  */
837
842
  function generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, correlationId, idTokenClaims) {
838
- // since ADFS/DSTS do not have tid and does not set client_info
839
- if (!(authType === AuthorityType.Adfs || authType === AuthorityType.Dsts)) {
843
+ // ADFS does not have tid and does not set client_info
844
+ if (authType !== AuthorityType.Adfs) {
840
845
  // for cases where there is clientInfo
841
846
  if (serverClientInfo) {
842
847
  try {
@@ -869,7 +874,7 @@ function isAccountEntity(entity) {
869
874
  entity.hasOwnProperty("authorityType"));
870
875
  }
871
876
 
872
- /*! @azure/msal-common v16.12.0 2026-08-04 */
877
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
873
878
  /*
874
879
  * Copyright (c) Microsoft Corporation. All rights reserved.
875
880
  * Licensed under the MIT License.
@@ -886,7 +891,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
886
891
  unexpectedError: unexpectedError
887
892
  });
888
893
 
889
- /*! @azure/msal-common v16.12.0 2026-08-04 */
894
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
890
895
 
891
896
  /*
892
897
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -906,7 +911,7 @@ function createClientConfigurationError(errorCode, correlationId) {
906
911
  return new ClientConfigurationError(errorCode, correlationId);
907
912
  }
908
913
 
909
- /*! @azure/msal-common v16.12.0 2026-08-04 */
914
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
910
915
  /*
911
916
  * Copyright (c) Microsoft Corporation. All rights reserved.
912
917
  * Licensed under the MIT License.
@@ -927,6 +932,7 @@ const invalidAuthorityMetadata = "invalid_authority_metadata";
927
932
  const untrustedAuthority = "untrusted_authority";
928
933
  const missingSshJwk = "missing_ssh_jwk";
929
934
  const missingSshKid = "missing_ssh_kid";
935
+ const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
930
936
  const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
931
937
  const invalidAuthenticationHeader = "invalid_authentication_header";
932
938
  const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
@@ -937,7 +943,9 @@ const invalidPlatformBrokerConfiguration = "invalid_platform_broker_configuratio
937
943
  const issuerValidationFailed = "issuer_validation_failed";
938
944
  const invalidResponseMode = "invalid_response_mode";
939
945
  const invalidDpopHtm = "invalid_dpop_htm";
940
- const invalidDpopHtu = "invalid_dpop_htu";
946
+ const invalidDpopHtu = "invalid_dpop_htu";
947
+ const invalidDpopNonce = "invalid_dpop_nonce";
948
+ const dpopMissingResourceContext = "dpop_missing_resource_context";
941
949
 
942
950
  var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
943
951
  __proto__: null,
@@ -946,6 +954,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
946
954
  cannotAllowPlatformBroker: cannotAllowPlatformBroker,
947
955
  cannotSetOIDCOptions: cannotSetOIDCOptions,
948
956
  claimsRequestParsingError: claimsRequestParsingError,
957
+ dpopMissingResourceContext: dpopMissingResourceContext,
949
958
  emptyInputScopesError: emptyInputScopesError,
950
959
  invalidAuthenticationHeader: invalidAuthenticationHeader,
951
960
  invalidAuthorityMetadata: invalidAuthorityMetadata,
@@ -954,6 +963,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
954
963
  invalidCodeChallengeMethod: invalidCodeChallengeMethod,
955
964
  invalidDpopHtm: invalidDpopHtm,
956
965
  invalidDpopHtu: invalidDpopHtu,
966
+ invalidDpopNonce: invalidDpopNonce,
957
967
  invalidPlatformBrokerConfiguration: invalidPlatformBrokerConfiguration,
958
968
  invalidRequestMethodForEAR: invalidRequestMethodForEAR,
959
969
  invalidResponseMode: invalidResponseMode,
@@ -965,12 +975,13 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
965
975
  pkceParamsMissing: pkceParamsMissing,
966
976
  redirectUriEmpty: redirectUriEmpty,
967
977
  tokenRequestEmpty: tokenRequestEmpty,
978
+ unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
968
979
  untrustedAuthority: untrustedAuthority,
969
980
  urlEmptyError: urlEmptyError,
970
981
  urlParseError: urlParseError
971
982
  });
972
983
 
973
- /*! @azure/msal-common v16.12.0 2026-08-04 */
984
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
974
985
 
975
986
  /*
976
987
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1028,7 +1039,7 @@ class AuthenticationHeaderParser {
1028
1039
  }
1029
1040
  }
1030
1041
 
1031
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1042
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1032
1043
  /*
1033
1044
  * Copyright (c) Microsoft Corporation. All rights reserved.
1034
1045
  * Licensed under the MIT License.
@@ -1040,7 +1051,7 @@ function isOpenIdConfigResponse(response) {
1040
1051
  response.hasOwnProperty("jwks_uri"));
1041
1052
  }
1042
1053
 
1043
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1054
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1044
1055
  /*
1045
1056
  * Copyright (c) Microsoft Corporation. All rights reserved.
1046
1057
  * Licensed under the MIT License.
@@ -1120,7 +1131,7 @@ class StringUtils {
1120
1131
  }
1121
1132
  }
1122
1133
 
1123
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1134
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1124
1135
 
1125
1136
  /*
1126
1137
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1278,7 +1289,7 @@ class UrlString {
1278
1289
  }
1279
1290
  }
1280
1291
 
1281
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1292
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1282
1293
 
1283
1294
  /*
1284
1295
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1287,10 +1298,7 @@ class UrlString {
1287
1298
  // Build endpoint metadata dynamically to avoid string duplication
1288
1299
  const endpointHosts = [
1289
1300
  { host: "login.microsoftonline.com" },
1290
- {
1291
- host: "login.chinacloudapi.cn",
1292
- issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
1293
- },
1301
+ { host: "login.partner.microsoftonline.cn" },
1294
1302
  { host: "login.microsoftonline.us" },
1295
1303
  { host: "login.sovcloud-identity.fr" },
1296
1304
  { host: "login.sovcloud-identity.de" },
@@ -1364,15 +1372,6 @@ const rawMetdataJSON = {
1364
1372
  preferred_cache: "login.sovcloud-identity.sg",
1365
1373
  aliases: ["login.sovcloud-identity.sg"],
1366
1374
  },
1367
- {
1368
- preferred_network: "login.windows-ppe.net",
1369
- preferred_cache: "login.windows-ppe.net",
1370
- aliases: [
1371
- "login.windows-ppe.net",
1372
- "sts.windows-ppe.net",
1373
- "login.microsoft-ppe.com",
1374
- ],
1375
- },
1376
1375
  ],
1377
1376
  },
1378
1377
  };
@@ -1444,7 +1443,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1444
1443
  return null;
1445
1444
  }
1446
1445
 
1447
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1446
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1448
1447
  /*
1449
1448
  * Copyright (c) Microsoft Corporation. All rights reserved.
1450
1449
  * Licensed under the MIT License.
@@ -1454,8 +1453,6 @@ const AzureCloudInstance = {
1454
1453
  None: "none",
1455
1454
  // Microsoft Azure public cloud
1456
1455
  AzurePublic: "https://login.microsoftonline.com",
1457
- // Microsoft PPE
1458
- AzurePpe: "https://login.windows-ppe.net",
1459
1456
  // Microsoft Chinese national/regional cloud
1460
1457
  AzureChina: "https://login.chinacloudapi.cn",
1461
1458
  // Microsoft German national/regional cloud ("Black Forest")
@@ -1464,7 +1461,7 @@ const AzureCloudInstance = {
1464
1461
  AzureUsGovernment: "https://login.microsoftonline.us",
1465
1462
  };
1466
1463
 
1467
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1464
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1468
1465
  /*
1469
1466
  * Copyright (c) Microsoft Corporation. All rights reserved.
1470
1467
  * Licensed under the MIT License.
@@ -1474,7 +1471,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1474
1471
  response.hasOwnProperty("metadata"));
1475
1472
  }
1476
1473
 
1477
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1474
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1478
1475
  /*
1479
1476
  * Copyright (c) Microsoft Corporation. All rights reserved.
1480
1477
  * Licensed under the MIT License.
@@ -1484,7 +1481,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1484
1481
  response.hasOwnProperty("error_description"));
1485
1482
  }
1486
1483
 
1487
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1484
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1488
1485
  /*
1489
1486
  * Copyright (c) Microsoft Corporation. All rights reserved.
1490
1487
  * Licensed under the MIT License.
@@ -1555,7 +1552,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1555
1552
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1556
1553
  const SetUserData = "setUserData";
1557
1554
 
1558
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1555
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1559
1556
  /*
1560
1557
  * Copyright (c) Microsoft Corporation. All rights reserved.
1561
1558
  * Licensed under the MIT License.
@@ -1648,7 +1645,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1648
1645
  };
1649
1646
  };
1650
1647
 
1651
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1648
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1652
1649
 
1653
1650
  /*
1654
1651
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1759,7 +1756,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1759
1756
  },
1760
1757
  };
1761
1758
 
1762
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1759
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1763
1760
  /*
1764
1761
  * Copyright (c) Microsoft Corporation. All rights reserved.
1765
1762
  * Licensed under the MIT License.
@@ -1824,7 +1821,7 @@ function wasClockTurnedBack(cachedAt) {
1824
1821
  return cachedAtSec > nowSeconds();
1825
1822
  }
1826
1823
 
1827
- /*! @azure/msal-common v16.12.0 2026-08-04 */
1824
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
1828
1825
 
1829
1826
  /*
1830
1827
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1881,6 +1878,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1881
1878
  if (refreshOn) {
1882
1879
  atEntity.refreshOn = refreshOn.toString();
1883
1880
  }
1881
+ const normalizedTokenType = atEntity.tokenType?.toLowerCase();
1884
1882
  /*
1885
1883
  * Create Access Token With Auth Scheme instead of regular access token
1886
1884
  * Cast to lower to handle "bearer" from ADFS
@@ -1889,7 +1887,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1889
1887
  AuthenticationScheme$1.BEARER.toLowerCase()) {
1890
1888
  atEntity.credentialType =
1891
1889
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
1892
- switch (atEntity.tokenType) {
1890
+ switch (normalizedTokenType) {
1893
1891
  case AuthenticationScheme$1.POP:
1894
1892
  // Make sure keyId is present and add it to credential
1895
1893
  const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
@@ -1898,6 +1896,12 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
1898
1896
  }
1899
1897
  atEntity.keyId = tokenClaims.cnf.kid;
1900
1898
  break;
1899
+ case "dpop":
1900
+ if (!keyId) {
1901
+ throw createClientAuthError(keyIdMissing, correlationId);
1902
+ }
1903
+ atEntity.keyId = keyId;
1904
+ break;
1901
1905
  case AuthenticationScheme$1.SSH:
1902
1906
  atEntity.keyId = keyId;
1903
1907
  }
@@ -2104,7 +2108,7 @@ function serializeAttributeTokens(attributeTokens) {
2104
2108
  return [...attributeTokens].sort().join(" ");
2105
2109
  }
2106
2110
 
2107
- /*! @azure/msal-common v16.12.0 2026-08-04 */
2111
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
2108
2112
 
2109
2113
  /*
2110
2114
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2148,8 +2152,6 @@ class Authority {
2148
2152
  switch (pathSegments[0].toLowerCase()) {
2149
2153
  case ADFS:
2150
2154
  return AuthorityType.Adfs;
2151
- case DSTS:
2152
- return AuthorityType.Dsts;
2153
2155
  }
2154
2156
  }
2155
2157
  return AuthorityType.Default;
@@ -3074,7 +3076,7 @@ function buildStaticAuthorityOptions(authOptions) {
3074
3076
  };
3075
3077
  }
3076
3078
 
3077
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3079
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3078
3080
 
3079
3081
  /*
3080
3082
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3108,7 +3110,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3108
3110
  }
3109
3111
  }
3110
3112
 
3111
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3113
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3112
3114
 
3113
3115
  /*
3114
3116
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3304,7 +3306,7 @@ class ScopeSet {
3304
3306
  }
3305
3307
  }
3306
3308
 
3307
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3309
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3308
3310
 
3309
3311
  /*
3310
3312
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3598,11 +3600,15 @@ function addExtraParameters(parameters, extraParams) {
3598
3600
  }
3599
3601
  /**
3600
3602
  * Default optional idToken claims requested on all auth requests.
3601
- * signin_state enables KMSI detection; login_hint enables login hint propagation.
3603
+ * signin_state enables KMSI detection; login_hint enables login hint propagation;
3604
+ * tenant_region_sub_scope identifies the sovereign enclave a tenant belongs to.
3602
3605
  */
3603
3606
  const DEFAULT_ID_TOKEN_CLAIMS = {
3604
3607
  [ClaimsRequestKeys.SIGNIN_STATE]: { essential: false },
3605
3608
  [ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
3609
+ [ClaimsRequestKeys.TENANT_REGION_SUB_SCOPE]: {
3610
+ essential: false,
3611
+ },
3606
3612
  };
3607
3613
  /**
3608
3614
  * Parses a claims JSON string into an object, throwing a ClientConfigurationError
@@ -3621,7 +3627,7 @@ function parseClaims(claims, correlationId = "") {
3621
3627
  // Malformed JSON
3622
3628
  throw createClientConfigurationError(invalidClaims, correlationId);
3623
3629
  }
3624
- if (!isPlainObject(parsed)) {
3630
+ if (!isPlainObject$1(parsed)) {
3625
3631
  // Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
3626
3632
  throw createClientConfigurationError(invalidClaims, correlationId);
3627
3633
  }
@@ -3632,7 +3638,7 @@ function parseClaims(claims, correlationId = "") {
3632
3638
  * @param value - The value to test
3633
3639
  * @returns True when value is a plain object that can be deep-merged
3634
3640
  */
3635
- function isPlainObject(value) {
3641
+ function isPlainObject$1(value) {
3636
3642
  return typeof value === "object" && value !== null && !Array.isArray(value);
3637
3643
  }
3638
3644
  /**
@@ -3649,7 +3655,7 @@ function deepMergeClaims(baseClaims, claimsToMerge) {
3649
3655
  const merged = { ...baseClaims };
3650
3656
  for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
3651
3657
  const baseValue = merged[key];
3652
- if (isPlainObject(baseValue) && isPlainObject(mergeInValue)) {
3658
+ if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
3653
3659
  merged[key] = deepMergeClaims(baseValue, mergeInValue);
3654
3660
  }
3655
3661
  else {
@@ -3661,8 +3667,8 @@ function deepMergeClaims(baseClaims, claimsToMerge) {
3661
3667
  /**
3662
3668
  * Parses claims JSON, optionally deep-merges a second client-originated claims string
3663
3669
  * (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
3664
- * default optional idToken claims (signin_state, login_hint), and appends client
3665
- * capabilities (xms_cc) to the access_token section.
3670
+ * default optional idToken claims (signin_state, login_hint, tenant_region_sub_scope), and appends client
3671
+ * capabilities (xms_cc) to the access_token section
3666
3672
  * Does not overwrite idToken claims already specified by the caller.
3667
3673
  * @param claims - Existing claims JSON string from the request (may be undefined)
3668
3674
  * @param clientCapabilities - Client capabilities array from configuration
@@ -3786,7 +3792,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3786
3792
  }
3787
3793
  }
3788
3794
 
3789
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3795
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3790
3796
 
3791
3797
  /*
3792
3798
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3908,12 +3914,20 @@ function validateUrl(url, logger, correlationId) {
3908
3914
  }
3909
3915
  }
3910
3916
 
3911
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3917
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3912
3918
 
3913
3919
  /*
3914
3920
  * Copyright (c) Microsoft Corporation. All rights reserved.
3915
3921
  * Licensed under the MIT License.
3916
3922
  */
3923
+ /**
3924
+ * Shared JOSE algorithm literals used by MSAL package internals.
3925
+ * @internal
3926
+ */
3927
+ const JsonWebTokenAlgorithms = {
3928
+ ES256: "ES256",
3929
+ RS256: "RS256",
3930
+ };
3917
3931
  /**
3918
3932
  * Default crypto implementation used when a platform-specific implementation has
3919
3933
  * not been provided.
@@ -3934,24 +3948,44 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3934
3948
  encodeKid: () => {
3935
3949
  throw createClientAuthError(methodNotImplemented, "");
3936
3950
  },
3937
- async getPublicKeyThumbprint() {
3938
- throw createClientAuthError(methodNotImplemented, "");
3939
- },
3940
- async removeTokenBindingKey() {
3941
- throw createClientAuthError(methodNotImplemented, "");
3951
+ async removeTokenBindingKey(kid, correlationId) {
3952
+ throw createClientAuthError(methodNotImplemented, correlationId);
3942
3953
  },
3943
- async clearKeystore() {
3944
- throw createClientAuthError(methodNotImplemented, "");
3954
+ async clearKeystore(correlationId) {
3955
+ throw createClientAuthError(methodNotImplemented, correlationId);
3945
3956
  },
3946
- async signJwt() {
3947
- throw createClientAuthError(methodNotImplemented, "");
3957
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
3958
+ throw createClientAuthError(methodNotImplemented, correlationId);
3948
3959
  },
3949
3960
  async hashString() {
3950
3961
  throw createClientAuthError(methodNotImplemented, "");
3951
3962
  },
3952
3963
  };
3953
3964
 
3954
- /*! @azure/msal-common v16.12.0 2026-08-04 */
3965
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3966
+
3967
+ /*
3968
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3969
+ * Licensed under the MIT License.
3970
+ */
3971
+ /**
3972
+ * Default token-binding key manager used when a platform-specific implementation
3973
+ * has not been provided.
3974
+ * @internal
3975
+ */
3976
+ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3977
+ async provisionTokenBindingKey(request) {
3978
+ throw createClientAuthError(methodNotImplemented, request.correlationId);
3979
+ },
3980
+ async removeTokenBindingKey(_kid, correlationId) {
3981
+ throw createClientAuthError(methodNotImplemented, correlationId);
3982
+ },
3983
+ async getTokenBindingPublicKeyJwk(_kid, correlationId) {
3984
+ throw createClientAuthError(methodNotImplemented, correlationId);
3985
+ },
3986
+ };
3987
+
3988
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
3955
3989
  /*
3956
3990
  * Copyright (c) Microsoft Corporation. All rights reserved.
3957
3991
  * Licensed under the MIT License.
@@ -4240,12 +4274,12 @@ class Logger {
4240
4274
  }
4241
4275
  }
4242
4276
 
4243
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4277
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4244
4278
  /* eslint-disable header/header */
4245
4279
  const name$1 = "@azure/msal-common";
4246
- const version$1 = "16.12.0";
4280
+ const version$1 = "16.14.0";
4247
4281
 
4248
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4282
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4249
4283
  /*
4250
4284
  * Copyright (c) Microsoft Corporation. All rights reserved.
4251
4285
  * Licensed under the MIT License.
@@ -4253,7 +4287,7 @@ const version$1 = "16.12.0";
4253
4287
  const cacheQuotaExceeded = "cache_quota_exceeded";
4254
4288
  const cacheErrorUnknown = "cache_error_unknown";
4255
4289
 
4256
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4290
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4257
4291
 
4258
4292
  /*
4259
4293
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4291,7 +4325,7 @@ function createCacheError(e) {
4291
4325
  }
4292
4326
  }
4293
4327
 
4294
- /*! @azure/msal-common v16.12.0 2026-08-04 */
4328
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
4295
4329
 
4296
4330
  /*
4297
4331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4302,9 +4336,10 @@ function createCacheError(e) {
4302
4336
  * @internal
4303
4337
  */
4304
4338
  class CacheManager {
4305
- constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions) {
4339
+ constructor(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions, tokenBindingKeyManager) {
4306
4340
  this.clientId = clientId;
4307
4341
  this.cryptoImpl = cryptoImpl;
4342
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
4308
4343
  this.commonLogger = logger.clone(name$1, version$1);
4309
4344
  this.staticAuthorityOptions = staticAuthorityOptions;
4310
4345
  this.performanceClient = performanceClient;
@@ -4652,16 +4687,9 @@ class CacheManager {
4652
4687
  // Access Token with Auth Scheme specific matching
4653
4688
  if (entity.credentialType ===
4654
4689
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
4655
- if (!!filter.tokenType &&
4656
- !this.matchTokenType(entity, filter.tokenType)) {
4690
+ if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
4657
4691
  return false;
4658
4692
  }
4659
- // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
4660
- if (filter.tokenType === AuthenticationScheme$1.SSH) {
4661
- if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
4662
- return false;
4663
- }
4664
- }
4665
4693
  }
4666
4694
  // Additional cache key components matching (bidirectional isolation)
4667
4695
  const entityComponents = entity.additionalCacheKeyComponents;
@@ -4800,19 +4828,24 @@ class CacheManager {
4800
4828
  }
4801
4829
  this.removeItem(key, correlationId);
4802
4830
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4803
- // Remove Token Binding Key from key store for PoP Tokens Credentials
4831
+ // Remove Token Binding Key from key store for token-bound access token credentials
4804
4832
  if (credential.credentialType.toLowerCase() ===
4805
4833
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
4806
- if (credential.tokenType === AuthenticationScheme$1.POP) {
4807
- const accessTokenWithAuthSchemeEntity = credential;
4808
- const kid = accessTokenWithAuthSchemeEntity.keyId;
4809
- if (kid) {
4810
- void this.cryptoImpl
4811
- .removeTokenBindingKey(kid, correlationId)
4812
- .catch(() => {
4813
- this.commonLogger.error(`0cx291 ${kid}`, correlationId);
4814
- this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4815
- });
4834
+ const tokenType = credential.tokenType?.toLowerCase();
4835
+ switch (tokenType) {
4836
+ case AuthenticationScheme$1.POP:
4837
+ case AuthenticationScheme$1.DPOP.toLowerCase(): {
4838
+ const accessTokenWithAuthSchemeEntity = credential;
4839
+ const kid = accessTokenWithAuthSchemeEntity.keyId;
4840
+ if (kid) {
4841
+ void this.tokenBindingKeyManager
4842
+ .removeTokenBindingKey(kid, correlationId)
4843
+ .catch(() => {
4844
+ this.commonLogger.error("0id34f", correlationId);
4845
+ this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4846
+ });
4847
+ }
4848
+ break;
4816
4849
  }
4817
4850
  }
4818
4851
  }
@@ -4978,7 +5011,9 @@ class CacheManager {
4978
5011
  realm: targetRealm || account.tenantId,
4979
5012
  target: scopes,
4980
5013
  tokenType: authScheme,
4981
- keyId: request.sshKid,
5014
+ keyId: authScheme === AuthenticationScheme$1.SSH
5015
+ ? request.sshKid
5016
+ : undefined,
4982
5017
  additionalCacheKeyComponents: additionalCacheKeyComponents,
4983
5018
  };
4984
5019
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5340,7 +5375,28 @@ class CacheManager {
5340
5375
  * @param tokenType
5341
5376
  */
5342
5377
  matchTokenType(entity, tokenType) {
5343
- return !!(entity.tokenType && entity.tokenType === tokenType);
5378
+ return !!(entity.tokenType &&
5379
+ entity.tokenType.toLowerCase() === tokenType.toLowerCase());
5380
+ }
5381
+ matchAccessTokenWithAuthScheme(entity, filter) {
5382
+ const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
5383
+ if (!!filter.tokenType &&
5384
+ !this.matchTokenType(entity, filter.tokenType)) {
5385
+ return false;
5386
+ }
5387
+ switch (normalizedFilterTokenType) {
5388
+ case "dpop":
5389
+ case AuthenticationScheme$1.SSH:
5390
+ return this.matchKeyBoundAccessToken(entity, filter);
5391
+ default:
5392
+ return true;
5393
+ }
5394
+ }
5395
+ matchKeyBoundAccessToken(entity, filter) {
5396
+ if (!filter.keyId) {
5397
+ return true;
5398
+ }
5399
+ return this.matchKeyId(entity, filter.keyId);
5344
5400
  }
5345
5401
  /**
5346
5402
  * Returns true if the credential's keyId matches the one in the request, false otherwise
@@ -5457,7 +5513,7 @@ class DefaultStorageClass extends CacheManager {
5457
5513
  }
5458
5514
  }
5459
5515
 
5460
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5516
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5461
5517
  /*
5462
5518
  * Copyright (c) Microsoft Corporation. All rights reserved.
5463
5519
  * Licensed under the MIT License.
@@ -5522,7 +5578,7 @@ const IntFields = new Set([
5522
5578
  "fetchRetryCount",
5523
5579
  ]);
5524
5580
 
5525
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5581
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5526
5582
 
5527
5583
  /*
5528
5584
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5580,7 +5636,7 @@ class StubPerformanceClient {
5580
5636
  }
5581
5637
  }
5582
5638
 
5583
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5639
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5584
5640
 
5585
5641
  /*
5586
5642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5634,19 +5690,21 @@ const DEFAULT_TELEMETRY_OPTIONS = {
5634
5690
  * @returns Configuration
5635
5691
  * @internal
5636
5692
  */
5637
- function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
5693
+ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, tokenBindingKeyManager: tokenBindingKeyManager, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
5638
5694
  const loggerOptions = {
5639
5695
  ...DEFAULT_LOGGER_IMPLEMENTATION,
5640
5696
  ...userLoggerOption,
5641
5697
  };
5698
+ const resolvedTokenBindingKeyManager = tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER;
5642
5699
  return {
5643
5700
  authOptions: buildAuthOptions(userAuthOptions),
5644
5701
  systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
5645
5702
  loggerOptions: loggerOptions,
5646
5703
  storageInterface: storageImplementation ||
5647
- new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
5704
+ new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient(), undefined, resolvedTokenBindingKeyManager),
5648
5705
  networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
5649
5706
  cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
5707
+ tokenBindingKeyManager: resolvedTokenBindingKeyManager,
5650
5708
  clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
5651
5709
  libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
5652
5710
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
@@ -5676,7 +5734,7 @@ function isOidcProtocolMode(config) {
5676
5734
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5677
5735
  }
5678
5736
 
5679
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5737
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5680
5738
  /*
5681
5739
  * Copyright (c) Microsoft Corporation. All rights reserved.
5682
5740
  * Licensed under the MIT License.
@@ -5703,7 +5761,129 @@ function isOidcProtocolMode(config) {
5703
5761
  }
5704
5762
  }
5705
5763
 
5706
- /*! @azure/msal-common v16.12.0 2026-08-04 */
5764
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5765
+
5766
+ /*
5767
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5768
+ * Licensed under the MIT License.
5769
+ */
5770
+ /**
5771
+ * Error thrown when there is an error in the client code running on the browser.
5772
+ */
5773
+ class JoseHeaderError extends AuthError {
5774
+ constructor(errorCode, correlationId, errorMessage) {
5775
+ super(errorCode, correlationId, errorMessage);
5776
+ this.name = "JoseHeaderError";
5777
+ Object.setPrototypeOf(this, JoseHeaderError.prototype);
5778
+ }
5779
+ }
5780
+ /** Returns JoseHeaderError object */
5781
+ function createJoseHeaderError(code, correlationId) {
5782
+ return new JoseHeaderError(code, correlationId);
5783
+ }
5784
+
5785
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5786
+ /*
5787
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5788
+ * Licensed under the MIT License.
5789
+ */
5790
+ /**
5791
+ * Checks whether a value is a plain JSON-like object.
5792
+ * Allows objects with null prototypes, but rejects arrays and object subclasses.
5793
+ */
5794
+ function isPlainObject(value) {
5795
+ if (typeof value !== "object" ||
5796
+ value === null ||
5797
+ Object.prototype.toString.call(value) !== "[object Object]") {
5798
+ return false;
5799
+ }
5800
+ if (Object.getPrototypeOf(value) === null) {
5801
+ return true;
5802
+ }
5803
+ let proto = value;
5804
+ while (Object.getPrototypeOf(proto) !== null) {
5805
+ proto = Object.getPrototypeOf(proto);
5806
+ }
5807
+ return Object.getPrototypeOf(value) === proto;
5808
+ }
5809
+
5810
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5811
+ /*
5812
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5813
+ * Licensed under the MIT License.
5814
+ */
5815
+ const missingKidError = "missing_kid_error";
5816
+ const missingAlgError = "missing_alg_error";
5817
+ const missingJwkError = "missing_jwk_error";
5818
+ const invalidJwkError = "invalid_jwk_error";
5819
+
5820
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5821
+
5822
+ /*
5823
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5824
+ * Licensed under the MIT License.
5825
+ */
5826
+ /** @internal */
5827
+ class JoseHeader {
5828
+ constructor(options, correlationId) {
5829
+ if (typeof options.alg !== "string" || !options.alg) {
5830
+ throw createJoseHeaderError(missingAlgError, correlationId);
5831
+ }
5832
+ this.typ = options.typ;
5833
+ this.alg = options.alg;
5834
+ this.kid = options.kid;
5835
+ this.jwk = options.jwk;
5836
+ }
5837
+ /**
5838
+ * Builds SignedHttpRequest formatted JOSE Header from the
5839
+ * JOSE Header options provided or previously set on the object.
5840
+ * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
5841
+ * @param shrHeaderOptions
5842
+ * @param correlationId
5843
+ * @returns
5844
+ */
5845
+ static getShrHeader(shrHeaderOptions, correlationId) {
5846
+ // KeyID is required on the SHR header
5847
+ if (!shrHeaderOptions.kid) {
5848
+ throw createJoseHeaderError(missingKidError, correlationId);
5849
+ }
5850
+ // Alg is required on the SHR header
5851
+ if (!shrHeaderOptions.alg) {
5852
+ throw createJoseHeaderError(missingAlgError, correlationId);
5853
+ }
5854
+ return new JoseHeader({
5855
+ // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
5856
+ typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
5857
+ kid: shrHeaderOptions.kid,
5858
+ alg: shrHeaderOptions.alg,
5859
+ }, correlationId);
5860
+ }
5861
+ /**
5862
+ * Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
5863
+ * Throws if public JWK or algorithm aren't provided since they are required for DPoP.
5864
+ * @param dpopHeaderOptions
5865
+ * @param correlationId
5866
+ * @returns
5867
+ */
5868
+ static getDpopHeader(dpopHeaderOptions, correlationId) {
5869
+ if (!isPlainObject(dpopHeaderOptions.jwk)) {
5870
+ throw createJoseHeaderError(missingJwkError, correlationId);
5871
+ }
5872
+ if (!dpopHeaderOptions.alg) {
5873
+ throw createJoseHeaderError(missingAlgError, correlationId);
5874
+ }
5875
+ if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
5876
+ throw createJoseHeaderError(invalidJwkError, correlationId);
5877
+ }
5878
+ return new JoseHeader({
5879
+ typ: JsonWebTokenTypes$1.Dpop,
5880
+ alg: dpopHeaderOptions.alg,
5881
+ jwk: dpopHeaderOptions.jwk,
5882
+ }, correlationId);
5883
+ }
5884
+ }
5885
+
5886
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5707
5887
 
5708
5888
  /*
5709
5889
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5711,10 +5891,13 @@ function isOidcProtocolMode(config) {
5711
5891
  */
5712
5892
  const KeyLocation = {
5713
5893
  SW: "sw"};
5894
+ const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
5895
+ const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
5714
5896
  /** @internal */
5715
5897
  class PopTokenGenerator {
5716
- constructor(cryptoUtils, performanceClient) {
5898
+ constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
5717
5899
  this.cryptoUtils = cryptoUtils;
5900
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
5718
5901
  this.performanceClient = performanceClient;
5719
5902
  }
5720
5903
  /**
@@ -5737,7 +5920,11 @@ class PopTokenGenerator {
5737
5920
  * @returns
5738
5921
  */
5739
5922
  async generateKid(request) {
5740
- const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
5923
+ const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
5924
+ correlationId: request.correlationId,
5925
+ tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
5926
+ tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
5927
+ });
5741
5928
  return {
5742
5929
  kid: kidThumbprint,
5743
5930
  xms_ksl: KeyLocation.SW,
@@ -5767,7 +5954,17 @@ class PopTokenGenerator {
5767
5954
  ? new UrlString(resourceRequestUri, request.correlationId)
5768
5955
  : undefined;
5769
5956
  const resourceUrlComponents = resourceUrlString?.getUrlComponents();
5770
- return this.cryptoUtils.signJwt({
5957
+ const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
5958
+ const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
5959
+ const shrAlgorithm = shrOptions?.header?.alg ||
5960
+ publicKeyJwk.alg ||
5961
+ SHR_TOKEN_BINDING_KEY_ALGORITHM;
5962
+ const shrHeader = JoseHeader.getShrHeader({
5963
+ ...shrOptions?.header,
5964
+ alg: shrAlgorithm,
5965
+ kid: encodedKeyIdThumbprint,
5966
+ }, request.correlationId);
5967
+ const shrPayload = {
5771
5968
  at: payload,
5772
5969
  ts: nowSeconds(),
5773
5970
  m: resourceRequestMethod?.toUpperCase(),
@@ -5779,11 +5976,160 @@ class PopTokenGenerator {
5779
5976
  : undefined,
5780
5977
  client_claims: shrClaims || undefined,
5781
5978
  ...claims,
5782
- }, keyId, shrOptions, request.correlationId);
5979
+ cnf: {
5980
+ jwk: publicKeyJwk,
5981
+ },
5982
+ };
5983
+ return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
5984
+ }
5985
+ }
5986
+
5987
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5988
+
5989
+ /*
5990
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5991
+ * Licensed under the MIT License.
5992
+ */
5993
+ const DPOP_HTM_REGEX = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
5994
+ const DPOP_TOKEN_BINDING_KEY_TYPE = "dpop";
5995
+ const DPOP_JWT_HEADER_ALGORITHM = JsonWebTokenAlgorithms.ES256;
5996
+ function buildProofHeader(publicJwk, correlationId) {
5997
+ return JoseHeader.getDpopHeader({
5998
+ alg: DPOP_JWT_HEADER_ALGORITHM,
5999
+ jwk: publicJwk,
6000
+ }, correlationId);
6001
+ }
6002
+ function normalizeHtm(htm, correlationId) {
6003
+ if (typeof htm !== "string" || !DPOP_HTM_REGEX.test(htm)) {
6004
+ throw createClientConfigurationError(invalidDpopHtm, correlationId);
6005
+ }
6006
+ return htm.toUpperCase();
6007
+ }
6008
+ /**
6009
+ * Normalizes a URL for use as the DPoP htu claim.
6010
+ * Per RFC 9449 §4.2, htu is the target URI without query and fragment components.
6011
+ * WHATWG URL serialization handles RFC 3986 syntax- and scheme-based normalization
6012
+ * such as lowercasing scheme/host and eliding default ports.
6013
+ */
6014
+ function normalizeHtu(url, correlationId) {
6015
+ let parsedUrl;
6016
+ try {
6017
+ parsedUrl = new URL(url);
6018
+ }
6019
+ catch {
6020
+ throw createClientConfigurationError(urlParseError, correlationId);
6021
+ }
6022
+ if (!/^https:\/\//i.test(url) ||
6023
+ parsedUrl.protocol !== "https:" ||
6024
+ parsedUrl.username ||
6025
+ parsedUrl.password) {
6026
+ throw createClientConfigurationError(invalidDpopHtu, correlationId);
6027
+ }
6028
+ parsedUrl.search = "";
6029
+ parsedUrl.hash = "";
6030
+ return parsedUrl.href;
6031
+ }
6032
+ function validateDpopNonce(nonce, correlationId) {
6033
+ if (nonce !== undefined && nonce.trim().length === 0) {
6034
+ throw createClientConfigurationError(invalidDpopNonce, correlationId);
6035
+ }
6036
+ }
6037
+ /**
6038
+ * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6039
+ * resource-endpoint proof bindings.
6040
+ *
6041
+ * Not exported from any public package entry point.
6042
+ * This helper is internal-only until DPoP is wired into acquisition flows
6043
+ * in a subsequent work item.
6044
+ *
6045
+ * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6046
+ * @internal
6047
+ */
6048
+ class DpopProofGenerator {
6049
+ constructor(cryptoUtils, tokenBindingKeyManager) {
6050
+ this.cryptoUtils = cryptoUtils;
6051
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6052
+ }
6053
+ /**
6054
+ * Provisions a fresh DPoP key and returns the RFC 7638 JWK thumbprint used
6055
+ * as `dpop_jkt`.
6056
+ */
6057
+ async generateJkt(correlationId = "") {
6058
+ return this.tokenBindingKeyManager.provisionTokenBindingKey({
6059
+ tokenBindingKeyType: DPOP_TOKEN_BINDING_KEY_TYPE,
6060
+ tokenBindingKeyAlgorithm: DPOP_JWT_HEADER_ALGORITHM,
6061
+ correlationId,
6062
+ });
6063
+ }
6064
+ /**
6065
+ * Builds RFC 9449 claims for a token-endpoint DPoP proof.
6066
+ * - htm is always "POST" because token endpoint requests use HTTP POST (RFC 9449 §5).
6067
+ * - htu is the normalized token endpoint URI (query and fragment stripped).
6068
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6069
+ */
6070
+ buildTokenProofClaims(params, correlationId = "") {
6071
+ validateDpopNonce(params.nonce, correlationId);
6072
+ const claims = {
6073
+ jti: this.cryptoUtils.createNewGuid(),
6074
+ htm: "POST",
6075
+ htu: normalizeHtu(params.tokenEndpoint, correlationId),
6076
+ iat: nowSeconds(),
6077
+ };
6078
+ if (params.nonce !== undefined) {
6079
+ claims.nonce = params.nonce;
6080
+ }
6081
+ return claims;
6082
+ }
6083
+ /**
6084
+ * Builds and signs a compact DPoP proof JWT for a token-endpoint request.
6085
+ */
6086
+ async generateTokenProof(params, keyId, correlationId = "") {
6087
+ return this.generateProof(this.buildTokenProofClaims(params, correlationId), keyId, correlationId);
6088
+ }
6089
+ /**
6090
+ * Builds RFC 9449 claims for a resource-endpoint DPoP proof.
6091
+ * - htm is uppercased per RFC 9449 §4.2.
6092
+ * - htu is the normalized resource URI (query and fragment stripped).
6093
+ * - ath is the base64url-encoded SHA-256 hash of the ASCII access token.
6094
+ * - jti is a fresh CSPRNG-backed unique identifier for every proof.
6095
+ */
6096
+ buildResourceProofClaims(params, correlationId = "") {
6097
+ validateDpopNonce(params.nonce, correlationId);
6098
+ const claims = {
6099
+ jti: this.cryptoUtils.createNewGuid(),
6100
+ htm: normalizeHtm(params.htm, correlationId),
6101
+ htu: normalizeHtu(params.htu, correlationId),
6102
+ ath: params.ath,
6103
+ iat: nowSeconds(),
6104
+ };
6105
+ if (params.nonce !== undefined) {
6106
+ claims.nonce = params.nonce;
6107
+ }
6108
+ return claims;
6109
+ }
6110
+ /**
6111
+ * Builds and signs a compact DPoP proof JWT for a resource request.
6112
+ */
6113
+ async generateResourceProof(params, keyId, correlationId = "") {
6114
+ const { htu, htm, nonce } = params;
6115
+ if (!htu || !htm) {
6116
+ throw createClientConfigurationError(dpopMissingResourceContext, correlationId);
6117
+ }
6118
+ const ath = await this.cryptoUtils.hashString(params.accessToken);
6119
+ return this.generateProof(this.buildResourceProofClaims({
6120
+ htu,
6121
+ htm,
6122
+ ath,
6123
+ nonce,
6124
+ }, correlationId), keyId, correlationId);
6125
+ }
6126
+ async generateProof(claims, keyId, correlationId) {
6127
+ const publicJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, correlationId);
6128
+ return this.cryptoUtils.signTokenBindingJwt(buildProofHeader(publicJwk, correlationId), claims, keyId, correlationId);
5783
6129
  }
5784
6130
  }
5785
6131
 
5786
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6132
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5787
6133
  /*
5788
6134
  * Copyright (c) Microsoft Corporation. All rights reserved.
5789
6135
  * Licensed under the MIT License.
@@ -5847,7 +6193,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
5847
6193
  uiNotAllowed: uiNotAllowed
5848
6194
  });
5849
6195
 
5850
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6196
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5851
6197
 
5852
6198
  /*
5853
6199
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5914,7 +6260,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
5914
6260
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
5915
6261
  }
5916
6262
 
5917
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6263
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5918
6264
 
5919
6265
  /*
5920
6266
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5933,7 +6279,7 @@ class ServerError extends AuthError {
5933
6279
  }
5934
6280
  }
5935
6281
 
5936
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6282
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
5937
6283
 
5938
6284
  /*
5939
6285
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6004,7 +6350,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6004
6350
  }
6005
6351
  }
6006
6352
 
6007
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6353
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6008
6354
 
6009
6355
  /*
6010
6356
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6015,10 +6361,11 @@ function parseRequestState(base64Decode, state, correlationId) {
6015
6361
  * @internal
6016
6362
  */
6017
6363
  class ResponseHandler {
6018
- constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
6364
+ constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
6019
6365
  this.clientId = clientId;
6020
6366
  this.cacheStorage = cacheStorage;
6021
6367
  this.cryptoObj = cryptoObj;
6368
+ this.tokenBindingKeyManager = tokenBindingKeyManager;
6022
6369
  this.logger = logger;
6023
6370
  this.performanceClient = performanceClient;
6024
6371
  this.serializableCache = serializableCache;
@@ -6092,7 +6439,21 @@ class ResponseHandler {
6092
6439
  }
6093
6440
  // Add keyId from request to serverTokenResponse if defined
6094
6441
  serverTokenResponse.key_id =
6095
- serverTokenResponse.key_id || request.sshKid || undefined;
6442
+ serverTokenResponse.key_id ||
6443
+ request.dpopJkt ||
6444
+ request.sshKid ||
6445
+ undefined;
6446
+ if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
6447
+ if (serverTokenResponse.token_type?.toLowerCase() !==
6448
+ AuthenticationScheme$1.DPOP.toLowerCase()) {
6449
+ this.performanceClient?.addFields({
6450
+ dpopTokenTypeMismatch: serverTokenResponse.token_type,
6451
+ }, request.correlationId);
6452
+ throw createClientAuthError(dpopTokenTypeMismatch, request.correlationId);
6453
+ }
6454
+ serverTokenResponse.token_type =
6455
+ AuthenticationScheme$1.DPOP;
6456
+ }
6096
6457
  // Compute components once for entity storage (fallback if hash not provided by client)
6097
6458
  const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
6098
6459
  const cacheKeyComponents = additionalCacheKeyComponents ??
@@ -6127,7 +6488,12 @@ class ResponseHandler {
6127
6488
  this.performanceClient?.addFields({
6128
6489
  acntLoggedOut: true,
6129
6490
  }, request.correlationId);
6130
- return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, undefined, serverRequestId);
6491
+ return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6492
+ idTokenClaims,
6493
+ requestState: requestStateObj,
6494
+ requestId: serverRequestId,
6495
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6496
+ });
6131
6497
  }
6132
6498
  }
6133
6499
  await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
@@ -6140,7 +6506,13 @@ class ResponseHandler {
6140
6506
  await this.persistencePlugin.afterCacheAccess(cacheContext);
6141
6507
  }
6142
6508
  }
6143
- return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, idTokenClaims, requestStateObj, serverTokenResponse, serverRequestId);
6509
+ return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
6510
+ idTokenClaims,
6511
+ requestState: requestStateObj,
6512
+ serverTokenResponse,
6513
+ requestId: serverRequestId,
6514
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
6515
+ });
6144
6516
  }
6145
6517
  /**
6146
6518
  * Generates CacheRecord
@@ -6236,14 +6608,17 @@ class ResponseHandler {
6236
6608
  * @param fromTokenCache
6237
6609
  * @param stateString
6238
6610
  */
6239
- static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, idTokenClaims, requestState, serverTokenResponse, requestId) {
6611
+ static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
6612
+ const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
6240
6613
  let accessToken = "";
6241
6614
  let responseScopes = [];
6242
6615
  let expiresOn = null;
6243
6616
  let extExpiresOn;
6244
6617
  let refreshOn;
6245
6618
  let familyId = "";
6619
+ let dpopProof;
6246
6620
  if (cacheRecord.accessToken) {
6621
+ const accessTokenType = cacheRecord.accessToken.tokenType?.toLowerCase();
6247
6622
  /*
6248
6623
  * if the request object has `popKid` property, `signPopToken` will be set to false and
6249
6624
  * the token will be returned unsigned
@@ -6251,7 +6626,7 @@ class ResponseHandler {
6251
6626
  if (cacheRecord.accessToken.tokenType ===
6252
6627
  AuthenticationScheme$1.POP &&
6253
6628
  !request.popKid) {
6254
- const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
6629
+ const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
6255
6630
  const { secret, keyId } = cacheRecord.accessToken;
6256
6631
  if (!keyId) {
6257
6632
  throw createClientAuthError(keyIdMissing, request.correlationId);
@@ -6261,6 +6636,18 @@ class ResponseHandler {
6261
6636
  else {
6262
6637
  accessToken = cacheRecord.accessToken.secret;
6263
6638
  }
6639
+ if (accessTokenType ===
6640
+ AuthenticationScheme$1.DPOP.toLowerCase()) {
6641
+ if (!cacheRecord.accessToken.keyId) {
6642
+ throw createClientAuthError(keyIdMissing, request.correlationId);
6643
+ }
6644
+ const dpopProofGenerator = new DpopProofGenerator(cryptoObj, tokenBindingKeyManager);
6645
+ dpopProof = await dpopProofGenerator.generateResourceProof({
6646
+ htu: request.resourceRequestUri,
6647
+ htm: request.resourceRequestMethod,
6648
+ accessToken: cacheRecord.accessToken.secret,
6649
+ }, cacheRecord.accessToken.keyId, request.correlationId);
6650
+ }
6264
6651
  responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target, request.correlationId).asArray();
6265
6652
  // Access token expiresOn cached in seconds, converting to Date for AuthenticationResult
6266
6653
  expiresOn = toDateFromSeconds(cacheRecord.accessToken.expiresOn);
@@ -6277,6 +6664,15 @@ class ResponseHandler {
6277
6664
  }
6278
6665
  const uid = idTokenClaims?.oid || idTokenClaims?.sub || "";
6279
6666
  const tid = idTokenClaims?.tid || "";
6667
+ /*
6668
+ * Surface the sovereign enclave for telemetry. This runs for both freshly acquired
6669
+ * and cache-served tokens because SilentFlowClient shares this method, so the field
6670
+ * is present on silent requests that never hit the network.
6671
+ */
6672
+ const regionSubScope = idTokenClaims?.tenant_region_sub_scope;
6673
+ if (typeof regionSubScope === "string") {
6674
+ performanceClient?.addFields({ regionSubScope }, request.correlationId);
6675
+ }
6280
6676
  // for hybrid + native bridge enablement, send back the native account Id
6281
6677
  if (serverTokenResponse?.spa_accountid && !!cacheRecord.account) {
6282
6678
  // Set on deprecated top-level for downgrade compat
@@ -6305,6 +6701,7 @@ class ResponseHandler {
6305
6701
  idToken: cacheRecord?.idToken?.secret || "",
6306
6702
  idTokenClaims: idTokenClaims || {},
6307
6703
  accessToken: accessToken,
6704
+ dpopProof,
6308
6705
  fromCache: fromTokenCache,
6309
6706
  expiresOn: expiresOn,
6310
6707
  extExpiresOn: extExpiresOn,
@@ -6312,7 +6709,10 @@ class ResponseHandler {
6312
6709
  correlationId: request.correlationId,
6313
6710
  requestId: requestId || "",
6314
6711
  familyId: familyId,
6315
- tokenType: cacheRecord.accessToken?.tokenType || "",
6712
+ tokenType: cacheRecord.accessToken?.tokenType?.toLowerCase() ===
6713
+ AuthenticationScheme$1.DPOP.toLowerCase()
6714
+ ? AuthenticationScheme$1.DPOP
6715
+ : cacheRecord.accessToken?.tokenType || "",
6316
6716
  state: requestState ? requestState.userRequestState : "",
6317
6717
  cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || "",
6318
6718
  msGraphHost: cacheRecord.account?.msGraphHost || "",
@@ -6363,7 +6763,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6363
6763
  return baseAccount;
6364
6764
  }
6365
6765
 
6366
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6766
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6367
6767
  /*
6368
6768
  * Copyright (c) Microsoft Corporation. All rights reserved.
6369
6769
  * Licensed under the MIT License.
@@ -6373,7 +6773,7 @@ const CcsCredentialType = {
6373
6773
  UPN: "UPN",
6374
6774
  };
6375
6775
 
6376
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6776
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6377
6777
  /*
6378
6778
  * Copyright (c) Microsoft Corporation. All rights reserved.
6379
6779
  * Licensed under the MIT License.
@@ -6392,7 +6792,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6392
6792
  }
6393
6793
  }
6394
6794
 
6395
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6795
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6396
6796
 
6397
6797
  /*
6398
6798
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6416,7 +6816,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6416
6816
  };
6417
6817
  }
6418
6818
 
6419
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6819
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6420
6820
 
6421
6821
  /*
6422
6822
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6502,7 +6902,7 @@ class ThrottlingUtils {
6502
6902
  }
6503
6903
  }
6504
6904
 
6505
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6905
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6506
6906
 
6507
6907
  /*
6508
6908
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6533,7 +6933,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6533
6933
  return new NetworkError(error, httpStatus, responseHeaders);
6534
6934
  }
6535
6935
 
6536
- /*! @azure/msal-common v16.12.0 2026-08-04 */
6936
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6537
6937
 
6538
6938
  /*
6539
6939
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6563,6 +6963,23 @@ function createTokenRequestHeaders(logger, preventCorsPreflight, ccsCred) {
6563
6963
  }
6564
6964
  return headers;
6565
6965
  }
6966
+ /**
6967
+ * Adds the DPoP proof header for token endpoint requests when DPoP is requested.
6968
+ * @internal
6969
+ */
6970
+ async function addDpopTokenProofHeader(headers, request, tokenEndpoint, cryptoUtils, tokenBindingKeyManager) {
6971
+ if (request.authenticationScheme !== AuthenticationScheme$1.DPOP) {
6972
+ return;
6973
+ }
6974
+ const dpopProofGenerator = new DpopProofGenerator(cryptoUtils, tokenBindingKeyManager);
6975
+ const keyId = request.dpopJkt;
6976
+ if (!keyId?.trim()) {
6977
+ throw createClientAuthError(keyIdMissing, request.correlationId);
6978
+ }
6979
+ headers[HeaderNames.DPOP] = await dpopProofGenerator.generateTokenProof({
6980
+ tokenEndpoint,
6981
+ }, keyId, request.correlationId);
6982
+ }
6566
6983
  /**
6567
6984
  * Creates query string for the /token request
6568
6985
  * @param request
@@ -6649,7 +7066,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6649
7066
  return response;
6650
7067
  }
6651
7068
 
6652
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7069
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6653
7070
 
6654
7071
  /*
6655
7072
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6699,7 +7116,7 @@ class AuthorizationCodeClient {
6699
7116
  const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
6700
7117
  // Retrieve requestId from response headers
6701
7118
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
6702
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
7119
+ 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);
6703
7120
  // Validate response. This function throws a server error if an error is returned by the server.
6704
7121
  responseHandler.validateTokenResponse(response.body, request.correlationId);
6705
7122
  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);
@@ -6741,6 +7158,7 @@ class AuthorizationCodeClient {
6741
7158
  }
6742
7159
  }
6743
7160
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, ccsCredential || request.ccsCredential);
7161
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
6744
7162
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
6745
7163
  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);
6746
7164
  }
@@ -6800,7 +7218,7 @@ class AuthorizationCodeClient {
6800
7218
  addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
6801
7219
  addClientInfo(parameters);
6802
7220
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
6803
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
7221
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
6804
7222
  let reqCnfData;
6805
7223
  if (!request.popKid) {
6806
7224
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -6912,7 +7330,7 @@ class AuthorizationCodeClient {
6912
7330
  }
6913
7331
  }
6914
7332
 
6915
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7333
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
6916
7334
 
6917
7335
  /*
6918
7336
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7139,76 +7557,7 @@ function extractLoginHint(account) {
7139
7557
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7140
7558
  }
7141
7559
 
7142
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7143
-
7144
- /*
7145
- * Copyright (c) Microsoft Corporation. All rights reserved.
7146
- * Licensed under the MIT License.
7147
- */
7148
- /**
7149
- * Error thrown when there is an error in the client code running on the browser.
7150
- */
7151
- class JoseHeaderError extends AuthError {
7152
- constructor(errorCode, correlationId, errorMessage) {
7153
- super(errorCode, correlationId, errorMessage);
7154
- this.name = "JoseHeaderError";
7155
- Object.setPrototypeOf(this, JoseHeaderError.prototype);
7156
- }
7157
- }
7158
- /** Returns JoseHeaderError object */
7159
- function createJoseHeaderError(code, correlationId) {
7160
- return new JoseHeaderError(code, correlationId);
7161
- }
7162
-
7163
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7164
- /*
7165
- * Copyright (c) Microsoft Corporation. All rights reserved.
7166
- * Licensed under the MIT License.
7167
- */
7168
- const missingKidError = "missing_kid_error";
7169
- const missingAlgError = "missing_alg_error";
7170
-
7171
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7172
-
7173
- /*
7174
- * Copyright (c) Microsoft Corporation. All rights reserved.
7175
- * Licensed under the MIT License.
7176
- */
7177
- /** @internal */
7178
- class JoseHeader {
7179
- constructor(options) {
7180
- this.typ = options.typ;
7181
- this.alg = options.alg;
7182
- this.kid = options.kid;
7183
- }
7184
- /**
7185
- * Builds SignedHttpRequest formatted JOSE Header from the
7186
- * JOSE Header options provided or previously set on the object and returns
7187
- * the stringified header object.
7188
- * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
7189
- * @param shrHeaderOptions
7190
- * @returns
7191
- */
7192
- static getShrHeaderString(shrHeaderOptions) {
7193
- // KeyID is required on the SHR header
7194
- if (!shrHeaderOptions.kid) {
7195
- throw createJoseHeaderError(missingKidError, "");
7196
- }
7197
- // Alg is required on the SHR header
7198
- if (!shrHeaderOptions.alg) {
7199
- throw createJoseHeaderError(missingAlgError, "");
7200
- }
7201
- const shrHeader = new JoseHeader({
7202
- // Access Token PoP headers must have type pop, but the type header can be overriden for special cases
7203
- typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
7204
- kid: shrHeaderOptions.kid,
7205
- alg: shrHeaderOptions.alg,
7206
- });
7207
- return JSON.stringify(shrHeader);
7208
- }
7209
- }
7210
-
7211
- /*! @azure/msal-common v16.12.0 2026-08-04 */
7560
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7212
7561
 
7213
7562
  /*
7214
7563
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7757,7 +8106,7 @@ class PerformanceClient {
7757
8106
  }
7758
8107
  }
7759
8108
 
7760
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8109
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7761
8110
 
7762
8111
  /*
7763
8112
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7792,7 +8141,7 @@ class RefreshTokenClient {
7792
8141
  const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
7793
8142
  // Retrieve requestId from response headers
7794
8143
  const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
7795
- const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
8144
+ 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);
7796
8145
  responseHandler.validateTokenResponse(response.body, request.correlationId);
7797
8146
  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);
7798
8147
  }
@@ -7868,6 +8217,12 @@ class RefreshTokenClient {
7868
8217
  type: CcsCredentialType.HOME_ACCOUNT_ID,
7869
8218
  },
7870
8219
  };
8220
+ if (refreshTokenRequest.authenticationScheme ===
8221
+ AuthenticationScheme$1.DPOP &&
8222
+ !refreshTokenRequest.dpopJkt) {
8223
+ const dpopProofGenerator = new DpopProofGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager);
8224
+ refreshTokenRequest.dpopJkt = await dpopProofGenerator.generateJkt(request.correlationId);
8225
+ }
7871
8226
  try {
7872
8227
  return await invokeAsync(this.acquireToken.bind(this), RefreshTokenClientAcquireToken, this.logger, this.performanceClient, request.correlationId)(refreshTokenRequest, apiId);
7873
8228
  }
@@ -7893,6 +8248,7 @@ class RefreshTokenClient {
7893
8248
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
7894
8249
  const requestBody = await invokeAsync(this.createTokenRequestBody.bind(this), RefreshTokenClientCreateTokenRequestBody, this.logger, this.performanceClient, request.correlationId)(request);
7895
8250
  const headers = createTokenRequestHeaders(this.logger, this.config.systemOptions.preventCorsPreflight, request.ccsCredential);
8251
+ await addDpopTokenProofHeader(headers, request, endpoint, this.cryptoUtils, this.config.tokenBindingKeyManager);
7896
8252
  const thumbprint = getRequestThumbprint(this.config.authOptions.clientId, request);
7897
8253
  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);
7898
8254
  }
@@ -7933,7 +8289,7 @@ class RefreshTokenClient {
7933
8289
  addClientAssertionType(parameters, clientAssertion.assertionType);
7934
8290
  }
7935
8291
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
7936
- const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
8292
+ const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
7937
8293
  let reqCnfData;
7938
8294
  if (!request.popKid) {
7939
8295
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
@@ -7984,7 +8340,7 @@ class RefreshTokenClient {
7984
8340
  }
7985
8341
  }
7986
8342
 
7987
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8343
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
7988
8344
 
7989
8345
  /*
7990
8346
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8277,7 +8633,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
8277
8633
  clearNativeBrokerErrorCode() { }
8278
8634
  }
8279
8635
 
8280
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8636
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8281
8637
 
8282
8638
  /*
8283
8639
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8346,6 +8702,22 @@ class SilentFlowClient {
8346
8702
  lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
8347
8703
  // don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
8348
8704
  }
8705
+ const cachedAccessTokenType = cachedAccessToken.tokenType?.toLowerCase();
8706
+ if (cachedAccessTokenType === AuthenticationScheme$1.DPOP.toLowerCase()) {
8707
+ if (!cachedAccessToken.keyId) {
8708
+ this.logger.info("1enswf", request.correlationId);
8709
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
8710
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
8711
+ }
8712
+ try {
8713
+ await this.config.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(cachedAccessToken.keyId, request.correlationId);
8714
+ }
8715
+ catch {
8716
+ this.logger.info("14djth", request.correlationId);
8717
+ this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
8718
+ throw createClientAuthError(tokenRefreshRequired, request.correlationId);
8719
+ }
8720
+ }
8349
8721
  const environment = request.authority || this.authority.getPreferredCache();
8350
8722
  const cacheRecord = {
8351
8723
  account: this.cacheManager.getAccount(this.cacheManager.generateAccountKey(request.account), request.correlationId),
@@ -8381,11 +8753,14 @@ class SilentFlowClient {
8381
8753
  if (cacheRecord.idToken) {
8382
8754
  idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
8383
8755
  }
8384
- return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, idTokenClaims);
8756
+ return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
8757
+ idTokenClaims,
8758
+ tokenBindingKeyManager: this.config.tokenBindingKeyManager,
8759
+ });
8385
8760
  }
8386
8761
  }
8387
8762
 
8388
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8763
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8389
8764
 
8390
8765
  /*
8391
8766
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8401,7 +8776,7 @@ const StubbedNetworkModule = {
8401
8776
  },
8402
8777
  };
8403
8778
 
8404
- /*! @azure/msal-common v16.12.0 2026-08-04 */
8779
+ /*! @azure/msal-common v16.14.0 2026-08-28 */
8405
8780
 
8406
8781
  /*
8407
8782
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8454,13 +8829,13 @@ const AcquireTokenByRefreshToken = "acquireTokenByRefreshToken";
8454
8829
  */
8455
8830
  const AcquireTokenSilentAsync = "acquireTokenSilentAsync";
8456
8831
  /**
8457
- * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
8458
- * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
8832
+ * provisionTokenBindingKey API in TokenBindingKeyManager class (msal-browser).
8833
+ * Used to provision token-binding key material and return a key identifier.
8459
8834
  */
8460
8835
  const CryptoOptsGetPublicKeyThumbprint = "cryptoOptsGetPublicKeyThumbprint";
8461
8836
  /**
8462
- * signJwt API in CryptoOpts class (msal-browser).
8463
- * Used to signed a pop token.
8837
+ * signTokenBindingJwt API in CryptoOpts class (msal-browser).
8838
+ * Used to sign token-binding JWTs.
8464
8839
  */
8465
8840
  const CryptoOptsSignJwt = "cryptoOptsSignJwt";
8466
8841
  /**
@@ -8617,6 +8992,9 @@ const uninitializedPublicClientApplication = "uninitialized_public_client_applic
8617
8992
  const nativePromptNotSupported = "native_prompt_not_supported";
8618
8993
  const invalidBase64String = "invalid_base64_string";
8619
8994
  const invalidPopTokenRequest = "invalid_pop_token_request";
8995
+ const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
8996
+ const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
8997
+ const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
8620
8998
  const failedToBuildHeaders = "failed_to_build_headers";
8621
8999
  const failedToParseHeaders = "failed_to_parse_headers";
8622
9000
  const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
@@ -8673,11 +9051,14 @@ var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
8673
9051
  spaCodeAndNativeAccountIdPresent: spaCodeAndNativeAccountIdPresent,
8674
9052
  stateInteractionTypeMismatch: stateInteractionTypeMismatch,
8675
9053
  timedOut: timedOut,
9054
+ tokenBindingKeyAlgorithmMismatch: tokenBindingKeyAlgorithmMismatch,
9055
+ tokenBindingKeyJwkThumbprintMismatch: tokenBindingKeyJwkThumbprintMismatch,
8676
9056
  unableToAcquireTokenFromNativePlatform: unableToAcquireTokenFromNativePlatform,
8677
9057
  unableToLoadToken: unableToLoadToken,
8678
9058
  unableToParseState: unableToParseState,
8679
9059
  unableToParseTokenRequestCacheError: unableToParseTokenRequestCacheError,
8680
9060
  uninitializedPublicClientApplication: uninitializedPublicClientApplication,
9061
+ unsupportedTokenBindingAlgorithm: unsupportedTokenBindingAlgorithm,
8681
9062
  userCancelled: userCancelled
8682
9063
  });
8683
9064
 
@@ -9015,6 +9396,8 @@ const AES_GCM = "AES-GCM";
9015
9396
  const HKDF = "HKDF";
9016
9397
  // SHA-256 hashing algorithm
9017
9398
  const S256_HASH_ALG = "SHA-256";
9399
+ // JWK values used by browser-internal WebCrypto helpers.
9400
+ const JSON_WEB_KEY_CURVE_P256 = "P-256";
9018
9401
  const JSON_WEB_KEY_TYPE_EC = "EC";
9019
9402
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
9020
9403
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -9046,6 +9429,14 @@ const RSA_KEYGEN_ALGORITHM_OPTIONS = {
9046
9429
  const RSA_SIGN_ALGORITHM_OPTIONS = {
9047
9430
  name: PKCS1_V15_KEYGEN_ALG,
9048
9431
  };
9432
+ const ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS = {
9433
+ name: "ECDSA",
9434
+ namedCurve: JSON_WEB_KEY_CURVE_P256,
9435
+ };
9436
+ const ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS = {
9437
+ name: "ECDSA",
9438
+ hash: { name: S256_HASH_ALG },
9439
+ };
9049
9440
  /**
9050
9441
  * Check whether browser crypto is available.
9051
9442
  */
@@ -9144,16 +9535,6 @@ async function generateKeyPair(extractable, usages, algorithm) {
9144
9535
  async function exportJwk(key) {
9145
9536
  return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
9146
9537
  }
9147
- /**
9148
- * Imports key as Json Web Key (JWK), can set extractable and usages.
9149
- * @param key
9150
- * @param extractable
9151
- * @param usages
9152
- * @param algorithm
9153
- */
9154
- async function importJwk(key, extractable, usages, algorithm) {
9155
- return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
9156
- }
9157
9538
  /**
9158
9539
  * Signs given data with given key.
9159
9540
  * @param key
@@ -9309,22 +9690,22 @@ const JWK_THUMBPRINT_REQUIRED_MEMBERS = {
9309
9690
  [JSON_WEB_KEY_TYPE_EC]: ["crv", "kty", "x", "y"],
9310
9691
  [JSON_WEB_KEY_TYPE_RSA]: ["e", "kty", "n"],
9311
9692
  };
9312
- function getJwkThumbprintMembers(publicJwk) {
9693
+ function getJwkThumbprintMembers(publicJwk, correlationId) {
9313
9694
  const kty = publicJwk.kty;
9314
9695
  if (typeof kty !== "string" || kty.length === 0) {
9315
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_KTY_SUBERROR);
9696
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_KTY_SUBERROR);
9316
9697
  }
9317
9698
  const requiredMembers = JWK_THUMBPRINT_REQUIRED_MEMBERS[kty];
9318
9699
  if (!requiredMembers) {
9319
- throw createBrowserAuthError(invalidPublicJwk, "", UNSUPPORTED_JWK_KTY_SUBERROR);
9700
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, UNSUPPORTED_JWK_KTY_SUBERROR);
9320
9701
  }
9321
9702
  return requiredMembers.reduce((thumbprintMembers, memberName) => {
9322
9703
  const memberValue = publicJwk[memberName];
9323
9704
  if (typeof memberValue !== "string") {
9324
- throw createBrowserAuthError(invalidPublicJwk, "", MISSING_JWK_MEMBER_SUBERROR);
9705
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_MEMBER_SUBERROR);
9325
9706
  }
9326
9707
  if (memberValue.length === 0) {
9327
- throw createBrowserAuthError(invalidPublicJwk, "", EMPTY_JWK_MEMBER_SUBERROR);
9708
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, EMPTY_JWK_MEMBER_SUBERROR);
9328
9709
  }
9329
9710
  thumbprintMembers[memberName] = memberValue;
9330
9711
  return thumbprintMembers;
@@ -9336,8 +9717,8 @@ function getJwkThumbprintMembers(publicJwk) {
9336
9717
  * and the SHA-256 digest is returned as a base64url string.
9337
9718
  * @internal
9338
9719
  */
9339
- async function computeJwkThumbprint(publicJwk) {
9340
- const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
9720
+ async function computeJwkThumbprint(publicJwk, correlationId) {
9721
+ const thumbprintMembers = getJwkThumbprintMembers(publicJwk, correlationId);
9341
9722
  // RFC 7638 §3.3: use only required members, sorted lexicographically
9342
9723
  const thumbprintJson = JSON.stringify(thumbprintMembers, Object.keys(thumbprintMembers).sort());
9343
9724
  return hashString(thumbprintJson);
@@ -10071,71 +10452,214 @@ class AsyncMemoryStorage {
10071
10452
  }
10072
10453
  }
10073
10454
  /**
10074
- * 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
10075
- * asynchronous storage object.
10076
- * @param correlationId
10455
+ * Get all keys from both in-memory and persistent storage.
10456
+ * @param correlationId
10457
+ */
10458
+ async getKeys(correlationId) {
10459
+ const cacheKeys = this.inMemoryCache.getKeys();
10460
+ try {
10461
+ const persistentCacheKeys = await this.indexedDBCache.getKeys();
10462
+ return Array.from(new Set([...cacheKeys, ...persistentCacheKeys]));
10463
+ }
10464
+ catch (e) {
10465
+ this.handleDatabaseAccessError(e, correlationId);
10466
+ return cacheKeys;
10467
+ }
10468
+ }
10469
+ /**
10470
+ * Returns true or false if the given key is present in the cache.
10471
+ * @param key
10472
+ * @param correlationId
10473
+ */
10474
+ async containsKey(key, correlationId) {
10475
+ const containsKey = this.inMemoryCache.containsKey(key);
10476
+ if (!containsKey) {
10477
+ try {
10478
+ this.logger.verbose("03zl2j", correlationId);
10479
+ return await this.indexedDBCache.containsKey(key);
10480
+ }
10481
+ catch (e) {
10482
+ this.handleDatabaseAccessError(e, correlationId);
10483
+ }
10484
+ }
10485
+ return containsKey;
10486
+ }
10487
+ /**
10488
+ * Clears in-memory Map
10489
+ * @param correlationId
10490
+ */
10491
+ clearInMemory(correlationId) {
10492
+ // InMemory cache is a Map instance, clear is straightforward
10493
+ this.logger.verbose("03r21p", correlationId);
10494
+ this.inMemoryCache.clear();
10495
+ this.logger.verbose("0uksk1", correlationId);
10496
+ }
10497
+ /**
10498
+ * Tries to delete the IndexedDB database
10499
+ * @param correlationId
10500
+ * @returns
10501
+ */
10502
+ async clearPersistent(correlationId) {
10503
+ try {
10504
+ this.logger.verbose("0rdqut", correlationId);
10505
+ const dbDeleted = await this.indexedDBCache.deleteDatabase();
10506
+ if (dbDeleted) {
10507
+ this.logger.verbose("149ouc", correlationId);
10508
+ }
10509
+ return dbDeleted;
10510
+ }
10511
+ catch (e) {
10512
+ this.handleDatabaseAccessError(e, correlationId);
10513
+ return false;
10514
+ }
10515
+ }
10516
+ }
10517
+
10518
+ /*
10519
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10520
+ * Licensed under the MIT License.
10521
+ */
10522
+ /**
10523
+ * Owns browser token-binding key lifecycle and storage lookup.
10524
+ * @internal
10525
+ */
10526
+ class TokenBindingKeyManager {
10527
+ constructor(logger, performanceClient) {
10528
+ this.logger = logger;
10529
+ this.cache = TokenBindingKeyManager.getTokenBindingKeyStorage(this.logger);
10530
+ this.performanceClient = performanceClient;
10531
+ }
10532
+ static getTokenBindingKeyStorage(logger) {
10533
+ if (!TokenBindingKeyManager.tokenBindingKeyStorage) {
10534
+ TokenBindingKeyManager.tokenBindingKeyStorage =
10535
+ new AsyncMemoryStorage(logger);
10536
+ }
10537
+ return TokenBindingKeyManager.tokenBindingKeyStorage;
10538
+ }
10539
+ /**
10540
+ * Provisions a browser token-binding key and returns its key identifier.
10541
+ * @param request - Key provisioning policy.
10542
+ */
10543
+ async provisionTokenBindingKey(request) {
10544
+ const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10545
+ try {
10546
+ const activeKeyPair = await this.createTokenBindingKey(request);
10547
+ publicKeyThumbMeasurement?.end({
10548
+ success: true,
10549
+ ...this.getTokenBindingKeyTelemetry(activeKeyPair),
10550
+ });
10551
+ return activeKeyPair.keyId;
10552
+ }
10553
+ catch (e) {
10554
+ publicKeyThumbMeasurement?.end({
10555
+ success: false,
10556
+ tokenBindingKeyType: request.tokenBindingKeyType,
10557
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10558
+ });
10559
+ throw e;
10560
+ }
10561
+ }
10562
+ /**
10563
+ * Removes a browser token-binding key by identifier.
10564
+ * @param kid - Token-binding key identifier.
10565
+ * @param correlationId - Request correlation identifier.
10566
+ */
10567
+ async removeTokenBindingKey(kid, correlationId) {
10568
+ await this.cache.removeItem(kid, correlationId);
10569
+ const keyFound = await this.cache.containsKey(kid, correlationId);
10570
+ if (keyFound) {
10571
+ throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10572
+ }
10573
+ }
10574
+ /**
10575
+ * Clears browser token-binding keys from memory and persistent storage.
10576
+ * @param correlationId - Request correlation identifier.
10077
10577
  */
10078
- async getKeys(correlationId) {
10079
- const cacheKeys = this.inMemoryCache.getKeys();
10080
- if (cacheKeys.length === 0) {
10081
- try {
10082
- this.logger.verbose("1iqrbq", correlationId);
10083
- return await this.indexedDBCache.getKeys();
10578
+ async clearKeystore(correlationId) {
10579
+ this.cache.clearInMemory(correlationId);
10580
+ try {
10581
+ await this.cache.clearPersistent(correlationId);
10582
+ return true;
10583
+ }
10584
+ catch (e) {
10585
+ if (e instanceof Error) {
10586
+ this.logger.error(`1owpn8 ${e.message}`, correlationId);
10084
10587
  }
10085
- catch (e) {
10086
- this.handleDatabaseAccessError(e, correlationId);
10588
+ else {
10589
+ this.logger.error("0yrmwo", correlationId);
10087
10590
  }
10591
+ return false;
10088
10592
  }
10089
- return cacheKeys;
10090
10593
  }
10091
10594
  /**
10092
- * Returns true or false if the given key is present in the cache.
10093
- * @param key
10094
- * @param correlationId
10595
+ * Gets a token-binding public key as a JWK by identifier.
10596
+ * @param keyId - Token-binding key identifier.
10597
+ * @param correlationId - Request correlation identifier.
10095
10598
  */
10096
- async containsKey(key, correlationId) {
10097
- const containsKey = this.inMemoryCache.containsKey(key);
10098
- if (!containsKey) {
10099
- try {
10100
- this.logger.verbose("03zl2j", correlationId);
10101
- return await this.indexedDBCache.containsKey(key);
10102
- }
10103
- catch (e) {
10104
- this.handleDatabaseAccessError(e, correlationId);
10105
- }
10599
+ async getTokenBindingPublicKeyJwk(keyId, correlationId) {
10600
+ const cachedKeyPair = await this.getTokenBindingKeyPair(keyId, correlationId);
10601
+ return exportJwk(cachedKeyPair.publicKey);
10602
+ }
10603
+ async createTokenBindingKey(request) {
10604
+ const keyGenAlgorithm = this.getTokenBindingKeyGenAlgorithmOptions(request.tokenBindingKeyAlgorithm, request.correlationId);
10605
+ const generatedKeyPair = await this.generateKeyPairAndThumbprint(TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES, keyGenAlgorithm, request.correlationId);
10606
+ await this.cache.setItem(generatedKeyPair.keyId, {
10607
+ ...generatedKeyPair,
10608
+ tokenBindingKeyType: request.tokenBindingKeyType,
10609
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10610
+ }, request.correlationId);
10611
+ return {
10612
+ ...generatedKeyPair,
10613
+ tokenBindingKeyType: request.tokenBindingKeyType,
10614
+ tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
10615
+ };
10616
+ }
10617
+ async generateKeyPairAndThumbprint(usages, keyGenAlgorithm, correlationId) {
10618
+ const keyPair = await generateKeyPair(false, usages, keyGenAlgorithm);
10619
+ const publicJwk = await exportJwk(keyPair.publicKey);
10620
+ const keyId = await computeJwkThumbprint(publicJwk, correlationId);
10621
+ return {
10622
+ publicKey: keyPair.publicKey,
10623
+ privateKey: keyPair.privateKey,
10624
+ keyId,
10625
+ };
10626
+ }
10627
+ /** @internal */
10628
+ async getTokenBindingKeyPair(keyId, correlationId) {
10629
+ const cachedKeyPair = await this.cache.getItem(keyId, correlationId);
10630
+ if (!cachedKeyPair) {
10631
+ throw createBrowserAuthError(cryptoKeyNotFound, correlationId);
10106
10632
  }
10107
- return containsKey;
10633
+ return cachedKeyPair;
10108
10634
  }
10109
- /**
10110
- * Clears in-memory Map
10111
- * @param correlationId
10112
- */
10113
- clearInMemory(correlationId) {
10114
- // InMemory cache is a Map instance, clear is straightforward
10115
- this.logger.verbose("03r21p", correlationId);
10116
- this.inMemoryCache.clear();
10117
- this.logger.verbose("0uksk1", correlationId);
10635
+ /** @internal */
10636
+ getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10637
+ return {
10638
+ ...(cachedKeyPair.tokenBindingKeyType && {
10639
+ tokenBindingKeyType: cachedKeyPair.tokenBindingKeyType,
10640
+ }),
10641
+ ...(cachedKeyPair.tokenBindingKeyAlgorithm || fallbackAlgorithm
10642
+ ? {
10643
+ tokenBindingKeyAlgorithm: cachedKeyPair.tokenBindingKeyAlgorithm ||
10644
+ fallbackAlgorithm,
10645
+ }
10646
+ : {}),
10647
+ };
10118
10648
  }
10119
- /**
10120
- * Tries to delete the IndexedDB database
10121
- * @param correlationId
10122
- * @returns
10123
- */
10124
- async clearPersistent(correlationId) {
10125
- try {
10126
- this.logger.verbose("0rdqut", correlationId);
10127
- const dbDeleted = await this.indexedDBCache.deleteDatabase();
10128
- if (dbDeleted) {
10129
- this.logger.verbose("149ouc", correlationId);
10130
- }
10131
- return dbDeleted;
10649
+ getTokenBindingKeyGenAlgorithmOptions(tokenBindingKeyAlgorithm, correlationId) {
10650
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.RS256) {
10651
+ return RSA_KEYGEN_ALGORITHM_OPTIONS;
10132
10652
  }
10133
- catch (e) {
10134
- this.handleDatabaseAccessError(e, correlationId);
10135
- return false;
10653
+ if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.ES256) {
10654
+ return ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS;
10136
10655
  }
10656
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10137
10657
  }
10138
- }
10658
+ }
10659
+ TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
10660
+ "sign",
10661
+ "verify",
10662
+ ];
10139
10663
 
10140
10664
  /*
10141
10665
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10150,8 +10674,8 @@ class CryptoOps {
10150
10674
  this.logger = logger;
10151
10675
  // Browser crypto needs to be validated first before any other classes can be set.
10152
10676
  validateCryptoAvailable(skipValidateSubtleCrypto ?? false);
10153
- this.cache = new AsyncMemoryStorage(this.logger);
10154
10677
  this.performanceClient = performanceClient;
10678
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
10155
10679
  }
10156
10680
  /**
10157
10681
  * Creates a new random GUID - used to populate state and nonce.
@@ -10189,114 +10713,45 @@ class CryptoOps {
10189
10713
  encodeKid(inputKid) {
10190
10714
  return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
10191
10715
  }
10192
- /**
10193
- * Generates a keypair, stores it and returns a thumbprint
10194
- * @param request
10195
- */
10196
- async getPublicKeyThumbprint(request) {
10197
- const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
10198
- // Generate Keypair
10199
- const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES, RSA_KEYGEN_ALGORITHM_OPTIONS);
10200
- // Generate Thumbprint for Public Key
10201
- const publicKeyJwk = await exportJwk(keyPair.publicKey);
10202
- const publicJwkHash = await computeJwkThumbprint(publicKeyJwk);
10203
- // Generate Thumbprint for Private Key
10204
- const privateKeyJwk = await exportJwk(keyPair.privateKey);
10205
- // Re-import private key to make it unextractable
10206
- const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"], RSA_KEYGEN_ALGORITHM_OPTIONS);
10207
- // Store Keypair data in keystore
10208
- await this.cache.setItem(publicJwkHash, {
10209
- privateKey: unextractablePrivateKey,
10210
- publicKey: keyPair.publicKey,
10211
- requestMethod: request.resourceRequestMethod,
10212
- requestUri: request.resourceRequestUri,
10213
- }, request.correlationId);
10214
- if (publicKeyThumbMeasurement) {
10215
- publicKeyThumbMeasurement.end({
10216
- success: true,
10217
- });
10218
- }
10219
- return publicJwkHash;
10220
- }
10221
10716
  /**
10222
10717
  * Removes cryptographic keypair from key store matching the keyId passed in
10223
10718
  * @param kid
10224
10719
  * @param correlationId
10225
10720
  */
10226
10721
  async removeTokenBindingKey(kid, correlationId) {
10227
- await this.cache.removeItem(kid, correlationId);
10228
- const keyFound = await this.cache.containsKey(kid, correlationId);
10229
- if (keyFound) {
10230
- throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10231
- }
10722
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
10232
10723
  }
10233
10724
  /**
10234
10725
  * Removes all cryptographic keys from IndexedDB storage
10235
10726
  * @param correlationId
10236
10727
  */
10237
10728
  async clearKeystore(correlationId) {
10238
- // Delete in-memory keystores
10239
- this.cache.clearInMemory(correlationId);
10240
- /**
10241
- * There is only one database, so calling clearPersistent on asymmetric keystore takes care of
10242
- * every persistent keystore
10243
- */
10729
+ return this.tokenBindingKeyManager.clearKeystore(correlationId);
10730
+ }
10731
+ /** @internal */
10732
+ async signTokenBindingJwt(header, payload, kid, correlationId) {
10733
+ let telemetry = {};
10734
+ const signTokenBindingJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10244
10735
  try {
10245
- await this.cache.clearPersistent(correlationId);
10246
- return true;
10736
+ const cachedKeyPair = await this.tokenBindingKeyManager.getTokenBindingKeyPair(kid, correlationId);
10737
+ await this.validateTokenBindingJwtHeaderKey(header, kid, correlationId);
10738
+ telemetry = this.tokenBindingKeyManager.getTokenBindingKeyTelemetry(cachedKeyPair, header.alg);
10739
+ const signingAlgorithm = this.getTokenBindingKeySigningAlgorithm(cachedKeyPair, header.alg, correlationId);
10740
+ const tokenString = `${urlEncode(JSON.stringify(header))}.${urlEncode(JSON.stringify(payload))}`;
10741
+ const encodedSignature = await this.signInput(cachedKeyPair, tokenString, signingAlgorithm);
10742
+ signTokenBindingJwtMeasurement?.end({
10743
+ success: true,
10744
+ ...telemetry,
10745
+ });
10746
+ return `${tokenString}.${encodedSignature}`;
10247
10747
  }
10248
10748
  catch (e) {
10249
- if (e instanceof Error) {
10250
- this.logger.error(`1owpn8 ${e.message}`, correlationId);
10251
- }
10252
- else {
10253
- this.logger.error("0yrmwo", correlationId);
10254
- }
10255
- return false;
10256
- }
10257
- }
10258
- /**
10259
- * Signs the given object as a jwt payload with private key retrieved by given kid.
10260
- * @param payload
10261
- * @param kid
10262
- */
10263
- async signJwt(payload, kid, shrOptions, correlationId) {
10264
- const signJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
10265
- const cachedKeyPair = await this.cache.getItem(kid, correlationId || "");
10266
- if (!cachedKeyPair) {
10267
- throw createBrowserAuthError(cryptoKeyNotFound, correlationId || "");
10268
- }
10269
- // Get public key as JWK
10270
- const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
10271
- const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
10272
- // Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
10273
- const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
10274
- // Generate header
10275
- const shrHeader = JoseHeader.getShrHeaderString({
10276
- ...shrOptions?.header,
10277
- alg: publicKeyJwk.alg,
10278
- kid: encodedKeyIdThumbprint,
10279
- });
10280
- const encodedShrHeader = urlEncode(shrHeader);
10281
- // Generate payload
10282
- payload.cnf = {
10283
- jwk: JSON.parse(publicKeyJwkString),
10284
- };
10285
- const encodedPayload = urlEncode(JSON.stringify(payload));
10286
- // Form token string
10287
- const tokenString = `${encodedShrHeader}.${encodedPayload}`;
10288
- // Sign token
10289
- const encoder = new TextEncoder();
10290
- const tokenBuffer = encoder.encode(tokenString);
10291
- const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer, RSA_SIGN_ALGORITHM_OPTIONS);
10292
- const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
10293
- const signedJwt = `${tokenString}.${encodedSignature}`;
10294
- if (signJwtMeasurement) {
10295
- signJwtMeasurement.end({
10296
- success: true,
10749
+ signTokenBindingJwtMeasurement?.end({
10750
+ success: false,
10751
+ ...telemetry,
10297
10752
  });
10753
+ throw e;
10298
10754
  }
10299
- return signedJwt;
10300
10755
  }
10301
10756
  /**
10302
10757
  * Returns the SHA-256 hash of an input string
@@ -10305,11 +10760,39 @@ class CryptoOps {
10305
10760
  async hashString(plainText) {
10306
10761
  return hashString(plainText);
10307
10762
  }
10308
- }
10309
- CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
10310
- CryptoOps.EXTRACTABLE = true;
10311
- function getSortedObjectString(obj) {
10312
- return JSON.stringify(obj, Object.keys(obj).sort());
10763
+ async signInput(cachedKeyPair, signingInput, algorithm) {
10764
+ const encoder = new TextEncoder();
10765
+ const signatureBuffer = await sign(cachedKeyPair.privateKey, encoder.encode(signingInput), algorithm);
10766
+ return urlEncodeArr(new Uint8Array(signatureBuffer));
10767
+ }
10768
+ getTokenBindingKeySigningAlgorithm(cachedKeyPair, requestedAlgorithm, correlationId) {
10769
+ const keyAlgorithm = cachedKeyPair.privateKey.algorithm;
10770
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 &&
10771
+ keyAlgorithm.name === RSA_SIGN_ALGORITHM_OPTIONS.name) {
10772
+ return RSA_SIGN_ALGORITHM_OPTIONS;
10773
+ }
10774
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.ES256 &&
10775
+ keyAlgorithm.name ===
10776
+ ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS.name &&
10777
+ keyAlgorithm.namedCurve ===
10778
+ ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS.namedCurve) {
10779
+ return ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS;
10780
+ }
10781
+ if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 ||
10782
+ requestedAlgorithm === JsonWebTokenAlgorithms.ES256) {
10783
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId, tokenBindingKeyAlgorithmMismatch);
10784
+ }
10785
+ throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
10786
+ }
10787
+ async validateTokenBindingJwtHeaderKey(header, kid, correlationId) {
10788
+ if (!header.jwk) {
10789
+ return;
10790
+ }
10791
+ const headerKeyId = await computeJwkThumbprint(header.jwk, correlationId);
10792
+ if (headerKeyId !== kid) {
10793
+ throw createBrowserAuthError(invalidPublicJwk, correlationId, tokenBindingKeyJwkThumbprintMismatch);
10794
+ }
10795
+ }
10313
10796
  }
10314
10797
 
10315
10798
  /*
@@ -10817,10 +11300,20 @@ class LocalStorage {
10817
11300
  }
10818
11301
  if (context && context !== this.clientId) {
10819
11302
  this.logger.trace(`04rtdy ${context}`, correlationId);
10820
- perfMeasurement.end({
10821
- success: false,
10822
- errorCode: "contextMismatch",
10823
- });
11303
+ /*
11304
+ * Discarded rather than ended: this is expected routing, not a failure.
11305
+ * BroadcastChannel has no server-side filtering, so every MSAL instance on
11306
+ * the origin receives every message and drops the ones scoped to another
11307
+ * clientId. With N instances sharing an origin each write produces N-1 of
11308
+ * these no-ops, so emitting them scales O(N^2) - and because they were
11309
+ * previously reported with success: false they bypassed both the 1% misc
11310
+ * sampler and the observability trimming in the 1P telemetry reporter,
11311
+ * shipping at full payload. On origins hosting many embedded first-party
11312
+ * apps that dwarfed all other MSAL telemetry combined. These events carry
11313
+ * no diagnostic value, so drop the measurement entirely. Genuine faults
11314
+ * such as the noKey case above are still reported.
11315
+ */
11316
+ perfMeasurement.discard();
10824
11317
  return;
10825
11318
  }
10826
11319
  if (!value) {
@@ -10904,7 +11397,7 @@ const EventType = {
10904
11397
 
10905
11398
  /* eslint-disable header/header */
10906
11399
  const name = "@azure/msal-browser";
10907
- const version = "5.18.0";
11400
+ const version = "5.20.0";
10908
11401
 
10909
11402
  /*
10910
11403
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -10939,8 +11432,8 @@ const MigrationRemovalReason = {
10939
11432
  * This class implements the cache storage interface for MSAL through browser local or session storage.
10940
11433
  */
10941
11434
  class BrowserCacheManager extends CacheManager {
10942
- constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions) {
10943
- super(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions);
11435
+ constructor(clientId, cacheConfig, cryptoImpl, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
11436
+ super(clientId, cryptoImpl, logger, performanceClient, staticAuthorityOptions, tokenBindingKeyManager);
10944
11437
  this.cacheConfig = cacheConfig;
10945
11438
  this.logger = logger;
10946
11439
  this.internalStorage = new MemoryStorage();
@@ -12358,12 +12851,12 @@ function getStorageImplementation(clientId, cacheLocation, logger, performanceCl
12358
12851
  }
12359
12852
  return new MemoryStorage();
12360
12853
  }
12361
- const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler) => {
12854
+ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) => {
12362
12855
  const cacheOptions = {
12363
12856
  cacheLocation: BrowserCacheLocation.MemoryStorage,
12364
12857
  cacheRetentionDays: 5,
12365
12858
  };
12366
- return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler);
12859
+ return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger, performanceClient, eventHandler, staticAuthorityOptions, tokenBindingKeyManager);
12367
12860
  };
12368
12861
 
12369
12862
  /*
@@ -12519,7 +13012,7 @@ class EventHandler {
12519
13012
  * Licensed under the MIT License.
12520
13013
  */
12521
13014
  class BaseInteractionClient {
12522
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider) {
13015
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
12523
13016
  this.config = config;
12524
13017
  this.browserStorage = storageImpl;
12525
13018
  this.browserCrypto = browserCrypto;
@@ -12530,6 +13023,9 @@ class BaseInteractionClient {
12530
13023
  this.correlationId = correlationId;
12531
13024
  this.logger = logger.clone(name, version);
12532
13025
  this.performanceClient = performanceClient;
13026
+ this.tokenBindingKeyManager =
13027
+ tokenBindingKeyManager ||
13028
+ new TokenBindingKeyManager(this.logger, this.performanceClient);
12533
13029
  }
12534
13030
  }
12535
13031
  /**
@@ -12656,6 +13152,63 @@ async function clearCacheOnLogout(browserStorage, browserCrypto, logger, correla
12656
13152
  * Copyright (c) Microsoft Corporation. All rights reserved.
12657
13153
  * Licensed under the MIT License.
12658
13154
  */
13155
+ const SUPPORTED_AUTHENTICATION_SCHEMES = new Set([
13156
+ AuthenticationScheme$1.BEARER,
13157
+ AuthenticationScheme$1.POP,
13158
+ AuthenticationScheme$1.DPOP,
13159
+ AuthenticationScheme$1.SSH,
13160
+ ]);
13161
+ function validateSshRequest(request, correlationId) {
13162
+ if (!request.sshJwk) {
13163
+ throw createClientConfigurationError(missingSshJwk, correlationId);
13164
+ }
13165
+ if (!request.sshKid) {
13166
+ throw createClientConfigurationError(missingSshKid, correlationId);
13167
+ }
13168
+ }
13169
+ function validateDpopRequest(request, correlationId) {
13170
+ if (!request.resourceRequestMethod?.trim() ||
13171
+ !request.resourceRequestUri?.trim()) {
13172
+ throw createClientConfigurationError(dpopMissingResourceContext, correlationId);
13173
+ }
13174
+ }
13175
+ /**
13176
+ * Resolves the token-binding parameters needed before building authorize or token requests.
13177
+ * Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
13178
+ * a reqCnf confirmation claim. Requests that do not require request-time token binding return
13179
+ * no additional parameters.
13180
+ */
13181
+ async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
13182
+ switch (request.authenticationScheme) {
13183
+ case AuthenticationScheme$1.DPOP:
13184
+ if (request.platformBroker) {
13185
+ return {};
13186
+ }
13187
+ if (request.dpopJkt) {
13188
+ return { dpopJkt: request.dpopJkt };
13189
+ }
13190
+ return {
13191
+ dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
13192
+ tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
13193
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
13194
+ correlationId: request.correlationId,
13195
+ }),
13196
+ };
13197
+ case AuthenticationScheme$1.POP:
13198
+ if (!request.platformBroker) {
13199
+ return {};
13200
+ }
13201
+ const cryptoOps = new CryptoOps(logger, performanceClient);
13202
+ if (request.popKid) {
13203
+ return { reqCnf: cryptoOps.encodeKid(request.popKid) };
13204
+ }
13205
+ const popTokenGenerator = new PopTokenGenerator(cryptoOps, tokenBindingKeyManager, performanceClient);
13206
+ const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, logger, performanceClient, request.correlationId)(request, logger);
13207
+ return { reqCnf: generatedReqCnfData.reqCnfString };
13208
+ default:
13209
+ return {};
13210
+ }
13211
+ }
12659
13212
  /**
12660
13213
  * Initializer function for all request APIs
12661
13214
  * @param request
@@ -12680,13 +13233,16 @@ async function initializeBaseRequest(request, config, performanceClient, logger,
12680
13233
  logger.verbose("1l4fwv", correlationId);
12681
13234
  }
12682
13235
  else {
12683
- if (validatedRequest.authenticationScheme ===
12684
- AuthenticationScheme$1.SSH) {
12685
- if (!request.sshJwk) {
12686
- throw createClientConfigurationError(missingSshJwk, "");
12687
- }
12688
- if (!request.sshKid) {
12689
- throw createClientConfigurationError(missingSshKid, "");
13236
+ if (!SUPPORTED_AUTHENTICATION_SCHEMES.has(validatedRequest.authenticationScheme)) {
13237
+ throw createClientConfigurationError(unsupportedAuthenticationScheme, correlationId);
13238
+ }
13239
+ switch (validatedRequest.authenticationScheme) {
13240
+ case AuthenticationScheme$1.SSH:
13241
+ validateSshRequest(request, correlationId);
13242
+ break;
13243
+ case AuthenticationScheme$1.DPOP: {
13244
+ validateDpopRequest(request, correlationId);
13245
+ break;
12690
13246
  }
12691
13247
  }
12692
13248
  logger.verbose(`1ecmns ${validatedRequest.authenticationScheme}`, correlationId);
@@ -12871,6 +13427,7 @@ class StandardInteractionClient extends BaseInteractionClient {
12871
13427
  correlationId: this.correlationId,
12872
13428
  },
12873
13429
  cryptoInterface: this.browserCrypto,
13430
+ tokenBindingKeyManager: this.tokenBindingKeyManager,
12874
13431
  networkInterface: this.networkClient,
12875
13432
  storageInterface: this.browserStorage,
12876
13433
  serverTelemetryManager: serverTelemetryManager,
@@ -13342,13 +13899,13 @@ class SilentCacheClient extends StandardInteractionClient {
13342
13899
  * Licensed under the MIT License.
13343
13900
  */
13344
13901
  class PlatformAuthInteractionClient extends BaseInteractionClient {
13345
- constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
13346
- super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13902
+ constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
13903
+ super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
13347
13904
  this.apiId = apiId;
13348
13905
  this.accountId = accountId;
13349
13906
  this.platformAuthProvider = provider;
13350
13907
  this.nativeStorageManager = nativeStorageImpl;
13351
- this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
13908
+ this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, this.tokenBindingKeyManager);
13352
13909
  const extensionName = this.platformAuthProvider.getExtensionName();
13353
13910
  this.skus = ServerTelemetryManager.makeExtraSkuString({
13354
13911
  libraryName: BrowserConstants.MSAL_SKU,
@@ -13695,7 +14252,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
13695
14252
  return response.shr;
13696
14253
  }
13697
14254
  // Generate SHR in msal js if WAM does not compute it when POP is enabled
13698
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
14255
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13699
14256
  const shrParameters = {
13700
14257
  resourceRequestMethod: request.resourceRequestMethod,
13701
14258
  resourceRequestUri: request.resourceRequestUri,
@@ -13955,7 +14512,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
13955
14512
  shrNonce: request.shrNonce,
13956
14513
  correlationId: this.correlationId,
13957
14514
  };
13958
- const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
14515
+ const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
13959
14516
  // generate reqCnf if not provided in the request
13960
14517
  let reqCnfData;
13961
14518
  if (!validatedRequest.keyId) {
@@ -14143,21 +14700,16 @@ async function getStandardParameters(config, authority, request, logger, perform
14143
14700
  isPlatformAuthorizeRequest: true,
14144
14701
  }, request.correlationId);
14145
14702
  // pass the req_cnf for POP
14146
- if (request.authenticationScheme === AuthenticationScheme$1.POP) {
14147
- const cryptoOps = new CryptoOps(logger, performanceClient);
14148
- const popTokenGenerator = new PopTokenGenerator(cryptoOps, performanceClient);
14149
- // req_cnf is always sent as a string for SPAs
14150
- let reqCnfData;
14151
- if (!request.popKid) {
14152
- const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, logger, performanceClient, request.correlationId)(request, logger);
14153
- reqCnfData = generatedReqCnfData.reqCnfString;
14154
- }
14155
- else {
14156
- reqCnfData = cryptoOps.encodeKid(request.popKid);
14157
- }
14158
- addPopToken(parameters, reqCnfData);
14703
+ if (request.authenticationScheme ===
14704
+ AuthenticationScheme$1.POP &&
14705
+ request.reqCnf) {
14706
+ addPopToken(parameters, request.reqCnf);
14159
14707
  }
14160
14708
  }
14709
+ if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
14710
+ request.dpopJkt) {
14711
+ parameters.set(DPOP_JKT, request.dpopJkt);
14712
+ }
14161
14713
  instrumentBrokerParams(parameters, request.correlationId, performanceClient);
14162
14714
  return parameters;
14163
14715
  }
@@ -14354,7 +14906,7 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
14354
14906
  if (decryptedData.accountId) {
14355
14907
  return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
14356
14908
  }
14357
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null);
14909
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
14358
14910
  // Validate response. This function throws a server error if an error is returned by the server.
14359
14911
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
14360
14912
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -15234,8 +15786,8 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
15234
15786
  * Licensed under the MIT License.
15235
15787
  */
15236
15788
  class PopupClient extends StandardInteractionClient {
15237
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook) {
15238
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
15789
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook, tokenBindingKeyManager) {
15790
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15239
15791
  this.nativeStorage = nativeStorageImpl;
15240
15792
  this.eventHandler = eventHandler;
15241
15793
  this.waitForPopupResponseHook = waitForPopupResponseHook;
@@ -15349,9 +15901,11 @@ class PopupClient extends StandardInteractionClient {
15349
15901
  const serverTelemetryManager = initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
15350
15902
  const pkce = pkceCodes ||
15351
15903
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
15904
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15352
15905
  const popupRequest = {
15353
15906
  ...request,
15354
15907
  codeChallenge: pkce.challenge,
15908
+ ...tokenBindingParams,
15355
15909
  };
15356
15910
  try {
15357
15911
  // Initialize the client
@@ -15385,7 +15939,7 @@ class PopupClient extends StandardInteractionClient {
15385
15939
  // Wait for the redirect bridge response
15386
15940
  const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
15387
15941
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
15388
- 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);
15942
+ 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);
15389
15943
  }
15390
15944
  }
15391
15945
  catch (e) {
@@ -15409,10 +15963,12 @@ class PopupClient extends StandardInteractionClient {
15409
15963
  const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
15410
15964
  const pkce = pkceCodes ||
15411
15965
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
15966
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15412
15967
  const popupRequest = {
15413
15968
  ...request,
15414
15969
  earJwk: earJwk,
15415
15970
  codeChallenge: pkce.challenge,
15971
+ ...tokenBindingParams,
15416
15972
  };
15417
15973
  const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
15418
15974
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
@@ -15749,8 +16305,8 @@ function getNavigationType() {
15749
16305
  return navigation?.type;
15750
16306
  }
15751
16307
  class RedirectClient extends StandardInteractionClient {
15752
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler) {
15753
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
16308
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, tokenBindingKeyManager) {
16309
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
15754
16310
  this.nativeStorage = nativeStorageImpl;
15755
16311
  }
15756
16312
  /**
@@ -15799,9 +16355,11 @@ class RedirectClient extends StandardInteractionClient {
15799
16355
  const correlationId = request.correlationId;
15800
16356
  const serverTelemetryManager = initializeServerTelemetryManager(ApiId.acquireTokenRedirect, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
15801
16357
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16358
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15802
16359
  const redirectRequest = {
15803
16360
  ...request,
15804
16361
  codeChallenge: pkceCodes.challenge,
16362
+ ...tokenBindingParams,
15805
16363
  };
15806
16364
  this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
15807
16365
  try {
@@ -15841,10 +16399,12 @@ class RedirectClient extends StandardInteractionClient {
15841
16399
  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);
15842
16400
  const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
15843
16401
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16402
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
15844
16403
  const redirectRequest = {
15845
16404
  ...request,
15846
16405
  earJwk: earJwk,
15847
16406
  codeChallenge: pkceCodes.challenge,
16407
+ ...tokenBindingParams,
15848
16408
  };
15849
16409
  this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
15850
16410
  const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
@@ -16242,8 +16802,8 @@ function removeHiddenIframe(iframe) {
16242
16802
  * Licensed under the MIT License.
16243
16803
  */
16244
16804
  class SilentIframeClient extends StandardInteractionClient {
16245
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook) {
16246
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
16805
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook, tokenBindingKeyManager) {
16806
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16247
16807
  this.apiId = apiId;
16248
16808
  this.nativeStorage = nativeStorageImpl;
16249
16809
  this.waitForIframeResponseHook = waitForIframeResponseHook;
@@ -16414,8 +16974,8 @@ class SilentIframeClient extends StandardInteractionClient {
16414
16974
  * @param userRequestScopes
16415
16975
  */
16416
16976
  async silentTokenHelper(authClient, request) {
16417
- const { serverParams, pkceCodes } = await this.silentAuthorizeHelper(authClient, request);
16418
- 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);
16977
+ const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
16978
+ 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);
16419
16979
  }
16420
16980
  /**
16421
16981
  * Shared helper that generates PKCE codes, builds the /authorize URL,
@@ -16426,9 +16986,11 @@ class SilentIframeClient extends StandardInteractionClient {
16426
16986
  async silentAuthorizeHelper(authClient, request) {
16427
16987
  const correlationId = request.correlationId;
16428
16988
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
16989
+ const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16429
16990
  const silentRequest = {
16430
16991
  ...request,
16431
16992
  codeChallenge: pkceCodes.challenge,
16993
+ ...tokenBindingParams,
16432
16994
  };
16433
16995
  // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
16434
16996
  const iframe = createHiddenIframe();
@@ -16482,9 +17044,11 @@ class SilentRefreshClient extends StandardInteractionClient {
16482
17044
  */
16483
17045
  async acquireToken(request) {
16484
17046
  const baseRequest = await invokeAsync(initializeBaseRequest, InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger, this.correlationId);
17047
+ const tokenBindingParams = await getTokenBindingRequestParams(baseRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16485
17048
  const silentRequest = {
16486
17049
  ...request,
16487
17050
  ...baseRequest,
17051
+ ...tokenBindingParams,
16488
17052
  };
16489
17053
  if (request.redirectUri) {
16490
17054
  // 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
@@ -16550,8 +17114,8 @@ class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
16550
17114
  * Licensed under the MIT License.
16551
17115
  */
16552
17116
  class SilentAuthCodeClient extends StandardInteractionClient {
16553
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider) {
16554
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
17117
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
17118
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
16555
17119
  this.apiId = apiId;
16556
17120
  }
16557
17121
  /**
@@ -16572,10 +17136,12 @@ class SilentAuthCodeClient extends StandardInteractionClient {
16572
17136
  this.correlationId);
16573
17137
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
16574
17138
  try {
17139
+ const tokenBindingParams = await getTokenBindingRequestParams(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16575
17140
  // Create auth code request (PKCE not needed)
16576
17141
  const authCodeRequest = {
16577
17142
  ...silentRequest,
16578
17143
  code: request.code,
17144
+ ...tokenBindingParams,
16579
17145
  };
16580
17146
  // Initialize the client
16581
17147
  const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)({
@@ -16704,21 +17270,26 @@ class StandardController {
16704
17270
  this.hybridAuthCodeResponses = new Map();
16705
17271
  // Initialize performance client
16706
17272
  this.performanceClient = this.config.telemetry.client;
16707
- // Initialize the crypto class.
16708
- this.browserCrypto = this.isBrowserEnvironment
16709
- ? new CryptoOps(this.logger, this.performanceClient)
16710
- : DEFAULT_CRYPTO_IMPLEMENTATION;
17273
+ // Initialize environment-specific crypto and token-binding services.
17274
+ if (this.isBrowserEnvironment) {
17275
+ this.browserCrypto = new CryptoOps(this.logger, this.performanceClient);
17276
+ this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
17277
+ }
17278
+ else {
17279
+ this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;
17280
+ this.tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
17281
+ }
16711
17282
  this.eventHandler = new EventHandler(this.logger);
16712
17283
  // Initialize the browser storage class.
16713
17284
  this.browserStorage = this.isBrowserEnvironment
16714
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
16715
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
17285
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth), this.tokenBindingKeyManager)
17286
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler, undefined, this.tokenBindingKeyManager);
16716
17287
  // initialize in memory storage for native flows
16717
17288
  const nativeCacheOptions = {
16718
17289
  cacheLocation: BrowserCacheLocation.MemoryStorage,
16719
17290
  cacheRetentionDays: 5,
16720
17291
  };
16721
- this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler);
17292
+ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, undefined, this.tokenBindingKeyManager);
16722
17293
  this.activeSilentTokenRequests = new Map();
16723
17294
  // Register listener functions
16724
17295
  this.trackStateChange = this.trackStateChange.bind(this);
@@ -16860,7 +17431,7 @@ class StandardController {
16860
17431
  rootMeasurement.add({
16861
17432
  isPlatformBrokerRequest: true,
16862
17433
  });
16863
- 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);
17434
+ 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);
16864
17435
  redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)();
16865
17436
  }
16866
17437
  else {
@@ -16961,7 +17532,7 @@ class StandardController {
16961
17532
  let result;
16962
17533
  if (this.platformAuthProvider &&
16963
17534
  this.canUsePlatformBroker(request)) {
16964
- 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);
17535
+ 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);
16965
17536
  result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
16966
17537
  if (e instanceof NativeAuthError &&
16967
17538
  isFatalNativeAuthError(e)) {
@@ -17636,7 +18207,7 @@ class StandardController {
17636
18207
  if (!this.platformAuthProvider) {
17637
18208
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
17638
18209
  }
17639
- 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);
18210
+ 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);
17640
18211
  return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
17641
18212
  }
17642
18213
  /**
@@ -17693,39 +18264,39 @@ class StandardController {
17693
18264
  * @param correlationId
17694
18265
  */
17695
18266
  createPopupClient(correlationId) {
17696
- 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);
18267
+ 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);
17697
18268
  }
17698
18269
  /**
17699
18270
  * Returns new instance of the Redirect Interaction Client
17700
18271
  * @param correlationId
17701
18272
  */
17702
18273
  createRedirectClient(correlationId) {
17703
- return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider);
18274
+ return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17704
18275
  }
17705
18276
  /**
17706
18277
  * Returns new instance of the Silent Iframe Interaction Client
17707
18278
  * @param correlationId
17708
18279
  */
17709
18280
  createSilentIframeClient(correlationId) {
17710
- 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);
18281
+ 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);
17711
18282
  }
17712
18283
  /**
17713
18284
  * Returns new instance of the Silent Cache Interaction Client
17714
18285
  */
17715
18286
  createSilentCacheClient(correlationId) {
17716
- return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
18287
+ return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17717
18288
  }
17718
18289
  /**
17719
18290
  * Returns new instance of the Silent Refresh Interaction Client
17720
18291
  */
17721
18292
  createSilentRefreshClient(correlationId) {
17722
- return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
18293
+ return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17723
18294
  }
17724
18295
  /**
17725
18296
  * Returns new instance of the Silent AuthCode Interaction Client
17726
18297
  */
17727
18298
  createSilentAuthCodeClient(correlationId) {
17728
- return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider);
18299
+ return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
17729
18300
  }
17730
18301
  /**
17731
18302
  * Adds event callbacks to array
@@ -18313,6 +18884,92 @@ const BridgeStatusCode = {
18313
18884
  NestedAppAuthUnavailable: "NESTED_APP_AUTH_UNAVAILABLE", // NAA is unavailable in the current context, can retry with standard browser based auth
18314
18885
  };
18315
18886
 
18887
+ /*
18888
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18889
+ * Licensed under the MIT License.
18890
+ */
18891
+ /**
18892
+ * Unified error taxonomy shared by NAA and PWB.
18893
+ *
18894
+ * Each code maps to exactly one of the four base MSAL error classes
18895
+ * (`AuthError`, `ClientAuthError`, `ServerError`,
18896
+ * `InteractionRequiredAuthError`) via `toAuthError` in
18897
+ * `./WebBrokerBridgeErrorMap`.
18898
+ */
18899
+ const WebBrokerBridgeErrorCode = {
18900
+ /* Interaction / auth outcomes */
18901
+ UserInteractionRequired: "user_interaction_required",
18902
+ UserCanceled: "user_canceled",
18903
+ /* Environment / connectivity */
18904
+ NoNetwork: "no_network",
18905
+ AccountUnavailable: "account_unavailable",
18906
+ BridgeDisabled: "bridge_disabled",
18907
+ BridgeUnavailable: "bridge_unavailable",
18908
+ /* Server-side outcomes */
18909
+ TransientError: "transient_error",
18910
+ PersistentError: "persistent_error",
18911
+ /* Broker-channel failures */
18912
+ BridgeTimeout: "bridge_timeout",
18913
+ BridgeHandshakeFailed: "bridge_handshake_failed",
18914
+ BridgeConnectionReset: "bridge_connection_reset",
18915
+ BridgeResponseInvalid: "bridge_response_invalid",
18916
+ PopupWillRedirect: "popup_will_redirect",
18917
+ ShrGenerationError: "shr_generation_error",
18918
+ /* Fallback */
18919
+ Unknown: "unknown",
18920
+ };
18921
+
18922
+ /*
18923
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18924
+ * Licensed under the MIT License.
18925
+ */
18926
+ /**
18927
+ * Lift a normalized `WebBrokerBridgeError` to one of the four base
18928
+ * MSAL error classes. Callers are responsible for lowering
18929
+ * transport-specific errors into `WebBrokerBridgeError` before calling
18930
+ * this function.
18931
+ */
18932
+ function toAuthError(err) {
18933
+ const correlationId = err.correlationId ?? "";
18934
+ switch (err.code) {
18935
+ case WebBrokerBridgeErrorCode.UserInteractionRequired:
18936
+ return new InteractionRequiredAuthError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18937
+ case WebBrokerBridgeErrorCode.TransientError:
18938
+ case WebBrokerBridgeErrorCode.PersistentError:
18939
+ return new ServerError(err.innerErrorCode || "", correlationId, err.description, err.subError);
18940
+ case WebBrokerBridgeErrorCode.UserCanceled:
18941
+ return new ClientAuthError(userCanceled, correlationId);
18942
+ case WebBrokerBridgeErrorCode.NoNetwork:
18943
+ return new ClientAuthError(noNetworkConnectivity$1, correlationId);
18944
+ case WebBrokerBridgeErrorCode.AccountUnavailable:
18945
+ return new ClientAuthError(noAccountFound, correlationId);
18946
+ case WebBrokerBridgeErrorCode.BridgeDisabled:
18947
+ return new ClientAuthError(nestedAppAuthBridgeDisabled, correlationId);
18948
+ case WebBrokerBridgeErrorCode.BridgeUnavailable:
18949
+ /*
18950
+ * NAA parity: pass through inner code when the broker supplied
18951
+ * one, otherwise fall back to the disabled code.
18952
+ */
18953
+ return new ClientAuthError(err.innerErrorCode ||
18954
+ nestedAppAuthBridgeDisabled, correlationId, err.description);
18955
+ /*
18956
+ * PWB broker-channel failures. The common code doubles as the
18957
+ * concrete errorCode on AuthError so the original error identity
18958
+ * can be recovered by round-tripping the string.
18959
+ */
18960
+ case WebBrokerBridgeErrorCode.BridgeTimeout:
18961
+ case WebBrokerBridgeErrorCode.BridgeHandshakeFailed:
18962
+ case WebBrokerBridgeErrorCode.BridgeConnectionReset:
18963
+ case WebBrokerBridgeErrorCode.BridgeResponseInvalid:
18964
+ case WebBrokerBridgeErrorCode.PopupWillRedirect:
18965
+ case WebBrokerBridgeErrorCode.ShrGenerationError:
18966
+ return new AuthError(err.code, correlationId, err.description, err.subError);
18967
+ case WebBrokerBridgeErrorCode.Unknown:
18968
+ default:
18969
+ return new AuthError(err.innerErrorCode || "unknown_error", correlationId, err.description || "An unknown error occurred", err.subError);
18970
+ }
18971
+ }
18972
+
18316
18973
  /*
18317
18974
  * Copyright (c) Microsoft Corporation. All rights reserved.
18318
18975
  * Licensed under the MIT License.
@@ -18457,30 +19114,9 @@ class NestedAppAuthAdapter {
18457
19114
  */
18458
19115
  fromBridgeError(error) {
18459
19116
  if (isBridgeError(error)) {
18460
- switch (error.status) {
18461
- case BridgeStatusCode.UserCancel:
18462
- return new ClientAuthError(userCanceled, "");
18463
- case BridgeStatusCode.NoNetwork:
18464
- return new ClientAuthError(noNetworkConnectivity$1, "");
18465
- case BridgeStatusCode.AccountUnavailable:
18466
- return new ClientAuthError(noAccountFound, "");
18467
- case BridgeStatusCode.Disabled:
18468
- return new ClientAuthError(nestedAppAuthBridgeDisabled, "");
18469
- case BridgeStatusCode.NestedAppAuthUnavailable:
18470
- return new ClientAuthError(error.code ||
18471
- nestedAppAuthBridgeDisabled, "", error.description);
18472
- case BridgeStatusCode.TransientError:
18473
- case BridgeStatusCode.PersistentError:
18474
- return new ServerError(error.code || "", "", error.description);
18475
- case BridgeStatusCode.UserInteractionRequired:
18476
- return new InteractionRequiredAuthError(error.code || "", "", error.description);
18477
- default:
18478
- return new AuthError(error.code || "", "", error.description);
18479
- }
18480
- }
18481
- else {
18482
- return new AuthError("unknown_error", "", "An unknown error occurred");
19117
+ return toAuthError(bridgeErrorToWebBrokerBridgeError(error));
18483
19118
  }
19119
+ return new AuthError("unknown_error", "", "An unknown error occurred");
18484
19120
  }
18485
19121
  /**
18486
19122
  * Returns an AuthenticationResult from the given cache items
@@ -18516,6 +19152,52 @@ class NestedAppAuthAdapter {
18516
19152
  };
18517
19153
  return authenticationResult;
18518
19154
  }
19155
+ }
19156
+ /**
19157
+ * Converts NAA `BridgeError` into the shared `WebBrokerBridgeError`
19158
+ * taxonomy.
19159
+ */
19160
+ function bridgeErrorToWebBrokerBridgeError(error) {
19161
+ switch (error.status) {
19162
+ case BridgeStatusCode.UserCancel:
19163
+ return { code: WebBrokerBridgeErrorCode.UserCanceled };
19164
+ case BridgeStatusCode.NoNetwork:
19165
+ return { code: WebBrokerBridgeErrorCode.NoNetwork };
19166
+ case BridgeStatusCode.AccountUnavailable:
19167
+ return { code: WebBrokerBridgeErrorCode.AccountUnavailable };
19168
+ case BridgeStatusCode.Disabled:
19169
+ return { code: WebBrokerBridgeErrorCode.BridgeDisabled };
19170
+ case BridgeStatusCode.NestedAppAuthUnavailable:
19171
+ return {
19172
+ code: WebBrokerBridgeErrorCode.BridgeUnavailable,
19173
+ innerErrorCode: error.code,
19174
+ description: error.description,
19175
+ };
19176
+ case BridgeStatusCode.TransientError:
19177
+ return {
19178
+ code: WebBrokerBridgeErrorCode.TransientError,
19179
+ innerErrorCode: error.code,
19180
+ description: error.description,
19181
+ };
19182
+ case BridgeStatusCode.PersistentError:
19183
+ return {
19184
+ code: WebBrokerBridgeErrorCode.PersistentError,
19185
+ innerErrorCode: error.code,
19186
+ description: error.description,
19187
+ };
19188
+ case BridgeStatusCode.UserInteractionRequired:
19189
+ return {
19190
+ code: WebBrokerBridgeErrorCode.UserInteractionRequired,
19191
+ innerErrorCode: error.code,
19192
+ description: error.description,
19193
+ };
19194
+ default:
19195
+ return {
19196
+ code: WebBrokerBridgeErrorCode.Unknown,
19197
+ innerErrorCode: error.code,
19198
+ description: error.description,
19199
+ };
19200
+ }
18519
19201
  }
18520
19202
 
18521
19203
  /*
@@ -18561,11 +19243,14 @@ class NestedAppAuthController {
18561
19243
  this.browserCrypto = operatingContext.isBrowserEnvironment()
18562
19244
  ? new CryptoOps(this.logger, this.performanceClient, true)
18563
19245
  : DEFAULT_CRYPTO_IMPLEMENTATION;
19246
+ const tokenBindingKeyManager = operatingContext.isBrowserEnvironment()
19247
+ ? new TokenBindingKeyManager(this.logger, this.performanceClient)
19248
+ : DEFAULT_TOKEN_BINDING_KEY_MANAGER;
18564
19249
  this.eventHandler = new EventHandler(this.logger);
18565
19250
  // Initialize the browser storage class.
18566
19251
  this.browserStorage = this.operatingContext.isBrowserEnvironment()
18567
- ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth))
18568
- : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler);
19252
+ ? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth), tokenBindingKeyManager)
19253
+ : DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler, undefined, tokenBindingKeyManager);
18569
19254
  this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
18570
19255
  // Set the active account if available
18571
19256
  const accountContext = this.bridgeProxy.getAccountContext();
@@ -19001,6 +19686,66 @@ class NestedAppAuthController {
19001
19686
  }
19002
19687
  }
19003
19688
 
19689
+ /*
19690
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19691
+ * Licensed under the MIT License.
19692
+ */
19693
+ /**
19694
+ * Correlates outbound requests with inbound responses by `requestId`.
19695
+ */
19696
+ class PendingRequestRegistry {
19697
+ constructor() {
19698
+ this.pending = new Map();
19699
+ }
19700
+ /**
19701
+ * Register a pending request. Returns a promise that resolves when a
19702
+ * response with the matching `requestId` arrives, or rejects if the
19703
+ * caller invokes `reject` for that id.
19704
+ */
19705
+ register(requestId) {
19706
+ return new Promise((resolve, reject) => {
19707
+ this.pending.set(requestId, { resolve, reject });
19708
+ });
19709
+ }
19710
+ /** Resolve a pending request. No-op if `requestId` isn't registered. */
19711
+ resolve(requestId, response) {
19712
+ const entry = this.pending.get(requestId);
19713
+ if (entry === undefined) {
19714
+ return;
19715
+ }
19716
+ this.pending.delete(requestId);
19717
+ entry.resolve(response);
19718
+ }
19719
+ /** Reject a pending request. No-op if `requestId` isn't registered. */
19720
+ reject(requestId, reason) {
19721
+ const entry = this.pending.get(requestId);
19722
+ if (entry === undefined) {
19723
+ return;
19724
+ }
19725
+ this.pending.delete(requestId);
19726
+ entry.reject(reason);
19727
+ }
19728
+ /** True if `requestId` has an in-flight registration. */
19729
+ has(requestId) {
19730
+ return this.pending.has(requestId);
19731
+ }
19732
+ /**
19733
+ * Register, then invoke `send` synchronously. If `send` throws, the
19734
+ * pending entry is cleared and the promise rejects with the thrown
19735
+ * error.
19736
+ */
19737
+ async sendAndAwait(message, send) {
19738
+ const promise = this.register(message.requestId);
19739
+ try {
19740
+ send(message);
19741
+ }
19742
+ catch (err) {
19743
+ this.reject(message.requestId, err);
19744
+ }
19745
+ return promise;
19746
+ }
19747
+ }
19748
+
19004
19749
  /*
19005
19750
  * Copyright (c) Microsoft Corporation. All rights reserved.
19006
19751
  * Licensed under the MIT License.
@@ -19028,28 +19773,14 @@ class BridgeProxy {
19028
19773
  window.nestedAppAuthBridge.addEventListener("message", (response) => {
19029
19774
  const responsePayload = typeof response === "string" ? response : response.data;
19030
19775
  const responseEnvelope = JSON.parse(responsePayload);
19031
- const request = BridgeProxy.bridgeRequests.find((element) => element.requestId === responseEnvelope.requestId);
19032
- if (request !== undefined) {
19033
- BridgeProxy.bridgeRequests.splice(BridgeProxy.bridgeRequests.indexOf(request), 1);
19034
- if (responseEnvelope.success) {
19035
- request.resolve(responseEnvelope);
19036
- }
19037
- else {
19038
- request.reject(responseEnvelope.error);
19039
- }
19776
+ if (responseEnvelope.success) {
19777
+ BridgeProxy.pendingRegistry.resolve(responseEnvelope.requestId, responseEnvelope);
19778
+ }
19779
+ else {
19780
+ BridgeProxy.pendingRegistry.reject(responseEnvelope.requestId, responseEnvelope.error);
19040
19781
  }
19041
19782
  });
19042
- const bridgeResponse = await new Promise((resolve, reject) => {
19043
- const message = BridgeProxy.buildRequest("GetInitContext");
19044
- const request = {
19045
- requestId: message.requestId,
19046
- method: message.method,
19047
- resolve: resolve,
19048
- reject: reject,
19049
- };
19050
- BridgeProxy.bridgeRequests.push(request);
19051
- window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
19052
- });
19783
+ const bridgeResponse = await BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest("GetInitContext"));
19053
19784
  return BridgeProxy.validateBridgeResultOrThrow(bridgeResponse.initContext);
19054
19785
  }
19055
19786
  catch (error) {
@@ -19105,18 +19836,22 @@ class BridgeProxy {
19105
19836
  * @returns a promise that resolves to a response of provided type or rejects with a BridgeError
19106
19837
  */
19107
19838
  sendRequest(method, requestParams) {
19108
- const message = BridgeProxy.buildRequest(method, requestParams);
19109
- const promise = new Promise((resolve, reject) => {
19110
- const request = {
19111
- requestId: message.requestId,
19112
- method: message.method,
19113
- resolve: resolve,
19114
- reject: reject,
19115
- };
19116
- BridgeProxy.bridgeRequests.push(request);
19839
+ return BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest(method, requestParams));
19840
+ }
19841
+ /**
19842
+ * Registers `message.requestId` with the shared pending-request
19843
+ * registry, then posts the envelope over the host bridge. Resolves
19844
+ * with the matching response envelope; rejects with the raw
19845
+ * `BridgeError` payload.
19846
+ */
19847
+ static sendRequestViaRegistry(message) {
19848
+ const correlationKey = {
19849
+ requestId: message.requestId,
19850
+ type: message.method,
19851
+ };
19852
+ return BridgeProxy.pendingRegistry.sendAndAwait(correlationKey, () => {
19117
19853
  window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
19118
19854
  });
19119
- return promise;
19120
19855
  }
19121
19856
  static validateBridgeResultOrThrow(input) {
19122
19857
  if (input === undefined) {
@@ -19148,7 +19883,11 @@ class BridgeProxy {
19148
19883
  return new BridgeProxy(response.sdkName, response.sdkVersion, response.accountContext, response.capabilities);
19149
19884
  }
19150
19885
  }
19151
- BridgeProxy.bridgeRequests = [];
19886
+ /**
19887
+ * Correlates outbound bridge requests with inbound responses by
19888
+ * `requestId`
19889
+ */
19890
+ BridgeProxy.pendingRegistry = new PendingRequestRegistry();
19152
19891
 
19153
19892
  /*
19154
19893
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -19684,7 +20423,7 @@ async function loadExternalTokens(config, request, response, options, performanc
19684
20423
  };
19685
20424
  const logger = new Logger(browserConfig.system.loggerOptions || {}, name, version);
19686
20425
  const cryptoOps = new CryptoOps(logger, browserConfig.telemetry.client);
19687
- const storage = new BrowserCacheManager(browserConfig.auth.clientId, browserConfig.cache, cryptoOps, logger, browserConfig.telemetry.client, new EventHandler(logger), buildStaticAuthorityOptions(browserConfig.auth));
20426
+ 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));
19688
20427
  await storage.initialize(correlationId);
19689
20428
  const authorityString = request.authority || browserConfig.auth.authority;
19690
20429
  const authority = await createDiscoveredInstance(Authority.generateAuthority(authorityString, request.azureCloudOptions), browserConfig.system.networkClient, storage, authorityOptions, logger, correlationId, performanceClient);
@@ -19917,7 +20656,8 @@ class SignedHttpRequest {
19917
20656
  const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
19918
20657
  this.logger = new Logger(loggerOptions, name, version);
19919
20658
  this.cryptoOps = new CryptoOps(this.logger);
19920
- this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, new StubPerformanceClient());
20659
+ const tokenBindingKeyManager = new TokenBindingKeyManager(this.logger);
20660
+ this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, tokenBindingKeyManager, new StubPerformanceClient());
19921
20661
  this.shrParameters = shrParameters;
19922
20662
  }
19923
20663
  /**