@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.
@@ -296,7 +296,7 @@ const JsonWebTokenTypes = {
296
296
  // Token renewal offset default in seconds
297
297
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
298
298
 
299
- /*! @azure/msal-common v16.15.0 2026-10-27 */
299
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
300
300
  /*
301
301
  * Copyright (c) Microsoft Corporation. All rights reserved.
302
302
  * Licensed under the MIT License.
@@ -325,7 +325,7 @@ function createAuthError(code, correlationId, additionalMessage) {
325
325
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
326
326
  }
327
327
 
328
- /*! @azure/msal-common v16.15.0 2026-10-27 */
328
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
329
329
 
330
330
  /*
331
331
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -348,7 +348,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
348
348
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
349
349
  }
350
350
 
351
- /*! @azure/msal-common v16.15.0 2026-10-27 */
351
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
352
352
  /*
353
353
  * Copyright (c) Microsoft Corporation. All rights reserved.
354
354
  * Licensed under the MIT License.
@@ -386,7 +386,7 @@ const methodNotImplemented = "method_not_implemented";
386
386
  const resourceParameterRequired = "resource_parameter_required";
387
387
  const misplacedResourceParam = "misplaced_resource_parameter";
388
388
 
389
- /*! @azure/msal-common v16.15.0 2026-10-27 */
389
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
390
390
 
391
391
  /*
392
392
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -424,7 +424,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
424
424
  };
425
425
  }
426
426
 
427
- /*! @azure/msal-common v16.15.0 2026-10-27 */
427
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
428
428
 
429
429
  /*
430
430
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -490,7 +490,7 @@ function getJWSPayload(authToken, correlationId) {
490
490
  return matches[2];
491
491
  }
492
492
 
493
- /*! @azure/msal-common v16.15.0 2026-10-27 */
493
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
494
494
 
495
495
  /*
496
496
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -578,7 +578,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
578
578
  return updatedAccountInfo;
579
579
  }
580
580
 
581
- /*! @azure/msal-common v16.15.0 2026-10-27 */
581
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
582
582
  /*
583
583
  * Copyright (c) Microsoft Corporation. All rights reserved.
584
584
  * Licensed under the MIT License.
@@ -592,7 +592,7 @@ const AuthorityType = {
592
592
  Ciam: 3,
593
593
  };
594
594
 
595
- /*! @azure/msal-common v16.15.0 2026-10-27 */
595
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
596
596
  /*
597
597
  * Copyright (c) Microsoft Corporation. All rights reserved.
598
598
  * Licensed under the MIT License.
@@ -614,7 +614,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
614
614
  return null;
615
615
  }
616
616
 
617
- /*! @azure/msal-common v16.15.0 2026-10-27 */
617
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
618
618
  /*
619
619
  * Copyright (c) Microsoft Corporation. All rights reserved.
620
620
  * Licensed under the MIT License.
@@ -638,7 +638,7 @@ const ProtocolMode = {
638
638
  EAR: "EAR",
639
639
  };
640
640
 
641
- /*! @azure/msal-common v16.15.0 2026-10-27 */
641
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
642
642
  /**
643
643
  * Returns the AccountInfo interface for this account.
644
644
  * @internal
@@ -827,7 +827,7 @@ function isAccountEntity(entity) {
827
827
  entity.hasOwnProperty("authorityType"));
828
828
  }
829
829
 
830
- /*! @azure/msal-common v16.15.0 2026-10-27 */
830
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
831
831
  /*
832
832
  * Copyright (c) Microsoft Corporation. All rights reserved.
833
833
  * Licensed under the MIT License.
@@ -837,7 +837,7 @@ function isAccountEntity(entity) {
837
837
  */
838
838
  const unexpectedError = "unexpected_error";
839
839
 
840
- /*! @azure/msal-common v16.15.0 2026-10-27 */
840
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
841
841
 
842
842
  /*
843
843
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -857,7 +857,7 @@ function createClientConfigurationError(errorCode, correlationId) {
857
857
  return new ClientConfigurationError(errorCode, correlationId);
858
858
  }
859
859
 
860
- /*! @azure/msal-common v16.15.0 2026-10-27 */
860
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
861
861
  /*
862
862
  * Copyright (c) Microsoft Corporation. All rights reserved.
863
863
  * Licensed under the MIT License.
@@ -897,7 +897,7 @@ function getResponseHeader(headers, name) {
897
897
  return headerName === undefined ? undefined : headers[headerName];
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
  * Copyright (c) Microsoft Corporation. All rights reserved.
903
903
  * Licensed under the MIT License.
@@ -928,7 +928,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
928
928
  const invalidDpopNonce = "invalid_dpop_nonce";
929
929
  const dpopMissingResourceContext = "dpop_missing_resource_context";
930
930
 
931
- /*! @azure/msal-common v16.15.0 2026-10-27 */
931
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
932
932
  /*
933
933
  * Copyright (c) Microsoft Corporation. All rights reserved.
934
934
  * Licensed under the MIT License.
@@ -940,7 +940,7 @@ function isOpenIdConfigResponse(response) {
940
940
  response.hasOwnProperty("jwks_uri"));
941
941
  }
942
942
 
943
- /*! @azure/msal-common v16.15.0 2026-10-27 */
943
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
944
944
  /*
945
945
  * Copyright (c) Microsoft Corporation. All rights reserved.
946
946
  * Licensed under the MIT License.
@@ -1020,7 +1020,7 @@ class StringUtils {
1020
1020
  }
1021
1021
  }
1022
1022
 
1023
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1023
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1024
1024
 
1025
1025
  /*
1026
1026
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1178,7 +1178,7 @@ class UrlString {
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.
@@ -1332,7 +1332,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
1332
1332
  return null;
1333
1333
  }
1334
1334
 
1335
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1335
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1336
1336
  /*
1337
1337
  * Copyright (c) Microsoft Corporation. All rights reserved.
1338
1338
  * Licensed under the MIT License.
@@ -1341,7 +1341,7 @@ const AzureCloudInstance = {
1341
1341
  // AzureCloudInstance is not specified.
1342
1342
  None: "none"};
1343
1343
 
1344
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1344
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1345
1345
  /*
1346
1346
  * Copyright (c) Microsoft Corporation. All rights reserved.
1347
1347
  * Licensed under the MIT License.
@@ -1351,7 +1351,7 @@ function isCloudInstanceDiscoveryResponse(response) {
1351
1351
  response.hasOwnProperty("metadata"));
1352
1352
  }
1353
1353
 
1354
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1354
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1355
1355
  /*
1356
1356
  * Copyright (c) Microsoft Corporation. All rights reserved.
1357
1357
  * Licensed under the MIT License.
@@ -1361,7 +1361,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
1361
1361
  response.hasOwnProperty("error_description"));
1362
1362
  }
1363
1363
 
1364
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1364
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1365
1365
  /*
1366
1366
  * Copyright (c) Microsoft Corporation. All rights reserved.
1367
1367
  * Licensed under the MIT License.
@@ -1432,7 +1432,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
1432
1432
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1433
1433
  const SetUserData = "setUserData";
1434
1434
 
1435
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1435
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1436
1436
  /*
1437
1437
  * Copyright (c) Microsoft Corporation. All rights reserved.
1438
1438
  * Licensed under the MIT License.
@@ -1525,7 +1525,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
1525
1525
  };
1526
1526
  };
1527
1527
 
1528
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1528
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1529
1529
 
1530
1530
  /*
1531
1531
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1636,7 +1636,7 @@ RegionDiscovery.IMDS_OPTIONS = {
1636
1636
  },
1637
1637
  };
1638
1638
 
1639
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1639
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1640
1640
  /*
1641
1641
  * Copyright (c) Microsoft Corporation. All rights reserved.
1642
1642
  * Licensed under the MIT License.
@@ -1701,7 +1701,7 @@ function wasClockTurnedBack(cachedAt) {
1701
1701
  return cachedAtSec > nowSeconds();
1702
1702
  }
1703
1703
 
1704
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1704
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1705
1705
 
1706
1706
  /*
1707
1707
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1988,7 +1988,7 @@ function serializeAttributeTokens(attributeTokens) {
1988
1988
  return [...attributeTokens].sort().join(" ");
1989
1989
  }
1990
1990
 
1991
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1991
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1992
1992
 
1993
1993
  /*
1994
1994
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2956,7 +2956,7 @@ function buildStaticAuthorityOptions(authOptions) {
2956
2956
  };
2957
2957
  }
2958
2958
 
2959
- /*! @azure/msal-common v16.15.0 2026-10-27 */
2959
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2960
2960
 
2961
2961
  /*
2962
2962
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2990,7 +2990,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
2990
2990
  }
2991
2991
  }
2992
2992
 
2993
- /*! @azure/msal-common v16.15.0 2026-10-27 */
2993
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2994
2994
 
2995
2995
  /*
2996
2996
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3186,7 +3186,7 @@ class ScopeSet {
3186
3186
  }
3187
3187
  }
3188
3188
 
3189
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3189
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3190
3190
 
3191
3191
  /*
3192
3192
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3686,7 +3686,7 @@ function addAttributeTokens(parameters, attributeTokens) {
3686
3686
  }
3687
3687
  }
3688
3688
 
3689
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3689
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3690
3690
 
3691
3691
  /*
3692
3692
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3817,7 +3817,7 @@ function validateUrl(url, logger, correlationId) {
3817
3817
  }
3818
3818
  }
3819
3819
 
3820
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3820
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3821
3821
 
3822
3822
  /*
3823
3823
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3865,7 +3865,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
3865
3865
  },
3866
3866
  };
3867
3867
 
3868
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3868
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3869
3869
 
3870
3870
  /*
3871
3871
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3888,7 +3888,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
3888
3888
  },
3889
3889
  };
3890
3890
 
3891
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3891
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3892
3892
  /*
3893
3893
  * Copyright (c) Microsoft Corporation. All rights reserved.
3894
3894
  * Licensed under the MIT License.
@@ -4163,12 +4163,12 @@ class Logger {
4163
4163
  }
4164
4164
  }
4165
4165
 
4166
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4166
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4167
4167
  /* eslint-disable header/header */
4168
4168
  const name$1 = "@azure/msal-common";
4169
- const version$1 = "16.15.0";
4169
+ const version$1 = "16.16.0";
4170
4170
 
4171
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4171
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4172
4172
  /*
4173
4173
  * Copyright (c) Microsoft Corporation. All rights reserved.
4174
4174
  * Licensed under the MIT License.
@@ -4176,7 +4176,7 @@ const version$1 = "16.15.0";
4176
4176
  const cacheQuotaExceeded = "cache_quota_exceeded";
4177
4177
  const cacheErrorUnknown = "cache_error_unknown";
4178
4178
 
4179
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4179
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4180
4180
 
4181
4181
  /*
4182
4182
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4214,7 +4214,7 @@ function createCacheError(e) {
4214
4214
  }
4215
4215
  }
4216
4216
 
4217
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4217
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4218
4218
 
4219
4219
  /*
4220
4220
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4463,6 +4463,7 @@ class CacheManager {
4463
4463
  };
4464
4464
  const tokenKeys = this.getTokenKeys();
4465
4465
  const currentScopes = ScopeSet.fromString(credential.target, correlationId);
4466
+ const accessTokenKeysToRemove = [];
4466
4467
  tokenKeys.accessToken.forEach((key) => {
4467
4468
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
4468
4469
  return;
@@ -4472,10 +4473,13 @@ class CacheManager {
4472
4473
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
4473
4474
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
4474
4475
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
4475
- this.removeAccessToken(key, correlationId);
4476
+ accessTokenKeysToRemove.push(key);
4476
4477
  }
4477
4478
  }
4478
4479
  });
4480
+ for (const key of accessTokenKeysToRemove) {
4481
+ await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
4482
+ }
4479
4483
  await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4480
4484
  }
4481
4485
  /**
@@ -4711,12 +4715,32 @@ class CacheManager {
4711
4715
  * @param correlationId
4712
4716
  */
4713
4717
  removeAccessToken(key, correlationId) {
4718
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4719
+ if (credential) {
4720
+ void this.removeTokenBindingKeyForCredential(credential, correlationId);
4721
+ }
4722
+ }
4723
+ /**
4724
+ * Removes an access token and waits for any unreferenced token-binding key
4725
+ * cleanup. Internal callers that require deterministic cleanup should use
4726
+ * this method instead of the synchronous public cache contract.
4727
+ */
4728
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
4729
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4730
+ if (credential) {
4731
+ await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
4732
+ }
4733
+ }
4734
+ removeAccessTokenCredential(key, correlationId) {
4714
4735
  const credential = this.getAccessTokenCredential(key, correlationId);
4715
4736
  if (!credential) {
4716
- return;
4737
+ return null;
4717
4738
  }
4718
4739
  this.removeItem(key, correlationId);
4719
4740
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4741
+ return credential;
4742
+ }
4743
+ async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
4720
4744
  // Remove Token Binding Key from key store for token-bound access token credentials
4721
4745
  if (credential.credentialType.toLowerCase() ===
4722
4746
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
@@ -4726,19 +4750,28 @@ class CacheManager {
4726
4750
  case AuthenticationScheme.DPOP.toLowerCase(): {
4727
4751
  const accessTokenWithAuthSchemeEntity = credential;
4728
4752
  const kid = accessTokenWithAuthSchemeEntity.keyId;
4729
- if (kid) {
4730
- void this.tokenBindingKeyManager
4731
- .removeTokenBindingKey(kid, correlationId)
4732
- .catch(() => {
4753
+ if (kid &&
4754
+ kid !== preservedKeyId &&
4755
+ !this.isTokenBindingKeyReferenced(kid, correlationId)) {
4756
+ try {
4757
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
4758
+ }
4759
+ catch {
4733
4760
  this.commonLogger.error("0id34f", correlationId);
4734
4761
  this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4735
- });
4762
+ }
4736
4763
  }
4737
4764
  break;
4738
4765
  }
4739
4766
  }
4740
4767
  }
4741
4768
  }
4769
+ isTokenBindingKeyReferenced(keyId, correlationId) {
4770
+ return this.getTokenKeys().accessToken.some((accessTokenKey) => {
4771
+ const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
4772
+ return accessToken?.keyId === keyId;
4773
+ });
4774
+ }
4742
4775
  /**
4743
4776
  * Removes all app metadata objects from cache.
4744
4777
  */
@@ -4877,6 +4910,7 @@ class CacheManager {
4877
4910
  const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
4878
4911
  const authScheme = request.authenticationScheme ||
4879
4912
  AuthenticationScheme.BEARER;
4913
+ const normalizedAuthScheme = authScheme.toLowerCase();
4880
4914
  /*
4881
4915
  * Distinguish between Bearer and PoP/SSH token cache types
4882
4916
  * Cast to lowercase to handle "bearer" from ADFS
@@ -4901,7 +4935,10 @@ class CacheManager {
4901
4935
  tokenType: authScheme,
4902
4936
  keyId: authScheme === AuthenticationScheme.SSH
4903
4937
  ? request.sshKid
4904
- : undefined,
4938
+ : normalizedAuthScheme ===
4939
+ AuthenticationScheme.DPOP.toLowerCase()
4940
+ ? request.popKid || request.dpopJkt
4941
+ : undefined,
4905
4942
  additionalCacheKeyComponents: additionalCacheKeyComponents,
4906
4943
  };
4907
4944
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5401,7 +5438,7 @@ class DefaultStorageClass extends CacheManager {
5401
5438
  }
5402
5439
  }
5403
5440
 
5404
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5441
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5405
5442
  /*
5406
5443
  * Copyright (c) Microsoft Corporation. All rights reserved.
5407
5444
  * Licensed under the MIT License.
@@ -5415,7 +5452,7 @@ class DefaultStorageClass extends CacheManager {
5415
5452
  const PerformanceEventStatus = {
5416
5453
  InProgress: 1};
5417
5454
 
5418
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5455
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5419
5456
 
5420
5457
  /*
5421
5458
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5473,7 +5510,7 @@ class StubPerformanceClient {
5473
5510
  }
5474
5511
  }
5475
5512
 
5476
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5513
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5477
5514
 
5478
5515
  /*
5479
5516
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5571,7 +5608,7 @@ function isOidcProtocolMode(config) {
5571
5608
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5572
5609
  }
5573
5610
 
5574
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5611
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5575
5612
  /*
5576
5613
  * Copyright (c) Microsoft Corporation. All rights reserved.
5577
5614
  * Licensed under the MIT License.
@@ -5598,7 +5635,7 @@ function isOidcProtocolMode(config) {
5598
5635
  }
5599
5636
  }
5600
5637
 
5601
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5638
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5602
5639
 
5603
5640
  /*
5604
5641
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5619,7 +5656,7 @@ function createJoseHeaderError(code, correlationId) {
5619
5656
  return new JoseHeaderError(code, correlationId);
5620
5657
  }
5621
5658
 
5622
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5659
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5623
5660
  /*
5624
5661
  * Copyright (c) Microsoft Corporation. All rights reserved.
5625
5662
  * Licensed under the MIT License.
@@ -5644,7 +5681,7 @@ function isPlainObject(value) {
5644
5681
  return Object.getPrototypeOf(value) === proto;
5645
5682
  }
5646
5683
 
5647
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5684
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5648
5685
  /*
5649
5686
  * Copyright (c) Microsoft Corporation. All rights reserved.
5650
5687
  * Licensed under the MIT License.
@@ -5654,7 +5691,7 @@ const missingAlgError = "missing_alg_error";
5654
5691
  const missingJwkError = "missing_jwk_error";
5655
5692
  const invalidJwkError = "invalid_jwk_error";
5656
5693
 
5657
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5694
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5658
5695
 
5659
5696
  /*
5660
5697
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5720,7 +5757,7 @@ class JoseHeader {
5720
5757
  }
5721
5758
  }
5722
5759
 
5723
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5760
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5724
5761
 
5725
5762
  /*
5726
5763
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5821,7 +5858,7 @@ class PopTokenGenerator {
5821
5858
  }
5822
5859
  }
5823
5860
 
5824
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5861
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5825
5862
 
5826
5863
  /*
5827
5864
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5871,13 +5908,22 @@ function validateDpopNonce(nonce, correlationId) {
5871
5908
  throw createClientConfigurationError(invalidDpopNonce, correlationId);
5872
5909
  }
5873
5910
  }
5911
+ /**
5912
+ * Validates and normalizes the HTTP resource context for a DPoP-bound request.
5913
+ * @internal
5914
+ */
5915
+ function normalizeDpopResourceRequestContext(context, correlationId = "") {
5916
+ return {
5917
+ htm: normalizeHtm(context.htm, correlationId),
5918
+ htu: normalizeHtu(context.htu, correlationId),
5919
+ };
5920
+ }
5874
5921
  /**
5875
5922
  * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
5876
5923
  * resource-endpoint proof bindings.
5877
5924
  *
5878
- * Not exported from any public package entry point.
5879
- * This helper is internal-only until DPoP is wired into acquisition flows
5880
- * in a subsequent work item.
5925
+ * Exported from package entry points for use by MSAL Browser.
5926
+ * This helper remains an unsupported internal API for direct consumers.
5881
5927
  *
5882
5928
  * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
5883
5929
  * @internal
@@ -5932,10 +5978,11 @@ class DpopProofGenerator {
5932
5978
  */
5933
5979
  buildResourceProofClaims(params, correlationId = "") {
5934
5980
  validateDpopNonce(params.nonce, correlationId);
5981
+ const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
5935
5982
  const claims = {
5936
5983
  jti: this.cryptoUtils.createNewGuid(),
5937
- htm: normalizeHtm(params.htm, correlationId),
5938
- htu: normalizeHtu(params.htu, correlationId),
5984
+ htm: resourceContext.htm,
5985
+ htu: resourceContext.htu,
5939
5986
  ath: params.ath,
5940
5987
  iat: nowSeconds(),
5941
5988
  };
@@ -5966,7 +6013,7 @@ class DpopProofGenerator {
5966
6013
  }
5967
6014
  }
5968
6015
 
5969
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6016
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5970
6017
  /*
5971
6018
  * Copyright (c) Microsoft Corporation. All rights reserved.
5972
6019
  * Licensed under the MIT License.
@@ -6017,7 +6064,7 @@ const badToken = "bad_token";
6017
6064
  */
6018
6065
  const interruptedUser = "interrupted_user";
6019
6066
 
6020
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6067
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6021
6068
 
6022
6069
  /*
6023
6070
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6084,7 +6131,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
6084
6131
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6085
6132
  }
6086
6133
 
6087
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6134
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6088
6135
 
6089
6136
  /*
6090
6137
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6103,7 +6150,7 @@ class ServerError extends AuthError {
6103
6150
  }
6104
6151
  }
6105
6152
 
6106
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6153
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6107
6154
 
6108
6155
  /*
6109
6156
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6174,7 +6221,7 @@ function parseRequestState(base64Decode, state, correlationId) {
6174
6221
  }
6175
6222
  }
6176
6223
 
6177
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6224
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6178
6225
 
6179
6226
  /*
6180
6227
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6602,7 +6649,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
6602
6649
  return baseAccount;
6603
6650
  }
6604
6651
 
6605
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6652
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6606
6653
  /*
6607
6654
  * Copyright (c) Microsoft Corporation. All rights reserved.
6608
6655
  * Licensed under the MIT License.
@@ -6612,7 +6659,7 @@ const CcsCredentialType = {
6612
6659
  UPN: "UPN",
6613
6660
  };
6614
6661
 
6615
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6662
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6616
6663
  /*
6617
6664
  * Copyright (c) Microsoft Corporation. All rights reserved.
6618
6665
  * Licensed under the MIT License.
@@ -6631,7 +6678,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
6631
6678
  }
6632
6679
  }
6633
6680
 
6634
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6681
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6635
6682
 
6636
6683
  /*
6637
6684
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6655,7 +6702,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
6655
6702
  };
6656
6703
  }
6657
6704
 
6658
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6705
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6659
6706
 
6660
6707
  /*
6661
6708
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6745,7 +6792,7 @@ function getRetryAfterHeader(response) {
6745
6792
  return undefined;
6746
6793
  }
6747
6794
 
6748
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6795
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6749
6796
 
6750
6797
  /*
6751
6798
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6776,7 +6823,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
6776
6823
  return new NetworkError(error, httpStatus, responseHeaders);
6777
6824
  }
6778
6825
 
6779
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6826
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6780
6827
 
6781
6828
  /*
6782
6829
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6910,7 +6957,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
6910
6957
  return response;
6911
6958
  }
6912
6959
 
6913
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6960
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6914
6961
 
6915
6962
  /*
6916
6963
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7177,7 +7224,7 @@ class AuthorizationCodeClient {
7177
7224
  }
7178
7225
  }
7179
7226
 
7180
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7227
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7181
7228
 
7182
7229
  /*
7183
7230
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7407,7 +7454,7 @@ function extractLoginHint(account) {
7407
7454
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7408
7455
  }
7409
7456
 
7410
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7457
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7411
7458
 
7412
7459
  /*
7413
7460
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7642,7 +7689,7 @@ class RefreshTokenClient {
7642
7689
  }
7643
7690
  }
7644
7691
 
7645
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7692
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7646
7693
 
7647
7694
  /*
7648
7695
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7935,7 +7982,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
7935
7982
  clearNativeBrokerErrorCode() { }
7936
7983
  }
7937
7984
 
7938
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7985
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7939
7986
 
7940
7987
  /*
7941
7988
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8062,7 +8109,7 @@ class SilentFlowClient {
8062
8109
  }
8063
8110
  }
8064
8111
 
8065
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8112
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8066
8113
 
8067
8114
  /*
8068
8115
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8078,7 +8125,7 @@ const StubbedNetworkModule = {
8078
8125
  },
8079
8126
  };
8080
8127
 
8081
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8128
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8082
8129
 
8083
8130
  /*
8084
8131
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8514,7 +8561,7 @@ function ensureArgumentIsStringArray(argName, argValue, correlationId) {
8514
8561
 
8515
8562
  /* eslint-disable header/header */
8516
8563
  const name = "@azure/msal-browser";
8517
- const version = "5.27.0";
8564
+ const version = "5.28.0";
8518
8565
 
8519
8566
  /*
8520
8567
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9140,6 +9187,7 @@ const PlatformAuthInteractionClientInitializeRequest = "platformAuthInteractionC
9140
9187
  const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
9141
9188
  const PlatformAuthCacheAccount = "platformAuthCacheAccount";
9142
9189
  const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
9190
+ const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
9143
9191
  const RemoveHiddenIframe = "removeHiddenIframe";
9144
9192
  const ImportExistingCache = "importExistingCache";
9145
9193
  /**
@@ -9211,7 +9259,6 @@ const nativeConnectionNotEstablished = "native_connection_not_established";
9211
9259
  const uninitializedPublicClientApplication = "uninitialized_public_client_application";
9212
9260
  const nativePromptNotSupported = "native_prompt_not_supported";
9213
9261
  const invalidBase64String = "invalid_base64_string";
9214
- const invalidPopTokenRequest = "invalid_pop_token_request";
9215
9262
  const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
9216
9263
  const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
9217
9264
  const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
@@ -10564,6 +10611,19 @@ class AsyncMemoryStorage {
10564
10611
  return cacheKeys;
10565
10612
  }
10566
10613
  }
10614
+ /**
10615
+ * Returns whether a key is available in persistent storage. Unlike
10616
+ * containsKey, this does not consult the in-memory fallback.
10617
+ */
10618
+ async containsKeyInPersistentStorage(key, correlationId) {
10619
+ try {
10620
+ return await this.indexedDBCache.containsKey(key);
10621
+ }
10622
+ catch (e) {
10623
+ this.handleDatabaseAccessError(e, correlationId);
10624
+ return false;
10625
+ }
10626
+ }
10567
10627
  /**
10568
10628
  * Returns true or false if the given key is present in the cache.
10569
10629
  * @param key
@@ -10669,6 +10729,12 @@ class TokenBindingKeyManager {
10669
10729
  throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10670
10730
  }
10671
10731
  }
10732
+ /**
10733
+ * Returns whether a browser token-binding key is available.
10734
+ */
10735
+ async hasTokenBindingKey(keyId, correlationId) {
10736
+ return this.cache.containsKey(keyId, correlationId);
10737
+ }
10672
10738
  /**
10673
10739
  * Clears browser token-binding keys from memory and persistent storage.
10674
10740
  * @param correlationId - Request correlation identifier.
@@ -10730,6 +10796,13 @@ class TokenBindingKeyManager {
10730
10796
  }
10731
10797
  return cachedKeyPair;
10732
10798
  }
10799
+ /**
10800
+ * Returns whether a browser token-binding key survived in persistent
10801
+ * storage and can be restored after a redirect navigation.
10802
+ */
10803
+ async isTokenBindingKeyPersisted(keyId, correlationId) {
10804
+ return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
10805
+ }
10733
10806
  /** @internal */
10734
10807
  getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10735
10808
  return {
@@ -11060,19 +11133,13 @@ function validateDpopRequest(request, correlationId) {
11060
11133
  }
11061
11134
  /**
11062
11135
  * Resolves the token-binding parameters needed before building authorize or token requests.
11063
- * Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
11064
- * a reqCnf confirmation claim. Requests that do not require request-time token binding return
11065
- * no additional parameters.
11136
+ * DPoP requests provision a browser key for token endpoint redemption. Platform broker
11137
+ * authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
11138
+ * /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
11066
11139
  */
11067
11140
  async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
11068
11141
  switch (request.authenticationScheme) {
11069
11142
  case AuthenticationScheme.DPOP:
11070
- if (request.platformBroker) {
11071
- return {};
11072
- }
11073
- if (request.dpopJkt) {
11074
- return { dpopJkt: request.dpopJkt };
11075
- }
11076
11143
  return {
11077
11144
  dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
11078
11145
  tokenBindingKeyType: AuthenticationScheme.DPOP.toLowerCase(),
@@ -11095,6 +11162,36 @@ async function getTokenBindingRequestParams(request, tokenBindingKeyManager, log
11095
11162
  return {};
11096
11163
  }
11097
11164
  }
11165
+ /**
11166
+ * Removes a DPoP key that was provisioned for an authorization attempt which
11167
+ * did not complete. Cleanup failures are recorded without replacing the
11168
+ * original authorization error.
11169
+ */
11170
+ async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
11171
+ if (request.authenticationScheme !== AuthenticationScheme.DPOP ||
11172
+ !request.dpopJkt) {
11173
+ return;
11174
+ }
11175
+ try {
11176
+ await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
11177
+ }
11178
+ catch {
11179
+ logger.error("1su7ne", request.correlationId);
11180
+ performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
11181
+ }
11182
+ }
11183
+ /**
11184
+ * Returns whether an MSAL-owned DPoP key is available in persistent storage
11185
+ * before a redirect navigation. Custom managers without a persistence probe
11186
+ * retain their existing behavior.
11187
+ */
11188
+ async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
11189
+ const keyId = request.dpopJkt ?? request.keyId;
11190
+ if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
11191
+ return true;
11192
+ }
11193
+ return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
11194
+ }
11098
11195
  /**
11099
11196
  * Initializer function for all request APIs
11100
11197
  * @param request
@@ -11615,7 +11712,13 @@ const SIGN_UP_V2_CHALLENGE = 100212;
11615
11712
  const SIGN_UP_V2_SUBMIT_CODE = 100213;
11616
11713
  const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
11617
11714
  const SIGN_UP_V2_RESEND_CODE = 100215;
11618
- const SIGN_UP_V2_COMPLETE = 100216;
11715
+ const SIGN_UP_V2_COMPLETE = 100216;
11716
+ const JIT_V2_ENROLL_AUTH_METHOD = 100217;
11717
+ const JIT_V2_SUBMIT_CHALLENGE = 100218;
11718
+ const JIT_V2_RESEND_CHALLENGE = 100219;
11719
+ const MFA_V2_SELECT_AUTH_METHOD = 100220;
11720
+ const MFA_V2_SUBMIT_CHALLENGE = 100221;
11721
+ const MFA_V2_RESEND_CHALLENGE = 100222;
11619
11722
 
11620
11723
  /*
11621
11724
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12445,7 +12548,7 @@ class ResponseHandlerV2 {
12445
12548
  }
12446
12549
  // Required href; throws when it is absent.
12447
12550
  requireHref(href, relation, correlationId, missingHrefError) {
12448
- if (!href) {
12551
+ if (typeof href !== "string" || !href.trim()) {
12449
12552
  const errorCode = missingHrefError?.code ?? INVALID_HAL_RESPONSE;
12450
12553
  const errorMessage = missingHrefError?.message ??
12451
12554
  `Invalid HAL response: missing '${relation}' link`;
@@ -12559,9 +12662,17 @@ const CHALLENGE_RELATION = "challenge";
12559
12662
  const VERIFY_RELATION = "verify";
12560
12663
  const RISK_VERIFY_RELATION = "riskverify";
12561
12664
  const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
12665
+ const ENROLL_RELATION = "enroll";
12666
+ const ACTIVATE_RELATION = "activate";
12667
+ const RESEND_RELATION = "resend";
12668
+ const POLL_RELATION = "poll";
12562
12669
  const AuthenticationMethodTypeV2 = {
12563
12670
  EMAIL: "email",
12564
12671
  PASSWORD: "password",
12672
+ PHONE: "phone",
12673
+ SMS: "sms",
12674
+ };
12675
+ const PhoneRegistrationChannelV2 = {
12565
12676
  SMS: "sms",
12566
12677
  };
12567
12678
  /*
@@ -12779,16 +12890,6 @@ class BaseApiClientV2 {
12779
12890
  const AuthenticationFactorV2 = {
12780
12891
  SINGLE_FACTOR: "singleFactor",
12781
12892
  MULTI_FACTOR: "multiFactor",
12782
- };
12783
- const ChallengeNextActionV2 = {
12784
- VERIFY: "verify",
12785
- RISK_VERIFY: "riskVerify",
12786
- };
12787
- const VerifyNextActionV2 = {
12788
- UPDATE: "update",
12789
- CONTINUE: "continue",
12790
- CHALLENGE: "challenge",
12791
- COLLECT_ATTRIBUTES: "collectAttributes",
12792
12893
  };
12793
12894
 
12794
12895
  /*
@@ -12799,6 +12900,7 @@ const SignUpSubmitAttributesNextActionV2 = {
12799
12900
  VERIFY: "verify",
12800
12901
  COLLECT_ATTRIBUTES: "collectAttributes",
12801
12902
  CONTINUE: "continue",
12903
+ ENROLL: "enroll",
12802
12904
  };
12803
12905
 
12804
12906
  /*
@@ -12862,6 +12964,13 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12862
12964
  attributes: parsedResponse.body.attributes,
12863
12965
  };
12864
12966
  }
12967
+ if (parsedResponse.body.action === ENROLL_RELATION) {
12968
+ return {
12969
+ nextAction: ENROLL_RELATION,
12970
+ continuationToken,
12971
+ methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
12972
+ };
12973
+ }
12865
12974
  const message = "Invalid HAL response: sign-up attribute submission returned no known next action";
12866
12975
  this.logger?.error(message, correlationId);
12867
12976
  throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
@@ -12891,6 +13000,39 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12891
13000
  const parsedResponse = await this.sendActionRequest(verifyHref, HttpMethod.POST, request, context);
12892
13001
  return this.toVerifyResult(parsedResponse);
12893
13002
  }
13003
+ async enrollAuthMethod(enrollHref, request, context) {
13004
+ return this.sendEnrollmentRequest(enrollHref, request, context);
13005
+ }
13006
+ async resendAuthMethodRegistrationChallenge(resendHref, request, context) {
13007
+ return this.sendEnrollmentRequest(resendHref, request, context);
13008
+ }
13009
+ async sendEnrollmentRequest(href, request, context) {
13010
+ const parsedResponse = await this.sendActionRequest(href, HttpMethod.POST, request, context);
13011
+ if (parsedResponse.body.action !== ACTIVATE_RELATION) {
13012
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment returned no activation action", parsedResponse.correlationId);
13013
+ }
13014
+ const links = parsedResponse.body._links;
13015
+ return {
13016
+ nextAction: ACTIVATE_RELATION,
13017
+ continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
13018
+ hint: parsedResponse.body.hint,
13019
+ codeLength: this.normalizeCodeLength(parsedResponse.body.codeLength),
13020
+ activateHref: this.handler.requireHref(links?.activate?.href, ACTIVATE_RELATION, parsedResponse.correlationId),
13021
+ resendHref: links && "resend" in links
13022
+ ? this.handler.requireHref(links.resend?.href, RESEND_RELATION, parsedResponse.correlationId)
13023
+ : undefined,
13024
+ };
13025
+ }
13026
+ async activateAuthMethod(activateHref, request, context) {
13027
+ const parsedResponse = await this.sendActionRequest(activateHref, HttpMethod.POST, request, context);
13028
+ if (parsedResponse.body.state !== ResponseStateV2.CONTINUE) {
13029
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: activation returned no continuation state", parsedResponse.correlationId);
13030
+ }
13031
+ return {
13032
+ nextAction: ResponseStateV2.CONTINUE,
13033
+ continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
13034
+ };
13035
+ }
12894
13036
  /*
12895
13037
  * Submits the new password and returns the link used to poll for completion.
12896
13038
  */
@@ -12903,25 +13045,43 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12903
13045
  };
12904
13046
  }
12905
13047
  /*
12906
- * Polls once for reset completion and returns the next server-provided link.
13048
+ * Sends a poll request and validates the data needed for the next flow step.
12907
13049
  */
12908
13050
  async poll(pollHref, request, context) {
12909
13051
  const parsedResponse = await this.sendActionRequest(pollHref, HttpMethod.POST, request, context);
12910
- const isCompleted = parsedResponse.body.state === ResponseStateV2.CONTINUE;
12911
- return {
12912
- continuationToken: parsedResponse.continuationToken ?? request.continuationToken,
12913
- isCompleted,
12914
- pollHref: isCompleted
12915
- ? undefined
12916
- : this.handler.requireHref(parsedResponse.body._links?.poll?.href, "poll", parsedResponse.correlationId),
12917
- };
13052
+ const correlationId = parsedResponse.correlationId;
13053
+ const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
13054
+ const nextAction = parsedResponse.body.action ?? parsedResponse.body.state;
13055
+ if (nextAction === ENROLL_RELATION) {
13056
+ return {
13057
+ nextAction,
13058
+ continuationToken,
13059
+ enrollmentMethods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13060
+ };
13061
+ }
13062
+ if (nextAction === POLL_RELATION) {
13063
+ return {
13064
+ nextAction: POLL_RELATION,
13065
+ continuationToken,
13066
+ pollHref: this.handler.requireHref(parsedResponse.body._links?.poll?.href, POLL_RELATION, correlationId),
13067
+ };
13068
+ }
13069
+ if (nextAction === ResponseStateV2.CONTINUE) {
13070
+ return {
13071
+ nextAction,
13072
+ continuationToken,
13073
+ };
13074
+ }
13075
+ const message = `Password reset poll next action '${nextAction}' is not supported.`;
13076
+ this.logger?.error(message, correlationId);
13077
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
12918
13078
  }
12919
13079
  async sendStartRequest(startHref, request, context) {
12920
13080
  const parsedResponse = await this.sendActionRequest(startHref, HttpMethod.POST, request, context);
12921
13081
  const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
12922
13082
  return {
12923
13083
  continuationToken,
12924
- methods: this.resolveMethods(parsedResponse.body, parsedResponse.correlationId),
13084
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, parsedResponse.correlationId), parsedResponse.correlationId),
12925
13085
  authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
12926
13086
  scenario: parsedResponse.body.scenario,
12927
13087
  };
@@ -12931,13 +13091,13 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12931
13091
  const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
12932
13092
  if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
12933
13093
  return {
12934
- nextAction: VerifyNextActionV2.CONTINUE,
13094
+ nextAction: ResponseStateV2.CONTINUE,
12935
13095
  continuationToken,
12936
13096
  };
12937
13097
  }
12938
13098
  if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
12939
13099
  return {
12940
- nextAction: VerifyNextActionV2.COLLECT_ATTRIBUTES,
13100
+ nextAction: COLLECT_ATTRIBUTES_RELATION,
12941
13101
  continuationToken,
12942
13102
  attributes: parsedResponse.body.attributes ?? [],
12943
13103
  submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
@@ -12945,21 +13105,45 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12945
13105
  }
12946
13106
  if (parsedResponse.body.action === UPDATE_RELATION) {
12947
13107
  return {
12948
- nextAction: VerifyNextActionV2.UPDATE,
13108
+ nextAction: UPDATE_RELATION,
12949
13109
  continuationToken,
12950
13110
  updateHref: this.handler.requireHref(parsedResponse.body._links?.update?.href, "update", correlationId),
12951
13111
  };
12952
13112
  }
12953
13113
  if (parsedResponse.body.action === CHALLENGE_RELATION) {
12954
13114
  return {
12955
- nextAction: VerifyNextActionV2.CHALLENGE,
13115
+ nextAction: CHALLENGE_RELATION,
12956
13116
  continuationToken,
12957
13117
  authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
12958
- methods: this.resolveMethods(parsedResponse.body, correlationId),
13118
+ methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
13119
+ };
13120
+ }
13121
+ if (parsedResponse.body.action === ENROLL_RELATION) {
13122
+ return {
13123
+ nextAction: ENROLL_RELATION,
13124
+ continuationToken,
13125
+ methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
12959
13126
  };
12960
13127
  }
12961
13128
  throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: verify returned no known next action", correlationId);
12962
13129
  }
13130
+ resolveEnrollmentMethods(methods, correlationId) {
13131
+ return methods.map((method) => {
13132
+ if (typeof method.type !== "string" || !method.type.trim()) {
13133
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment method type is malformed", correlationId);
13134
+ }
13135
+ if (method.channels !== undefined &&
13136
+ (!Array.isArray(method.channels) ||
13137
+ method.channels.length === 0)) {
13138
+ throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment method channels are malformed", correlationId);
13139
+ }
13140
+ return {
13141
+ type: method.type,
13142
+ channels: method.channels,
13143
+ enrollHref: this.handler.requireHref(method._links?.enroll?.href, ENROLL_RELATION, correlationId),
13144
+ };
13145
+ });
13146
+ }
12963
13147
  resolveAuthenticationFactor(authenticationFactor, correlationId) {
12964
13148
  if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR ||
12965
13149
  authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
@@ -12975,7 +13159,7 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12975
13159
  if (parsedResponse.body.action === RISK_VERIFY_RELATION) {
12976
13160
  const riskResponse = parsedResponse.body;
12977
13161
  return {
12978
- nextAction: ChallengeNextActionV2.RISK_VERIFY,
13162
+ nextAction: RISK_VERIFY_RELATION,
12979
13163
  continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
12980
13164
  riskVerifyHref: this.handler.requireHref(riskResponse._links?.riskverify?.href, RISK_VERIFY_RELATION, parsedResponse.correlationId),
12981
13165
  };
@@ -12993,18 +13177,29 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
12993
13177
  "payload" in parsedResponse.body
12994
13178
  ? parsedResponse.body
12995
13179
  : undefined;
13180
+ const isPasswordChallenge = parsedResponse.body.type?.toLowerCase() ===
13181
+ AuthenticationMethodTypeV2.PASSWORD;
13182
+ const verifyHref = this.handler.requireHref(links?.verify?.href, VERIFY_RELATION, parsedResponse.correlationId);
13183
+ const resendHref = !isPasswordChallenge && links && "resend" in links
13184
+ ? this.handler.requireHref(links.resend?.href, RESEND_RELATION, parsedResponse.correlationId)
13185
+ : undefined;
13186
+ const codeLength = isPasswordChallenge
13187
+ ? undefined
13188
+ : this.normalizeCodeLength(codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength);
12996
13189
  return {
12997
- nextAction: ChallengeNextActionV2.VERIFY,
13190
+ nextAction: VERIFY_RELATION,
12998
13191
  continuationToken,
12999
- verifyHref: this.handler.requireHref(links?.verify?.href, "verify", parsedResponse.correlationId),
13000
- resendHref: links && "resend" in links ? links.resend?.href : undefined,
13001
- codeLength: codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength,
13192
+ verifyHref,
13193
+ resendHref,
13194
+ codeLength,
13002
13195
  hint: codeMetadata?.hint,
13003
13196
  type: parsedResponse.body.type,
13004
13197
  };
13005
13198
  }
13006
- resolveMethods(body, correlationId) {
13007
- const methods = this.handler.requireMethods(body._embedded?.methods, correlationId);
13199
+ normalizeCodeLength(value) {
13200
+ return typeof value === "number" && Number.isInteger(value) ? value : 0;
13201
+ }
13202
+ resolveMethods(methods, correlationId) {
13008
13203
  const resolved = [];
13009
13204
  methods.forEach((method, index) => {
13010
13205
  const href = method._links?.challenge?.href;
@@ -13100,6 +13295,8 @@ const FLOW_NEW_PASSWORD_REQUIRED_V2 = "FlowNewPasswordRequiredResultV2";
13100
13295
  const FLOW_ATTRIBUTES_REQUIRED_V2 = "FlowAttributesRequiredResultV2";
13101
13296
  const FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 = "FlowSignInContinuationRequiredResultV2";
13102
13297
  const FLOW_COMPLETED_V2 = "FlowCompletedResultV2";
13298
+ const FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 = "FlowAuthMethodRegistrationRequiredResultV2";
13299
+ const FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2 = "FlowAuthMethodVerificationRequiredResultV2";
13103
13300
  function createFlowMethodSelectionRequiredResultV2(input) {
13104
13301
  return { type: FLOW_METHOD_SELECTION_REQUIRED_V2, ...input };
13105
13302
  }
@@ -13126,6 +13323,12 @@ function createFlowSignInContinuationRequiredResultV2(input) {
13126
13323
  }
13127
13324
  function createFlowCompletedResultV2(input) {
13128
13325
  return { type: FLOW_COMPLETED_V2, ...input };
13326
+ }
13327
+ function createFlowAuthMethodRegistrationRequiredResultV2(input) {
13328
+ return { type: FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2, ...input };
13329
+ }
13330
+ function createFlowAuthMethodVerificationRequiredResultV2(input) {
13331
+ return { type: FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2, ...input };
13129
13332
  }
13130
13333
 
13131
13334
  /*
@@ -13172,7 +13375,20 @@ const FLOW_STEP_API_IDS_V2 = {
13172
13375
  signInWithContinuation: SIGN_UP_V2_COMPLETE,
13173
13376
  },
13174
13377
  };
13175
- function getPublicApiIdV2(scenario, step) {
13378
+ const MFA_STEP_API_IDS_V2 = {
13379
+ requestChallenge: MFA_V2_SELECT_AUTH_METHOD,
13380
+ submitCode: MFA_V2_SUBMIT_CHALLENGE,
13381
+ resendCode: MFA_V2_RESEND_CHALLENGE,
13382
+ };
13383
+ /**
13384
+ * Resolves the telemetry API ID for a flow step. MFA challenge operations use
13385
+ * distinct IDs when the sign-in caller identifies the second factor.
13386
+ */
13387
+ function getPublicApiIdV2(scenario, step, authenticationFactor) {
13388
+ if (scenario === CustomAuthFlowScenarioV2.SignIn &&
13389
+ authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
13390
+ return (MFA_STEP_API_IDS_V2[step] ?? FLOW_STEP_API_IDS_V2[scenario]?.[step]);
13391
+ }
13176
13392
  return FLOW_STEP_API_IDS_V2[scenario]?.[step];
13177
13393
  }
13178
13394
 
@@ -13296,8 +13512,9 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13296
13512
  },
13297
13513
  };
13298
13514
  const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
13299
- if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
13300
- const message = "Initial sign-up attribute submission cannot complete without code verification or additional attributes.";
13515
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 ||
13516
+ result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
13517
+ const message = `Initial sign-up attribute submission returned unsupported next action '${submitResult.nextAction}'.`;
13301
13518
  this.logger.error(message, correlationId);
13302
13519
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13303
13520
  }
@@ -13404,6 +13621,47 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13404
13621
  this.logger.error(message, parameters.correlationId);
13405
13622
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
13406
13623
  }
13624
+ /*
13625
+ * Registers the selected offered method and returns activation metadata.
13626
+ */
13627
+ async registerAuthMethod(parameters) {
13628
+ const { continuationState, correlationId } = parameters;
13629
+ if (!parameters.verificationContact?.trim()) {
13630
+ throw new InvalidArgumentError("verificationContact", correlationId);
13631
+ }
13632
+ const registrationRequest = this.createRegistrationRequest(parameters.method, parameters.verificationContact, continuationState.continuationToken, correlationId);
13633
+ const context = this.createRequestContext(JIT_V2_ENROLL_AUTH_METHOD, correlationId);
13634
+ this.logger.verbose("0dfkz9", correlationId);
13635
+ const result = await this.apiClient.enrollAuthMethod(this.requireLink(correlationId, parameters.method.enrollHref), registrationRequest, context);
13636
+ return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13637
+ }
13638
+ /*
13639
+ * Activates the registered method and redeems the resulting continuation
13640
+ * for tokens.
13641
+ */
13642
+ async verifyAuthMethodRegistration(parameters) {
13643
+ const { continuationState, correlationId } = parameters;
13644
+ const context = this.createRequestContext(JIT_V2_SUBMIT_CHALLENGE, correlationId);
13645
+ this.logger.verbose("073pof", correlationId);
13646
+ const result = await this.apiClient.activateAuthMethod(this.requireLink(correlationId, continuationState.links.activate), {
13647
+ continuationToken: continuationState.continuationToken,
13648
+ otp: parameters.code,
13649
+ }, context);
13650
+ return this.completeSignInAfterVerification(continuationState, result.continuationToken, correlationId);
13651
+ }
13652
+ /*
13653
+ * Requests a replacement activation challenge through the server-provided
13654
+ * resend link using the latest continuation token.
13655
+ */
13656
+ async resendAuthMethodRegistrationChallenge(parameters) {
13657
+ const { continuationState, correlationId } = parameters;
13658
+ const context = this.createRequestContext(JIT_V2_RESEND_CHALLENGE, correlationId);
13659
+ this.logger.verbose("04qvjc", correlationId);
13660
+ const result = await this.apiClient.resendAuthMethodRegistrationChallenge(this.requireLink(correlationId, continuationState.links.resend), {
13661
+ continuationToken: continuationState.continuationToken,
13662
+ }, context);
13663
+ return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
13664
+ }
13407
13665
  /*
13408
13666
  * Verifies the submitted one-time code using the server-provided link. The
13409
13667
  * response determines the next required action.
@@ -13411,7 +13669,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13411
13669
  async submitCode(parameters) {
13412
13670
  const continuationState = parameters.continuationState;
13413
13671
  const correlationId = parameters.correlationId;
13414
- const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId), correlationId);
13672
+ const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId, parameters.authenticationFactor), correlationId);
13415
13673
  this.logger.verbose("16ks6n", correlationId);
13416
13674
  const verifyHref = this.requireLink(correlationId, continuationState.links.verify);
13417
13675
  const verifyRequest = {
@@ -13421,7 +13679,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13421
13679
  const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
13422
13680
  if (continuationState.scenario ===
13423
13681
  CustomAuthFlowScenarioV2.PasswordReset &&
13424
- verifyResult.nextAction === VerifyNextActionV2.UPDATE) {
13682
+ verifyResult.nextAction === UPDATE_RELATION) {
13425
13683
  return createFlowNewPasswordRequiredResultV2({
13426
13684
  correlationId,
13427
13685
  continuationState: {
@@ -13435,46 +13693,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13435
13693
  if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
13436
13694
  return this.handleSignInVerification(continuationState, verifyResult, correlationId);
13437
13695
  }
13438
- if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
13439
- verifyResult.nextAction === VerifyNextActionV2.COLLECT_ATTRIBUTES) {
13440
- const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
13441
- attribute.required === true);
13442
- const nextContinuationState = {
13443
- continuationToken: verifyResult.continuationToken,
13444
- scenario: continuationState.scenario,
13445
- scopes: continuationState.scopes,
13446
- links: {
13447
- submitAttributes: verifyResult.submitAttributesHref,
13448
- },
13449
- signUp: continuationState.signUp,
13450
- };
13451
- const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
13452
- if (requiredPasswordAttribute &&
13453
- continuationState.signUp?.passwordWasSupplied !== true) {
13454
- return createFlowSignUpPasswordRequiredResultV2({
13455
- correlationId,
13456
- continuationState: nextContinuationState,
13457
- attributes,
13458
- requiredPasswordAttribute,
13459
- });
13460
- }
13461
- return createFlowAttributesRequiredResultV2({
13462
- correlationId,
13463
- continuationState: nextContinuationState,
13464
- attributes,
13465
- });
13466
- }
13467
- if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
13468
- verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
13469
- return createFlowSignInContinuationRequiredResultV2({
13470
- correlationId,
13471
- continuationState: {
13472
- continuationToken: verifyResult.continuationToken,
13473
- scenario: continuationState.scenario,
13474
- scopes: continuationState.scopes,
13475
- links: {},
13476
- },
13477
- });
13696
+ if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
13697
+ return this.handleSignUpVerification(continuationState, verifyResult, correlationId);
13478
13698
  }
13479
13699
  const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
13480
13700
  this.logger.error(message, correlationId);
@@ -13525,34 +13745,52 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13525
13745
  }, context);
13526
13746
  let pollToken = updateResult.continuationToken;
13527
13747
  let pollHref = updateResult.pollHref;
13528
- let completionToken;
13748
+ let pollResult;
13749
+ let isPolling = false;
13529
13750
  for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
13530
- const pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
13531
- if (pollResult.isCompleted) {
13532
- completionToken = pollResult.continuationToken;
13751
+ pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
13752
+ isPolling = pollResult.nextAction === POLL_RELATION;
13753
+ if (!isPolling) {
13533
13754
  break;
13534
13755
  }
13535
13756
  pollToken = pollResult.continuationToken;
13536
- pollHref = pollResult.pollHref ?? pollHref;
13757
+ pollHref = this.requireLink(correlationId, pollResult.pollHref);
13537
13758
  if (attempt < POLL_MAX_ATTEMPTS) {
13538
13759
  await delay(POLL_INTERVAL_MS);
13539
13760
  }
13540
13761
  }
13541
- if (!completionToken) {
13762
+ if (!pollResult || isPolling) {
13542
13763
  const message = "The password reset did not complete within the allotted number of polling attempts.";
13543
13764
  this.logger.error(message, correlationId);
13544
13765
  throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
13545
13766
  }
13546
- this.logger.verbose("0hrwdj", correlationId);
13547
- return createFlowSignInContinuationRequiredResultV2({
13548
- correlationId,
13549
- continuationState: {
13550
- continuationToken: completionToken,
13551
- scenario: continuationState.scenario,
13552
- scopes: continuationState.scopes,
13553
- links: {},
13554
- },
13555
- });
13767
+ if (pollResult.nextAction === ENROLL_RELATION &&
13768
+ pollResult.enrollmentMethods) {
13769
+ return this.createAuthMethodRegistrationRequiredResult({
13770
+ correlationId,
13771
+ continuationState: {
13772
+ ...continuationState,
13773
+ continuationToken: pollResult.continuationToken,
13774
+ links: {},
13775
+ },
13776
+ methods: pollResult.enrollmentMethods,
13777
+ });
13778
+ }
13779
+ if (pollResult.nextAction === ResponseStateV2.CONTINUE) {
13780
+ this.logger.verbose("0hrwdj", correlationId);
13781
+ return createFlowSignInContinuationRequiredResultV2({
13782
+ correlationId,
13783
+ continuationState: {
13784
+ continuationToken: pollResult.continuationToken,
13785
+ scenario: continuationState.scenario,
13786
+ scopes: continuationState.scopes,
13787
+ links: {},
13788
+ },
13789
+ });
13790
+ }
13791
+ const message = `Password reset poll next action '${pollResult.nextAction}' is not supported.`;
13792
+ this.logger.error(message, correlationId);
13793
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13556
13794
  }
13557
13795
  /*
13558
13796
  * Verifies a sign-in password and returns the next sign-in action.
@@ -13582,7 +13820,18 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13582
13820
  });
13583
13821
  }
13584
13822
  async handleSignInVerification(continuationState, verifyResult, correlationId) {
13585
- if (verifyResult.nextAction === VerifyNextActionV2.CHALLENGE) {
13823
+ if (verifyResult.nextAction === ENROLL_RELATION) {
13824
+ return this.createAuthMethodRegistrationRequiredResult({
13825
+ correlationId,
13826
+ continuationState: {
13827
+ ...continuationState,
13828
+ continuationToken: verifyResult.continuationToken,
13829
+ links: {},
13830
+ },
13831
+ methods: verifyResult.methods,
13832
+ });
13833
+ }
13834
+ if (verifyResult.nextAction === CHALLENGE_RELATION) {
13586
13835
  this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
13587
13836
  return createFlowMFARequiredResultV2({
13588
13837
  correlationId,
@@ -13600,61 +13849,27 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13600
13849
  })),
13601
13850
  });
13602
13851
  }
13603
- if (verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
13852
+ if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13604
13853
  return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
13605
13854
  }
13606
13855
  const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
13607
13856
  this.logger.error(message, correlationId);
13608
13857
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13609
13858
  }
13610
- getSupportedSignInMethods(methods, correlationId) {
13611
- const supportedMethods = methods.filter((method) => {
13612
- const methodType = method.type.toLowerCase();
13613
- return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13614
- methodType === AuthenticationMethodTypeV2.PASSWORD ||
13615
- methodType === AuthenticationMethodTypeV2.SMS);
13616
- });
13617
- if (supportedMethods.length > 0) {
13618
- return supportedMethods;
13619
- }
13620
- const message = "The sign-in start response did not include a supported email, SMS, or password method.";
13621
- this.logger.error(message, correlationId);
13622
- throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13623
- }
13624
- toSignUpActionResult(result, continuationState, correlationId) {
13625
- const nextAction = result.nextAction;
13626
- if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
13627
- return createFlowCodeRequiredResultV2({
13628
- correlationId,
13629
- continuationState: {
13630
- continuationToken: result.continuationToken,
13631
- scenario: continuationState.scenario,
13632
- scopes: continuationState.scopes,
13633
- links: {
13634
- verify: result.verifyHref,
13635
- resend: result.resendHref,
13636
- },
13637
- signUp: continuationState.signUp,
13638
- },
13639
- channel: result.type,
13640
- sentTo: result.hint,
13641
- codeLength: result.codeLength,
13642
- });
13643
- }
13644
- if (result.nextAction ===
13645
- SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
13646
- const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
13859
+ handleSignUpVerification(continuationState, verifyResult, correlationId) {
13860
+ if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
13861
+ const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
13647
13862
  attribute.required === true);
13648
13863
  const nextContinuationState = {
13649
- continuationToken: result.continuationToken,
13864
+ continuationToken: verifyResult.continuationToken,
13650
13865
  scenario: continuationState.scenario,
13651
13866
  scopes: continuationState.scopes,
13652
13867
  links: {
13653
- submitAttributes: result.submitAttributesHref,
13868
+ submitAttributes: verifyResult.submitAttributesHref,
13654
13869
  },
13655
13870
  signUp: continuationState.signUp,
13656
13871
  };
13657
- const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
13872
+ const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
13658
13873
  if (requiredPasswordAttribute &&
13659
13874
  continuationState.signUp?.passwordWasSupplied !== true) {
13660
13875
  return createFlowSignUpPasswordRequiredResultV2({
@@ -13670,18 +13885,191 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13670
13885
  attributes,
13671
13886
  });
13672
13887
  }
13673
- if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
13674
- return createFlowSignInContinuationRequiredResultV2({
13888
+ if (verifyResult.nextAction === ENROLL_RELATION) {
13889
+ return this.createAuthMethodRegistrationRequiredResult({
13675
13890
  correlationId,
13676
13891
  continuationState: {
13677
- continuationToken: result.continuationToken,
13678
- scenario: continuationState.scenario,
13679
- scopes: continuationState.scopes,
13892
+ ...continuationState,
13893
+ continuationToken: verifyResult.continuationToken,
13680
13894
  links: {},
13681
13895
  },
13896
+ methods: verifyResult.methods,
13682
13897
  });
13683
13898
  }
13684
- const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
13899
+ if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
13900
+ return createFlowSignInContinuationRequiredResultV2({
13901
+ correlationId,
13902
+ continuationState: {
13903
+ continuationToken: verifyResult.continuationToken,
13904
+ scenario: continuationState.scenario,
13905
+ scopes: continuationState.scopes,
13906
+ links: {},
13907
+ },
13908
+ });
13909
+ }
13910
+ const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
13911
+ this.logger.error(message, correlationId);
13912
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13913
+ }
13914
+ getSupportedSignInMethods(methods, correlationId) {
13915
+ const supportedMethods = methods.filter((method) => {
13916
+ const methodType = method.type.toLowerCase();
13917
+ return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13918
+ methodType === AuthenticationMethodTypeV2.PASSWORD ||
13919
+ methodType === AuthenticationMethodTypeV2.SMS);
13920
+ });
13921
+ if (supportedMethods.length > 0) {
13922
+ return supportedMethods;
13923
+ }
13924
+ const message = "The sign-in start response did not include a supported email, SMS, or password method.";
13925
+ this.logger.error(message, correlationId);
13926
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13927
+ }
13928
+ createRegistrationRequest(method, verificationContact, continuationToken, correlationId) {
13929
+ if (method.type === AuthenticationMethodTypeV2.EMAIL) {
13930
+ return {
13931
+ continuationToken,
13932
+ email: verificationContact,
13933
+ };
13934
+ }
13935
+ const [channel] = method.channels ?? [];
13936
+ if (method.type === AuthenticationMethodTypeV2.PHONE &&
13937
+ channel === PhoneRegistrationChannelV2.SMS) {
13938
+ return {
13939
+ continuationToken,
13940
+ phoneNumber: verificationContact,
13941
+ channel,
13942
+ };
13943
+ }
13944
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "The selected authentication method is not supported for registration.", correlationId);
13945
+ }
13946
+ createAuthMethodRegistrationRequiredResult(parameters) {
13947
+ const { correlationId, continuationState } = parameters;
13948
+ const supportedMethods = parameters.methods.filter((method) => {
13949
+ const methodType = method.type.trim().toLowerCase();
13950
+ return (methodType === AuthenticationMethodTypeV2.EMAIL ||
13951
+ (methodType === AuthenticationMethodTypeV2.PHONE &&
13952
+ method.channels?.includes(PhoneRegistrationChannelV2.SMS)));
13953
+ });
13954
+ if (supportedMethods.length === 0) {
13955
+ const message = "The enrollment response did not include a supported registration method.";
13956
+ this.logger.error(message, correlationId);
13957
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13958
+ }
13959
+ const methods = supportedMethods.map((method) => {
13960
+ const methodType = method.type.trim().toLowerCase();
13961
+ const channel = method.channels?.find((candidate) => candidate === PhoneRegistrationChannelV2.SMS);
13962
+ if (methodType === AuthenticationMethodTypeV2.EMAIL) {
13963
+ return {
13964
+ type: AuthenticationMethodTypeV2.EMAIL,
13965
+ enrollHref: this.requireLink(correlationId, method.enrollHref),
13966
+ };
13967
+ }
13968
+ if (methodType === AuthenticationMethodTypeV2.PHONE &&
13969
+ channel === PhoneRegistrationChannelV2.SMS) {
13970
+ return {
13971
+ type: AuthenticationMethodTypeV2.PHONE,
13972
+ channels: [channel],
13973
+ enrollHref: this.requireLink(correlationId, method.enrollHref),
13974
+ };
13975
+ }
13976
+ const message = "The enrollment response included an unsupported registration method.";
13977
+ this.logger.error(message, correlationId);
13978
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13979
+ });
13980
+ return createFlowAuthMethodRegistrationRequiredResultV2({
13981
+ correlationId,
13982
+ continuationState,
13983
+ methods,
13984
+ });
13985
+ }
13986
+ createAuthMethodVerificationRequiredResult(continuationState, result, correlationId) {
13987
+ return createFlowAuthMethodVerificationRequiredResultV2({
13988
+ correlationId,
13989
+ continuationState: {
13990
+ ...continuationState,
13991
+ continuationToken: result.continuationToken,
13992
+ links: {
13993
+ activate: this.requireLink(correlationId, result.activateHref),
13994
+ resend: result.resendHref,
13995
+ },
13996
+ },
13997
+ sentTo: result.hint,
13998
+ codeLength: result.codeLength,
13999
+ });
14000
+ }
14001
+ toSignUpActionResult(result, continuationState, correlationId) {
14002
+ const nextAction = result.nextAction;
14003
+ if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
14004
+ return createFlowCodeRequiredResultV2({
14005
+ correlationId,
14006
+ continuationState: {
14007
+ continuationToken: result.continuationToken,
14008
+ scenario: continuationState.scenario,
14009
+ scopes: continuationState.scopes,
14010
+ links: {
14011
+ verify: result.verifyHref,
14012
+ resend: result.resendHref,
14013
+ },
14014
+ signUp: continuationState.signUp,
14015
+ },
14016
+ channel: result.type,
14017
+ sentTo: result.hint,
14018
+ codeLength: result.codeLength,
14019
+ });
14020
+ }
14021
+ if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
14022
+ return this.createAuthMethodRegistrationRequiredResult({
14023
+ correlationId,
14024
+ continuationState: {
14025
+ ...continuationState,
14026
+ continuationToken: result.continuationToken,
14027
+ links: {},
14028
+ },
14029
+ methods: result.methods,
14030
+ });
14031
+ }
14032
+ if (result.nextAction ===
14033
+ SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
14034
+ const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
14035
+ attribute.required === true);
14036
+ const nextContinuationState = {
14037
+ continuationToken: result.continuationToken,
14038
+ scenario: continuationState.scenario,
14039
+ scopes: continuationState.scopes,
14040
+ links: {
14041
+ submitAttributes: result.submitAttributesHref,
14042
+ },
14043
+ signUp: continuationState.signUp,
14044
+ };
14045
+ const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
14046
+ if (requiredPasswordAttribute &&
14047
+ continuationState.signUp?.passwordWasSupplied !== true) {
14048
+ return createFlowSignUpPasswordRequiredResultV2({
14049
+ correlationId,
14050
+ continuationState: nextContinuationState,
14051
+ attributes,
14052
+ requiredPasswordAttribute,
14053
+ });
14054
+ }
14055
+ return createFlowAttributesRequiredResultV2({
14056
+ correlationId,
14057
+ continuationState: nextContinuationState,
14058
+ attributes,
14059
+ });
14060
+ }
14061
+ if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
14062
+ return createFlowSignInContinuationRequiredResultV2({
14063
+ correlationId,
14064
+ continuationState: {
14065
+ continuationToken: result.continuationToken,
14066
+ scenario: continuationState.scenario,
14067
+ scopes: continuationState.scopes,
14068
+ links: {},
14069
+ },
14070
+ });
14071
+ }
14072
+ const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
13685
14073
  this.logger.error(message, correlationId);
13686
14074
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
13687
14075
  }
@@ -13719,16 +14107,16 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13719
14107
  const challengeHref = step === "resendCode"
13720
14108
  ? continuationState.links.resend
13721
14109
  : continuationState.links.challenge;
13722
- const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId), correlationId);
14110
+ const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId, parameters.authenticationFactor), correlationId);
13723
14111
  this.logger.verbose(step === "0d2mys"
13724
14112
  ? "Resending V2 one-time code."
13725
14113
  : "Requesting V2 challenge.", correlationId);
13726
14114
  const challengeResult = await this.apiClient.requestChallenge(this.requireLink(correlationId, challengeHref), { continuationToken: continuationState.continuationToken }, context);
13727
14115
  const nextAction = challengeResult.nextAction;
13728
- if (challengeResult.nextAction === ChallengeNextActionV2.VERIFY) {
14116
+ if (challengeResult.nextAction === VERIFY_RELATION) {
13729
14117
  return challengeResult;
13730
14118
  }
13731
- if (challengeResult.nextAction === ChallengeNextActionV2.RISK_VERIFY) {
14119
+ if (challengeResult.nextAction === RISK_VERIFY_RELATION) {
13732
14120
  return this.apiClient.verifyRisk(challengeResult.riskVerifyHref, { continuationToken: challengeResult.continuationToken }, context);
13733
14121
  }
13734
14122
  const message = `Challenge next action '${nextAction}' is not supported.`;
@@ -13751,8 +14139,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13751
14139
  }),
13752
14140
  };
13753
14141
  }
13754
- resolveStepApiId(scenario, step, correlationId) {
13755
- const apiId = getPublicApiIdV2(scenario, step);
14142
+ resolveStepApiId(scenario, step, correlationId, authenticationFactor) {
14143
+ const apiId = getPublicApiIdV2(scenario, step, authenticationFactor);
13756
14144
  if (apiId === undefined) {
13757
14145
  const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
13758
14146
  this.logger.error(message, correlationId);
@@ -13761,7 +14149,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
13761
14149
  return apiId;
13762
14150
  }
13763
14151
  requireLink(correlationId, href, missingLinkError) {
13764
- if (!href) {
14152
+ if (typeof href !== "string" || !href.trim()) {
13765
14153
  const errorCode = missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
13766
14154
  const message = missingLinkError?.message ??
13767
14155
  "The continuation state is missing a link required to advance the flow.";
@@ -14047,6 +14435,141 @@ class CompletedStateV2 extends AuthFlowStateBase {
14047
14435
  }
14048
14436
  }
14049
14437
 
14438
+ /*
14439
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14440
+ * Licensed under the MIT License.
14441
+ */
14442
+ /**
14443
+ * State returned when a newly registered authentication method must be
14444
+ * activated with the challenge sent by the service.
14445
+ */
14446
+ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14447
+ constructor(stateParameters) {
14448
+ super(stateParameters);
14449
+ this.stateType = "authMethodVerificationRequired";
14450
+ this.type = stateParameters.type;
14451
+ this.sentTo = stateParameters.sentTo;
14452
+ this.codeLength = stateParameters.codeLength;
14453
+ }
14454
+ /**
14455
+ * Submits the activation challenge for the registered method.
14456
+ * @param challenge - The activation challenge to submit.
14457
+ * @returns The completed authentication result or a failed state.
14458
+ */
14459
+ async submitChallenge(challenge) {
14460
+ const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
14461
+ try {
14462
+ ensureArgumentIsNotNullOrUndefined("challenge", challenge, correlationId);
14463
+ logger.verbose("0c4x62", correlationId);
14464
+ const result = await flowClient.verifyAuthMethodRegistration({
14465
+ correlationId,
14466
+ continuationState,
14467
+ code: challenge,
14468
+ });
14469
+ const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14470
+ return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14471
+ }
14472
+ catch (error) {
14473
+ logger.errorPii(`1mwqno ${error}`, correlationId);
14474
+ return CustomAuthResultV2.createWithError(error, {
14475
+ scenario: continuationState.scenario,
14476
+ correlationId,
14477
+ });
14478
+ }
14479
+ }
14480
+ /**
14481
+ * Requests a replacement activation challenge using the retained server
14482
+ * resend link.
14483
+ * @returns Refreshed activation metadata or a failed state.
14484
+ */
14485
+ async resendChallenge() {
14486
+ const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
14487
+ try {
14488
+ logger.verbose("04qvjc", correlationId);
14489
+ const result = await flowClient.resendAuthMethodRegistrationChallenge({
14490
+ correlationId,
14491
+ continuationState,
14492
+ });
14493
+ return new CustomAuthResultV2(new AuthMethodVerificationRequiredStateV2({
14494
+ correlationId: result.correlationId,
14495
+ logger,
14496
+ config: this.stateParameters.config,
14497
+ flowClient,
14498
+ cacheClient: this.stateParameters.cacheClient,
14499
+ continuationState: result.continuationState,
14500
+ type: this.type,
14501
+ sentTo: result.sentTo ?? this.sentTo,
14502
+ codeLength: result.codeLength,
14503
+ }), undefined, result.continuationState.scenario);
14504
+ }
14505
+ catch (error) {
14506
+ logger.errorPii(`1m3w34 ${error}`, correlationId);
14507
+ return CustomAuthResultV2.createWithError(error, {
14508
+ scenario: continuationState.scenario,
14509
+ correlationId,
14510
+ });
14511
+ }
14512
+ }
14513
+ }
14514
+
14515
+ /*
14516
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14517
+ * Licensed under the MIT License.
14518
+ */
14519
+ /**
14520
+ * State returned when an authentication method must be registered. Applications
14521
+ * select one of the sanitized offered methods and provide its contact value.
14522
+ */
14523
+ class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14524
+ constructor(stateParameters) {
14525
+ super(stateParameters);
14526
+ this.stateType = "authMethodRegistrationRequired";
14527
+ this.methods = stateParameters.methods;
14528
+ }
14529
+ /**
14530
+ * Selects an authentication method for strong-auth registration and requests
14531
+ * its activation challenge.
14532
+ * @param method - A method from {@link methods}.
14533
+ * @param verificationContact - The email address or phone number to register.
14534
+ * @returns The registration activation result.
14535
+ */
14536
+ async selectAuthMethod(method, verificationContact) {
14537
+ const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
14538
+ try {
14539
+ const selectedMethod = this.methods.find((candidate) => candidate.type === method.type);
14540
+ if (!selectedMethod) {
14541
+ throw new InvalidArgumentError("method", correlationId);
14542
+ }
14543
+ ensureArgumentIsNotEmptyString("verificationContact", verificationContact, correlationId);
14544
+ logger.verbose("1lzpbc", correlationId);
14545
+ const result = await flowClient.registerAuthMethod({
14546
+ correlationId,
14547
+ continuationState,
14548
+ method: selectedMethod,
14549
+ verificationContact,
14550
+ });
14551
+ return new CustomAuthResultV2(new AuthMethodVerificationRequiredStateV2({
14552
+ correlationId: result.correlationId,
14553
+ logger,
14554
+ config: this.stateParameters.config,
14555
+ flowClient,
14556
+ cacheClient: this.stateParameters.cacheClient,
14557
+ continuationState: result.continuationState,
14558
+ type: selectedMethod.type,
14559
+ sentTo: result.sentTo,
14560
+ codeLength: result.codeLength,
14561
+ }), undefined, result.continuationState.scenario);
14562
+ }
14563
+ catch (error) {
14564
+ logger.errorPii(`03yx60 ${error}`, correlationId);
14565
+ return CustomAuthResultV2.createWithError(error, {
14566
+ scenario: continuationState.scenario,
14567
+ correlationId,
14568
+ });
14569
+ }
14570
+ }
14571
+ }
14572
+
14050
14573
  /*
14051
14574
  * Copyright (c) Microsoft Corporation. All rights reserved.
14052
14575
  * Licensed under the MIT License.
@@ -14094,8 +14617,8 @@ class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
14094
14617
  */
14095
14618
  /**
14096
14619
  * State returned when the user must supply a new password to complete the flow.
14097
- * A successful submission returns `SignInContinuationStateV2` so the app can
14098
- * sign the user in.
14620
+ * A successful submission can require registration or return a continuation
14621
+ * for sign-in.
14099
14622
  */
14100
14623
  class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14101
14624
  constructor() {
@@ -14103,8 +14626,8 @@ class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14103
14626
  this.stateType = "newPasswordRequired";
14104
14627
  }
14105
14628
  /**
14106
- * Submits the new password to complete the reset. The result either allows
14107
- * sign-in or reports that the password was rejected.
14629
+ * Submits the new password to complete the reset. Enrollment may be
14630
+ * required before sign-in; a rejected password returns an error.
14108
14631
  * @param password - The new password to set.
14109
14632
  * @returns The result of submitting the new password.
14110
14633
  */
@@ -14118,14 +14641,29 @@ class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14118
14641
  continuationState,
14119
14642
  newPassword: password,
14120
14643
  });
14121
- return new CustomAuthResultV2(new SignInContinuationStateV2({
14122
- correlationId: result.correlationId,
14123
- logger,
14124
- config: this.stateParameters.config,
14125
- flowClient,
14126
- continuationState: result.continuationState,
14127
- cacheClient: this.stateParameters.cacheClient,
14128
- }), undefined, result.continuationState.scenario);
14644
+ const resultType = result.type;
14645
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
14646
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
14647
+ correlationId: result.correlationId,
14648
+ logger,
14649
+ config: this.stateParameters.config,
14650
+ flowClient,
14651
+ continuationState: result.continuationState,
14652
+ cacheClient: this.stateParameters.cacheClient,
14653
+ methods: result.methods,
14654
+ }), undefined, result.continuationState.scenario);
14655
+ }
14656
+ if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14657
+ return new CustomAuthResultV2(new SignInContinuationStateV2({
14658
+ correlationId: result.correlationId,
14659
+ logger,
14660
+ config: this.stateParameters.config,
14661
+ flowClient,
14662
+ continuationState: result.continuationState,
14663
+ cacheClient: this.stateParameters.cacheClient,
14664
+ }), undefined, result.continuationState.scenario);
14665
+ }
14666
+ throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
14129
14667
  }
14130
14668
  catch (error) {
14131
14669
  logger.errorPii(`03m081 ${error}`, correlationId);
@@ -14149,18 +14687,20 @@ class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
14149
14687
  this.channel = stateParameters.channel;
14150
14688
  this.codeLength = stateParameters.codeLength;
14151
14689
  }
14152
- async submitCodeCore(code) {
14690
+ async submitCodeCore(code, authenticationFactor) {
14153
14691
  ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
14154
14692
  return this.stateParameters.flowClient.submitCode({
14155
14693
  correlationId: this.stateParameters.correlationId,
14156
14694
  continuationState: this.stateParameters.continuationState,
14695
+ authenticationFactor,
14157
14696
  code,
14158
14697
  });
14159
14698
  }
14160
- async resendCodeCore() {
14699
+ async resendCodeCore(authenticationFactor) {
14161
14700
  return this.stateParameters.flowClient.resendCode({
14162
14701
  correlationId: this.stateParameters.correlationId,
14163
14702
  continuationState: this.stateParameters.continuationState,
14703
+ authenticationFactor,
14164
14704
  });
14165
14705
  }
14166
14706
  }
@@ -14221,6 +14761,17 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14221
14761
  cacheClient: this.stateParameters.cacheClient,
14222
14762
  }), undefined, result.continuationState.scenario);
14223
14763
  }
14764
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
14765
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
14766
+ correlationId: result.correlationId,
14767
+ logger,
14768
+ config: this.stateParameters.config,
14769
+ flowClient: this.stateParameters.flowClient,
14770
+ continuationState: result.continuationState,
14771
+ cacheClient: this.stateParameters.cacheClient,
14772
+ methods: result.methods,
14773
+ }), undefined, result.continuationState.scenario);
14774
+ }
14224
14775
  if (result.type === FLOW_MFA_REQUIRED_V2) {
14225
14776
  const signInStateTransitionHandler = this.stateParameters.signInStateTransitionHandler;
14226
14777
  if (!signInStateTransitionHandler) {
@@ -14300,7 +14851,7 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14300
14851
  const { correlationId, logger, continuationState } = this.stateParameters;
14301
14852
  try {
14302
14853
  logger.verbose("10k0lc", correlationId);
14303
- const result = await this.submitCodeCore(challenge);
14854
+ const result = await this.submitCodeCore(challenge, AuthenticationFactorV2.MULTI_FACTOR);
14304
14855
  if (result.type !== FLOW_COMPLETED_V2) {
14305
14856
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
14306
14857
  }
@@ -14324,7 +14875,7 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
14324
14875
  const { correlationId, logger, continuationState } = this.stateParameters;
14325
14876
  try {
14326
14877
  logger.verbose("13st9u", correlationId);
14327
- const result = await this.resendCodeCore();
14878
+ const result = await this.resendCodeCore(AuthenticationFactorV2.MULTI_FACTOR);
14328
14879
  return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
14329
14880
  correlationId: result.correlationId,
14330
14881
  logger,
@@ -14439,13 +14990,14 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
14439
14990
  }
14440
14991
  }
14441
14992
  async requestSelectedMethodChallenge(method) {
14442
- const { correlationId, continuationState, flowClient } = this.stateParameters;
14993
+ const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
14443
14994
  const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
14444
14995
  if (!selectedMethod) {
14445
14996
  throw new InvalidArgumentError("method", correlationId);
14446
14997
  }
14447
14998
  const result = await flowClient.requestChallenge({
14448
14999
  correlationId,
15000
+ authenticationFactor,
14449
15001
  continuationState: {
14450
15002
  ...continuationState,
14451
15003
  links: {
@@ -14490,6 +15042,17 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
14490
15042
  const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
14491
15043
  return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
14492
15044
  }
15045
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15046
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15047
+ correlationId: result.correlationId,
15048
+ logger,
15049
+ config: this.stateParameters.config,
15050
+ flowClient,
15051
+ continuationState: result.continuationState,
15052
+ cacheClient: this.stateParameters.cacheClient,
15053
+ methods: result.methods,
15054
+ }), undefined, result.continuationState.scenario);
15055
+ }
14493
15056
  if (result.type === FLOW_MFA_REQUIRED_V2) {
14494
15057
  return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
14495
15058
  correlationId: result.correlationId,
@@ -14646,6 +15209,12 @@ class SignUpStateTransitionHandlerV2 {
14646
15209
  if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
14647
15210
  return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario);
14648
15211
  }
15212
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
15213
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
15214
+ ...commonStateParameters,
15215
+ methods: result.methods,
15216
+ }), undefined, result.continuationState.scenario);
15217
+ }
14649
15218
  throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
14650
15219
  }
14651
15220
  handleVerification(result, stateParameters) {
@@ -19119,7 +19688,7 @@ class BrowserCacheManager extends CacheManager {
19119
19688
  throw cacheError;
19120
19689
  }
19121
19690
  // When cache quota is exceeded, start removing access tokens until we can successfully set the item
19122
- this.removeAccessToken(accessTokenKeys[i], correlationId, false // Don't save token keys yet, do it at the end
19691
+ await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
19123
19692
  );
19124
19693
  }
19125
19694
  else {
@@ -19261,6 +19830,13 @@ class BrowserCacheManager extends CacheManager {
19261
19830
  super.removeAccessToken(key, correlationId);
19262
19831
  updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
19263
19832
  }
19833
+ /**
19834
+ * Removes an access token and awaits token-binding key cleanup.
19835
+ */
19836
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
19837
+ await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
19838
+ updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
19839
+ }
19264
19840
  /**
19265
19841
  * Remove access token key from the key map
19266
19842
  * @param key
@@ -20525,12 +21101,26 @@ class InteractionHandler {
20525
21101
  * Copyright (c) Microsoft Corporation. All rights reserved.
20526
21102
  * Licensed under the MIT License.
20527
21103
  */
21104
+ /**
21105
+ * Key storage enclaves supported by the platform broker.
21106
+ */
21107
+ const PlatformAuthEnclave = {
21108
+ /**
21109
+ * Persisted software key using MS_KEY_STORAGE_PROVIDER.
21110
+ */
21111
+ SOFTWARE: "sw"};
20528
21112
  /**
20529
21113
  * Token types supported by the platform broker request contract.
20530
21114
  */
20531
21115
  const PlatformAuthTokenType = {
20532
21116
  DPOP_WITH_PROOF: "dpop+proof",
20533
21117
  };
21118
+ /**
21119
+ * Token binding preferences supported by the platform broker.
21120
+ */
21121
+ const PlatformAuthBindingPreference = {
21122
+ ATTESTED: "attested",
21123
+ };
20534
21124
  const PROOF_OF_POSSESSION_TOKEN_TYPES = [
20535
21125
  AuthenticationScheme.POP,
20536
21126
  AuthenticationScheme.DPOP,
@@ -20546,19 +21136,19 @@ function isProofOfPossessionTokenType(tokenType) {
20546
21136
  /**
20547
21137
  * Adds canonical proof request fields to the broker no-cache property bag.
20548
21138
  */
20549
- function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
20550
- if (!isProofOfPossessionRequest) {
20551
- return extraParametersNoCache;
21139
+ function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
21140
+ if (!isProofOfPossessionTokenType(tokenType)) {
21141
+ return undefined;
20552
21142
  }
20553
21143
  return {
20554
- ...extraParametersNoCache,
20555
21144
  ...(resourceRequestMethod && {
20556
21145
  pop_method: resourceRequestMethod,
20557
21146
  }),
20558
21147
  ...(resourceRequestUri && {
20559
21148
  pop_url: resourceRequestUri,
20560
21149
  }),
20561
- ...(dpopNonce && {
21150
+ ...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
21151
+ dpopNonce && {
20562
21152
  pop_nonce: dpopNonce,
20563
21153
  }),
20564
21154
  };
@@ -20705,6 +21295,7 @@ class SilentCacheClient extends StandardInteractionClient {
20705
21295
  * Copyright (c) Microsoft Corporation. All rights reserved.
20706
21296
  * Licensed under the MIT License.
20707
21297
  */
21298
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
20708
21299
  class PlatformAuthInteractionClient extends BaseInteractionClient {
20709
21300
  constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
20710
21301
  super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
@@ -20763,17 +21354,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20763
21354
  throw e;
20764
21355
  }
20765
21356
  // check if the tokens can be retrieved from internal cache
21357
+ let cachedResult;
20766
21358
  try {
20767
- const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
20768
- // Served from the native internal cache; token did not come directly from the broker
20769
- nativeATMeasurement.add({
20770
- isNativeBroker: false,
20771
- });
20772
- nativeATMeasurement.end({
20773
- success: true,
20774
- fromCache: true,
20775
- });
20776
- return result;
21359
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
20777
21360
  }
20778
21361
  catch (e) {
20779
21362
  if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
@@ -20784,13 +21367,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20784
21367
  nativeATMeasurement.end({
20785
21368
  success: false,
20786
21369
  });
21370
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
20787
21371
  throw e;
20788
21372
  }
20789
21373
  // continue with a native call for any and all errors
20790
21374
  this.logger.info("0957j1", this.correlationId);
20791
21375
  }
21376
+ if (cachedResult) {
21377
+ // Served from the native internal cache; token did not come directly from the broker
21378
+ nativeATMeasurement.add({
21379
+ isNativeBroker: false,
21380
+ });
21381
+ nativeATMeasurement.end({
21382
+ success: true,
21383
+ fromCache: true,
21384
+ });
21385
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
21386
+ return cachedResult;
21387
+ }
20792
21388
  // dispatch the request to the broker
20793
21389
  try {
21390
+ await this.prepareDpopBrokerRequest(nativeRequest);
21391
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
20794
21392
  const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
20795
21393
  const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
20796
21394
  nativeATMeasurement.end({
@@ -20808,6 +21406,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20808
21406
  success: false,
20809
21407
  }, e);
20810
21408
  this.setBrokerErrorTelemetry(e);
21409
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
20811
21410
  throw e;
20812
21411
  }
20813
21412
  }
@@ -20842,6 +21441,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20842
21441
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
20843
21442
  account: cachedAccount,
20844
21443
  forceRefresh: false,
21444
+ ...this.createSilentCacheTokenBindingParameters(request),
20845
21445
  resource: request.extraParameters?.resource,
20846
21446
  };
20847
21447
  // Preserve FMI partition semantics for silent cache filtering.
@@ -20850,6 +21450,29 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20850
21450
  }
20851
21451
  return silentRequest;
20852
21452
  }
21453
+ /**
21454
+ * Maps platform-broker token-binding state to silent-cache request fields.
21455
+ * @param request
21456
+ */
21457
+ createSilentCacheTokenBindingParameters(request) {
21458
+ const authenticationScheme = this.isDpopBrokerRequest(request)
21459
+ ? AuthenticationScheme.DPOP
21460
+ : request.tokenType;
21461
+ if (authenticationScheme !== AuthenticationScheme.DPOP &&
21462
+ authenticationScheme !== AuthenticationScheme.POP) {
21463
+ return { authenticationScheme };
21464
+ }
21465
+ return {
21466
+ authenticationScheme,
21467
+ ...(authenticationScheme === AuthenticationScheme.DPOP &&
21468
+ request.keyId && { dpopJkt: request.keyId }),
21469
+ ...(authenticationScheme === AuthenticationScheme.POP &&
21470
+ request.signPopToken === false &&
21471
+ request.keyId && { popKid: request.keyId }),
21472
+ resourceRequestMethod: request.resourceRequestMethod,
21473
+ resourceRequestUri: request.resourceRequestUri,
21474
+ };
21475
+ }
20853
21476
  /**
20854
21477
  * Fetches the tokens from the cache if un-expired
20855
21478
  * @param nativeAccountId
@@ -20898,10 +21521,22 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20898
21521
  const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
20899
21522
  const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
20900
21523
  try {
20901
- await this.platformAuthProvider.sendMessage(nativeRequest);
21524
+ await this.prepareDpopBrokerRequest(nativeRequest);
21525
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
21526
+ const response = await this.platformAuthProvider.sendMessage(nativeRequest);
21527
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
21528
+ if (dpopBrokerOutcome === "L3") {
21529
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
21530
+ }
20902
21531
  }
20903
21532
  catch (e) {
20904
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
21533
+ /*
21534
+ * Raw persistent/transient broker errors are retrieved again in
21535
+ * phase two. Availability errors are thrown for controller-managed
21536
+ * web fallback, while translated cancellation, network, and
21537
+ * interaction-required errors are surfaced without being swallowed.
21538
+ */
21539
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
20905
21540
  if (e instanceof NativeAuthError) {
20906
21541
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
20907
21542
  serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
@@ -20916,6 +21551,16 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20916
21551
  throw e;
20917
21552
  }
20918
21553
  }
21554
+ else if (this.isDpopBrokerRequest(nativeRequest)) {
21555
+ throw e;
21556
+ }
21557
+ }
21558
+ try {
21559
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
21560
+ }
21561
+ catch (e) {
21562
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21563
+ throw e;
20919
21564
  }
20920
21565
  this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
20921
21566
  ...nativeRequest,
@@ -20930,7 +21575,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20930
21575
  ? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
20931
21576
  : getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
20932
21577
  rootMeasurement.end({ success: true });
20933
- await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
21578
+ try {
21579
+ await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
21580
+ }
21581
+ catch (e) {
21582
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
21583
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
21584
+ throw e;
21585
+ }
20934
21586
  }
20935
21587
  /**
20936
21588
  * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
@@ -20963,6 +21615,8 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20963
21615
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
20964
21616
  const reqTimestamp = nowSeconds();
20965
21617
  try {
21618
+ await this.prepareDpopBrokerRequest(request, true);
21619
+ this.addDpopBrokerAttemptTelemetry(request);
20966
21620
  this.logger.verbose("003x5a", this.correlationId);
20967
21621
  const response = await this.platformAuthProvider.sendMessage(request);
20968
21622
  const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
@@ -20971,7 +21625,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20971
21625
  return authResult;
20972
21626
  }
20973
21627
  catch (e) {
21628
+ if (e instanceof NativeAuthError) {
21629
+ const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
21630
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
21631
+ }
20974
21632
  this.setBrokerErrorTelemetry(e);
21633
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
20975
21634
  throw e;
20976
21635
  }
20977
21636
  }
@@ -20991,6 +21650,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
20991
21650
  */
20992
21651
  async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
20993
21652
  this.logger.trace("1bojln", this.correlationId);
21653
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
20994
21654
  // generate identifiers
20995
21655
  const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
20996
21656
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
@@ -21016,10 +21676,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21016
21676
  response.expires_in = Number(response.expires_in);
21017
21677
  // generate authenticationResult
21018
21678
  const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
21679
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
21019
21680
  // cache accounts and tokens in the appropriate storage
21020
- await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims));
21681
+ const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
21682
+ (this.isDpopBrokerRequest(request) &&
21683
+ storeInCache?.accessToken === false);
21684
+ if (shouldRemoveGeneratedDpopKey) {
21685
+ await this.resetGeneratedDpopRequestKey(request);
21686
+ }
21687
+ await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
21021
21688
  await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
21022
- storeInCache);
21689
+ storeInCache, dpopBrokerOutcome);
21023
21690
  return result;
21024
21691
  }
21025
21692
  /**
@@ -21095,7 +21762,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21095
21762
  */
21096
21763
  async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
21097
21764
  // Add Native Broker fields to Telemetry
21098
- const mats = this.addTelemetryFromNativeResponse(response.properties.MATS);
21765
+ const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
21099
21766
  // If scopes not returned in server response, use request scopes
21100
21767
  const responseScopes = this.generateScopes(request.scope, response.scope);
21101
21768
  const accountProperties = response.account.properties || {};
@@ -21121,9 +21788,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21121
21788
  }
21122
21789
  // generate PoP token as needed
21123
21790
  const responseAccessToken = await this.generatePopAccessToken(response, request);
21124
- const tokenType = request.tokenType === AuthenticationScheme.POP
21125
- ? AuthenticationScheme.POP
21126
- : AuthenticationScheme.BEARER;
21791
+ const isDpopRequest = this.isDpopBrokerRequest(request);
21792
+ let tokenType = AuthenticationScheme.BEARER;
21793
+ if (isDpopRequest) {
21794
+ tokenType = AuthenticationScheme.DPOP;
21795
+ }
21796
+ else if (request.tokenType === AuthenticationScheme.POP) {
21797
+ tokenType = AuthenticationScheme.POP;
21798
+ }
21799
+ const dpopProof = isDpopRequest
21800
+ ? await this.generateDpopProof(response, request)
21801
+ : undefined;
21127
21802
  const result = {
21128
21803
  authority: authority,
21129
21804
  uniqueId: uid,
@@ -21137,6 +21812,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21137
21812
  // Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
21138
21813
  expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
21139
21814
  tokenType: tokenType,
21815
+ dpopProof,
21140
21816
  correlationId: this.correlationId,
21141
21817
  state: response.state,
21142
21818
  fromPlatformBroker: true,
@@ -21150,11 +21826,13 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21150
21826
  * cache the account entity in browser storage
21151
21827
  * @param accountEntity
21152
21828
  */
21153
- async cacheAccount(accountEntity, kmsi) {
21829
+ async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
21154
21830
  // Store the account info and hence `nativeAccountId` in browser cache
21155
21831
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
21156
21832
  // Remove any existing cached tokens for this account in browser storage
21157
- this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
21833
+ if (clearExistingTokens) {
21834
+ this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
21835
+ }
21158
21836
  }
21159
21837
  /**
21160
21838
  * Stores the access_token and id_token in inmemory storage
@@ -21166,8 +21844,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21166
21844
  * @param tenantId
21167
21845
  * @param reqTimestamp
21168
21846
  */
21169
- async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
21847
+ async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
21170
21848
  const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
21849
+ // save idtoken credential in configured browser storage
21850
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
21851
+ await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
21852
+ }
21853
+ if (dpopBrokerOutcome === "L3") {
21854
+ return;
21855
+ }
21856
+ if (storeInCache?.accessToken === false) {
21857
+ return;
21858
+ }
21171
21859
  // cache accessToken in inmemory storage
21172
21860
  const expiresIn = request.tokenType === AuthenticationScheme.POP
21173
21861
  ? SHR_NONCE_VALIDITY
@@ -21177,18 +21865,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21177
21865
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
21178
21866
  const responseScopes = this.generateScopes(response.scope, request.scope);
21179
21867
  const additionalCacheKeyComponents = request.attributeTokens
21180
- ? {
21181
- attribute_tokens: request.attributeTokens,
21182
- }
21868
+ ? { attribute_tokens: request.attributeTokens }
21183
21869
  : undefined;
21184
- 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);
21870
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
21871
+ ? AuthenticationScheme.DPOP
21872
+ : request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
21185
21873
  if (request.extraParameters?.resource) {
21186
21874
  cachedAccessToken.resource = request.extraParameters.resource;
21187
21875
  }
21188
- // save idtoken credential in configured browser storage
21189
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
21190
- await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
21191
- }
21192
21876
  // save access token credential in memory storage
21193
21877
  const nativeCacheRecord = {
21194
21878
  accessToken: cachedAccessToken,
@@ -21265,11 +21949,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21265
21949
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
21266
21950
  ? undefined
21267
21951
  : this.config.auth.clientCapabilities;
21268
- /*
21269
- * 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.
21270
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
21271
- */
21272
- const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
21952
+ const { scopes, claims, dpopNonce } = request;
21273
21953
  const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES], this.correlationId);
21274
21954
  const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
21275
21955
  const hasAttributeTokens = !!request.attributeTokens?.length;
@@ -21293,57 +21973,391 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21293
21973
  loginHint: request.loginHint,
21294
21974
  extraParameters: {
21295
21975
  ...request.extraParameters,
21296
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
21976
+ // Native broker resource is set for MCP scenarios.
21977
+ ...(request.resource && { resource: request.resource }),
21297
21978
  },
21298
21979
  extendedExpiryToken: false,
21299
21980
  keyId: request.popKid,
21300
- resourceRequestMethod: request.resourceRequestMethod,
21301
- resourceRequestUri: request.resourceRequestUri,
21302
- shrClaims: request.shrClaims,
21303
- shrNonce: request.shrNonce,
21304
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
21305
21981
  };
21306
21982
  if (hasAttributeTokens) {
21307
21983
  validatedRequest.attributeTokens =
21308
21984
  serializeAttributeTokens(request.attributeTokens);
21309
21985
  }
21310
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
21311
- if (validatedRequest.signPopToken && !!request.popKid) {
21312
- throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
21313
- }
21314
21986
  this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
21315
21987
  validatedRequest.extraParameters =
21316
21988
  validatedRequest.extraParameters || {};
21317
21989
  validatedRequest.extraParameters.telemetry =
21318
21990
  PlatformAuthConstants.MATS_TELEMETRY;
21319
21991
  if (request.authenticationScheme === AuthenticationScheme.POP) {
21320
- // add POP request type
21321
21992
  const shrParameters = {
21322
- resourceRequestUri: request.resourceRequestUri,
21323
21993
  resourceRequestMethod: request.resourceRequestMethod,
21994
+ resourceRequestUri: request.resourceRequestUri,
21324
21995
  shrClaims: request.shrClaims,
21325
21996
  shrNonce: request.shrNonce,
21326
21997
  correlationId: this.correlationId,
21327
21998
  };
21328
21999
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
21329
- // generate reqCnf if not provided in the request
21330
- let reqCnfData;
21331
22000
  if (!validatedRequest.keyId) {
21332
22001
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
21333
- reqCnfData = generatedReqCnfData.reqCnfString;
22002
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
21334
22003
  validatedRequest.keyId = generatedReqCnfData.kid;
21335
22004
  validatedRequest.signPopToken = true;
21336
22005
  }
21337
22006
  else {
21338
- reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
22007
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
21339
22008
  validatedRequest.signPopToken = false;
21340
22009
  }
21341
- // SPAs require whole string to be passed to broker
21342
- validatedRequest.reqCnf = reqCnfData;
22010
+ validatedRequest.resourceRequestMethod =
22011
+ request.resourceRequestMethod;
22012
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
22013
+ validatedRequest.shrClaims = request.shrClaims;
22014
+ validatedRequest.shrNonce = request.shrNonce;
22015
+ }
22016
+ else if (request.authenticationScheme === AuthenticationScheme.DPOP) {
22017
+ Object.assign(validatedRequest, this.createDpopRequestParameters(request));
21343
22018
  }
22019
+ validatedRequest.extraParametersNoCache =
22020
+ createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
21344
22021
  this.addRequestSKUs(validatedRequest);
21345
22022
  return validatedRequest;
21346
22023
  }
22024
+ /**
22025
+ * Creates and validates the broker-specific parameters for a DPoP request.
22026
+ * @param request - Developer-provided token request.
22027
+ * @returns Broker parameters for a DPoP token and resource proof.
22028
+ */
22029
+ createDpopRequestParameters(request) {
22030
+ if (request.popKid) {
22031
+ throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
22032
+ }
22033
+ if (!request.resourceRequestMethod?.trim() ||
22034
+ !request.resourceRequestUri?.trim()) {
22035
+ throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
22036
+ }
22037
+ const resourceContext = normalizeDpopResourceRequestContext({
22038
+ htm: request.resourceRequestMethod,
22039
+ htu: request.resourceRequestUri,
22040
+ }, this.correlationId);
22041
+ return {
22042
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
22043
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
22044
+ keyId: request.dpopJkt,
22045
+ resourceRequestMethod: resourceContext.htm,
22046
+ resourceRequestUri: resourceContext.htu,
22047
+ };
22048
+ }
22049
+ /**
22050
+ * Provisions the local key and confirmation data for a DPoP broker request.
22051
+ * @param request - Broker request to prepare.
22052
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
22053
+ */
22054
+ async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
22055
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
22056
+ return;
22057
+ }
22058
+ /*
22059
+ * Phase one clears both fields after an L3 response or non-fatal broker
22060
+ * error. In that case phase two must provision a replacement. If either
22061
+ * field remains, treat it as a retained binding and validate it fully.
22062
+ */
22063
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
22064
+ if (!request.keyId || !request.reqCnf) {
22065
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
22066
+ }
22067
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
22068
+ if (request.reqCnf !== expectedReqCnf) {
22069
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
22070
+ }
22071
+ const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
22072
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
22073
+ : await this.tokenBindingKeyManager
22074
+ .getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
22075
+ .then(() => true, () => false);
22076
+ if (!hasKey) {
22077
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
22078
+ }
22079
+ return;
22080
+ }
22081
+ if (request.reqCnf) {
22082
+ throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
22083
+ }
22084
+ if (!request.keyId) {
22085
+ request.keyId =
22086
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
22087
+ tokenBindingKeyType: AuthenticationScheme.DPOP.toLowerCase(),
22088
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
22089
+ correlationId: this.correlationId,
22090
+ });
22091
+ }
22092
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
22093
+ }
22094
+ /**
22095
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
22096
+ * @param keyId - Browser-managed DPoP key identifier.
22097
+ * @returns Encoded broker confirmation claim.
22098
+ */
22099
+ createDpopBrokerReqCnf(keyId) {
22100
+ return this.browserCrypto.base64UrlEncode(JSON.stringify({
22101
+ kid: keyId,
22102
+ xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
22103
+ }));
22104
+ }
22105
+ /**
22106
+ * Ensures an owned DPoP key can survive redirect navigation before the
22107
+ * request metadata is persisted for phase two.
22108
+ */
22109
+ async ensureRedirectDpopKeyIsPersisted(request) {
22110
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
22111
+ return;
22112
+ }
22113
+ if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
22114
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
22115
+ }
22116
+ }
22117
+ /**
22118
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
22119
+ * @param response - Broker response to validate.
22120
+ * @param request - Broker request associated with the response.
22121
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
22122
+ */
22123
+ validateDpopBrokerOutcome(response, request) {
22124
+ const isDpopRequest = this.isDpopBrokerRequest(request);
22125
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
22126
+ const normalizedRequestTokenType = request.tokenType
22127
+ ?.trim()
22128
+ .toLowerCase();
22129
+ const bindingPreferenceSent = request.bindingPreferenceSent ??
22130
+ request.preferBinding !== undefined;
22131
+ const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
22132
+ normalizedResponse.proof !== undefined ||
22133
+ normalizedResponse.hasBindingAttested;
22134
+ if (!isDpopRequest) {
22135
+ if (hasDpopResponse) {
22136
+ this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
22137
+ }
22138
+ return "none";
22139
+ }
22140
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
22141
+ this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
22142
+ }
22143
+ this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
22144
+ if (normalizedResponse.tokenType ===
22145
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
22146
+ return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
22147
+ }
22148
+ return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
22149
+ }
22150
+ /**
22151
+ * Normalizes the canonical DPoP fields returned under response properties.
22152
+ */
22153
+ normalizeDpopBrokerResponse(response) {
22154
+ const responseProperties = response.properties;
22155
+ const rawTokenType = responseProperties?.token_type;
22156
+ const tokenType = typeof rawTokenType === "string"
22157
+ ? rawTokenType.trim().toLowerCase()
22158
+ : undefined;
22159
+ const rawBindingAttested = responseProperties?.binding_attested;
22160
+ let bindingAttested;
22161
+ if (typeof rawBindingAttested === "string") {
22162
+ const normalizedBindingAttested = rawBindingAttested
22163
+ .trim()
22164
+ .toLowerCase();
22165
+ if (normalizedBindingAttested === "true") {
22166
+ bindingAttested = true;
22167
+ }
22168
+ else if (normalizedBindingAttested === "false") {
22169
+ bindingAttested = false;
22170
+ }
22171
+ }
22172
+ return {
22173
+ tokenType,
22174
+ proof: responseProperties?.DPoP,
22175
+ bindingAttested,
22176
+ hasBindingAttested: rawBindingAttested !== undefined,
22177
+ hasMalformedBindingAttested: rawBindingAttested !== undefined &&
22178
+ bindingAttested === undefined,
22179
+ };
22180
+ }
22181
+ /**
22182
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
22183
+ */
22184
+ validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
22185
+ if (normalizedResponse.hasMalformedBindingAttested) {
22186
+ this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
22187
+ }
22188
+ if (bindingPreferenceSent &&
22189
+ normalizedResponse.bindingAttested === undefined) {
22190
+ this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
22191
+ }
22192
+ }
22193
+ /**
22194
+ * Validates a broker-returned L3 DPoP proof outcome.
22195
+ */
22196
+ validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
22197
+ const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
22198
+ if (typeof normalizedResponse.proof !== "string" ||
22199
+ normalizedResponse.proof.trim().length === 0) {
22200
+ this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
22201
+ }
22202
+ if (normalizedResponse.bindingAttested !== true) {
22203
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
22204
+ }
22205
+ if (normalizedRequestTokenType !== dpopWithProofTokenType ||
22206
+ normalizedResponse.tokenType !== dpopWithProofTokenType) {
22207
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
22208
+ }
22209
+ this.performanceClient.addFields({
22210
+ "ext.brokerDpopOutcome": "l3",
22211
+ "ext.brokerDpopBindingLevel": "L3",
22212
+ }, this.correlationId);
22213
+ return "L3";
22214
+ }
22215
+ /**
22216
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
22217
+ */
22218
+ validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
22219
+ if (normalizedResponse.proof !== undefined) {
22220
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
22221
+ }
22222
+ if (normalizedRequestTokenType !==
22223
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
22224
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
22225
+ }
22226
+ if (normalizedResponse.bindingAttested !== false &&
22227
+ !(!bindingPreferenceSent &&
22228
+ normalizedResponse.bindingAttested === undefined)) {
22229
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
22230
+ }
22231
+ if (!request.reqCnf || !request.keyId) {
22232
+ this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
22233
+ }
22234
+ this.performanceClient.addFields({
22235
+ "ext.brokerDpopOutcome": "l1",
22236
+ "ext.brokerDpopBindingLevel": "L1",
22237
+ }, this.correlationId);
22238
+ return "L1";
22239
+ }
22240
+ /**
22241
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
22242
+ */
22243
+ throwInvalidDpopResponse(failureReason, message) {
22244
+ this.performanceClient.addFields({
22245
+ "ext.brokerDpopOutcome": "invalid_response",
22246
+ "ext.brokerDpopFailureReason": failureReason,
22247
+ }, this.correlationId);
22248
+ throw createAuthError(unexpectedError, this.correlationId, message);
22249
+ }
22250
+ /**
22251
+ * Returns the broker proof or signs an L1 resource proof with the local key.
22252
+ * @param response - Broker response containing the access token and optional proof.
22253
+ * @param request - Broker request containing the proof context and local key.
22254
+ * @returns The resource proof for the broker access token.
22255
+ */
22256
+ async generateDpopProof(response, request) {
22257
+ const brokerProof = response.properties?.DPoP;
22258
+ if (brokerProof !== undefined) {
22259
+ return brokerProof;
22260
+ }
22261
+ const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
22262
+ return dpopProofGenerator.generateResourceProof({
22263
+ htu: request.resourceRequestUri,
22264
+ htm: request.resourceRequestMethod,
22265
+ accessToken: response.access_token,
22266
+ nonce: request.extraParametersNoCache?.pop_nonce,
22267
+ }, request.keyId, this.correlationId);
22268
+ }
22269
+ /**
22270
+ * Removes a generated DPoP request key and clears its request metadata.
22271
+ * @param request - Broker request whose generated key should be removed.
22272
+ */
22273
+ async resetGeneratedDpopRequestKey(request) {
22274
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
22275
+ return;
22276
+ }
22277
+ const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
22278
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
22279
+ try {
22280
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
22281
+ throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
22282
+ }
22283
+ this.performanceClient.addFields({
22284
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
22285
+ }, this.correlationId);
22286
+ cleanupMeasurement.end({ success: true });
22287
+ request.keyId = undefined;
22288
+ request.reqCnf = undefined;
22289
+ }
22290
+ catch (error) {
22291
+ this.performanceClient.addFields({
22292
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
22293
+ }, this.correlationId);
22294
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
22295
+ cleanupMeasurement.end({ success: false }, error);
22296
+ throw error;
22297
+ }
22298
+ }
22299
+ /**
22300
+ * Attempts to remove a generated DPoP request key without replacing an
22301
+ * existing operation error with a cleanup failure.
22302
+ * @param request - Broker request whose generated key should be removed.
22303
+ */
22304
+ async resetGeneratedDpopRequestKeyBestEffort(request) {
22305
+ try {
22306
+ await this.resetGeneratedDpopRequestKey(request);
22307
+ }
22308
+ catch {
22309
+ this.logger.error("1kxxak", this.correlationId);
22310
+ this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
22311
+ request.keyId = undefined;
22312
+ request.reqCnf = undefined;
22313
+ }
22314
+ }
22315
+ /**
22316
+ * Records that a DPoP request is about to be dispatched to the platform broker.
22317
+ * @param request - Broker request about to cross the provider boundary.
22318
+ */
22319
+ addDpopBrokerAttemptTelemetry(request) {
22320
+ if (!this.isDpopBrokerRequest(request)) {
22321
+ return;
22322
+ }
22323
+ this.performanceClient.addFields({
22324
+ "ext.brokerDpopAttempted": 1,
22325
+ }, this.correlationId);
22326
+ }
22327
+ /**
22328
+ * Determines whether a request uses the DPoP broker protocol.
22329
+ * @param request - Broker request to inspect.
22330
+ * @returns Whether the request uses a DPoP token type.
22331
+ */
22332
+ isDpopBrokerRequest(request) {
22333
+ return this.isDpopBrokerTokenType(request.tokenType);
22334
+ }
22335
+ /**
22336
+ * Determines whether a token type represents a DPoP broker request.
22337
+ * @param tokenType - Token type to inspect.
22338
+ * @returns Whether the token type is a supported DPoP broker token type.
22339
+ */
22340
+ isDpopBrokerTokenType(tokenType) {
22341
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
22342
+ return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
22343
+ normalizedTokenType ===
22344
+ AuthenticationScheme.DPOP.toLowerCase());
22345
+ }
22346
+ /**
22347
+ * Removes a DPoP key while reporting cleanup failures.
22348
+ * @param keyId - Identifier of the DPoP key to remove.
22349
+ * @returns Whether the key was removed successfully.
22350
+ */
22351
+ async removeDpopKey(keyId) {
22352
+ try {
22353
+ await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
22354
+ return true;
22355
+ }
22356
+ catch {
22357
+ this.logger.error("1w60e4", this.correlationId);
22358
+ return false;
22359
+ }
22360
+ }
21347
22361
  async getCanonicalAuthority(request) {
21348
22362
  const requestAuthority = request.authority || this.config.auth.authority;
21349
22363
  const { azureCloudOptions, account } = request;
@@ -21382,29 +22396,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21382
22396
  }
21383
22397
  }
21384
22398
  /**
21385
- * Handles extra broker request parameters
21386
- * @param request {PlatformAuthRequest}
21387
- * @private
22399
+ * Handles extra broker request parameters.
22400
+ * @param request - Platform broker request.
22401
+ * @param embeddedClientId - Embedded application client identifier.
21388
22402
  */
21389
22403
  handleExtraBrokerParams(request, embeddedClientId) {
21390
- const hasExtraBrokerParams = request.extraParameters &&
21391
- request.extraParameters.hasOwnProperty(BROKER_CLIENT_ID) &&
21392
- request.extraParameters.hasOwnProperty(BROKER_REDIRECT_URI) &&
21393
- request.extraParameters.hasOwnProperty(CLIENT_ID);
22404
+ const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
22405
+ const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
22406
+ hasOwnParameter(BROKER_REDIRECT_URI) &&
22407
+ hasOwnParameter(CLIENT_ID);
21394
22408
  if (!embeddedClientId && !hasExtraBrokerParams) {
21395
22409
  return;
21396
22410
  }
21397
- let child_client_id = "";
21398
- const child_redirect_uri = request.redirectUri;
22411
+ const childRedirectUri = request.redirectUri;
22412
+ const childClientId = embeddedClientId ||
22413
+ request.extraParameters?.[CLIENT_ID] ||
22414
+ "";
21399
22415
  if (embeddedClientId) {
21400
22416
  request.redirectUri = this.config.auth.redirectUri;
21401
- child_client_id = embeddedClientId;
21402
22417
  }
21403
22418
  else if (request.extraParameters) {
21404
22419
  request.redirectUri =
21405
22420
  request.extraParameters[BROKER_REDIRECT_URI];
21406
- child_client_id =
21407
- request.extraParameters[CLIENT_ID];
21408
22421
  }
21409
22422
  const {
21410
22423
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -21415,15 +22428,20 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
21415
22428
  [CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
21416
22429
  request.extraParameters = {
21417
22430
  ...remainingExtraParameters,
21418
- child_client_id,
21419
- child_redirect_uri,
22431
+ child_client_id: childClientId,
22432
+ child_redirect_uri: childRedirectUri,
21420
22433
  };
21421
22434
  this.performanceClient?.addFields({
21422
- embeddedClientId: child_client_id,
21423
- embeddedRedirectUri: child_redirect_uri,
22435
+ embeddedClientId: childClientId,
22436
+ embeddedRedirectUri: childRedirectUri,
21424
22437
  }, this.correlationId);
21425
22438
  }
21426
- }
22439
+ }
22440
+ /**
22441
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
22442
+ * This does not constrain the binding selected by the platform broker.
22443
+ */
22444
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
21427
22445
 
21428
22446
  /*
21429
22447
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -21529,6 +22547,7 @@ async function getStandardParameters(config, authority, request, logger, perform
21529
22547
  }
21530
22548
  }
21531
22549
  if (request.authenticationScheme === AuthenticationScheme.DPOP &&
22550
+ !request.platformBroker &&
21532
22551
  request.dpopJkt) {
21533
22552
  parameters.set(DPOP_JKT, request.dpopJkt);
21534
22553
  }
@@ -21652,19 +22671,25 @@ function createForm(frame, action, fields) {
21652
22671
  * @param nativeMessageHandler
21653
22672
  * @returns
21654
22673
  */
21655
- async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
22674
+ async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
21656
22675
  logger.verbose("11qcow", request.correlationId);
21657
22676
  if (!platformAuthProvider) {
21658
22677
  throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
21659
22678
  }
21660
22679
  const browserCrypto = new CryptoOps(logger, performanceClient);
21661
- const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
22680
+ const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
21662
22681
  const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
21663
- return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
21664
- ...request,
21665
- state: userRequestState,
21666
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
21667
- });
22682
+ try {
22683
+ return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
22684
+ ...request,
22685
+ state: userRequestState,
22686
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
22687
+ });
22688
+ }
22689
+ catch (e) {
22690
+ await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
22691
+ throw e;
22692
+ }
21668
22693
  }
21669
22694
  /**
21670
22695
  * Response handler when server returns code on the /authorize request
@@ -21677,13 +22702,13 @@ async function handleResponsePlatformBroker(request, accountId, apiId, config, b
21677
22702
  * @param performanceClient
21678
22703
  * @returns
21679
22704
  */
21680
- async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
22705
+ async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
21681
22706
  // Remove throttle if it exists
21682
22707
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
21683
22708
  // Instrument clientdata telemetry fields from the authorize response
21684
22709
  instrumentClientData(response, request.correlationId, performanceClient);
21685
22710
  if (response.accountId) {
21686
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
22711
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
21687
22712
  }
21688
22713
  const authCodeRequest = {
21689
22714
  ...request,
@@ -21711,7 +22736,7 @@ async function handleResponseCode(request, response, codeVerifier, apiId, config
21711
22736
  * @param nativeMessageHandler
21712
22737
  * @returns
21713
22738
  */
21714
- async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
22739
+ async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
21715
22740
  // Remove throttle if it exists
21716
22741
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
21717
22742
  // Instrument clientdata telemetry fields from the authorize response
@@ -21726,9 +22751,9 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
21726
22751
  }
21727
22752
  const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
21728
22753
  if (decryptedData.accountId) {
21729
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
22754
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
21730
22755
  }
21731
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
22756
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
21732
22757
  // Validate response. This function throws a server error if an error is returned by the server.
21733
22758
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
21734
22759
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -22175,6 +23200,7 @@ class PlatformAuthExtensionHandler {
22175
23200
  const extensionRequest = { ...request };
22176
23201
  delete extensionRequest.resourceRequestMethod;
22177
23202
  delete extensionRequest.resourceRequestUri;
23203
+ delete extensionRequest.bindingPreferenceSent;
22178
23204
  const messageBody = {
22179
23205
  method: NativeExtensionMethod.GetToken,
22180
23206
  request: extensionRequest,
@@ -22186,8 +23212,9 @@ class PlatformAuthExtensionHandler {
22186
23212
  body: messageBody,
22187
23213
  };
22188
23214
  this.logger.trace(`1qadfi ${this.platformAuthType}`, correlationId);
22189
- this.logger.tracePii(`1xm533 ${this.platformAuthType} ${JSON.stringify(req)}`, correlationId);
22190
23215
  this.messageChannel.port1.postMessage(req);
23216
+ request.bindingPreferenceSent =
23217
+ extensionRequest.preferBinding !== undefined;
22191
23218
  const response = await new Promise((resolve, reject) => {
22192
23219
  this.resolvers.set(req.responseId, {
22193
23220
  resolve,
@@ -22384,13 +23411,11 @@ class PlatformAuthExtensionHandler {
22384
23411
  try {
22385
23412
  const response = request.body.response;
22386
23413
  this.logger.trace(`19hpgm ${this.platformAuthType}`, correlationId);
22387
- this.logger.tracePii(`179a24 ${this.platformAuthType} ${JSON.stringify(response)}`, correlationId);
22388
23414
  if (response.status !== "Success") {
22389
23415
  resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
22390
23416
  }
22391
23417
  else if (response.result) {
22392
- if (response.result["code"] &&
22393
- response.result["description"]) {
23418
+ if (response.result["code"]) {
22394
23419
  resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
22395
23420
  }
22396
23421
  else {
@@ -22471,11 +23496,12 @@ class PlatformAuthExtensionHandler {
22471
23496
  Object.prototype.hasOwnProperty.call(response, "account") &&
22472
23497
  Object.prototype.hasOwnProperty.call(response, "scope") &&
22473
23498
  Object.prototype.hasOwnProperty.call(response, "expires_in")) {
23499
+ const validatedResponse = response;
22474
23500
  validationMeasurement.end({
22475
23501
  success: true,
22476
23502
  platformAuthProviderType: this.platformAuthType,
22477
23503
  });
22478
- return response;
23504
+ return validatedResponse;
22479
23505
  }
22480
23506
  else {
22481
23507
  const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
@@ -22517,6 +23543,7 @@ class PlatformAuthExtensionHandler {
22517
23543
  * Copyright (c) Microsoft Corporation. All rights reserved.
22518
23544
  * Licensed under the MIT License.
22519
23545
  */
23546
+ const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
22520
23547
  class PlatformAuthDOMHandler {
22521
23548
  constructor(logger, performanceClient, correlationId) {
22522
23549
  this.logger = logger;
@@ -22596,6 +23623,10 @@ class PlatformAuthDOMHandler {
22596
23623
  });
22597
23624
  this.logger.trace(`02bcil ${this.platformAuthType}`, correlationId);
22598
23625
  try {
23626
+ if (request.tokenType?.trim().toLowerCase() ===
23627
+ PlatformAuthTokenType.DPOP_WITH_PROOF) {
23628
+ throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
23629
+ }
22599
23630
  const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
22600
23631
  const response =
22601
23632
  // @ts-ignore
@@ -22622,6 +23653,7 @@ class PlatformAuthDOMHandler {
22622
23653
  this.logger.trace(`15d6yv ${this.platformAuthType}`, requestCorrelationId);
22623
23654
  delete remainingProperties.resourceRequestMethod;
22624
23655
  delete remainingProperties.resourceRequestUri;
23656
+ delete remainingProperties.bindingPreferenceSent;
22625
23657
  const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
22626
23658
  const platformDOMRequest = {
22627
23659
  accountId: accountId,
@@ -22832,7 +23864,9 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
22832
23864
  logger.trace("0uko3r", correlationId);
22833
23865
  const schemeSupported = !authenticationScheme ||
22834
23866
  authenticationScheme === AuthenticationScheme.BEARER ||
22835
- authenticationScheme === AuthenticationScheme.POP;
23867
+ authenticationScheme === AuthenticationScheme.POP ||
23868
+ (authenticationScheme === AuthenticationScheme.DPOP &&
23869
+ !(platformAuthProvider instanceof PlatformAuthDOMHandler));
22836
23870
  const fields = {
22837
23871
  allowPlatformBroker: config.system.allowPlatformBroker,
22838
23872
  ...(config.system.allowPlatformBroker && {
@@ -23029,12 +24063,13 @@ class PopupClient extends StandardInteractionClient {
23029
24063
  // Wait for the redirect bridge response
23030
24064
  const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
23031
24065
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
23032
- 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);
24066
+ 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);
23033
24067
  }
23034
24068
  }
23035
24069
  catch (e) {
23036
24070
  // Close the synchronous popup if an error is thrown before the window unload event is registered
23037
24071
  popupParams.popup?.close();
24072
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
23038
24073
  if (e instanceof AuthError) {
23039
24074
  e.correlationId = this.correlationId;
23040
24075
  serverTelemetryManager.cacheFailedRequest(e);
@@ -23061,23 +24096,29 @@ class PopupClient extends StandardInteractionClient {
23061
24096
  ...tokenBindingParams,
23062
24097
  popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
23063
24098
  };
23064
- const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
23065
- // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
23066
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
23067
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
23068
- if (!serverParams.ear_jwe && serverParams.code) {
23069
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
23070
- serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
23071
- requestAuthority: request.authority,
23072
- requestAzureCloudOptions: request.azureCloudOptions,
23073
- requestExtraQueryParameters: request.extraQueryParameters,
23074
- account: request.account,
23075
- authority: discoveredAuthority,
23076
- });
23077
- 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);
24099
+ try {
24100
+ const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
24101
+ // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
24102
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
24103
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
24104
+ if (!serverParams.ear_jwe && serverParams.code) {
24105
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
24106
+ serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
24107
+ requestAuthority: request.authority,
24108
+ requestAzureCloudOptions: request.azureCloudOptions,
24109
+ requestExtraQueryParameters: request.extraQueryParameters,
24110
+ account: request.account,
24111
+ authority: discoveredAuthority,
24112
+ });
24113
+ 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);
24114
+ }
24115
+ else {
24116
+ 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);
24117
+ }
23078
24118
  }
23079
- else {
23080
- 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);
24119
+ catch (e) {
24120
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
24121
+ throw e;
23081
24122
  }
23082
24123
  }
23083
24124
  async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
@@ -23088,7 +24129,7 @@ class PopupClient extends StandardInteractionClient {
23088
24129
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
23089
24130
  const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
23090
24131
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
23091
- 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);
24132
+ 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);
23092
24133
  }
23093
24134
  /**
23094
24135
  *
@@ -23476,8 +24517,11 @@ class RedirectClient extends StandardInteractionClient {
23476
24517
  codeChallenge: pkceCodes.challenge,
23477
24518
  ...tokenBindingParams,
23478
24519
  };
23479
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
23480
24520
  try {
24521
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
24522
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
24523
+ }
24524
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
23481
24525
  if (redirectRequest.httpMethod === HttpMethod$1.POST) {
23482
24526
  return await this.executeCodeFlowWithPost(redirectRequest);
23483
24527
  }
@@ -23497,6 +24541,7 @@ class RedirectClient extends StandardInteractionClient {
23497
24541
  }
23498
24542
  }
23499
24543
  catch (e) {
24544
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
23500
24545
  if (e instanceof AuthError) {
23501
24546
  e.correlationId = this.correlationId;
23502
24547
  serverTelemetryManager.cacheFailedRequest(e);
@@ -23521,14 +24566,23 @@ class RedirectClient extends StandardInteractionClient {
23521
24566
  codeChallenge: pkceCodes.challenge,
23522
24567
  ...tokenBindingParams,
23523
24568
  };
23524
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
23525
- const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
23526
- form.submit();
23527
- return new Promise((resolve, reject) => {
23528
- setTimeout(() => {
23529
- reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
23530
- }, this.config.system.redirectNavigationTimeout);
23531
- });
24569
+ try {
24570
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
24571
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
24572
+ }
24573
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
24574
+ const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
24575
+ form.submit();
24576
+ return await new Promise((resolve, reject) => {
24577
+ setTimeout(() => {
24578
+ reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
24579
+ }, this.config.system.redirectNavigationTimeout);
24580
+ });
24581
+ }
24582
+ catch (e) {
24583
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
24584
+ throw e;
24585
+ }
23532
24586
  }
23533
24587
  /**
23534
24588
  * Executes classic Authorization Code flow with a POST request.
@@ -23567,6 +24621,7 @@ class RedirectClient extends StandardInteractionClient {
23567
24621
  if (!serverParams) {
23568
24622
  // Not a recognized server response hash or hash not associated with a redirect request
23569
24623
  this.logger.info("1qmv0q", this.correlationId);
24624
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
23570
24625
  this.browserStorage.resetRequestCache(this.correlationId);
23571
24626
  // Do not instrument "no_server_response" if user clicked back button
23572
24627
  if (getNavigationType() !== "back_forward") {
@@ -23636,6 +24691,7 @@ class RedirectClient extends StandardInteractionClient {
23636
24691
  return null;
23637
24692
  }
23638
24693
  catch (e) {
24694
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
23639
24695
  if (e instanceof AuthError) {
23640
24696
  e.correlationId = this.correlationId;
23641
24697
  serverTelemetryManager.cacheFailedRequest(e);
@@ -23702,10 +24758,10 @@ class RedirectClient extends StandardInteractionClient {
23702
24758
  const { authority, azureCloudOptions, extraQueryParameters, account } = request;
23703
24759
  if (serverParams.ear_jwe) {
23704
24760
  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);
23705
- 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);
24761
+ 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);
23706
24762
  }
23707
24763
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
23708
- 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);
24764
+ 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);
23709
24765
  }
23710
24766
  /**
23711
24767
  * Redirects window to given URL.
@@ -24036,10 +25092,10 @@ class SilentIframeClient extends StandardInteractionClient {
24036
25092
  account: request.account,
24037
25093
  authority: discoveredAuthority,
24038
25094
  });
24039
- 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);
25095
+ 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);
24040
25096
  }
24041
25097
  else {
24042
- 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);
25098
+ 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);
24043
25099
  }
24044
25100
  }
24045
25101
  /**
@@ -24089,7 +25145,13 @@ class SilentIframeClient extends StandardInteractionClient {
24089
25145
  */
24090
25146
  async silentTokenHelper(authClient, request) {
24091
25147
  const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
24092
- 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);
25148
+ try {
25149
+ 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);
25150
+ }
25151
+ catch (e) {
25152
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
25153
+ throw e;
25154
+ }
24093
25155
  }
24094
25156
  /**
24095
25157
  * Shared helper that generates PKCE codes, builds the /authorize URL,
@@ -24106,38 +25168,44 @@ class SilentIframeClient extends StandardInteractionClient {
24106
25168
  codeChallenge: pkceCodes.challenge,
24107
25169
  ...tokenBindingParams,
24108
25170
  };
24109
- // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
24110
- const iframe = createHiddenIframe();
24111
- const responseType = this.config.auth.OIDCOptions.responseMode;
24112
- // Wait for response from the redirect bridge.
24113
- let responseString;
24114
25171
  try {
24115
- const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
24116
- responsePromise.catch(() => {
24117
- /*
24118
- * If URL creation or navigation below throws before
24119
- * responsePromise is awaited, the listener still rejects on
24120
- * timeout. Swallow it here so it does not surface as an
24121
- * unhandled rejection; the navigation error is propagated
24122
- * instead.
24123
- */
24124
- });
24125
- if (request.httpMethod === HttpMethod$1.POST) {
24126
- await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
25172
+ // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
25173
+ const iframe = createHiddenIframe();
25174
+ const responseType = this.config.auth.OIDCOptions.responseMode;
25175
+ // Wait for response from the redirect bridge.
25176
+ let responseString;
25177
+ try {
25178
+ const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
25179
+ responsePromise.catch(() => {
25180
+ /*
25181
+ * If URL creation or navigation below throws before
25182
+ * responsePromise is awaited, the listener still rejects on
25183
+ * timeout. Swallow it here so it does not surface as an
25184
+ * unhandled rejection; the navigation error is propagated
25185
+ * instead.
25186
+ */
25187
+ });
25188
+ if (request.httpMethod === HttpMethod$1.POST) {
25189
+ await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
25190
+ }
25191
+ else {
25192
+ // Create authorize request url
25193
+ const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
25194
+ // Navigate the iframe to the authorize request url
25195
+ await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
25196
+ }
25197
+ responseString = await responsePromise;
24127
25198
  }
24128
- else {
24129
- // Create authorize request url
24130
- const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
24131
- // Navigate the iframe to the authorize request url
24132
- await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
25199
+ finally {
25200
+ invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
24133
25201
  }
24134
- responseString = await responsePromise;
25202
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
25203
+ return { serverParams, pkceCodes, silentRequest };
24135
25204
  }
24136
- finally {
24137
- invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
25205
+ catch (e) {
25206
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
25207
+ throw e;
24138
25208
  }
24139
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
24140
- return { serverParams, pkceCodes, silentRequest };
24141
25209
  }
24142
25210
  async waitForIframeResponse(iframe, request) {
24143
25211
  if (this.waitForIframeResponseHook) {
@@ -24398,7 +25466,6 @@ function getPlatformSilentRequestKey(request, config) {
24398
25466
  : undefined,
24399
25467
  extraParameters: canonicalizeStringDict(request.extraParameters),
24400
25468
  extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
24401
- extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
24402
25469
  forceRefresh: !!request.forceRefresh,
24403
25470
  cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
24404
25471
  });
@@ -24407,8 +25474,12 @@ function getPlatformSilentRequestKey(request, config) {
24407
25474
  * Copies caller-owned mutable inputs before asynchronous broker initialization.
24408
25475
  */
24409
25476
  function snapshotPlatformSilentRequest(request) {
24410
- return {
25477
+ const snapshot = {
24411
25478
  ...request,
25479
+ };
25480
+ delete snapshot.extraParametersNoCache;
25481
+ return {
25482
+ ...snapshot,
24412
25483
  scopes: [...(request.scopes || [])],
24413
25484
  account: { ...request.account },
24414
25485
  azureCloudOptions: request.azureCloudOptions
@@ -24420,9 +25491,6 @@ function snapshotPlatformSilentRequest(request) {
24420
25491
  extraQueryParameters: request.extraQueryParameters
24421
25492
  ? { ...request.extraQueryParameters }
24422
25493
  : undefined,
24423
- extraParametersNoCache: request.extraParametersNoCache
24424
- ? { ...request.extraParametersNoCache }
24425
- : undefined,
24426
25494
  attributeTokens: request.attributeTokens
24427
25495
  ? [...request.attributeTokens]
24428
25496
  : undefined,
@@ -24787,8 +25855,9 @@ class StandardController {
24787
25855
  let result;
24788
25856
  const platformAuthProvider = this.platformAuthProvider;
24789
25857
  if (this.canUsePlatformBroker(request) && platformAuthProvider) {
25858
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
24790
25859
  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);
24791
- result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
25860
+ result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
24792
25861
  if (e instanceof NativeAuthError &&
24793
25862
  isFatalNativeAuthError(e)) {
24794
25863
  this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
@@ -25333,6 +26402,13 @@ class StandardController {
25333
26402
  const correlationId = this.getRequestCorrelationId(logoutRequest);
25334
26403
  redirectPreflightCheck(this.initialized, this.config);
25335
26404
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
26405
+ try {
26406
+ await this.clearNativeCache(logoutRequest?.account, correlationId);
26407
+ }
26408
+ catch (error) {
26409
+ this.browserStorage.setInteractionInProgress(false);
26410
+ throw error;
26411
+ }
25336
26412
  const redirectClient = this.createRedirectClient(correlationId);
25337
26413
  return redirectClient.logout(logoutRequest);
25338
26414
  }
@@ -25346,7 +26422,11 @@ class StandardController {
25346
26422
  preflightCheck$1(this.initialized);
25347
26423
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
25348
26424
  const popupClient = this.createPopupClient(correlationId);
25349
- return popupClient.logout(logoutRequest).finally(() => {
26425
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
26426
+ const popupLogout = popupClient.logout(logoutRequest);
26427
+ return Promise.all([nativeCacheClear, popupLogout])
26428
+ .then(() => undefined)
26429
+ .finally(() => {
25350
26430
  this.browserStorage.setInteractionInProgress(false);
25351
26431
  });
25352
26432
  }
@@ -25365,7 +26445,30 @@ class StandardController {
25365
26445
  }
25366
26446
  const correlationId = this.getRequestCorrelationId(logoutRequest);
25367
26447
  const cacheClient = this.createSilentCacheClient(correlationId);
25368
- return cacheClient.logout(logoutRequest);
26448
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
26449
+ const browserCacheClear = cacheClient.logout(logoutRequest);
26450
+ await Promise.all([nativeCacheClear, browserCacheClear]);
26451
+ }
26452
+ async clearNativeCache(account, correlationId) {
26453
+ const homeAccountId = account?.homeAccountId.toLowerCase();
26454
+ const environment = account?.environment.toLowerCase();
26455
+ const accessTokenKeys = this.nativeInternalStorage
26456
+ .getTokenKeys()
26457
+ .accessToken.filter((key) => {
26458
+ if (!account) {
26459
+ return true;
26460
+ }
26461
+ const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
26462
+ if (!accessToken) {
26463
+ return false;
26464
+ }
26465
+ return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
26466
+ accessToken.environment.toLowerCase() === environment);
26467
+ });
26468
+ await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
26469
+ if (!account) {
26470
+ this.nativeInternalStorage.clear(correlationId);
26471
+ }
25369
26472
  }
25370
26473
  // #endregion
25371
26474
  // #region Account APIs
@@ -25447,6 +26550,19 @@ class StandardController {
25447
26550
  }
25448
26551
  }
25449
26552
  // #region Helpers
26553
+ /**
26554
+ * Removes internal DPoP key state from application-originated broker requests.
26555
+ */
26556
+ sanitizeNativeBrokerRequest(request, correlationId) {
26557
+ if (!request.dpopJkt) {
26558
+ return request;
26559
+ }
26560
+ this.logger.warning("0rh2us", correlationId);
26561
+ return {
26562
+ ...request,
26563
+ dpopJkt: undefined,
26564
+ };
26565
+ }
25450
26566
  /**
25451
26567
  * Acquire a token from native device (e.g. WAM)
25452
26568
  * @param request
@@ -25466,7 +26582,8 @@ class StandardController {
25466
26582
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
25467
26583
  }
25468
26584
  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);
25469
- return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
26585
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
26586
+ return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
25470
26587
  }
25471
26588
  /**
25472
26589
  * Returns boolean indicating if this request can use the platform broker
@@ -25746,14 +26863,23 @@ class StandardController {
25746
26863
  correlationId,
25747
26864
  config: this.config,
25748
26865
  }, this.platformAuthProvider, this.logger, this.performanceClient);
25749
- const inProgressRequest = this.activeSilentTokenRequests.get(preparedRequest.key);
26866
+ const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
26867
+ AuthenticationScheme.DPOP;
26868
+ const inProgressRequest = shouldDeduplicate
26869
+ ? this.activeSilentTokenRequests.get(preparedRequest.key)
26870
+ : undefined;
25750
26871
  if (typeof inProgressRequest === "undefined") {
25751
- this.logger.verbose("0fcjbk", correlationId);
26872
+ this.logger.verbose(shouldDeduplicate
26873
+ ? "0fcjbk"
26874
+ : "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
25752
26875
  this.performanceClient.addFields({ deduped: false }, correlationId);
25753
26876
  const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
25754
26877
  ...preparedRequest.request,
25755
26878
  correlationId,
25756
26879
  }, preparedRequest.account);
26880
+ if (!shouldDeduplicate) {
26881
+ return activeRequest;
26882
+ }
25757
26883
  this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
25758
26884
  return activeRequest.finally(() => {
25759
26885
  this.activeSilentTokenRequests.delete(preparedRequest.key);
@@ -26346,6 +27472,17 @@ class CustomAuthStandardController extends StandardController {
26346
27472
  cacheClient: this.cacheClient,
26347
27473
  }), undefined, result.continuationState.scenario);
26348
27474
  }
27475
+ if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
27476
+ return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
27477
+ correlationId: result.correlationId,
27478
+ logger: this.logger,
27479
+ config: this.customAuthConfig,
27480
+ flowClient: this.flowClientV2,
27481
+ continuationState: result.continuationState,
27482
+ cacheClient: this.cacheClient,
27483
+ methods: result.methods,
27484
+ }), undefined, result.continuationState.scenario);
27485
+ }
26349
27486
  if (result.type === FLOW_CODE_REQUIRED_V2) {
26350
27487
  return new CustomAuthResultV2(new CodeRequiredStateV2({
26351
27488
  correlationId: result.correlationId,
@@ -27506,10 +28643,12 @@ exports.AuthMethodRegistrationChallengeMethodResult = AuthMethodRegistrationChal
27506
28643
  exports.AuthMethodRegistrationCompletedState = AuthMethodRegistrationCompletedState;
27507
28644
  exports.AuthMethodRegistrationFailedState = AuthMethodRegistrationFailedState;
27508
28645
  exports.AuthMethodRegistrationRequiredState = AuthMethodRegistrationRequiredState;
28646
+ exports.AuthMethodRegistrationRequiredStateV2 = AuthMethodRegistrationRequiredStateV2;
27509
28647
  exports.AuthMethodRegistrationSubmitChallengeError = AuthMethodRegistrationSubmitChallengeError;
27510
28648
  exports.AuthMethodRegistrationSubmitChallengeResult = AuthMethodRegistrationSubmitChallengeResult;
27511
28649
  exports.AuthMethodSelectionRequiredStateV2 = AuthMethodSelectionRequiredStateV2;
27512
28650
  exports.AuthMethodVerificationRequiredState = AuthMethodVerificationRequiredState;
28651
+ exports.AuthMethodVerificationRequiredStateV2 = AuthMethodVerificationRequiredStateV2;
27513
28652
  exports.CodeRequiredStateV2 = CodeRequiredStateV2;
27514
28653
  exports.CompletedStateV2 = CompletedStateV2;
27515
28654
  exports.CustomAuthAccountData = CustomAuthAccountData;