@azure/msal-browser 5.27.0 → 5.28.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 (434) 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 +9 -1
  5. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +7 -6
  7. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +4 -2
  9. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
  10. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +21 -7
  11. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -1
  12. package/dist/cache/AccountManager.mjs +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +14 -1
  14. package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
  15. package/dist/cache/BrowserCacheManager.mjs +9 -2
  16. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  17. package/dist/cache/CacheHelpers.mjs +1 -1
  18. package/dist/cache/CacheKeys.mjs +1 -1
  19. package/dist/cache/CookieStorage.mjs +1 -1
  20. package/dist/cache/DatabaseStorage.mjs +1 -1
  21. package/dist/cache/EncryptedData.mjs +1 -1
  22. package/dist/cache/LocalStorage.mjs +1 -1
  23. package/dist/cache/MemoryStorage.mjs +1 -1
  24. package/dist/cache/SessionStorage.mjs +1 -1
  25. package/dist/cache/TokenCache.mjs +1 -1
  26. package/dist/config/Configuration.mjs +1 -1
  27. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  28. package/dist/controllers/StandardController.mjs +65 -7
  29. package/dist/controllers/StandardController.mjs.map +1 -1
  30. package/dist/crypto/BrowserCrypto.mjs +1 -1
  31. package/dist/crypto/CryptoOps.mjs +1 -1
  32. package/dist/crypto/PkceGenerator.mjs +1 -1
  33. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  34. package/dist/crypto/TokenBindingKeyManager.mjs +14 -1
  35. package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -1
  36. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  37. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  38. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +14 -2
  39. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  40. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  57. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
  58. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +1 -1
  59. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +1 -1
  60. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +1 -1
  61. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +68 -0
  62. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs.map +1 -0
  63. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +3 -2
  64. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  65. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +87 -0
  66. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -0
  67. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +5 -3
  68. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
  69. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -2
  70. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  71. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
  72. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
  73. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +4 -3
  74. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  75. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  76. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  77. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  78. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  79. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  80. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  81. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  82. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  83. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  84. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  85. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  86. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  87. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  88. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  89. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  90. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  91. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  92. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  93. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  94. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  95. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  96. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  97. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +246 -73
  98. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  99. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +1 -1
  100. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -2
  101. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
  102. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  109. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  110. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  111. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +10 -2
  112. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  113. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
  114. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +118 -25
  115. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
  117. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +2 -2
  119. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +2 -12
  122. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
  123. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +2 -1
  124. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
  125. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  126. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  127. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +17 -3
  128. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
  129. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +9 -3
  130. package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
  131. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  132. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  133. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  134. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  135. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  136. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  137. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  138. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  139. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  140. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  141. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  142. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  143. package/dist/custom_auth/index.mjs +3 -1
  144. package/dist/custom_auth/index.mjs.map +1 -1
  145. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  146. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  147. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  148. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  149. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  150. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  151. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  152. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  153. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  154. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  155. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  156. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +32 -13
  157. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  158. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  159. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  160. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  161. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  162. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  163. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  164. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  165. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  166. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  167. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  168. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  169. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  170. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  171. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +14 -2
  172. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
  173. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +1 -1
  174. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +1 -1
  175. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  176. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  177. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  178. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  179. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  180. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  181. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  182. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  183. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  184. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  185. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  186. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  187. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  188. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  189. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -1
  190. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
  191. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +9 -2
  193. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
  194. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  195. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  196. package/dist/encode/Base64Decode.mjs +1 -1
  197. package/dist/encode/Base64Encode.mjs +1 -1
  198. package/dist/error/BrowserAuthError.mjs +1 -1
  199. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  200. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  201. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  202. package/dist/error/NativeAuthError.mjs +1 -1
  203. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  204. package/dist/error/NestedAppAuthError.mjs +1 -1
  205. package/dist/event/EventHandler.mjs +1 -1
  206. package/dist/event/EventMessage.mjs +1 -1
  207. package/dist/event/EventType.mjs +1 -1
  208. package/dist/index.mjs +1 -1
  209. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  210. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  211. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +504 -75
  212. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  213. package/dist/interaction_client/PopupClient.mjs +27 -20
  214. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  215. package/dist/interaction_client/RedirectClient.mjs +29 -14
  216. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  217. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  218. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  219. package/dist/interaction_client/SilentIframeClient.mjs +44 -32
  220. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  221. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  222. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  223. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  224. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  225. package/dist/log-strings-mapping.json +59 -19
  226. package/dist/naa/BridgeError.mjs +1 -1
  227. package/dist/naa/BridgeProxy.mjs +1 -1
  228. package/dist/naa/BridgeStatusCode.mjs +1 -1
  229. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  230. package/dist/navigation/NavigationClient.mjs +1 -1
  231. package/dist/network/FetchClient.mjs +1 -1
  232. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  233. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  234. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  235. package/dist/packageMetadata.mjs +2 -2
  236. package/dist/popup_relay/constants.mjs +1 -1
  237. package/dist/popup_relay/index.mjs +1 -1
  238. package/dist/popup_relay/relayClient.mjs +1 -1
  239. package/dist/protocol/Authorize.mjs +21 -13
  240. package/dist/protocol/Authorize.mjs.map +1 -1
  241. package/dist/redirect_bridge/index.mjs +1 -1
  242. package/dist/request/RequestHelpers.mjs +35 -11
  243. package/dist/request/RequestHelpers.mjs.map +1 -1
  244. package/dist/request/SilentRequestHelpers.mjs +6 -6
  245. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  246. package/dist/response/ResponseHandler.mjs +1 -1
  247. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  248. package/dist/telemetry/BrowserPerformanceEvents.mjs +3 -2
  249. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  250. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  251. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  252. package/dist/utils/BrowserConstants.mjs +1 -1
  253. package/dist/utils/BrowserDetection.mjs +1 -1
  254. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  255. package/dist/utils/BrowserUtils.mjs +1 -1
  256. package/dist/utils/Helpers.mjs +1 -1
  257. package/dist/utils/IframeMonitor.mjs +1 -1
  258. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  259. package/dist/utils/PopupMonitor.mjs +1 -1
  260. package/dist/utils/PopupOriginCheck.mjs +1 -1
  261. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  262. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  263. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  264. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  265. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  266. package/dist/webBrokerBridge/index.mjs +1 -1
  267. package/lib/custom-auth-path/log-strings-mapping.json +51 -11
  268. package/lib/custom-auth-path/msal-custom-auth.cjs +1563 -424
  269. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  270. package/lib/custom-auth-path/msal-custom-auth.js +1563 -424
  271. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  272. package/lib/log-strings-mapping.json +19 -11
  273. package/lib/msal-browser.cjs +914 -259
  274. package/lib/msal-browser.cjs.map +1 -1
  275. package/lib/msal-browser.js +914 -259
  276. package/lib/msal-browser.js.map +1 -1
  277. package/lib/msal-browser.min.js +2 -2
  278. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  279. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  280. package/lib/popup-relay/msal-popup-relay.js +2 -2
  281. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  282. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  283. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  284. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  285. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  286. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  287. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  288. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  289. package/package.json +2 -2
  290. package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +15 -0
  291. package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +6 -21
  292. package/src/broker/nativeBroker/PlatformAuthProvider.ts +3 -1
  293. package/src/broker/nativeBroker/PlatformAuthRequest.ts +12 -8
  294. package/src/broker/nativeBroker/PlatformAuthResponse.ts +31 -0
  295. package/src/cache/AsyncMemoryStorage.ts +16 -0
  296. package/src/cache/BrowserCacheManager.ts +19 -1
  297. package/src/controllers/StandardController.ts +107 -11
  298. package/src/crypto/TokenBindingKeyManager.ts +21 -0
  299. package/src/custom_auth/controller/CustomAuthStandardController.ts +18 -0
  300. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +15 -0
  301. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +23 -0
  302. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +26 -0
  303. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +1 -1
  304. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +2 -0
  305. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +94 -0
  306. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +7 -2
  307. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +132 -0
  308. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +8 -2
  309. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +18 -0
  310. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +13 -0
  311. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +8 -2
  312. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +1 -0
  313. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +445 -91
  314. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +25 -0
  315. package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +34 -0
  316. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +9 -0
  317. package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +262 -43
  318. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +4 -7
  319. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +21 -0
  320. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +41 -2
  321. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +44 -19
  322. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +4 -6
  323. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +6 -1
  324. package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +25 -1
  325. package/src/custom_auth/core/telemetry/PublicApiId.ts +6 -0
  326. package/src/custom_auth/index.ts +11 -0
  327. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
  328. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +47 -15
  329. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -0
  330. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -0
  331. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +18 -0
  332. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -0
  333. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +13 -0
  334. package/src/interaction_client/PlatformAuthInteractionClient.ts +851 -128
  335. package/src/interaction_client/PopupClient.ts +104 -83
  336. package/src/interaction_client/RedirectClient.ts +88 -34
  337. package/src/interaction_client/SilentIframeClient.ts +121 -95
  338. package/src/packageMetadata.ts +1 -1
  339. package/src/protocol/Authorize.ts +46 -18
  340. package/src/request/RequestHelpers.ts +64 -11
  341. package/src/request/SilentRequestHelpers.ts +8 -9
  342. package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
  343. package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
  344. package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
  345. package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  346. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +6 -1
  347. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
  348. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +21 -0
  349. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
  350. package/types/cache/AsyncMemoryStorage.d.ts +5 -0
  351. package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
  352. package/types/cache/BrowserCacheManager.d.ts +4 -0
  353. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  354. package/types/controllers/StandardController.d.ts +5 -0
  355. package/types/controllers/StandardController.d.ts.map +1 -1
  356. package/types/crypto/TokenBindingKeyManager.d.ts +9 -0
  357. package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -1
  358. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  359. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  360. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +11 -0
  361. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -0
  362. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +14 -0
  363. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts.map +1 -0
  364. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +15 -0
  365. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -0
  366. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +1 -1
  367. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +2 -1
  368. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  369. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +22 -0
  370. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts.map +1 -0
  371. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  372. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +28 -0
  373. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -0
  374. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +3 -2
  375. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
  376. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  377. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -0
  378. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  379. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  380. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -0
  381. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  382. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -5
  383. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  384. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +17 -0
  385. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  386. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +18 -2
  387. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
  388. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +8 -0
  389. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  390. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +8 -2
  391. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
  392. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +3 -3
  393. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  394. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +12 -0
  395. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  396. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +29 -2
  397. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  398. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +30 -17
  399. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
  400. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +3 -1
  401. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
  402. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +3 -2
  403. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
  404. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +6 -1
  405. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
  406. package/types/custom_auth/core/telemetry/PublicApiId.d.ts +6 -0
  407. package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
  408. package/types/custom_auth/index.d.ts +5 -0
  409. package/types/custom_auth/index.d.ts.map +1 -1
  410. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
  411. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  412. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +4 -4
  413. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  414. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +2 -1
  415. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  416. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +2 -1
  417. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
  418. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
  419. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +2 -1
  420. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  421. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
  422. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +106 -5
  423. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  424. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  425. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  426. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  427. package/types/packageMetadata.d.ts +1 -1
  428. package/types/protocol/Authorize.d.ts +4 -4
  429. package/types/protocol/Authorize.d.ts.map +1 -1
  430. package/types/request/RequestHelpers.d.ts +21 -3
  431. package/types/request/RequestHelpers.d.ts.map +1 -1
  432. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  433. package/types/telemetry/BrowserPerformanceEvents.d.ts +1 -0
  434. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
@@ -1,8 +1,8 @@
1
- /*! @azure/msal-browser v5.27.0 2026-10-27 */
1
+ /*! @azure/msal-browser v5.28.0 2026-11-05 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6
6
  /*
7
7
  * Copyright (c) Microsoft Corporation. All rights reserved.
8
8
  * Licensed under the MIT License.
@@ -62,7 +62,7 @@ const ATTRIBUTE_TOKENS = "attribute_tokens";
62
62
  */
63
63
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
64
64
 
65
- /*! @azure/msal-common v16.15.0 2026-10-27 */
65
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
66
66
  /*
67
67
  * Copyright (c) Microsoft Corporation. All rights reserved.
68
68
  * Licensed under the MIT License.
@@ -301,7 +301,7 @@ const JsonWebTokenTypes$1 = {
301
301
  // Token renewal offset default in seconds
302
302
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
303
303
 
304
- /*! @azure/msal-common v16.15.0 2026-10-27 */
304
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
305
305
  /*
306
306
  * Copyright (c) Microsoft Corporation. All rights reserved.
307
307
  * Licensed under the MIT License.
@@ -330,7 +330,7 @@ function createAuthError(code, correlationId, additionalMessage) {
330
330
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
331
331
  }
332
332
 
333
- /*! @azure/msal-common v16.15.0 2026-10-27 */
333
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
334
334
 
335
335
  /*
336
336
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -353,7 +353,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
353
353
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
354
354
  }
355
355
 
356
- /*! @azure/msal-common v16.15.0 2026-10-27 */
356
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
357
357
  /*
358
358
  * Copyright (c) Microsoft Corporation. All rights reserved.
359
359
  * Licensed under the MIT License.
@@ -439,7 +439,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
439
439
  userCanceled: userCanceled
440
440
  });
441
441
 
442
- /*! @azure/msal-common v16.15.0 2026-10-27 */
442
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
443
443
 
444
444
  /*
445
445
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -477,7 +477,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
477
477
  };
478
478
  }
479
479
 
480
- /*! @azure/msal-common v16.15.0 2026-10-27 */
480
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
481
481
 
482
482
  /*
483
483
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -543,7 +543,7 @@ function getJWSPayload(authToken, correlationId) {
543
543
  return matches[2];
544
544
  }
545
545
 
546
- /*! @azure/msal-common v16.15.0 2026-10-27 */
546
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
547
547
 
548
548
  /*
549
549
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -631,7 +631,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
631
631
  return updatedAccountInfo;
632
632
  }
633
633
 
634
- /*! @azure/msal-common v16.15.0 2026-10-27 */
634
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
635
635
  /*
636
636
  * Copyright (c) Microsoft Corporation. All rights reserved.
637
637
  * Licensed under the MIT License.
@@ -645,7 +645,7 @@ const AuthorityType = {
645
645
  Ciam: 3,
646
646
  };
647
647
 
648
- /*! @azure/msal-common v16.15.0 2026-10-27 */
648
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
649
649
  /*
650
650
  * Copyright (c) Microsoft Corporation. All rights reserved.
651
651
  * Licensed under the MIT License.
@@ -667,7 +667,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
667
667
  return null;
668
668
  }
669
669
 
670
- /*! @azure/msal-common v16.15.0 2026-10-27 */
670
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
671
671
  /*
672
672
  * Copyright (c) Microsoft Corporation. All rights reserved.
673
673
  * Licensed under the MIT License.
@@ -691,7 +691,7 @@ const ProtocolMode = {
691
691
  EAR: "EAR",
692
692
  };
693
693
 
694
- /*! @azure/msal-common v16.15.0 2026-10-27 */
694
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
695
695
  /**
696
696
  * Returns the AccountInfo interface for this account.
697
697
  * @internal
@@ -880,7 +880,7 @@ function isAccountEntity(entity) {
880
880
  entity.hasOwnProperty("authorityType"));
881
881
  }
882
882
 
883
- /*! @azure/msal-common v16.15.0 2026-10-27 */
883
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
884
884
  /*
885
885
  * Copyright (c) Microsoft Corporation. All rights reserved.
886
886
  * Licensed under the MIT License.
@@ -897,7 +897,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
897
897
  unexpectedError: unexpectedError
898
898
  });
899
899
 
900
- /*! @azure/msal-common v16.15.0 2026-10-27 */
900
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
901
901
 
902
902
  /*
903
903
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -917,7 +917,7 @@ function createClientConfigurationError(errorCode, correlationId) {
917
917
  return new ClientConfigurationError(errorCode, correlationId);
918
918
  }
919
919
 
920
- /*! @azure/msal-common v16.15.0 2026-10-27 */
920
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
921
921
  /*
922
922
  * Copyright (c) Microsoft Corporation. All rights reserved.
923
923
  * Licensed under the MIT License.
@@ -957,7 +957,7 @@ function getResponseHeader(headers, name) {
957
957
  return headerName === undefined ? undefined : headers[headerName];
958
958
  }
959
959
 
960
- /*! @azure/msal-common v16.15.0 2026-10-27 */
960
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
961
961
  /*
962
962
  * Copyright (c) Microsoft Corporation. All rights reserved.
963
963
  * Licensed under the MIT License.
@@ -1027,7 +1027,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
1027
1027
  urlParseError: urlParseError
1028
1028
  });
1029
1029
 
1030
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1030
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1031
1031
 
1032
1032
  /*
1033
1033
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1086,7 +1086,7 @@ class AuthenticationHeaderParser {
1086
1086
  }
1087
1087
  }
1088
1088
 
1089
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1089
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1090
1090
  /*
1091
1091
  * Copyright (c) Microsoft Corporation. All rights reserved.
1092
1092
  * Licensed under the MIT License.
@@ -1098,7 +1098,7 @@ function isOpenIdConfigResponse(response) {
1098
1098
  response.hasOwnProperty("jwks_uri"));
1099
1099
  }
1100
1100
 
1101
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1101
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1102
1102
  /*
1103
1103
  * Copyright (c) Microsoft Corporation. All rights reserved.
1104
1104
  * Licensed under the MIT License.
@@ -1178,7 +1178,7 @@ class StringUtils {
1178
1178
  }
1179
1179
  }
1180
1180
 
1181
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1181
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1182
1182
 
1183
1183
  /*
1184
1184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1336,7 +1336,7 @@ class UrlString {
1336
1336
  }
1337
1337
  }
1338
1338
 
1339
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1339
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1340
1340
 
1341
1341
  /*
1342
1342
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1490,7 +1490,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1490
1490
  return null;
1491
1491
  }
1492
1492
 
1493
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1493
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1494
1494
  /*
1495
1495
  * Copyright (c) Microsoft Corporation. All rights reserved.
1496
1496
  * Licensed under the MIT License.
@@ -1508,7 +1508,7 @@ const AzureCloudInstance = {
1508
1508
  AzureUsGovernment: "https://login.microsoftonline.us",
1509
1509
  };
1510
1510
 
1511
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1511
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1512
1512
  /*
1513
1513
  * Copyright (c) Microsoft Corporation. All rights reserved.
1514
1514
  * Licensed under the MIT License.
@@ -1518,7 +1518,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1518
1518
  response.hasOwnProperty("metadata"));
1519
1519
  }
1520
1520
 
1521
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1521
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1522
1522
  /*
1523
1523
  * Copyright (c) Microsoft Corporation. All rights reserved.
1524
1524
  * Licensed under the MIT License.
@@ -1528,7 +1528,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1528
1528
  response.hasOwnProperty("error_description"));
1529
1529
  }
1530
1530
 
1531
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1531
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1532
1532
  /*
1533
1533
  * Copyright (c) Microsoft Corporation. All rights reserved.
1534
1534
  * Licensed under the MIT License.
@@ -1599,7 +1599,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1599
1599
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1600
1600
  const SetUserData = "setUserData";
1601
1601
 
1602
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1602
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1603
1603
  /*
1604
1604
  * Copyright (c) Microsoft Corporation. All rights reserved.
1605
1605
  * Licensed under the MIT License.
@@ -1692,7 +1692,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1692
1692
  };
1693
1693
  };
1694
1694
 
1695
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1695
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1696
1696
 
1697
1697
  /*
1698
1698
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1803,7 +1803,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1803
1803
  },
1804
1804
  };
1805
1805
 
1806
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1806
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1807
1807
  /*
1808
1808
  * Copyright (c) Microsoft Corporation. All rights reserved.
1809
1809
  * Licensed under the MIT License.
@@ -1868,7 +1868,7 @@ function wasClockTurnedBack(cachedAt) {
1868
1868
  return cachedAtSec > nowSeconds();
1869
1869
  }
1870
1870
 
1871
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1871
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1872
1872
 
1873
1873
  /*
1874
1874
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2155,7 +2155,7 @@ function serializeAttributeTokens(attributeTokens) {
2155
2155
  return [...attributeTokens].sort().join(" ");
2156
2156
  }
2157
2157
 
2158
- /*! @azure/msal-common v16.15.0 2026-10-27 */
2158
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2159
2159
 
2160
2160
  /*
2161
2161
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3123,7 +3123,7 @@ function buildStaticAuthorityOptions(authOptions) {
3123
3123
  };
3124
3124
  }
3125
3125
 
3126
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3126
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3127
3127
 
3128
3128
  /*
3129
3129
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3157,7 +3157,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
3157
3157
  }
3158
3158
  }
3159
3159
 
3160
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3160
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3161
3161
 
3162
3162
  /*
3163
3163
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3353,7 +3353,7 @@ class ScopeSet {
3353
3353
  }
3354
3354
  }
3355
3355
 
3356
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3356
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3357
3357
 
3358
3358
  /*
3359
3359
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3853,7 +3853,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3853
3853
  }
3854
3854
  }
3855
3855
 
3856
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3856
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3857
3857
 
3858
3858
  /*
3859
3859
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3984,7 +3984,7 @@ function validateUrl(url, logger, correlationId) {
3984
3984
  }
3985
3985
  }
3986
3986
 
3987
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3987
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3988
3988
 
3989
3989
  /*
3990
3990
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4032,7 +4032,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
4032
4032
  },
4033
4033
  };
4034
4034
 
4035
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4035
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4036
4036
 
4037
4037
  /*
4038
4038
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4055,7 +4055,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
4055
4055
  },
4056
4056
  };
4057
4057
 
4058
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4058
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4059
4059
  /*
4060
4060
  * Copyright (c) Microsoft Corporation. All rights reserved.
4061
4061
  * Licensed under the MIT License.
@@ -4344,12 +4344,12 @@ class Logger {
4344
4344
  }
4345
4345
  }
4346
4346
 
4347
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4347
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4348
4348
  /* eslint-disable header/header */
4349
4349
  const name$1 = "@azure/msal-common";
4350
- const version$1 = "16.15.0";
4350
+ const version$1 = "16.16.0";
4351
4351
 
4352
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4352
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4353
4353
  /*
4354
4354
  * Copyright (c) Microsoft Corporation. All rights reserved.
4355
4355
  * Licensed under the MIT License.
@@ -4357,7 +4357,7 @@ const version$1 = "16.15.0";
4357
4357
  const cacheQuotaExceeded = "cache_quota_exceeded";
4358
4358
  const cacheErrorUnknown = "cache_error_unknown";
4359
4359
 
4360
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4360
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4361
4361
 
4362
4362
  /*
4363
4363
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4395,7 +4395,7 @@ function createCacheError(e) {
4395
4395
  }
4396
4396
  }
4397
4397
 
4398
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4398
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4399
4399
 
4400
4400
  /*
4401
4401
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4644,6 +4644,7 @@ class CacheManager {
4644
4644
  };
4645
4645
  const tokenKeys = this.getTokenKeys();
4646
4646
  const currentScopes = ScopeSet.fromString(credential.target, correlationId);
4647
+ const accessTokenKeysToRemove = [];
4647
4648
  tokenKeys.accessToken.forEach((key) => {
4648
4649
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
4649
4650
  return;
@@ -4653,10 +4654,13 @@ class CacheManager {
4653
4654
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
4654
4655
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
4655
4656
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
4656
- this.removeAccessToken(key, correlationId);
4657
+ accessTokenKeysToRemove.push(key);
4657
4658
  }
4658
4659
  }
4659
4660
  });
4661
+ for (const key of accessTokenKeysToRemove) {
4662
+ await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
4663
+ }
4660
4664
  await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4661
4665
  }
4662
4666
  /**
@@ -4892,12 +4896,32 @@ class CacheManager {
4892
4896
  * @param correlationId
4893
4897
  */
4894
4898
  removeAccessToken(key, correlationId) {
4899
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4900
+ if (credential) {
4901
+ void this.removeTokenBindingKeyForCredential(credential, correlationId);
4902
+ }
4903
+ }
4904
+ /**
4905
+ * Removes an access token and waits for any unreferenced token-binding key
4906
+ * cleanup. Internal callers that require deterministic cleanup should use
4907
+ * this method instead of the synchronous public cache contract.
4908
+ */
4909
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
4910
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4911
+ if (credential) {
4912
+ await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
4913
+ }
4914
+ }
4915
+ removeAccessTokenCredential(key, correlationId) {
4895
4916
  const credential = this.getAccessTokenCredential(key, correlationId);
4896
4917
  if (!credential) {
4897
- return;
4918
+ return null;
4898
4919
  }
4899
4920
  this.removeItem(key, correlationId);
4900
4921
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4922
+ return credential;
4923
+ }
4924
+ async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
4901
4925
  // Remove Token Binding Key from key store for token-bound access token credentials
4902
4926
  if (credential.credentialType.toLowerCase() ===
4903
4927
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
@@ -4907,19 +4931,28 @@ class CacheManager {
4907
4931
  case AuthenticationScheme$1.DPOP.toLowerCase(): {
4908
4932
  const accessTokenWithAuthSchemeEntity = credential;
4909
4933
  const kid = accessTokenWithAuthSchemeEntity.keyId;
4910
- if (kid) {
4911
- void this.tokenBindingKeyManager
4912
- .removeTokenBindingKey(kid, correlationId)
4913
- .catch(() => {
4934
+ if (kid &&
4935
+ kid !== preservedKeyId &&
4936
+ !this.isTokenBindingKeyReferenced(kid, correlationId)) {
4937
+ try {
4938
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
4939
+ }
4940
+ catch {
4914
4941
  this.commonLogger.error("0id34f", correlationId);
4915
4942
  this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4916
- });
4943
+ }
4917
4944
  }
4918
4945
  break;
4919
4946
  }
4920
4947
  }
4921
4948
  }
4922
4949
  }
4950
+ isTokenBindingKeyReferenced(keyId, correlationId) {
4951
+ return this.getTokenKeys().accessToken.some((accessTokenKey) => {
4952
+ const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
4953
+ return accessToken?.keyId === keyId;
4954
+ });
4955
+ }
4923
4956
  /**
4924
4957
  * Removes all app metadata objects from cache.
4925
4958
  */
@@ -5058,6 +5091,7 @@ class CacheManager {
5058
5091
  const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
5059
5092
  const authScheme = request.authenticationScheme ||
5060
5093
  AuthenticationScheme$1.BEARER;
5094
+ const normalizedAuthScheme = authScheme.toLowerCase();
5061
5095
  /*
5062
5096
  * Distinguish between Bearer and PoP/SSH token cache types
5063
5097
  * Cast to lowercase to handle "bearer" from ADFS
@@ -5083,7 +5117,10 @@ class CacheManager {
5083
5117
  tokenType: authScheme,
5084
5118
  keyId: authScheme === AuthenticationScheme$1.SSH
5085
5119
  ? request.sshKid
5086
- : undefined,
5120
+ : normalizedAuthScheme ===
5121
+ AuthenticationScheme$1.DPOP.toLowerCase()
5122
+ ? request.popKid || request.dpopJkt
5123
+ : undefined,
5087
5124
  additionalCacheKeyComponents: additionalCacheKeyComponents,
5088
5125
  };
5089
5126
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5583,7 +5620,7 @@ class DefaultStorageClass extends CacheManager {
5583
5620
  }
5584
5621
  }
5585
5622
 
5586
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5623
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5587
5624
  /*
5588
5625
  * Copyright (c) Microsoft Corporation. All rights reserved.
5589
5626
  * Licensed under the MIT License.
@@ -5648,7 +5685,7 @@ const IntFields = new Set([
5648
5685
  "fetchRetryCount",
5649
5686
  ]);
5650
5687
 
5651
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5688
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5652
5689
 
5653
5690
  /*
5654
5691
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5706,7 +5743,7 @@ class StubPerformanceClient {
5706
5743
  }
5707
5744
  }
5708
5745
 
5709
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5746
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5710
5747
 
5711
5748
  /*
5712
5749
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5804,7 +5841,7 @@ function isOidcProtocolMode(config) {
5804
5841
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5805
5842
  }
5806
5843
 
5807
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5844
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5808
5845
  /*
5809
5846
  * Copyright (c) Microsoft Corporation. All rights reserved.
5810
5847
  * Licensed under the MIT License.
@@ -5831,7 +5868,7 @@ function isOidcProtocolMode(config) {
5831
5868
  }
5832
5869
  }
5833
5870
 
5834
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5871
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5835
5872
 
5836
5873
  /*
5837
5874
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5852,7 +5889,7 @@ function createJoseHeaderError(code, correlationId) {
5852
5889
  return new JoseHeaderError(code, correlationId);
5853
5890
  }
5854
5891
 
5855
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5892
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5856
5893
  /*
5857
5894
  * Copyright (c) Microsoft Corporation. All rights reserved.
5858
5895
  * Licensed under the MIT License.
@@ -5877,7 +5914,7 @@ function isPlainObject(value) {
5877
5914
  return Object.getPrototypeOf(value) === proto;
5878
5915
  }
5879
5916
 
5880
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5917
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5881
5918
  /*
5882
5919
  * Copyright (c) Microsoft Corporation. All rights reserved.
5883
5920
  * Licensed under the MIT License.
@@ -5887,7 +5924,7 @@ const missingAlgError = "missing_alg_error";
5887
5924
  const missingJwkError = "missing_jwk_error";
5888
5925
  const invalidJwkError = "invalid_jwk_error";
5889
5926
 
5890
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5927
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5891
5928
 
5892
5929
  /*
5893
5930
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5953,7 +5990,7 @@ class JoseHeader {
5953
5990
  }
5954
5991
  }
5955
5992
 
5956
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5993
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5957
5994
 
5958
5995
  /*
5959
5996
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6054,7 +6091,7 @@ class PopTokenGenerator {
6054
6091
  }
6055
6092
  }
6056
6093
 
6057
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6094
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6058
6095
 
6059
6096
  /*
6060
6097
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6104,13 +6141,22 @@ function validateDpopNonce(nonce, correlationId) {
6104
6141
  throw createClientConfigurationError(invalidDpopNonce, correlationId);
6105
6142
  }
6106
6143
  }
6144
+ /**
6145
+ * Validates and normalizes the HTTP resource context for a DPoP-bound request.
6146
+ * @internal
6147
+ */
6148
+ function normalizeDpopResourceRequestContext(context, correlationId = "") {
6149
+ return {
6150
+ htm: normalizeHtm(context.htm, correlationId),
6151
+ htu: normalizeHtu(context.htu, correlationId),
6152
+ };
6153
+ }
6107
6154
  /**
6108
6155
  * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6109
6156
  * resource-endpoint proof bindings.
6110
6157
  *
6111
- * Not exported from any public package entry point.
6112
- * This helper is internal-only until DPoP is wired into acquisition flows
6113
- * in a subsequent work item.
6158
+ * Exported from package entry points for use by MSAL Browser.
6159
+ * This helper remains an unsupported internal API for direct consumers.
6114
6160
  *
6115
6161
  * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6116
6162
  * @internal
@@ -6165,10 +6211,11 @@ class DpopProofGenerator {
6165
6211
  */
6166
6212
  buildResourceProofClaims(params, correlationId = "") {
6167
6213
  validateDpopNonce(params.nonce, correlationId);
6214
+ const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
6168
6215
  const claims = {
6169
6216
  jti: this.cryptoUtils.createNewGuid(),
6170
- htm: normalizeHtm(params.htm, correlationId),
6171
- htu: normalizeHtu(params.htu, correlationId),
6217
+ htm: resourceContext.htm,
6218
+ htu: resourceContext.htu,
6172
6219
  ath: params.ath,
6173
6220
  iat: nowSeconds(),
6174
6221
  };
@@ -6199,7 +6246,7 @@ class DpopProofGenerator {
6199
6246
  }
6200
6247
  }
6201
6248
 
6202
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6249
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6203
6250
  /*
6204
6251
  * Copyright (c) Microsoft Corporation. All rights reserved.
6205
6252
  * Licensed under the MIT License.
@@ -6263,7 +6310,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
6263
6310
  uiNotAllowed: uiNotAllowed
6264
6311
  });
6265
6312
 
6266
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6313
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6267
6314
 
6268
6315
  /*
6269
6316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6330,7 +6377,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6330
6377
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6331
6378
  }
6332
6379
 
6333
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6380
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6334
6381
 
6335
6382
  /*
6336
6383
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6349,7 +6396,7 @@ class ServerError extends AuthError {
6349
6396
  }
6350
6397
  }
6351
6398
 
6352
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6399
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6353
6400
 
6354
6401
  /*
6355
6402
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6420,7 +6467,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6420
6467
  }
6421
6468
  }
6422
6469
 
6423
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6470
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6424
6471
 
6425
6472
  /*
6426
6473
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6848,7 +6895,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6848
6895
  return baseAccount;
6849
6896
  }
6850
6897
 
6851
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6898
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6852
6899
  /*
6853
6900
  * Copyright (c) Microsoft Corporation. All rights reserved.
6854
6901
  * Licensed under the MIT License.
@@ -6858,7 +6905,7 @@ const CcsCredentialType = {
6858
6905
  UPN: "UPN",
6859
6906
  };
6860
6907
 
6861
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6908
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6862
6909
  /*
6863
6910
  * Copyright (c) Microsoft Corporation. All rights reserved.
6864
6911
  * Licensed under the MIT License.
@@ -6877,7 +6924,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6877
6924
  }
6878
6925
  }
6879
6926
 
6880
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6927
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6881
6928
 
6882
6929
  /*
6883
6930
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6901,7 +6948,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6901
6948
  };
6902
6949
  }
6903
6950
 
6904
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6951
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6905
6952
 
6906
6953
  /*
6907
6954
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6991,7 +7038,7 @@ function getRetryAfterHeader(response) {
6991
7038
  return undefined;
6992
7039
  }
6993
7040
 
6994
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7041
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6995
7042
 
6996
7043
  /*
6997
7044
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7022,7 +7069,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
7022
7069
  return new NetworkError(error, httpStatus, responseHeaders);
7023
7070
  }
7024
7071
 
7025
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7072
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7026
7073
 
7027
7074
  /*
7028
7075
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7156,7 +7203,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
7156
7203
  return response;
7157
7204
  }
7158
7205
 
7159
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7206
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7160
7207
 
7161
7208
  /*
7162
7209
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7423,7 +7470,7 @@ class AuthorizationCodeClient {
7423
7470
  }
7424
7471
  }
7425
7472
 
7426
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7473
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7427
7474
 
7428
7475
  /*
7429
7476
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7653,7 +7700,7 @@ function extractLoginHint(account) {
7653
7700
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7654
7701
  }
7655
7702
 
7656
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7703
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7657
7704
 
7658
7705
  /*
7659
7706
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8202,7 +8249,7 @@ class PerformanceClient {
8202
8249
  }
8203
8250
  }
8204
8251
 
8205
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8252
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8206
8253
 
8207
8254
  /*
8208
8255
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8437,7 +8484,7 @@ class RefreshTokenClient {
8437
8484
  }
8438
8485
  }
8439
8486
 
8440
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8487
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8441
8488
 
8442
8489
  /*
8443
8490
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8730,7 +8777,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
8730
8777
  clearNativeBrokerErrorCode() { }
8731
8778
  }
8732
8779
 
8733
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8780
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8734
8781
 
8735
8782
  /*
8736
8783
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8857,7 +8904,7 @@ class SilentFlowClient {
8857
8904
  }
8858
8905
  }
8859
8906
 
8860
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8907
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8861
8908
 
8862
8909
  /*
8863
8910
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8873,7 +8920,7 @@ const StubbedNetworkModule = {
8873
8920
  },
8874
8921
  };
8875
8922
 
8876
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8923
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8877
8924
 
8878
8925
  /*
8879
8926
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9022,6 +9069,7 @@ const PlatformAuthInteractionClientInitializeRequest = "platformAuthInteractionC
9022
9069
  const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
9023
9070
  const PlatformAuthCacheAccount = "platformAuthCacheAccount";
9024
9071
  const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
9072
+ const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
9025
9073
  const RemoveHiddenIframe = "removeHiddenIframe";
9026
9074
  const ImportExistingCache = "importExistingCache";
9027
9075
  /**
@@ -10582,6 +10630,19 @@ class AsyncMemoryStorage {
10582
10630
  return cacheKeys;
10583
10631
  }
10584
10632
  }
10633
+ /**
10634
+ * Returns whether a key is available in persistent storage. Unlike
10635
+ * containsKey, this does not consult the in-memory fallback.
10636
+ */
10637
+ async containsKeyInPersistentStorage(key, correlationId) {
10638
+ try {
10639
+ return await this.indexedDBCache.containsKey(key);
10640
+ }
10641
+ catch (e) {
10642
+ this.handleDatabaseAccessError(e, correlationId);
10643
+ return false;
10644
+ }
10645
+ }
10585
10646
  /**
10586
10647
  * Returns true or false if the given key is present in the cache.
10587
10648
  * @param key
@@ -10687,6 +10748,12 @@ class TokenBindingKeyManager {
10687
10748
  throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10688
10749
  }
10689
10750
  }
10751
+ /**
10752
+ * Returns whether a browser token-binding key is available.
10753
+ */
10754
+ async hasTokenBindingKey(keyId, correlationId) {
10755
+ return this.cache.containsKey(keyId, correlationId);
10756
+ }
10690
10757
  /**
10691
10758
  * Clears browser token-binding keys from memory and persistent storage.
10692
10759
  * @param correlationId - Request correlation identifier.
@@ -10748,6 +10815,13 @@ class TokenBindingKeyManager {
10748
10815
  }
10749
10816
  return cachedKeyPair;
10750
10817
  }
10818
+ /**
10819
+ * Returns whether a browser token-binding key survived in persistent
10820
+ * storage and can be restored after a redirect navigation.
10821
+ */
10822
+ async isTokenBindingKeyPersisted(keyId, correlationId) {
10823
+ return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
10824
+ }
10751
10825
  /** @internal */
10752
10826
  getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10753
10827
  return {
@@ -11581,7 +11655,7 @@ const EventType = {
11581
11655
 
11582
11656
  /* eslint-disable header/header */
11583
11657
  const name = "@azure/msal-browser";
11584
- const version = "5.27.0";
11658
+ const version = "5.28.0";
11585
11659
 
11586
11660
  /*
11587
11661
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12213,7 +12287,7 @@ class BrowserCacheManager extends CacheManager {
12213
12287
  throw cacheError;
12214
12288
  }
12215
12289
  // When cache quota is exceeded, start removing access tokens until we can successfully set the item
12216
- this.removeAccessToken(accessTokenKeys[i], correlationId, false // Don't save token keys yet, do it at the end
12290
+ await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
12217
12291
  );
12218
12292
  }
12219
12293
  else {
@@ -12355,6 +12429,13 @@ class BrowserCacheManager extends CacheManager {
12355
12429
  super.removeAccessToken(key, correlationId);
12356
12430
  updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
12357
12431
  }
12432
+ /**
12433
+ * Removes an access token and awaits token-binding key cleanup.
12434
+ */
12435
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
12436
+ await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
12437
+ updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
12438
+ }
12358
12439
  /**
12359
12440
  * Remove access token key from the key map
12360
12441
  * @param key
@@ -13468,19 +13549,13 @@ function validateDpopRequest(request, correlationId) {
13468
13549
  }
13469
13550
  /**
13470
13551
  * Resolves the token-binding parameters needed before building authorize or token requests.
13471
- * Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
13472
- * a reqCnf confirmation claim. Requests that do not require request-time token binding return
13473
- * no additional parameters.
13552
+ * DPoP requests provision a browser key for token endpoint redemption. Platform broker
13553
+ * authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
13554
+ * /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
13474
13555
  */
13475
13556
  async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
13476
13557
  switch (request.authenticationScheme) {
13477
13558
  case AuthenticationScheme$1.DPOP:
13478
- if (request.platformBroker) {
13479
- return {};
13480
- }
13481
- if (request.dpopJkt) {
13482
- return { dpopJkt: request.dpopJkt };
13483
- }
13484
13559
  return {
13485
13560
  dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
13486
13561
  tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
@@ -13503,6 +13578,36 @@ async function getTokenBindingRequestParams(request, tokenBindingKeyManager, log
13503
13578
  return {};
13504
13579
  }
13505
13580
  }
13581
+ /**
13582
+ * Removes a DPoP key that was provisioned for an authorization attempt which
13583
+ * did not complete. Cleanup failures are recorded without replacing the
13584
+ * original authorization error.
13585
+ */
13586
+ async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
13587
+ if (request.authenticationScheme !== AuthenticationScheme$1.DPOP ||
13588
+ !request.dpopJkt) {
13589
+ return;
13590
+ }
13591
+ try {
13592
+ await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
13593
+ }
13594
+ catch {
13595
+ logger.error("1su7ne", request.correlationId);
13596
+ performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
13597
+ }
13598
+ }
13599
+ /**
13600
+ * Returns whether an MSAL-owned DPoP key is available in persistent storage
13601
+ * before a redirect navigation. Custom managers without a persistence probe
13602
+ * retain their existing behavior.
13603
+ */
13604
+ async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
13605
+ const keyId = request.dpopJkt ?? request.keyId;
13606
+ if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
13607
+ return true;
13608
+ }
13609
+ return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
13610
+ }
13506
13611
  /**
13507
13612
  * Initializer function for all request APIs
13508
13613
  * @param request
@@ -14190,12 +14295,26 @@ class InteractionHandler {
14190
14295
  * Copyright (c) Microsoft Corporation. All rights reserved.
14191
14296
  * Licensed under the MIT License.
14192
14297
  */
14298
+ /**
14299
+ * Key storage enclaves supported by the platform broker.
14300
+ */
14301
+ const PlatformAuthEnclave = {
14302
+ /**
14303
+ * Persisted software key using MS_KEY_STORAGE_PROVIDER.
14304
+ */
14305
+ SOFTWARE: "sw"};
14193
14306
  /**
14194
14307
  * Token types supported by the platform broker request contract.
14195
14308
  */
14196
14309
  const PlatformAuthTokenType = {
14197
14310
  DPOP_WITH_PROOF: "dpop+proof",
14198
14311
  };
14312
+ /**
14313
+ * Token binding preferences supported by the platform broker.
14314
+ */
14315
+ const PlatformAuthBindingPreference = {
14316
+ ATTESTED: "attested",
14317
+ };
14199
14318
  const PROOF_OF_POSSESSION_TOKEN_TYPES = [
14200
14319
  AuthenticationScheme$1.POP,
14201
14320
  AuthenticationScheme$1.DPOP,
@@ -14211,19 +14330,19 @@ function isProofOfPossessionTokenType(tokenType) {
14211
14330
  /**
14212
14331
  * Adds canonical proof request fields to the broker no-cache property bag.
14213
14332
  */
14214
- function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
14215
- if (!isProofOfPossessionRequest) {
14216
- return extraParametersNoCache;
14333
+ function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
14334
+ if (!isProofOfPossessionTokenType(tokenType)) {
14335
+ return undefined;
14217
14336
  }
14218
14337
  return {
14219
- ...extraParametersNoCache,
14220
14338
  ...(resourceRequestMethod && {
14221
14339
  pop_method: resourceRequestMethod,
14222
14340
  }),
14223
14341
  ...(resourceRequestUri && {
14224
14342
  pop_url: resourceRequestUri,
14225
14343
  }),
14226
- ...(dpopNonce && {
14344
+ ...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
14345
+ dpopNonce && {
14227
14346
  pop_nonce: dpopNonce,
14228
14347
  }),
14229
14348
  };
@@ -14371,6 +14490,7 @@ class SilentCacheClient extends StandardInteractionClient {
14371
14490
  * Copyright (c) Microsoft Corporation. All rights reserved.
14372
14491
  * Licensed under the MIT License.
14373
14492
  */
14493
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
14374
14494
  class PlatformAuthInteractionClient extends BaseInteractionClient {
14375
14495
  constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
14376
14496
  super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
@@ -14429,17 +14549,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14429
14549
  throw e;
14430
14550
  }
14431
14551
  // check if the tokens can be retrieved from internal cache
14552
+ let cachedResult;
14432
14553
  try {
14433
- const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
14434
- // Served from the native internal cache; token did not come directly from the broker
14435
- nativeATMeasurement.add({
14436
- isNativeBroker: false,
14437
- });
14438
- nativeATMeasurement.end({
14439
- success: true,
14440
- fromCache: true,
14441
- });
14442
- return result;
14554
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
14443
14555
  }
14444
14556
  catch (e) {
14445
14557
  if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
@@ -14450,13 +14562,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14450
14562
  nativeATMeasurement.end({
14451
14563
  success: false,
14452
14564
  });
14565
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14453
14566
  throw e;
14454
14567
  }
14455
14568
  // continue with a native call for any and all errors
14456
14569
  this.logger.info("0957j1", this.correlationId);
14457
14570
  }
14571
+ if (cachedResult) {
14572
+ // Served from the native internal cache; token did not come directly from the broker
14573
+ nativeATMeasurement.add({
14574
+ isNativeBroker: false,
14575
+ });
14576
+ nativeATMeasurement.end({
14577
+ success: true,
14578
+ fromCache: true,
14579
+ });
14580
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
14581
+ return cachedResult;
14582
+ }
14458
14583
  // dispatch the request to the broker
14459
14584
  try {
14585
+ await this.prepareDpopBrokerRequest(nativeRequest);
14586
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
14460
14587
  const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
14461
14588
  const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
14462
14589
  nativeATMeasurement.end({
@@ -14474,6 +14601,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14474
14601
  success: false,
14475
14602
  }, e);
14476
14603
  this.setBrokerErrorTelemetry(e);
14604
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14477
14605
  throw e;
14478
14606
  }
14479
14607
  }
@@ -14508,6 +14636,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14508
14636
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
14509
14637
  account: cachedAccount,
14510
14638
  forceRefresh: false,
14639
+ ...this.createSilentCacheTokenBindingParameters(request),
14511
14640
  resource: request.extraParameters?.resource,
14512
14641
  };
14513
14642
  // Preserve FMI partition semantics for silent cache filtering.
@@ -14516,6 +14645,29 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14516
14645
  }
14517
14646
  return silentRequest;
14518
14647
  }
14648
+ /**
14649
+ * Maps platform-broker token-binding state to silent-cache request fields.
14650
+ * @param request
14651
+ */
14652
+ createSilentCacheTokenBindingParameters(request) {
14653
+ const authenticationScheme = this.isDpopBrokerRequest(request)
14654
+ ? AuthenticationScheme$1.DPOP
14655
+ : request.tokenType;
14656
+ if (authenticationScheme !== AuthenticationScheme$1.DPOP &&
14657
+ authenticationScheme !== AuthenticationScheme$1.POP) {
14658
+ return { authenticationScheme };
14659
+ }
14660
+ return {
14661
+ authenticationScheme,
14662
+ ...(authenticationScheme === AuthenticationScheme$1.DPOP &&
14663
+ request.keyId && { dpopJkt: request.keyId }),
14664
+ ...(authenticationScheme === AuthenticationScheme$1.POP &&
14665
+ request.signPopToken === false &&
14666
+ request.keyId && { popKid: request.keyId }),
14667
+ resourceRequestMethod: request.resourceRequestMethod,
14668
+ resourceRequestUri: request.resourceRequestUri,
14669
+ };
14670
+ }
14519
14671
  /**
14520
14672
  * Fetches the tokens from the cache if un-expired
14521
14673
  * @param nativeAccountId
@@ -14564,10 +14716,22 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14564
14716
  const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
14565
14717
  const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
14566
14718
  try {
14567
- await this.platformAuthProvider.sendMessage(nativeRequest);
14719
+ await this.prepareDpopBrokerRequest(nativeRequest);
14720
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
14721
+ const response = await this.platformAuthProvider.sendMessage(nativeRequest);
14722
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
14723
+ if (dpopBrokerOutcome === "L3") {
14724
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
14725
+ }
14568
14726
  }
14569
14727
  catch (e) {
14570
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
14728
+ /*
14729
+ * Raw persistent/transient broker errors are retrieved again in
14730
+ * phase two. Availability errors are thrown for controller-managed
14731
+ * web fallback, while translated cancellation, network, and
14732
+ * interaction-required errors are surfaced without being swallowed.
14733
+ */
14734
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14571
14735
  if (e instanceof NativeAuthError) {
14572
14736
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
14573
14737
  serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
@@ -14582,6 +14746,16 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14582
14746
  throw e;
14583
14747
  }
14584
14748
  }
14749
+ else if (this.isDpopBrokerRequest(nativeRequest)) {
14750
+ throw e;
14751
+ }
14752
+ }
14753
+ try {
14754
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
14755
+ }
14756
+ catch (e) {
14757
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14758
+ throw e;
14585
14759
  }
14586
14760
  this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
14587
14761
  ...nativeRequest,
@@ -14596,7 +14770,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14596
14770
  ? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
14597
14771
  : getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
14598
14772
  rootMeasurement.end({ success: true });
14599
- await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
14773
+ try {
14774
+ await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
14775
+ }
14776
+ catch (e) {
14777
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
14778
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14779
+ throw e;
14780
+ }
14600
14781
  }
14601
14782
  /**
14602
14783
  * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
@@ -14629,6 +14810,8 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14629
14810
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
14630
14811
  const reqTimestamp = nowSeconds();
14631
14812
  try {
14813
+ await this.prepareDpopBrokerRequest(request, true);
14814
+ this.addDpopBrokerAttemptTelemetry(request);
14632
14815
  this.logger.verbose("003x5a", this.correlationId);
14633
14816
  const response = await this.platformAuthProvider.sendMessage(request);
14634
14817
  const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
@@ -14637,7 +14820,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14637
14820
  return authResult;
14638
14821
  }
14639
14822
  catch (e) {
14823
+ if (e instanceof NativeAuthError) {
14824
+ const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
14825
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
14826
+ }
14640
14827
  this.setBrokerErrorTelemetry(e);
14828
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
14641
14829
  throw e;
14642
14830
  }
14643
14831
  }
@@ -14657,6 +14845,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14657
14845
  */
14658
14846
  async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
14659
14847
  this.logger.trace("1bojln", this.correlationId);
14848
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
14660
14849
  // generate identifiers
14661
14850
  const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
14662
14851
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
@@ -14682,10 +14871,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14682
14871
  response.expires_in = Number(response.expires_in);
14683
14872
  // generate authenticationResult
14684
14873
  const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
14874
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
14685
14875
  // cache accounts and tokens in the appropriate storage
14686
- await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims));
14876
+ const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
14877
+ (this.isDpopBrokerRequest(request) &&
14878
+ storeInCache?.accessToken === false);
14879
+ if (shouldRemoveGeneratedDpopKey) {
14880
+ await this.resetGeneratedDpopRequestKey(request);
14881
+ }
14882
+ await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
14687
14883
  await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
14688
- storeInCache);
14884
+ storeInCache, dpopBrokerOutcome);
14689
14885
  return result;
14690
14886
  }
14691
14887
  /**
@@ -14761,7 +14957,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14761
14957
  */
14762
14958
  async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
14763
14959
  // Add Native Broker fields to Telemetry
14764
- const mats = this.addTelemetryFromNativeResponse(response.properties.MATS);
14960
+ const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
14765
14961
  // If scopes not returned in server response, use request scopes
14766
14962
  const responseScopes = this.generateScopes(request.scope, response.scope);
14767
14963
  const accountProperties = response.account.properties || {};
@@ -14787,9 +14983,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14787
14983
  }
14788
14984
  // generate PoP token as needed
14789
14985
  const responseAccessToken = await this.generatePopAccessToken(response, request);
14790
- const tokenType = request.tokenType === AuthenticationScheme$1.POP
14791
- ? AuthenticationScheme$1.POP
14792
- : AuthenticationScheme$1.BEARER;
14986
+ const isDpopRequest = this.isDpopBrokerRequest(request);
14987
+ let tokenType = AuthenticationScheme$1.BEARER;
14988
+ if (isDpopRequest) {
14989
+ tokenType = AuthenticationScheme$1.DPOP;
14990
+ }
14991
+ else if (request.tokenType === AuthenticationScheme$1.POP) {
14992
+ tokenType = AuthenticationScheme$1.POP;
14993
+ }
14994
+ const dpopProof = isDpopRequest
14995
+ ? await this.generateDpopProof(response, request)
14996
+ : undefined;
14793
14997
  const result = {
14794
14998
  authority: authority,
14795
14999
  uniqueId: uid,
@@ -14803,6 +15007,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14803
15007
  // Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
14804
15008
  expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
14805
15009
  tokenType: tokenType,
15010
+ dpopProof,
14806
15011
  correlationId: this.correlationId,
14807
15012
  state: response.state,
14808
15013
  fromPlatformBroker: true,
@@ -14816,11 +15021,13 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14816
15021
  * cache the account entity in browser storage
14817
15022
  * @param accountEntity
14818
15023
  */
14819
- async cacheAccount(accountEntity, kmsi) {
15024
+ async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
14820
15025
  // Store the account info and hence `nativeAccountId` in browser cache
14821
15026
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
14822
15027
  // Remove any existing cached tokens for this account in browser storage
14823
- this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
15028
+ if (clearExistingTokens) {
15029
+ this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
15030
+ }
14824
15031
  }
14825
15032
  /**
14826
15033
  * Stores the access_token and id_token in inmemory storage
@@ -14832,8 +15039,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14832
15039
  * @param tenantId
14833
15040
  * @param reqTimestamp
14834
15041
  */
14835
- async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
15042
+ async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
14836
15043
  const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
15044
+ // save idtoken credential in configured browser storage
15045
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
15046
+ await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
15047
+ }
15048
+ if (dpopBrokerOutcome === "L3") {
15049
+ return;
15050
+ }
15051
+ if (storeInCache?.accessToken === false) {
15052
+ return;
15053
+ }
14837
15054
  // cache accessToken in inmemory storage
14838
15055
  const expiresIn = request.tokenType === AuthenticationScheme$1.POP
14839
15056
  ? SHR_NONCE_VALIDITY
@@ -14843,18 +15060,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14843
15060
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
14844
15061
  const responseScopes = this.generateScopes(response.scope, request.scope);
14845
15062
  const additionalCacheKeyComponents = request.attributeTokens
14846
- ? {
14847
- attribute_tokens: request.attributeTokens,
14848
- }
15063
+ ? { attribute_tokens: request.attributeTokens }
14849
15064
  : undefined;
14850
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
15065
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
15066
+ ? AuthenticationScheme$1.DPOP
15067
+ : request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
14851
15068
  if (request.extraParameters?.resource) {
14852
15069
  cachedAccessToken.resource = request.extraParameters.resource;
14853
15070
  }
14854
- // save idtoken credential in configured browser storage
14855
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
14856
- await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
14857
- }
14858
15071
  // save access token credential in memory storage
14859
15072
  const nativeCacheRecord = {
14860
15073
  accessToken: cachedAccessToken,
@@ -14931,11 +15144,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14931
15144
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
14932
15145
  ? undefined
14933
15146
  : this.config.auth.clientCapabilities;
14934
- /*
14935
- * scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
14936
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
14937
- */
14938
- const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
15147
+ const { scopes, claims, dpopNonce } = request;
14939
15148
  const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES$1], this.correlationId);
14940
15149
  const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
14941
15150
  const hasAttributeTokens = !!request.attributeTokens?.length;
@@ -14959,57 +15168,391 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
14959
15168
  loginHint: request.loginHint,
14960
15169
  extraParameters: {
14961
15170
  ...request.extraParameters,
14962
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
15171
+ // Native broker resource is set for MCP scenarios.
15172
+ ...(request.resource && { resource: request.resource }),
14963
15173
  },
14964
15174
  extendedExpiryToken: false,
14965
15175
  keyId: request.popKid,
14966
- resourceRequestMethod: request.resourceRequestMethod,
14967
- resourceRequestUri: request.resourceRequestUri,
14968
- shrClaims: request.shrClaims,
14969
- shrNonce: request.shrNonce,
14970
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
14971
15176
  };
14972
15177
  if (hasAttributeTokens) {
14973
15178
  validatedRequest.attributeTokens =
14974
15179
  serializeAttributeTokens(request.attributeTokens);
14975
15180
  }
14976
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
14977
- if (validatedRequest.signPopToken && !!request.popKid) {
14978
- throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
14979
- }
14980
15181
  this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
14981
15182
  validatedRequest.extraParameters =
14982
15183
  validatedRequest.extraParameters || {};
14983
15184
  validatedRequest.extraParameters.telemetry =
14984
15185
  PlatformAuthConstants.MATS_TELEMETRY;
14985
15186
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
14986
- // add POP request type
14987
15187
  const shrParameters = {
14988
- resourceRequestUri: request.resourceRequestUri,
14989
15188
  resourceRequestMethod: request.resourceRequestMethod,
15189
+ resourceRequestUri: request.resourceRequestUri,
14990
15190
  shrClaims: request.shrClaims,
14991
15191
  shrNonce: request.shrNonce,
14992
15192
  correlationId: this.correlationId,
14993
15193
  };
14994
15194
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
14995
- // generate reqCnf if not provided in the request
14996
- let reqCnfData;
14997
15195
  if (!validatedRequest.keyId) {
14998
15196
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
14999
- reqCnfData = generatedReqCnfData.reqCnfString;
15197
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
15000
15198
  validatedRequest.keyId = generatedReqCnfData.kid;
15001
15199
  validatedRequest.signPopToken = true;
15002
15200
  }
15003
15201
  else {
15004
- reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
15202
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
15005
15203
  validatedRequest.signPopToken = false;
15006
15204
  }
15007
- // SPAs require whole string to be passed to broker
15008
- validatedRequest.reqCnf = reqCnfData;
15205
+ validatedRequest.resourceRequestMethod =
15206
+ request.resourceRequestMethod;
15207
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
15208
+ validatedRequest.shrClaims = request.shrClaims;
15209
+ validatedRequest.shrNonce = request.shrNonce;
15210
+ }
15211
+ else if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
15212
+ Object.assign(validatedRequest, this.createDpopRequestParameters(request));
15009
15213
  }
15214
+ validatedRequest.extraParametersNoCache =
15215
+ createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
15010
15216
  this.addRequestSKUs(validatedRequest);
15011
15217
  return validatedRequest;
15012
15218
  }
15219
+ /**
15220
+ * Creates and validates the broker-specific parameters for a DPoP request.
15221
+ * @param request - Developer-provided token request.
15222
+ * @returns Broker parameters for a DPoP token and resource proof.
15223
+ */
15224
+ createDpopRequestParameters(request) {
15225
+ if (request.popKid) {
15226
+ throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
15227
+ }
15228
+ if (!request.resourceRequestMethod?.trim() ||
15229
+ !request.resourceRequestUri?.trim()) {
15230
+ throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
15231
+ }
15232
+ const resourceContext = normalizeDpopResourceRequestContext({
15233
+ htm: request.resourceRequestMethod,
15234
+ htu: request.resourceRequestUri,
15235
+ }, this.correlationId);
15236
+ return {
15237
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
15238
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
15239
+ keyId: request.dpopJkt,
15240
+ resourceRequestMethod: resourceContext.htm,
15241
+ resourceRequestUri: resourceContext.htu,
15242
+ };
15243
+ }
15244
+ /**
15245
+ * Provisions the local key and confirmation data for a DPoP broker request.
15246
+ * @param request - Broker request to prepare.
15247
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
15248
+ */
15249
+ async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
15250
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
15251
+ return;
15252
+ }
15253
+ /*
15254
+ * Phase one clears both fields after an L3 response or non-fatal broker
15255
+ * error. In that case phase two must provision a replacement. If either
15256
+ * field remains, treat it as a retained binding and validate it fully.
15257
+ */
15258
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
15259
+ if (!request.keyId || !request.reqCnf) {
15260
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
15261
+ }
15262
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
15263
+ if (request.reqCnf !== expectedReqCnf) {
15264
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
15265
+ }
15266
+ const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
15267
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
15268
+ : await this.tokenBindingKeyManager
15269
+ .getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
15270
+ .then(() => true, () => false);
15271
+ if (!hasKey) {
15272
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
15273
+ }
15274
+ return;
15275
+ }
15276
+ if (request.reqCnf) {
15277
+ throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
15278
+ }
15279
+ if (!request.keyId) {
15280
+ request.keyId =
15281
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
15282
+ tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
15283
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
15284
+ correlationId: this.correlationId,
15285
+ });
15286
+ }
15287
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
15288
+ }
15289
+ /**
15290
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
15291
+ * @param keyId - Browser-managed DPoP key identifier.
15292
+ * @returns Encoded broker confirmation claim.
15293
+ */
15294
+ createDpopBrokerReqCnf(keyId) {
15295
+ return this.browserCrypto.base64UrlEncode(JSON.stringify({
15296
+ kid: keyId,
15297
+ xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
15298
+ }));
15299
+ }
15300
+ /**
15301
+ * Ensures an owned DPoP key can survive redirect navigation before the
15302
+ * request metadata is persisted for phase two.
15303
+ */
15304
+ async ensureRedirectDpopKeyIsPersisted(request) {
15305
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
15306
+ return;
15307
+ }
15308
+ if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
15309
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
15310
+ }
15311
+ }
15312
+ /**
15313
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
15314
+ * @param response - Broker response to validate.
15315
+ * @param request - Broker request associated with the response.
15316
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
15317
+ */
15318
+ validateDpopBrokerOutcome(response, request) {
15319
+ const isDpopRequest = this.isDpopBrokerRequest(request);
15320
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
15321
+ const normalizedRequestTokenType = request.tokenType
15322
+ ?.trim()
15323
+ .toLowerCase();
15324
+ const bindingPreferenceSent = request.bindingPreferenceSent ??
15325
+ request.preferBinding !== undefined;
15326
+ const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
15327
+ normalizedResponse.proof !== undefined ||
15328
+ normalizedResponse.hasBindingAttested;
15329
+ if (!isDpopRequest) {
15330
+ if (hasDpopResponse) {
15331
+ this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
15332
+ }
15333
+ return "none";
15334
+ }
15335
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
15336
+ this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
15337
+ }
15338
+ this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
15339
+ if (normalizedResponse.tokenType ===
15340
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
15341
+ return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
15342
+ }
15343
+ return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
15344
+ }
15345
+ /**
15346
+ * Normalizes the canonical DPoP fields returned under response properties.
15347
+ */
15348
+ normalizeDpopBrokerResponse(response) {
15349
+ const responseProperties = response.properties;
15350
+ const rawTokenType = responseProperties?.token_type;
15351
+ const tokenType = typeof rawTokenType === "string"
15352
+ ? rawTokenType.trim().toLowerCase()
15353
+ : undefined;
15354
+ const rawBindingAttested = responseProperties?.binding_attested;
15355
+ let bindingAttested;
15356
+ if (typeof rawBindingAttested === "string") {
15357
+ const normalizedBindingAttested = rawBindingAttested
15358
+ .trim()
15359
+ .toLowerCase();
15360
+ if (normalizedBindingAttested === "true") {
15361
+ bindingAttested = true;
15362
+ }
15363
+ else if (normalizedBindingAttested === "false") {
15364
+ bindingAttested = false;
15365
+ }
15366
+ }
15367
+ return {
15368
+ tokenType,
15369
+ proof: responseProperties?.DPoP,
15370
+ bindingAttested,
15371
+ hasBindingAttested: rawBindingAttested !== undefined,
15372
+ hasMalformedBindingAttested: rawBindingAttested !== undefined &&
15373
+ bindingAttested === undefined,
15374
+ };
15375
+ }
15376
+ /**
15377
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
15378
+ */
15379
+ validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
15380
+ if (normalizedResponse.hasMalformedBindingAttested) {
15381
+ this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
15382
+ }
15383
+ if (bindingPreferenceSent &&
15384
+ normalizedResponse.bindingAttested === undefined) {
15385
+ this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
15386
+ }
15387
+ }
15388
+ /**
15389
+ * Validates a broker-returned L3 DPoP proof outcome.
15390
+ */
15391
+ validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
15392
+ const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
15393
+ if (typeof normalizedResponse.proof !== "string" ||
15394
+ normalizedResponse.proof.trim().length === 0) {
15395
+ this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
15396
+ }
15397
+ if (normalizedResponse.bindingAttested !== true) {
15398
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
15399
+ }
15400
+ if (normalizedRequestTokenType !== dpopWithProofTokenType ||
15401
+ normalizedResponse.tokenType !== dpopWithProofTokenType) {
15402
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
15403
+ }
15404
+ this.performanceClient.addFields({
15405
+ "ext.brokerDpopOutcome": "l3",
15406
+ "ext.brokerDpopBindingLevel": "L3",
15407
+ }, this.correlationId);
15408
+ return "L3";
15409
+ }
15410
+ /**
15411
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
15412
+ */
15413
+ validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
15414
+ if (normalizedResponse.proof !== undefined) {
15415
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
15416
+ }
15417
+ if (normalizedRequestTokenType !==
15418
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
15419
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
15420
+ }
15421
+ if (normalizedResponse.bindingAttested !== false &&
15422
+ !(!bindingPreferenceSent &&
15423
+ normalizedResponse.bindingAttested === undefined)) {
15424
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
15425
+ }
15426
+ if (!request.reqCnf || !request.keyId) {
15427
+ this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
15428
+ }
15429
+ this.performanceClient.addFields({
15430
+ "ext.brokerDpopOutcome": "l1",
15431
+ "ext.brokerDpopBindingLevel": "L1",
15432
+ }, this.correlationId);
15433
+ return "L1";
15434
+ }
15435
+ /**
15436
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
15437
+ */
15438
+ throwInvalidDpopResponse(failureReason, message) {
15439
+ this.performanceClient.addFields({
15440
+ "ext.brokerDpopOutcome": "invalid_response",
15441
+ "ext.brokerDpopFailureReason": failureReason,
15442
+ }, this.correlationId);
15443
+ throw createAuthError(unexpectedError, this.correlationId, message);
15444
+ }
15445
+ /**
15446
+ * Returns the broker proof or signs an L1 resource proof with the local key.
15447
+ * @param response - Broker response containing the access token and optional proof.
15448
+ * @param request - Broker request containing the proof context and local key.
15449
+ * @returns The resource proof for the broker access token.
15450
+ */
15451
+ async generateDpopProof(response, request) {
15452
+ const brokerProof = response.properties?.DPoP;
15453
+ if (brokerProof !== undefined) {
15454
+ return brokerProof;
15455
+ }
15456
+ const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
15457
+ return dpopProofGenerator.generateResourceProof({
15458
+ htu: request.resourceRequestUri,
15459
+ htm: request.resourceRequestMethod,
15460
+ accessToken: response.access_token,
15461
+ nonce: request.extraParametersNoCache?.pop_nonce,
15462
+ }, request.keyId, this.correlationId);
15463
+ }
15464
+ /**
15465
+ * Removes a generated DPoP request key and clears its request metadata.
15466
+ * @param request - Broker request whose generated key should be removed.
15467
+ */
15468
+ async resetGeneratedDpopRequestKey(request) {
15469
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
15470
+ return;
15471
+ }
15472
+ const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
15473
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
15474
+ try {
15475
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
15476
+ throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
15477
+ }
15478
+ this.performanceClient.addFields({
15479
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
15480
+ }, this.correlationId);
15481
+ cleanupMeasurement.end({ success: true });
15482
+ request.keyId = undefined;
15483
+ request.reqCnf = undefined;
15484
+ }
15485
+ catch (error) {
15486
+ this.performanceClient.addFields({
15487
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
15488
+ }, this.correlationId);
15489
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
15490
+ cleanupMeasurement.end({ success: false }, error);
15491
+ throw error;
15492
+ }
15493
+ }
15494
+ /**
15495
+ * Attempts to remove a generated DPoP request key without replacing an
15496
+ * existing operation error with a cleanup failure.
15497
+ * @param request - Broker request whose generated key should be removed.
15498
+ */
15499
+ async resetGeneratedDpopRequestKeyBestEffort(request) {
15500
+ try {
15501
+ await this.resetGeneratedDpopRequestKey(request);
15502
+ }
15503
+ catch {
15504
+ this.logger.error("1kxxak", this.correlationId);
15505
+ this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
15506
+ request.keyId = undefined;
15507
+ request.reqCnf = undefined;
15508
+ }
15509
+ }
15510
+ /**
15511
+ * Records that a DPoP request is about to be dispatched to the platform broker.
15512
+ * @param request - Broker request about to cross the provider boundary.
15513
+ */
15514
+ addDpopBrokerAttemptTelemetry(request) {
15515
+ if (!this.isDpopBrokerRequest(request)) {
15516
+ return;
15517
+ }
15518
+ this.performanceClient.addFields({
15519
+ "ext.brokerDpopAttempted": 1,
15520
+ }, this.correlationId);
15521
+ }
15522
+ /**
15523
+ * Determines whether a request uses the DPoP broker protocol.
15524
+ * @param request - Broker request to inspect.
15525
+ * @returns Whether the request uses a DPoP token type.
15526
+ */
15527
+ isDpopBrokerRequest(request) {
15528
+ return this.isDpopBrokerTokenType(request.tokenType);
15529
+ }
15530
+ /**
15531
+ * Determines whether a token type represents a DPoP broker request.
15532
+ * @param tokenType - Token type to inspect.
15533
+ * @returns Whether the token type is a supported DPoP broker token type.
15534
+ */
15535
+ isDpopBrokerTokenType(tokenType) {
15536
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
15537
+ return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
15538
+ normalizedTokenType ===
15539
+ AuthenticationScheme$1.DPOP.toLowerCase());
15540
+ }
15541
+ /**
15542
+ * Removes a DPoP key while reporting cleanup failures.
15543
+ * @param keyId - Identifier of the DPoP key to remove.
15544
+ * @returns Whether the key was removed successfully.
15545
+ */
15546
+ async removeDpopKey(keyId) {
15547
+ try {
15548
+ await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
15549
+ return true;
15550
+ }
15551
+ catch {
15552
+ this.logger.error("1w60e4", this.correlationId);
15553
+ return false;
15554
+ }
15555
+ }
15013
15556
  async getCanonicalAuthority(request) {
15014
15557
  const requestAuthority = request.authority || this.config.auth.authority;
15015
15558
  const { azureCloudOptions, account } = request;
@@ -15048,29 +15591,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
15048
15591
  }
15049
15592
  }
15050
15593
  /**
15051
- * Handles extra broker request parameters
15052
- * @param request {PlatformAuthRequest}
15053
- * @private
15594
+ * Handles extra broker request parameters.
15595
+ * @param request - Platform broker request.
15596
+ * @param embeddedClientId - Embedded application client identifier.
15054
15597
  */
15055
15598
  handleExtraBrokerParams(request, embeddedClientId) {
15056
- const hasExtraBrokerParams = request.extraParameters &&
15057
- request.extraParameters.hasOwnProperty(BROKER_CLIENT_ID) &&
15058
- request.extraParameters.hasOwnProperty(BROKER_REDIRECT_URI) &&
15059
- request.extraParameters.hasOwnProperty(CLIENT_ID);
15599
+ const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
15600
+ const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
15601
+ hasOwnParameter(BROKER_REDIRECT_URI) &&
15602
+ hasOwnParameter(CLIENT_ID);
15060
15603
  if (!embeddedClientId && !hasExtraBrokerParams) {
15061
15604
  return;
15062
15605
  }
15063
- let child_client_id = "";
15064
- const child_redirect_uri = request.redirectUri;
15606
+ const childRedirectUri = request.redirectUri;
15607
+ const childClientId = embeddedClientId ||
15608
+ request.extraParameters?.[CLIENT_ID] ||
15609
+ "";
15065
15610
  if (embeddedClientId) {
15066
15611
  request.redirectUri = this.config.auth.redirectUri;
15067
- child_client_id = embeddedClientId;
15068
15612
  }
15069
15613
  else if (request.extraParameters) {
15070
15614
  request.redirectUri =
15071
15615
  request.extraParameters[BROKER_REDIRECT_URI];
15072
- child_client_id =
15073
- request.extraParameters[CLIENT_ID];
15074
15616
  }
15075
15617
  const {
15076
15618
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -15081,15 +15623,20 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
15081
15623
  [CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
15082
15624
  request.extraParameters = {
15083
15625
  ...remainingExtraParameters,
15084
- child_client_id,
15085
- child_redirect_uri,
15626
+ child_client_id: childClientId,
15627
+ child_redirect_uri: childRedirectUri,
15086
15628
  };
15087
15629
  this.performanceClient?.addFields({
15088
- embeddedClientId: child_client_id,
15089
- embeddedRedirectUri: child_redirect_uri,
15630
+ embeddedClientId: childClientId,
15631
+ embeddedRedirectUri: childRedirectUri,
15090
15632
  }, this.correlationId);
15091
15633
  }
15092
- }
15634
+ }
15635
+ /**
15636
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
15637
+ * This does not constrain the binding selected by the platform broker.
15638
+ */
15639
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
15093
15640
 
15094
15641
  /*
15095
15642
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15195,6 +15742,7 @@ async function getStandardParameters(config, authority, request, logger, perform
15195
15742
  }
15196
15743
  }
15197
15744
  if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
15745
+ !request.platformBroker &&
15198
15746
  request.dpopJkt) {
15199
15747
  parameters.set(DPOP_JKT, request.dpopJkt);
15200
15748
  }
@@ -15318,19 +15866,25 @@ function createForm(frame, action, fields) {
15318
15866
  * @param nativeMessageHandler
15319
15867
  * @returns
15320
15868
  */
15321
- async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15869
+ async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15322
15870
  logger.verbose("11qcow", request.correlationId);
15323
15871
  if (!platformAuthProvider) {
15324
15872
  throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
15325
15873
  }
15326
15874
  const browserCrypto = new CryptoOps(logger, performanceClient);
15327
- const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
15875
+ const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
15328
15876
  const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
15329
- return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
15330
- ...request,
15331
- state: userRequestState,
15332
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
15333
- });
15877
+ try {
15878
+ return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
15879
+ ...request,
15880
+ state: userRequestState,
15881
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
15882
+ });
15883
+ }
15884
+ catch (e) {
15885
+ await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
15886
+ throw e;
15887
+ }
15334
15888
  }
15335
15889
  /**
15336
15890
  * Response handler when server returns code on the /authorize request
@@ -15343,13 +15897,13 @@ async function handleResponsePlatformBroker(request, accountId, apiId, config, b
15343
15897
  * @param performanceClient
15344
15898
  * @returns
15345
15899
  */
15346
- async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15900
+ async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15347
15901
  // Remove throttle if it exists
15348
15902
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
15349
15903
  // Instrument clientdata telemetry fields from the authorize response
15350
15904
  instrumentClientData(response, request.correlationId, performanceClient);
15351
15905
  if (response.accountId) {
15352
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
15906
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
15353
15907
  }
15354
15908
  const authCodeRequest = {
15355
15909
  ...request,
@@ -15377,7 +15931,7 @@ async function handleResponseCode(request, response, codeVerifier, apiId, config
15377
15931
  * @param nativeMessageHandler
15378
15932
  * @returns
15379
15933
  */
15380
- async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15934
+ async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15381
15935
  // Remove throttle if it exists
15382
15936
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
15383
15937
  // Instrument clientdata telemetry fields from the authorize response
@@ -15392,9 +15946,9 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
15392
15946
  }
15393
15947
  const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
15394
15948
  if (decryptedData.accountId) {
15395
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
15949
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
15396
15950
  }
15397
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
15951
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
15398
15952
  // Validate response. This function throws a server error if an error is returned by the server.
15399
15953
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
15400
15954
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -15841,6 +16395,7 @@ class PlatformAuthExtensionHandler {
15841
16395
  const extensionRequest = { ...request };
15842
16396
  delete extensionRequest.resourceRequestMethod;
15843
16397
  delete extensionRequest.resourceRequestUri;
16398
+ delete extensionRequest.bindingPreferenceSent;
15844
16399
  const messageBody = {
15845
16400
  method: NativeExtensionMethod.GetToken,
15846
16401
  request: extensionRequest,
@@ -15852,8 +16407,9 @@ class PlatformAuthExtensionHandler {
15852
16407
  body: messageBody,
15853
16408
  };
15854
16409
  this.logger.trace(`1qadfi ${this.platformAuthType}`, correlationId);
15855
- this.logger.tracePii(`1xm533 ${this.platformAuthType} ${JSON.stringify(req)}`, correlationId);
15856
16410
  this.messageChannel.port1.postMessage(req);
16411
+ request.bindingPreferenceSent =
16412
+ extensionRequest.preferBinding !== undefined;
15857
16413
  const response = await new Promise((resolve, reject) => {
15858
16414
  this.resolvers.set(req.responseId, {
15859
16415
  resolve,
@@ -16050,13 +16606,11 @@ class PlatformAuthExtensionHandler {
16050
16606
  try {
16051
16607
  const response = request.body.response;
16052
16608
  this.logger.trace(`19hpgm ${this.platformAuthType}`, correlationId);
16053
- this.logger.tracePii(`179a24 ${this.platformAuthType} ${JSON.stringify(response)}`, correlationId);
16054
16609
  if (response.status !== "Success") {
16055
16610
  resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
16056
16611
  }
16057
16612
  else if (response.result) {
16058
- if (response.result["code"] &&
16059
- response.result["description"]) {
16613
+ if (response.result["code"]) {
16060
16614
  resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
16061
16615
  }
16062
16616
  else {
@@ -16137,11 +16691,12 @@ class PlatformAuthExtensionHandler {
16137
16691
  Object.prototype.hasOwnProperty.call(response, "account") &&
16138
16692
  Object.prototype.hasOwnProperty.call(response, "scope") &&
16139
16693
  Object.prototype.hasOwnProperty.call(response, "expires_in")) {
16694
+ const validatedResponse = response;
16140
16695
  validationMeasurement.end({
16141
16696
  success: true,
16142
16697
  platformAuthProviderType: this.platformAuthType,
16143
16698
  });
16144
- return response;
16699
+ return validatedResponse;
16145
16700
  }
16146
16701
  else {
16147
16702
  const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
@@ -16183,6 +16738,7 @@ class PlatformAuthExtensionHandler {
16183
16738
  * Copyright (c) Microsoft Corporation. All rights reserved.
16184
16739
  * Licensed under the MIT License.
16185
16740
  */
16741
+ const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
16186
16742
  class PlatformAuthDOMHandler {
16187
16743
  constructor(logger, performanceClient, correlationId) {
16188
16744
  this.logger = logger;
@@ -16262,6 +16818,10 @@ class PlatformAuthDOMHandler {
16262
16818
  });
16263
16819
  this.logger.trace(`02bcil ${this.platformAuthType}`, correlationId);
16264
16820
  try {
16821
+ if (request.tokenType?.trim().toLowerCase() ===
16822
+ PlatformAuthTokenType.DPOP_WITH_PROOF) {
16823
+ throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
16824
+ }
16265
16825
  const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
16266
16826
  const response =
16267
16827
  // @ts-ignore
@@ -16288,6 +16848,7 @@ class PlatformAuthDOMHandler {
16288
16848
  this.logger.trace(`15d6yv ${this.platformAuthType}`, requestCorrelationId);
16289
16849
  delete remainingProperties.resourceRequestMethod;
16290
16850
  delete remainingProperties.resourceRequestUri;
16851
+ delete remainingProperties.bindingPreferenceSent;
16291
16852
  const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
16292
16853
  const platformDOMRequest = {
16293
16854
  accountId: accountId,
@@ -16515,7 +17076,9 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
16515
17076
  logger.trace("0uko3r", correlationId);
16516
17077
  const schemeSupported = !authenticationScheme ||
16517
17078
  authenticationScheme === AuthenticationScheme$1.BEARER ||
16518
- authenticationScheme === AuthenticationScheme$1.POP;
17079
+ authenticationScheme === AuthenticationScheme$1.POP ||
17080
+ (authenticationScheme === AuthenticationScheme$1.DPOP &&
17081
+ !(platformAuthProvider instanceof PlatformAuthDOMHandler));
16519
17082
  const fields = {
16520
17083
  allowPlatformBroker: config.system.allowPlatformBroker,
16521
17084
  ...(config.system.allowPlatformBroker && {
@@ -16712,12 +17275,13 @@ class PopupClient extends StandardInteractionClient {
16712
17275
  // Wait for the redirect bridge response
16713
17276
  const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
16714
17277
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16715
- 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);
17278
+ 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, this.tokenBindingKeyManager);
16716
17279
  }
16717
17280
  }
16718
17281
  catch (e) {
16719
17282
  // Close the synchronous popup if an error is thrown before the window unload event is registered
16720
17283
  popupParams.popup?.close();
17284
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16721
17285
  if (e instanceof AuthError) {
16722
17286
  e.correlationId = this.correlationId;
16723
17287
  serverTelemetryManager.cacheFailedRequest(e);
@@ -16744,23 +17308,29 @@ class PopupClient extends StandardInteractionClient {
16744
17308
  ...tokenBindingParams,
16745
17309
  popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
16746
17310
  };
16747
- const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
16748
- // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
16749
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
16750
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16751
- if (!serverParams.ear_jwe && serverParams.code) {
16752
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
16753
- serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
16754
- requestAuthority: request.authority,
16755
- requestAzureCloudOptions: request.azureCloudOptions,
16756
- requestExtraQueryParameters: request.extraQueryParameters,
16757
- account: request.account,
16758
- authority: discoveredAuthority,
16759
- });
16760
- return 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);
17311
+ try {
17312
+ const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
17313
+ // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
17314
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
17315
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
17316
+ if (!serverParams.ear_jwe && serverParams.code) {
17317
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
17318
+ serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
17319
+ requestAuthority: request.authority,
17320
+ requestAzureCloudOptions: request.azureCloudOptions,
17321
+ requestExtraQueryParameters: request.extraQueryParameters,
17322
+ account: request.account,
17323
+ authority: discoveredAuthority,
17324
+ });
17325
+ 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, this.tokenBindingKeyManager);
17326
+ }
17327
+ else {
17328
+ return await invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, ApiId.acquireTokenPopup, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17329
+ }
16761
17330
  }
16762
- else {
16763
- return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, ApiId.acquireTokenPopup, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
17331
+ catch (e) {
17332
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17333
+ throw e;
16764
17334
  }
16765
17335
  }
16766
17336
  async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
@@ -16771,7 +17341,7 @@ class PopupClient extends StandardInteractionClient {
16771
17341
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
16772
17342
  const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
16773
17343
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16774
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkceVerifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
17344
+ return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkceVerifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
16775
17345
  }
16776
17346
  /**
16777
17347
  *
@@ -17159,8 +17729,11 @@ class RedirectClient extends StandardInteractionClient {
17159
17729
  codeChallenge: pkceCodes.challenge,
17160
17730
  ...tokenBindingParams,
17161
17731
  };
17162
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17163
17732
  try {
17733
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
17734
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
17735
+ }
17736
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17164
17737
  if (redirectRequest.httpMethod === HttpMethod.POST) {
17165
17738
  return await this.executeCodeFlowWithPost(redirectRequest);
17166
17739
  }
@@ -17180,6 +17753,7 @@ class RedirectClient extends StandardInteractionClient {
17180
17753
  }
17181
17754
  }
17182
17755
  catch (e) {
17756
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17183
17757
  if (e instanceof AuthError) {
17184
17758
  e.correlationId = this.correlationId;
17185
17759
  serverTelemetryManager.cacheFailedRequest(e);
@@ -17204,14 +17778,23 @@ class RedirectClient extends StandardInteractionClient {
17204
17778
  codeChallenge: pkceCodes.challenge,
17205
17779
  ...tokenBindingParams,
17206
17780
  };
17207
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17208
- const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
17209
- form.submit();
17210
- return new Promise((resolve, reject) => {
17211
- setTimeout(() => {
17212
- reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
17213
- }, this.config.system.redirectNavigationTimeout);
17214
- });
17781
+ try {
17782
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
17783
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
17784
+ }
17785
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17786
+ const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
17787
+ form.submit();
17788
+ return await new Promise((resolve, reject) => {
17789
+ setTimeout(() => {
17790
+ reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
17791
+ }, this.config.system.redirectNavigationTimeout);
17792
+ });
17793
+ }
17794
+ catch (e) {
17795
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17796
+ throw e;
17797
+ }
17215
17798
  }
17216
17799
  /**
17217
17800
  * Executes classic Authorization Code flow with a POST request.
@@ -17250,6 +17833,7 @@ class RedirectClient extends StandardInteractionClient {
17250
17833
  if (!serverParams) {
17251
17834
  // Not a recognized server response hash or hash not associated with a redirect request
17252
17835
  this.logger.info("1qmv0q", this.correlationId);
17836
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17253
17837
  this.browserStorage.resetRequestCache(this.correlationId);
17254
17838
  // Do not instrument "no_server_response" if user clicked back button
17255
17839
  if (getNavigationType() !== "back_forward") {
@@ -17319,6 +17903,7 @@ class RedirectClient extends StandardInteractionClient {
17319
17903
  return null;
17320
17904
  }
17321
17905
  catch (e) {
17906
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17322
17907
  if (e instanceof AuthError) {
17323
17908
  e.correlationId = this.correlationId;
17324
17909
  serverTelemetryManager.cacheFailedRequest(e);
@@ -17385,10 +17970,10 @@ class RedirectClient extends StandardInteractionClient {
17385
17970
  const { authority, azureCloudOptions, extraQueryParameters, account } = request;
17386
17971
  if (serverParams.ear_jwe) {
17387
17972
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, request.correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
17388
- return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
17973
+ return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17389
17974
  }
17390
17975
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
17391
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
17976
+ return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17392
17977
  }
17393
17978
  /**
17394
17979
  * Redirects window to given URL.
@@ -17719,10 +18304,10 @@ class SilentIframeClient extends StandardInteractionClient {
17719
18304
  account: request.account,
17720
18305
  authority: discoveredAuthority,
17721
18306
  });
17722
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
18307
+ return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17723
18308
  }
17724
18309
  else {
17725
- return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
18310
+ return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17726
18311
  }
17727
18312
  }
17728
18313
  /**
@@ -17772,7 +18357,13 @@ class SilentIframeClient extends StandardInteractionClient {
17772
18357
  */
17773
18358
  async silentTokenHelper(authClient, request) {
17774
18359
  const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
17775
- 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);
18360
+ try {
18361
+ return await 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, this.tokenBindingKeyManager);
18362
+ }
18363
+ catch (e) {
18364
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
18365
+ throw e;
18366
+ }
17776
18367
  }
17777
18368
  /**
17778
18369
  * Shared helper that generates PKCE codes, builds the /authorize URL,
@@ -17789,38 +18380,44 @@ class SilentIframeClient extends StandardInteractionClient {
17789
18380
  codeChallenge: pkceCodes.challenge,
17790
18381
  ...tokenBindingParams,
17791
18382
  };
17792
- // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
17793
- const iframe = createHiddenIframe();
17794
- const responseType = this.config.auth.OIDCOptions.responseMode;
17795
- // Wait for response from the redirect bridge.
17796
- let responseString;
17797
18383
  try {
17798
- const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
17799
- responsePromise.catch(() => {
17800
- /*
17801
- * If URL creation or navigation below throws before
17802
- * responsePromise is awaited, the listener still rejects on
17803
- * timeout. Swallow it here so it does not surface as an
17804
- * unhandled rejection; the navigation error is propagated
17805
- * instead.
17806
- */
17807
- });
17808
- if (request.httpMethod === HttpMethod.POST) {
17809
- await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18384
+ // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
18385
+ const iframe = createHiddenIframe();
18386
+ const responseType = this.config.auth.OIDCOptions.responseMode;
18387
+ // Wait for response from the redirect bridge.
18388
+ let responseString;
18389
+ try {
18390
+ const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
18391
+ responsePromise.catch(() => {
18392
+ /*
18393
+ * If URL creation or navigation below throws before
18394
+ * responsePromise is awaited, the listener still rejects on
18395
+ * timeout. Swallow it here so it does not surface as an
18396
+ * unhandled rejection; the navigation error is propagated
18397
+ * instead.
18398
+ */
18399
+ });
18400
+ if (request.httpMethod === HttpMethod.POST) {
18401
+ await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18402
+ }
18403
+ else {
18404
+ // Create authorize request url
18405
+ const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18406
+ // Navigate the iframe to the authorize request url
18407
+ await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
18408
+ }
18409
+ responseString = await responsePromise;
17810
18410
  }
17811
- else {
17812
- // Create authorize request url
17813
- const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
17814
- // Navigate the iframe to the authorize request url
17815
- await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
18411
+ finally {
18412
+ invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
17816
18413
  }
17817
- responseString = await responsePromise;
18414
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
18415
+ return { serverParams, pkceCodes, silentRequest };
17818
18416
  }
17819
- finally {
17820
- invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
18417
+ catch (e) {
18418
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
18419
+ throw e;
17821
18420
  }
17822
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
17823
- return { serverParams, pkceCodes, silentRequest };
17824
18421
  }
17825
18422
  async waitForIframeResponse(iframe, request) {
17826
18423
  if (this.waitForIframeResponseHook) {
@@ -18093,7 +18690,6 @@ function getPlatformSilentRequestKey(request, config) {
18093
18690
  : undefined,
18094
18691
  extraParameters: canonicalizeStringDict(request.extraParameters),
18095
18692
  extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
18096
- extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
18097
18693
  forceRefresh: !!request.forceRefresh,
18098
18694
  cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
18099
18695
  });
@@ -18102,8 +18698,12 @@ function getPlatformSilentRequestKey(request, config) {
18102
18698
  * Copies caller-owned mutable inputs before asynchronous broker initialization.
18103
18699
  */
18104
18700
  function snapshotPlatformSilentRequest(request) {
18105
- return {
18701
+ const snapshot = {
18106
18702
  ...request,
18703
+ };
18704
+ delete snapshot.extraParametersNoCache;
18705
+ return {
18706
+ ...snapshot,
18107
18707
  scopes: [...(request.scopes || [])],
18108
18708
  account: { ...request.account },
18109
18709
  azureCloudOptions: request.azureCloudOptions
@@ -18115,9 +18715,6 @@ function snapshotPlatformSilentRequest(request) {
18115
18715
  extraQueryParameters: request.extraQueryParameters
18116
18716
  ? { ...request.extraQueryParameters }
18117
18717
  : undefined,
18118
- extraParametersNoCache: request.extraParametersNoCache
18119
- ? { ...request.extraParametersNoCache }
18120
- : undefined,
18121
18718
  attributeTokens: request.attributeTokens
18122
18719
  ? [...request.attributeTokens]
18123
18720
  : undefined,
@@ -18482,8 +19079,9 @@ class StandardController {
18482
19079
  let result;
18483
19080
  const platformAuthProvider = this.platformAuthProvider;
18484
19081
  if (this.canUsePlatformBroker(request) && platformAuthProvider) {
19082
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
18485
19083
  const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
18486
- result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
19084
+ result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
18487
19085
  if (e instanceof NativeAuthError &&
18488
19086
  isFatalNativeAuthError(e)) {
18489
19087
  this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
@@ -19028,6 +19626,13 @@ class StandardController {
19028
19626
  const correlationId = this.getRequestCorrelationId(logoutRequest);
19029
19627
  redirectPreflightCheck(this.initialized, this.config);
19030
19628
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
19629
+ try {
19630
+ await this.clearNativeCache(logoutRequest?.account, correlationId);
19631
+ }
19632
+ catch (error) {
19633
+ this.browserStorage.setInteractionInProgress(false);
19634
+ throw error;
19635
+ }
19031
19636
  const redirectClient = this.createRedirectClient(correlationId);
19032
19637
  return redirectClient.logout(logoutRequest);
19033
19638
  }
@@ -19041,7 +19646,11 @@ class StandardController {
19041
19646
  preflightCheck$1(this.initialized);
19042
19647
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
19043
19648
  const popupClient = this.createPopupClient(correlationId);
19044
- return popupClient.logout(logoutRequest).finally(() => {
19649
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
19650
+ const popupLogout = popupClient.logout(logoutRequest);
19651
+ return Promise.all([nativeCacheClear, popupLogout])
19652
+ .then(() => undefined)
19653
+ .finally(() => {
19045
19654
  this.browserStorage.setInteractionInProgress(false);
19046
19655
  });
19047
19656
  }
@@ -19060,7 +19669,30 @@ class StandardController {
19060
19669
  }
19061
19670
  const correlationId = this.getRequestCorrelationId(logoutRequest);
19062
19671
  const cacheClient = this.createSilentCacheClient(correlationId);
19063
- return cacheClient.logout(logoutRequest);
19672
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
19673
+ const browserCacheClear = cacheClient.logout(logoutRequest);
19674
+ await Promise.all([nativeCacheClear, browserCacheClear]);
19675
+ }
19676
+ async clearNativeCache(account, correlationId) {
19677
+ const homeAccountId = account?.homeAccountId.toLowerCase();
19678
+ const environment = account?.environment.toLowerCase();
19679
+ const accessTokenKeys = this.nativeInternalStorage
19680
+ .getTokenKeys()
19681
+ .accessToken.filter((key) => {
19682
+ if (!account) {
19683
+ return true;
19684
+ }
19685
+ const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
19686
+ if (!accessToken) {
19687
+ return false;
19688
+ }
19689
+ return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
19690
+ accessToken.environment.toLowerCase() === environment);
19691
+ });
19692
+ await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
19693
+ if (!account) {
19694
+ this.nativeInternalStorage.clear(correlationId);
19695
+ }
19064
19696
  }
19065
19697
  // #endregion
19066
19698
  // #region Account APIs
@@ -19142,6 +19774,19 @@ class StandardController {
19142
19774
  }
19143
19775
  }
19144
19776
  // #region Helpers
19777
+ /**
19778
+ * Removes internal DPoP key state from application-originated broker requests.
19779
+ */
19780
+ sanitizeNativeBrokerRequest(request, correlationId) {
19781
+ if (!request.dpopJkt) {
19782
+ return request;
19783
+ }
19784
+ this.logger.warning("0rh2us", correlationId);
19785
+ return {
19786
+ ...request,
19787
+ dpopJkt: undefined,
19788
+ };
19789
+ }
19145
19790
  /**
19146
19791
  * Acquire a token from native device (e.g. WAM)
19147
19792
  * @param request
@@ -19161,7 +19806,8 @@ class StandardController {
19161
19806
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
19162
19807
  }
19163
19808
  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);
19164
- return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
19809
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
19810
+ return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
19165
19811
  }
19166
19812
  /**
19167
19813
  * Returns boolean indicating if this request can use the platform broker
@@ -19441,14 +20087,23 @@ class StandardController {
19441
20087
  correlationId,
19442
20088
  config: this.config,
19443
20089
  }, this.platformAuthProvider, this.logger, this.performanceClient);
19444
- const inProgressRequest = this.activeSilentTokenRequests.get(preparedRequest.key);
20090
+ const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
20091
+ AuthenticationScheme$1.DPOP;
20092
+ const inProgressRequest = shouldDeduplicate
20093
+ ? this.activeSilentTokenRequests.get(preparedRequest.key)
20094
+ : undefined;
19445
20095
  if (typeof inProgressRequest === "undefined") {
19446
- this.logger.verbose("0fcjbk", correlationId);
20096
+ this.logger.verbose(shouldDeduplicate
20097
+ ? "0fcjbk"
20098
+ : "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
19447
20099
  this.performanceClient.addFields({ deduped: false }, correlationId);
19448
20100
  const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
19449
20101
  ...preparedRequest.request,
19450
20102
  correlationId,
19451
20103
  }, preparedRequest.account);
20104
+ if (!shouldDeduplicate) {
20105
+ return activeRequest;
20106
+ }
19452
20107
  this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
19453
20108
  return activeRequest.finally(() => {
19454
20109
  this.activeSilentTokenRequests.delete(preparedRequest.key);