@azure/msal-browser 5.27.0 → 5.29.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 (567) 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 +6 -4
  38. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
  39. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +58 -50
  40. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  41. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  57. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  58. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +3 -5
  59. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -1
  60. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +19 -13
  61. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -1
  62. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +8 -2
  63. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -1
  64. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +58 -69
  65. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs.map +1 -1
  66. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +68 -0
  67. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs.map +1 -0
  68. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +44 -16
  69. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  70. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +100 -0
  71. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -0
  72. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +5 -3
  73. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
  74. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +27 -19
  75. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  76. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +2 -4
  77. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -1
  78. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +2 -3
  79. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -1
  80. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +20 -8
  81. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  82. package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs +110 -0
  83. package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
  84. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  85. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  86. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  87. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  88. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +2 -1
  89. package/dist/custom_auth/core/error/InvalidArgumentError.mjs.map +1 -1
  90. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  91. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  92. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  93. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  94. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  95. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  96. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  97. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  98. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  99. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  100. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  101. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  102. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  103. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  104. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  105. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  106. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  107. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +465 -186
  108. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  109. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +2 -6
  110. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -1
  111. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +18 -3
  112. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
  113. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  114. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  115. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  117. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  119. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  122. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +10 -8
  123. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  124. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
  125. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +147 -38
  126. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
  127. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
  128. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  129. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +21 -10
  130. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  131. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
  132. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +2 -12
  133. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
  134. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +2 -2
  135. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
  136. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  137. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  138. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +15 -3
  139. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
  140. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +10 -3
  141. package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
  142. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +17 -2
  143. package/dist/custom_auth/core/utils/ArgumentValidator.mjs.map +1 -1
  144. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  145. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  146. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  147. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  148. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  149. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  150. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  151. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  152. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  153. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  154. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  155. package/dist/custom_auth/index.mjs +6 -3
  156. package/dist/custom_auth/index.mjs.map +1 -1
  157. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  158. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  159. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  160. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  161. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  162. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  163. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  164. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  165. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  166. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  167. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  168. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +49 -14
  169. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  170. package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs +24 -0
  171. package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs.map +1 -0
  172. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  173. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  174. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  175. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  176. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  177. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  178. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  179. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  180. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  181. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  182. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  183. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  184. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  185. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +4 -7
  186. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -1
  187. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +2 -2
  188. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs.map +1 -1
  189. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  190. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  191. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  193. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  194. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  195. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  196. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  197. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  198. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  199. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  200. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  201. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  202. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  203. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +17 -8
  204. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -1
  205. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs +78 -0
  206. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs.map +1 -0
  207. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs +48 -0
  208. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs.map +1 -0
  209. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs +49 -0
  210. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs.map +1 -0
  211. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +21 -21
  212. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
  213. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  214. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  215. package/dist/encode/Base64Decode.mjs +1 -1
  216. package/dist/encode/Base64Encode.mjs +1 -1
  217. package/dist/error/BrowserAuthError.mjs +1 -1
  218. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  219. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  220. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  221. package/dist/error/NativeAuthError.mjs +1 -1
  222. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  223. package/dist/error/NestedAppAuthError.mjs +1 -1
  224. package/dist/event/EventHandler.mjs +1 -1
  225. package/dist/event/EventMessage.mjs +1 -1
  226. package/dist/event/EventType.mjs +1 -1
  227. package/dist/index.mjs +1 -1
  228. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  229. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  230. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +526 -90
  231. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  232. package/dist/interaction_client/PopupClient.mjs +27 -20
  233. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  234. package/dist/interaction_client/RedirectClient.mjs +29 -14
  235. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  236. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  237. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  238. package/dist/interaction_client/SilentIframeClient.mjs +44 -32
  239. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  240. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  241. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  242. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  243. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  244. package/dist/log-strings-mapping.json +77 -25
  245. package/dist/naa/BridgeError.mjs +1 -1
  246. package/dist/naa/BridgeProxy.mjs +1 -1
  247. package/dist/naa/BridgeStatusCode.mjs +1 -1
  248. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  249. package/dist/navigation/NavigationClient.mjs +1 -1
  250. package/dist/network/FetchClient.mjs +1 -1
  251. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  252. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  253. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  254. package/dist/packageMetadata.mjs +2 -2
  255. package/dist/popup_relay/constants.mjs +1 -1
  256. package/dist/popup_relay/index.mjs +1 -1
  257. package/dist/popup_relay/relayClient.mjs +1 -1
  258. package/dist/protocol/Authorize.mjs +21 -13
  259. package/dist/protocol/Authorize.mjs.map +1 -1
  260. package/dist/redirect_bridge/index.mjs +1 -1
  261. package/dist/request/RequestHelpers.mjs +35 -11
  262. package/dist/request/RequestHelpers.mjs.map +1 -1
  263. package/dist/request/SilentRequestHelpers.mjs +6 -6
  264. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  265. package/dist/response/ResponseHandler.mjs +1 -1
  266. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  267. package/dist/telemetry/BrowserPerformanceEvents.mjs +3 -2
  268. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  269. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  270. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  271. package/dist/utils/BrowserConstants.mjs +1 -1
  272. package/dist/utils/BrowserDetection.mjs +1 -1
  273. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  274. package/dist/utils/BrowserUtils.mjs +1 -1
  275. package/dist/utils/Helpers.mjs +1 -1
  276. package/dist/utils/IframeMonitor.mjs +1 -1
  277. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  278. package/dist/utils/PopupMonitor.mjs +1 -1
  279. package/dist/utils/PopupOriginCheck.mjs +1 -1
  280. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  281. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  282. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  283. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  284. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  285. package/dist/webBrokerBridge/index.mjs +1 -1
  286. package/lib/custom-auth-path/log-strings-mapping.json +69 -17
  287. package/lib/custom-auth-path/msal-custom-auth.cjs +2394 -920
  288. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  289. package/lib/custom-auth-path/msal-custom-auth.js +2394 -920
  290. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  291. package/lib/log-strings-mapping.json +23 -11
  292. package/lib/msal-browser.cjs +943 -278
  293. package/lib/msal-browser.cjs.map +1 -1
  294. package/lib/msal-browser.js +943 -278
  295. package/lib/msal-browser.js.map +1 -1
  296. package/lib/msal-browser.min.js +2 -2
  297. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  298. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  299. package/lib/popup-relay/msal-popup-relay.js +2 -2
  300. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  301. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  302. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  303. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  304. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  305. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  306. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  307. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  308. package/package.json +2 -2
  309. package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +15 -0
  310. package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +6 -21
  311. package/src/broker/nativeBroker/PlatformAuthProvider.ts +3 -1
  312. package/src/broker/nativeBroker/PlatformAuthRequest.ts +12 -8
  313. package/src/broker/nativeBroker/PlatformAuthResponse.ts +31 -0
  314. package/src/cache/AsyncMemoryStorage.ts +16 -0
  315. package/src/cache/BrowserCacheManager.ts +19 -1
  316. package/src/controllers/StandardController.ts +107 -11
  317. package/src/crypto/TokenBindingKeyManager.ts +21 -0
  318. package/src/custom_auth/CustomAuthActionInputs.ts +12 -5
  319. package/src/custom_auth/CustomAuthPublicClientApplication.ts +5 -3
  320. package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +5 -3
  321. package/src/custom_auth/controller/CustomAuthStandardController.ts +79 -92
  322. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +14 -0
  323. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +1 -4
  324. package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +5 -4
  325. package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +28 -16
  326. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +6 -0
  327. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.ts +83 -72
  328. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +23 -0
  329. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +28 -0
  330. package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +10 -6
  331. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +9 -6
  332. package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +4 -6
  333. package/src/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.ts +36 -0
  334. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +8 -8
  335. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +94 -0
  336. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +68 -14
  337. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +150 -0
  338. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +8 -2
  339. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +48 -24
  340. package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +1 -3
  341. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +24 -2
  342. package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +1 -2
  343. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +34 -9
  344. package/src/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.ts +179 -0
  345. package/src/custom_auth/core/error/InvalidArgumentError.ts +1 -1
  346. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +13 -12
  347. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +771 -261
  348. package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +2 -6
  349. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +27 -15
  350. package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +97 -26
  351. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +9 -6
  352. package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +330 -63
  353. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +51 -15
  354. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +25 -6
  355. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +0 -6
  356. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +48 -48
  357. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +44 -37
  358. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +32 -15
  359. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +14 -10
  360. package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +24 -1
  361. package/src/custom_auth/core/telemetry/PublicApiId.ts +7 -0
  362. package/src/custom_auth/core/utils/ArgumentValidator.ts +26 -0
  363. package/src/custom_auth/index.ts +21 -11
  364. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +8 -10
  365. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +71 -16
  366. package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.ts +30 -0
  367. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +4 -8
  368. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +4 -5
  369. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +3 -6
  370. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +0 -3
  371. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.ts +2 -3
  372. package/src/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.ts +49 -0
  373. package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +8 -4
  374. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +18 -4
  375. package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +26 -5
  376. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.ts +101 -0
  377. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.ts +53 -0
  378. package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.ts +97 -0
  379. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +0 -6
  380. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +33 -43
  381. package/src/interaction_client/PlatformAuthInteractionClient.ts +886 -148
  382. package/src/interaction_client/PopupClient.ts +104 -83
  383. package/src/interaction_client/RedirectClient.ts +88 -34
  384. package/src/interaction_client/SilentIframeClient.ts +121 -95
  385. package/src/packageMetadata.ts +1 -1
  386. package/src/protocol/Authorize.ts +46 -18
  387. package/src/request/RequestHelpers.ts +64 -11
  388. package/src/request/SilentRequestHelpers.ts +8 -9
  389. package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
  390. package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
  391. package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
  392. package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  393. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +6 -1
  394. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
  395. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +21 -0
  396. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
  397. package/types/cache/AsyncMemoryStorage.d.ts +5 -0
  398. package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
  399. package/types/cache/BrowserCacheManager.d.ts +4 -0
  400. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  401. package/types/controllers/StandardController.d.ts +5 -0
  402. package/types/controllers/StandardController.d.ts.map +1 -1
  403. package/types/crypto/TokenBindingKeyManager.d.ts +9 -0
  404. package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -1
  405. package/types/custom_auth/CustomAuthActionInputs.d.ts +12 -5
  406. package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
  407. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  408. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts +5 -3
  409. package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
  410. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +5 -3
  411. package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -1
  412. package/types/custom_auth/controller/CustomAuthStandardController.d.ts +2 -0
  413. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  414. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +10 -0
  415. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -0
  416. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +1 -4
  417. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -1
  418. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +5 -4
  419. package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -1
  420. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +17 -8
  421. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -1
  422. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +6 -0
  423. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -1
  424. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts +23 -44
  425. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts.map +1 -1
  426. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +14 -0
  427. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts.map +1 -0
  428. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +16 -0
  429. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -0
  430. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +7 -6
  431. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -1
  432. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +8 -7
  433. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -1
  434. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +4 -6
  435. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -1
  436. package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +20 -0
  437. package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
  438. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +7 -8
  439. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  440. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +22 -0
  441. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts.map +1 -0
  442. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +3 -6
  443. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  444. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +28 -0
  445. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -0
  446. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +3 -2
  447. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
  448. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +6 -8
  449. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  450. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +1 -3
  451. package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -1
  452. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +18 -2
  453. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  454. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +1 -2
  455. package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -1
  456. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +5 -6
  457. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  458. package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +23 -0
  459. package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
  460. package/types/custom_auth/core/error/InvalidArgumentError.d.ts +1 -0
  461. package/types/custom_auth/core/error/InvalidArgumentError.d.ts.map +1 -1
  462. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +9 -1
  463. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  464. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +19 -10
  465. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  466. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +1 -1
  467. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -1
  468. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +19 -5
  469. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  470. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +39 -4
  471. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
  472. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +8 -0
  473. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  474. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +8 -2
  475. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
  476. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +4 -3
  477. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  478. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +13 -1
  479. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  480. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -1
  481. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +36 -9
  482. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  483. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +30 -17
  484. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
  485. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +18 -4
  486. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
  487. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +8 -11
  488. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
  489. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +2 -1
  490. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
  491. package/types/custom_auth/core/telemetry/PublicApiId.d.ts +7 -0
  492. package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
  493. package/types/custom_auth/core/utils/ArgumentValidator.d.ts +3 -0
  494. package/types/custom_auth/core/utils/ArgumentValidator.d.ts.map +1 -1
  495. package/types/custom_auth/index.d.ts +10 -5
  496. package/types/custom_auth/index.d.ts.map +1 -1
  497. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +7 -11
  498. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  499. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +7 -5
  500. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  501. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts +7 -0
  502. package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts.map +1 -0
  503. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +4 -8
  504. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -1
  505. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +5 -5
  506. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  507. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +3 -6
  508. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -1
  509. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +0 -1
  510. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -1
  511. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts +3 -2
  512. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts.map +1 -1
  513. package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts +27 -0
  514. package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts.map +1 -0
  515. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +6 -3
  516. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -1
  517. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +13 -3
  518. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  519. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +8 -3
  520. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -1
  521. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts +24 -0
  522. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts.map +1 -0
  523. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts +18 -0
  524. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts.map +1 -0
  525. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts +7 -0
  526. package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts.map +1 -0
  527. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +0 -4
  528. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -1
  529. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +5 -4
  530. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
  531. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +110 -8
  532. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  533. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  534. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  535. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  536. package/types/packageMetadata.d.ts +1 -1
  537. package/types/protocol/Authorize.d.ts +4 -4
  538. package/types/protocol/Authorize.d.ts.map +1 -1
  539. package/types/request/RequestHelpers.d.ts +21 -3
  540. package/types/request/RequestHelpers.d.ts.map +1 -1
  541. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  542. package/types/telemetry/BrowserPerformanceEvents.d.ts +1 -0
  543. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
  544. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +0 -70
  545. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +0 -1
  546. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +0 -25
  547. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +0 -1
  548. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +0 -45
  549. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +0 -1
  550. package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +0 -23
  551. package/src/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.ts +0 -19
  552. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +0 -20
  553. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +0 -97
  554. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +0 -34
  555. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +0 -61
  556. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +0 -14
  557. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +0 -1
  558. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts +0 -13
  559. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts.map +0 -1
  560. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +0 -8
  561. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +0 -1
  562. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +0 -17
  563. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +0 -1
  564. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +0 -11
  565. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +0 -1
  566. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +0 -19
  567. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +0 -1
@@ -1,23 +1,25 @@
1
- /*! @azure/msal-browser v5.27.0 2026-10-27 */
1
+ /*! @azure/msal-browser v5.29.0 2026-11-06 */
2
2
  'use strict';
3
- import { ServerTelemetryManager, AADServerParamKeys, TimeUtils, invokeAsync, AuthError, ScopeSet, createClientAuthError, ClientAuthErrorCodes, AuthToken, updateAccountTenantProfileData, UrlString, buildAccountToCache, AccountEntityUtils, AuthorityType, Constants, PopTokenGenerator, CacheHelpers, RequestParameterBuilder, PerformanceEvents } from '@azure/msal-common/browser';
4
- import { createPlatformAuthExtraParametersNoCache, isProofOfPossessionTokenType } from '../broker/nativeBroker/PlatformAuthRequest.mjs';
3
+ import { ServerTelemetryManager, AADServerParamKeys, TimeUtils, invokeAsync, AuthError, ScopeSet, Constants, createClientAuthError, ClientAuthErrorCodes, AuthToken, updateAccountTenantProfileData, UrlString, buildAccountToCache, AccountEntityUtils, AuthorityType, PopTokenGenerator, CacheHelpers, RequestParameterBuilder, PerformanceEvents, createClientConfigurationError, ClientConfigurationErrorCodes, normalizeDpopResourceRequestContext, createAuthError, AuthErrorCodes, JsonWebTokenAlgorithms, DpopProofGenerator } from '@azure/msal-common/browser';
4
+ import { createPlatformAuthExtraParametersNoCache, PlatformAuthBindingPreference, PlatformAuthTokenType, PlatformAuthEnclave } from '../broker/nativeBroker/PlatformAuthRequest.mjs';
5
5
  import { base64Decode } from '../encode/Base64Decode.mjs';
6
6
  import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
7
7
  import { NativeAuthError, isFatalNativeAuthError, createNativeAuthError } from '../error/NativeAuthError.mjs';
8
8
  import { version } from '../packageMetadata.mjs';
9
- import { NativeInteractionClientAcquireToken, PlatformAuthInteractionClientInitializeRequest, PlatformAuthHandleNativeResponse, NativeGenerateAuthResult, PlatformAuthCacheAccount, PlatformAuthCacheNativeTokens } from '../telemetry/BrowserPerformanceEvents.mjs';
10
- import { BrowserConstants, CacheLookupPolicy, TemporaryCacheKeys, ApiId, PlatformAuthConstants } from '../utils/BrowserConstants.mjs';
9
+ import { isTokenBindingKeyPersistedForRedirect } from '../request/RequestHelpers.mjs';
10
+ import { NativeInteractionClientAcquireToken, PlatformAuthInteractionClientInitializeRequest, PlatformAuthHandleNativeResponse, NativeGenerateAuthResult, PlatformAuthCacheAccount, PlatformAuthCacheNativeTokens, PlatformAuthDpopKeyCleanup } from '../telemetry/BrowserPerformanceEvents.mjs';
11
+ import { BrowserConstants, ApiId, CacheLookupPolicy, TemporaryCacheKeys, PlatformAuthConstants } from '../utils/BrowserConstants.mjs';
11
12
  import { getCurrentUri } from '../utils/BrowserUtils.mjs';
12
13
  import { BaseInteractionClient, initializeServerTelemetryManager, getRedirectUri, getDiscoveredAuthority } from './BaseInteractionClient.mjs';
13
14
  import { SilentCacheClient } from './SilentCacheClient.mjs';
14
- import { invalidPopTokenRequest, nativePromptNotSupported } from '../error/BrowserAuthErrorCodes.mjs';
15
+ import { nativePromptNotSupported } from '../error/BrowserAuthErrorCodes.mjs';
15
16
  import { userSwitch } from '../error/NativeAuthErrorCodes.mjs';
16
17
 
17
18
  /*
18
19
  * Copyright (c) Microsoft Corporation. All rights reserved.
19
20
  * Licensed under the MIT License.
20
21
  */
22
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
21
23
  class PlatformAuthInteractionClient extends BaseInteractionClient {
22
24
  constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
23
25
  super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
@@ -75,35 +77,43 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
75
77
  }, e);
76
78
  throw e;
77
79
  }
78
- // check if the tokens can be retrieved from internal cache
79
- try {
80
- const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
81
- // Served from the native internal cache; token did not come directly from the broker
82
- nativeATMeasurement.add({
83
- isNativeBroker: false,
84
- });
85
- nativeATMeasurement.end({
86
- success: true,
87
- fromCache: true,
88
- });
89
- return result;
90
- }
91
- catch (e) {
92
- if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
93
- this.logger.info("0eitbc", this.correlationId);
80
+ if (this.apiId === ApiId.acquireTokenSilent_silentFlow) {
81
+ let cachedResult;
82
+ try {
83
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest, cacheLookupPolicy);
84
+ }
85
+ catch (e) {
86
+ if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
87
+ this.logger.info("0eitbc", this.correlationId);
88
+ nativeATMeasurement.add({
89
+ isNativeBroker: false,
90
+ });
91
+ nativeATMeasurement.end({
92
+ success: false,
93
+ });
94
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
95
+ throw e;
96
+ }
97
+ // continue with a native call for any and all errors
98
+ this.logger.info("0957j1", this.correlationId);
99
+ }
100
+ if (cachedResult) {
101
+ // Served from the native internal cache; token did not come directly from the broker
94
102
  nativeATMeasurement.add({
95
103
  isNativeBroker: false,
96
104
  });
97
105
  nativeATMeasurement.end({
98
- success: false,
106
+ success: true,
107
+ fromCache: true,
99
108
  });
100
- throw e;
109
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
110
+ return cachedResult;
101
111
  }
102
- // continue with a native call for any and all errors
103
- this.logger.info("0957j1", this.correlationId);
104
112
  }
105
113
  // dispatch the request to the broker
106
114
  try {
115
+ await this.prepareDpopBrokerRequest(nativeRequest);
116
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
107
117
  const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
108
118
  const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
109
119
  nativeATMeasurement.end({
@@ -121,6 +131,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
121
131
  success: false,
122
132
  }, e);
123
133
  this.setBrokerErrorTelemetry(e);
134
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
124
135
  throw e;
125
136
  }
126
137
  }
@@ -155,6 +166,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
155
166
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
156
167
  account: cachedAccount,
157
168
  forceRefresh: false,
169
+ ...this.createSilentCacheTokenBindingParameters(request),
158
170
  resource: request.extraParameters?.resource,
159
171
  };
160
172
  // Preserve FMI partition semantics for silent cache filtering.
@@ -164,12 +176,41 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
164
176
  return silentRequest;
165
177
  }
166
178
  /**
167
- * Fetches the tokens from the cache if un-expired
179
+ * Maps platform-broker token-binding state to silent-cache request fields.
180
+ * @param request
181
+ */
182
+ createSilentCacheTokenBindingParameters(request) {
183
+ const authenticationScheme = this.isDpopBrokerRequest(request)
184
+ ? Constants.AuthenticationScheme.DPOP
185
+ : request.tokenType;
186
+ if (authenticationScheme !== Constants.AuthenticationScheme.DPOP &&
187
+ authenticationScheme !== Constants.AuthenticationScheme.POP) {
188
+ return { authenticationScheme };
189
+ }
190
+ return {
191
+ authenticationScheme,
192
+ ...(authenticationScheme === Constants.AuthenticationScheme.DPOP &&
193
+ request.keyId && { dpopJkt: request.keyId }),
194
+ ...(authenticationScheme === Constants.AuthenticationScheme.POP &&
195
+ request.signPopToken === false &&
196
+ request.keyId && { popKid: request.keyId }),
197
+ resourceRequestMethod: request.resourceRequestMethod,
198
+ resourceRequestUri: request.resourceRequestUri,
199
+ };
200
+ }
201
+ /**
202
+ * Fetches unexpired tokens when allowed by cache policy.
168
203
  * @param nativeAccountId
169
204
  * @param request
170
- * @returns authenticationResult
205
+ * @param cacheLookupPolicy
206
+ * @returns Cached result, or undefined when cache policy bypasses lookup.
171
207
  */
172
- async acquireTokensFromCache(nativeAccountId, request) {
208
+ async acquireTokensFromCache(nativeAccountId, request, cacheLookupPolicy = CacheLookupPolicy.Default) {
209
+ if (cacheLookupPolicy === CacheLookupPolicy.RefreshTokenAndNetwork ||
210
+ cacheLookupPolicy === CacheLookupPolicy.Skip) {
211
+ this.logger.verbose("03uwyk", this.correlationId);
212
+ return undefined;
213
+ }
173
214
  if (!nativeAccountId) {
174
215
  this.logger.warning("1ndf3e", this.correlationId);
175
216
  throw createClientAuthError(ClientAuthErrorCodes.noAccountFound, this.correlationId);
@@ -211,10 +252,22 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
211
252
  const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
212
253
  const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
213
254
  try {
214
- await this.platformAuthProvider.sendMessage(nativeRequest);
255
+ await this.prepareDpopBrokerRequest(nativeRequest);
256
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
257
+ const response = await this.platformAuthProvider.sendMessage(nativeRequest);
258
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
259
+ if (dpopBrokerOutcome === "L3") {
260
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
261
+ }
215
262
  }
216
263
  catch (e) {
217
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
264
+ /*
265
+ * Raw persistent/transient broker errors are retrieved again in
266
+ * phase two. Availability errors are thrown for controller-managed
267
+ * web fallback, while translated cancellation, network, and
268
+ * interaction-required errors are surfaced without being swallowed.
269
+ */
270
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
218
271
  if (e instanceof NativeAuthError) {
219
272
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
220
273
  serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
@@ -229,6 +282,16 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
229
282
  throw e;
230
283
  }
231
284
  }
285
+ else if (this.isDpopBrokerRequest(nativeRequest)) {
286
+ throw e;
287
+ }
288
+ }
289
+ try {
290
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
291
+ }
292
+ catch (e) {
293
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
294
+ throw e;
232
295
  }
233
296
  this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
234
297
  ...nativeRequest,
@@ -243,7 +306,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
243
306
  ? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
244
307
  : getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
245
308
  rootMeasurement.end({ success: true });
246
- await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
309
+ try {
310
+ await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
311
+ }
312
+ catch (e) {
313
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
314
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
315
+ throw e;
316
+ }
247
317
  }
248
318
  /**
249
319
  * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
@@ -276,6 +346,8 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
276
346
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
277
347
  const reqTimestamp = TimeUtils.nowSeconds();
278
348
  try {
349
+ await this.prepareDpopBrokerRequest(request, true);
350
+ this.addDpopBrokerAttemptTelemetry(request);
279
351
  this.logger.verbose("003x5a", this.correlationId);
280
352
  const response = await this.platformAuthProvider.sendMessage(request);
281
353
  const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
@@ -284,7 +356,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
284
356
  return authResult;
285
357
  }
286
358
  catch (e) {
359
+ if (e instanceof NativeAuthError) {
360
+ const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
361
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
362
+ }
287
363
  this.setBrokerErrorTelemetry(e);
364
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
288
365
  throw e;
289
366
  }
290
367
  }
@@ -304,6 +381,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
304
381
  */
305
382
  async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
306
383
  this.logger.trace("1bojln", this.correlationId);
384
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
307
385
  // generate identifiers
308
386
  const idTokenClaims = AuthToken.extractTokenClaims(response.id_token, base64Decode, this.correlationId);
309
387
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
@@ -329,10 +407,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
329
407
  response.expires_in = Number(response.expires_in);
330
408
  // generate authenticationResult
331
409
  const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
410
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
332
411
  // cache accounts and tokens in the appropriate storage
333
- await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, AuthToken.isKmsi(idTokenClaims));
412
+ const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
413
+ (this.isDpopBrokerRequest(request) &&
414
+ storeInCache?.accessToken === false);
415
+ if (shouldRemoveGeneratedDpopKey) {
416
+ await this.resetGeneratedDpopRequestKey(request);
417
+ }
418
+ await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, AuthToken.isKmsi(idTokenClaims), !isL3DpopResponse);
334
419
  await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
335
- storeInCache);
420
+ storeInCache, dpopBrokerOutcome);
336
421
  return result;
337
422
  }
338
423
  /**
@@ -408,7 +493,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
408
493
  */
409
494
  async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
410
495
  // Add Native Broker fields to Telemetry
411
- const mats = this.addTelemetryFromNativeResponse(response.properties.MATS);
496
+ const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
412
497
  // If scopes not returned in server response, use request scopes
413
498
  const responseScopes = this.generateScopes(request.scope, response.scope);
414
499
  const accountProperties = response.account.properties || {};
@@ -434,9 +519,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
434
519
  }
435
520
  // generate PoP token as needed
436
521
  const responseAccessToken = await this.generatePopAccessToken(response, request);
437
- const tokenType = request.tokenType === Constants.AuthenticationScheme.POP
438
- ? Constants.AuthenticationScheme.POP
439
- : Constants.AuthenticationScheme.BEARER;
522
+ const isDpopRequest = this.isDpopBrokerRequest(request);
523
+ let tokenType = Constants.AuthenticationScheme.BEARER;
524
+ if (isDpopRequest) {
525
+ tokenType = Constants.AuthenticationScheme.DPOP;
526
+ }
527
+ else if (request.tokenType === Constants.AuthenticationScheme.POP) {
528
+ tokenType = Constants.AuthenticationScheme.POP;
529
+ }
530
+ const dpopProof = isDpopRequest
531
+ ? await this.generateDpopProof(response, request)
532
+ : undefined;
440
533
  const result = {
441
534
  authority: authority,
442
535
  uniqueId: uid,
@@ -450,6 +543,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
450
543
  // Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
451
544
  expiresOn: TimeUtils.toDateFromSeconds(reqTimestamp + response.expires_in),
452
545
  tokenType: tokenType,
546
+ dpopProof,
453
547
  correlationId: this.correlationId,
454
548
  state: response.state,
455
549
  fromPlatformBroker: true,
@@ -463,11 +557,13 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
463
557
  * cache the account entity in browser storage
464
558
  * @param accountEntity
465
559
  */
466
- async cacheAccount(accountEntity, kmsi) {
560
+ async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
467
561
  // Store the account info and hence `nativeAccountId` in browser cache
468
562
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
469
- // Remove any existing cached tokens for this account in browser storage
470
- this.browserStorage.removeAccountContext(AccountEntityUtils.getAccountInfo(accountEntity), this.correlationId);
563
+ // Remove cached web access and refresh tokens, preserving ID tokens.
564
+ if (clearExistingTokens) {
565
+ this.browserStorage.removeAccountContext(AccountEntityUtils.getAccountInfo(accountEntity), this.correlationId);
566
+ }
471
567
  }
472
568
  /**
473
569
  * Stores the access_token and id_token in inmemory storage
@@ -479,8 +575,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
479
575
  * @param tenantId
480
576
  * @param reqTimestamp
481
577
  */
482
- async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
578
+ async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
483
579
  const cachedIdToken = CacheHelpers.createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
580
+ // save idtoken credential in configured browser storage
581
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
582
+ await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, AuthToken.isKmsi(idTokenClaims));
583
+ }
584
+ if (dpopBrokerOutcome === "L3") {
585
+ return;
586
+ }
587
+ if (storeInCache?.accessToken === false) {
588
+ return;
589
+ }
484
590
  // cache accessToken in inmemory storage
485
591
  const expiresIn = request.tokenType === Constants.AuthenticationScheme.POP
486
592
  ? Constants.SHR_NONCE_VALIDITY
@@ -490,18 +596,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
490
596
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
491
597
  const responseScopes = this.generateScopes(response.scope, request.scope);
492
598
  const additionalCacheKeyComponents = request.attributeTokens
493
- ? {
494
- attribute_tokens: request.attributeTokens,
495
- }
599
+ ? { attribute_tokens: request.attributeTokens }
496
600
  : undefined;
497
- const cachedAccessToken = CacheHelpers.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);
601
+ const cachedAccessToken = CacheHelpers.createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
602
+ ? Constants.AuthenticationScheme.DPOP
603
+ : request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
498
604
  if (request.extraParameters?.resource) {
499
605
  cachedAccessToken.resource = request.extraParameters.resource;
500
606
  }
501
- // save idtoken credential in configured browser storage
502
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
503
- await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, AuthToken.isKmsi(idTokenClaims));
504
- }
505
607
  // save access token credential in memory storage
506
608
  const nativeCacheRecord = {
507
609
  accessToken: cachedAccessToken,
@@ -578,11 +680,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
578
680
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
579
681
  ? undefined
580
682
  : this.config.auth.clientCapabilities;
581
- /*
582
- * 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.
583
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
584
- */
585
- const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
683
+ const { scopes, claims, dpopNonce } = request;
586
684
  const scopeSet = new ScopeSet([...(scopes || []), ...Constants.OIDC_DEFAULT_SCOPES], this.correlationId);
587
685
  const mergedClaims = RequestParameterBuilder.buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
588
686
  const hasAttributeTokens = !!request.attributeTokens?.length;
@@ -606,57 +704,391 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
606
704
  loginHint: request.loginHint,
607
705
  extraParameters: {
608
706
  ...request.extraParameters,
609
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
707
+ // Native broker resource is set for MCP scenarios.
708
+ ...(request.resource && { resource: request.resource }),
610
709
  },
611
710
  extendedExpiryToken: false,
612
711
  keyId: request.popKid,
613
- resourceRequestMethod: request.resourceRequestMethod,
614
- resourceRequestUri: request.resourceRequestUri,
615
- shrClaims: request.shrClaims,
616
- shrNonce: request.shrNonce,
617
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
618
712
  };
619
713
  if (hasAttributeTokens) {
620
714
  validatedRequest.attributeTokens =
621
715
  CacheHelpers.serializeAttributeTokens(request.attributeTokens);
622
716
  }
623
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
624
- if (validatedRequest.signPopToken && !!request.popKid) {
625
- throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
626
- }
627
717
  this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
628
718
  validatedRequest.extraParameters =
629
719
  validatedRequest.extraParameters || {};
630
720
  validatedRequest.extraParameters.telemetry =
631
721
  PlatformAuthConstants.MATS_TELEMETRY;
632
722
  if (request.authenticationScheme === Constants.AuthenticationScheme.POP) {
633
- // add POP request type
634
723
  const shrParameters = {
635
- resourceRequestUri: request.resourceRequestUri,
636
724
  resourceRequestMethod: request.resourceRequestMethod,
725
+ resourceRequestUri: request.resourceRequestUri,
637
726
  shrClaims: request.shrClaims,
638
727
  shrNonce: request.shrNonce,
639
728
  correlationId: this.correlationId,
640
729
  };
641
730
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
642
- // generate reqCnf if not provided in the request
643
- let reqCnfData;
644
731
  if (!validatedRequest.keyId) {
645
732
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
646
- reqCnfData = generatedReqCnfData.reqCnfString;
733
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
647
734
  validatedRequest.keyId = generatedReqCnfData.kid;
648
735
  validatedRequest.signPopToken = true;
649
736
  }
650
737
  else {
651
- reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
738
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
652
739
  validatedRequest.signPopToken = false;
653
740
  }
654
- // SPAs require whole string to be passed to broker
655
- validatedRequest.reqCnf = reqCnfData;
741
+ validatedRequest.resourceRequestMethod =
742
+ request.resourceRequestMethod;
743
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
744
+ validatedRequest.shrClaims = request.shrClaims;
745
+ validatedRequest.shrNonce = request.shrNonce;
746
+ }
747
+ else if (request.authenticationScheme === Constants.AuthenticationScheme.DPOP) {
748
+ Object.assign(validatedRequest, this.createDpopRequestParameters(request));
656
749
  }
750
+ validatedRequest.extraParametersNoCache =
751
+ createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
657
752
  this.addRequestSKUs(validatedRequest);
658
753
  return validatedRequest;
659
754
  }
755
+ /**
756
+ * Creates and validates the broker-specific parameters for a DPoP request.
757
+ * @param request - Developer-provided token request.
758
+ * @returns Broker parameters for a DPoP token and resource proof.
759
+ */
760
+ createDpopRequestParameters(request) {
761
+ if (request.popKid) {
762
+ throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
763
+ }
764
+ if (!request.resourceRequestMethod?.trim() ||
765
+ !request.resourceRequestUri?.trim()) {
766
+ throw createClientConfigurationError(ClientConfigurationErrorCodes.dpopMissingResourceContext, this.correlationId);
767
+ }
768
+ const resourceContext = normalizeDpopResourceRequestContext({
769
+ htm: request.resourceRequestMethod,
770
+ htu: request.resourceRequestUri,
771
+ }, this.correlationId);
772
+ return {
773
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
774
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
775
+ keyId: request.dpopJkt,
776
+ resourceRequestMethod: resourceContext.htm,
777
+ resourceRequestUri: resourceContext.htu,
778
+ };
779
+ }
780
+ /**
781
+ * Provisions the local key and confirmation data for a DPoP broker request.
782
+ * @param request - Broker request to prepare.
783
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
784
+ */
785
+ async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
786
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
787
+ return;
788
+ }
789
+ /*
790
+ * Phase one clears both fields after an L3 response or non-fatal broker
791
+ * error. In that case phase two must provision a replacement. If either
792
+ * field remains, treat it as a retained binding and validate it fully.
793
+ */
794
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
795
+ if (!request.keyId || !request.reqCnf) {
796
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
797
+ }
798
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
799
+ if (request.reqCnf !== expectedReqCnf) {
800
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
801
+ }
802
+ const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
803
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
804
+ : await this.tokenBindingKeyManager
805
+ .getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
806
+ .then(() => true, () => false);
807
+ if (!hasKey) {
808
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
809
+ }
810
+ return;
811
+ }
812
+ if (request.reqCnf) {
813
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
814
+ }
815
+ if (!request.keyId) {
816
+ request.keyId =
817
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
818
+ tokenBindingKeyType: Constants.AuthenticationScheme.DPOP.toLowerCase(),
819
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
820
+ correlationId: this.correlationId,
821
+ });
822
+ }
823
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
824
+ }
825
+ /**
826
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
827
+ * @param keyId - Browser-managed DPoP key identifier.
828
+ * @returns Encoded broker confirmation claim.
829
+ */
830
+ createDpopBrokerReqCnf(keyId) {
831
+ return this.browserCrypto.base64UrlEncode(JSON.stringify({
832
+ kid: keyId,
833
+ xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
834
+ }));
835
+ }
836
+ /**
837
+ * Ensures an owned DPoP key can survive redirect navigation before the
838
+ * request metadata is persisted for phase two.
839
+ */
840
+ async ensureRedirectDpopKeyIsPersisted(request) {
841
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
842
+ return;
843
+ }
844
+ if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
845
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
846
+ }
847
+ }
848
+ /**
849
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
850
+ * @param response - Broker response to validate.
851
+ * @param request - Broker request associated with the response.
852
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
853
+ */
854
+ validateDpopBrokerOutcome(response, request) {
855
+ const isDpopRequest = this.isDpopBrokerRequest(request);
856
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
857
+ const normalizedRequestTokenType = request.tokenType
858
+ ?.trim()
859
+ .toLowerCase();
860
+ const bindingPreferenceSent = request.bindingPreferenceSent ??
861
+ request.preferBinding !== undefined;
862
+ const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
863
+ normalizedResponse.proof !== undefined ||
864
+ normalizedResponse.hasBindingAttested;
865
+ if (!isDpopRequest) {
866
+ if (hasDpopResponse) {
867
+ this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
868
+ }
869
+ return "none";
870
+ }
871
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
872
+ this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
873
+ }
874
+ this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
875
+ if (normalizedResponse.tokenType ===
876
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
877
+ return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
878
+ }
879
+ return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
880
+ }
881
+ /**
882
+ * Normalizes the canonical DPoP fields returned under response properties.
883
+ */
884
+ normalizeDpopBrokerResponse(response) {
885
+ const responseProperties = response.properties;
886
+ const rawTokenType = responseProperties?.token_type;
887
+ const tokenType = typeof rawTokenType === "string"
888
+ ? rawTokenType.trim().toLowerCase()
889
+ : undefined;
890
+ const rawBindingAttested = responseProperties?.binding_attested;
891
+ let bindingAttested;
892
+ if (typeof rawBindingAttested === "string") {
893
+ const normalizedBindingAttested = rawBindingAttested
894
+ .trim()
895
+ .toLowerCase();
896
+ if (normalizedBindingAttested === "true") {
897
+ bindingAttested = true;
898
+ }
899
+ else if (normalizedBindingAttested === "false") {
900
+ bindingAttested = false;
901
+ }
902
+ }
903
+ return {
904
+ tokenType,
905
+ proof: responseProperties?.DPoP,
906
+ bindingAttested,
907
+ hasBindingAttested: rawBindingAttested !== undefined,
908
+ hasMalformedBindingAttested: rawBindingAttested !== undefined &&
909
+ bindingAttested === undefined,
910
+ };
911
+ }
912
+ /**
913
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
914
+ */
915
+ validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
916
+ if (normalizedResponse.hasMalformedBindingAttested) {
917
+ this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
918
+ }
919
+ if (bindingPreferenceSent &&
920
+ normalizedResponse.bindingAttested === undefined) {
921
+ this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
922
+ }
923
+ }
924
+ /**
925
+ * Validates a broker-returned L3 DPoP proof outcome.
926
+ */
927
+ validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
928
+ const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
929
+ if (typeof normalizedResponse.proof !== "string" ||
930
+ normalizedResponse.proof.trim().length === 0) {
931
+ this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
932
+ }
933
+ if (normalizedResponse.bindingAttested !== true) {
934
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
935
+ }
936
+ if (normalizedRequestTokenType !== dpopWithProofTokenType ||
937
+ normalizedResponse.tokenType !== dpopWithProofTokenType) {
938
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
939
+ }
940
+ this.performanceClient.addFields({
941
+ "ext.brokerDpopOutcome": "l3",
942
+ "ext.brokerDpopBindingLevel": "L3",
943
+ }, this.correlationId);
944
+ return "L3";
945
+ }
946
+ /**
947
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
948
+ */
949
+ validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
950
+ if (normalizedResponse.proof !== undefined) {
951
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
952
+ }
953
+ if (normalizedRequestTokenType !==
954
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
955
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
956
+ }
957
+ if (normalizedResponse.bindingAttested !== false &&
958
+ !(!bindingPreferenceSent &&
959
+ normalizedResponse.bindingAttested === undefined)) {
960
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
961
+ }
962
+ if (!request.reqCnf || !request.keyId) {
963
+ this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
964
+ }
965
+ this.performanceClient.addFields({
966
+ "ext.brokerDpopOutcome": "l1",
967
+ "ext.brokerDpopBindingLevel": "L1",
968
+ }, this.correlationId);
969
+ return "L1";
970
+ }
971
+ /**
972
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
973
+ */
974
+ throwInvalidDpopResponse(failureReason, message) {
975
+ this.performanceClient.addFields({
976
+ "ext.brokerDpopOutcome": "invalid_response",
977
+ "ext.brokerDpopFailureReason": failureReason,
978
+ }, this.correlationId);
979
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, message);
980
+ }
981
+ /**
982
+ * Returns the broker proof or signs an L1 resource proof with the local key.
983
+ * @param response - Broker response containing the access token and optional proof.
984
+ * @param request - Broker request containing the proof context and local key.
985
+ * @returns The resource proof for the broker access token.
986
+ */
987
+ async generateDpopProof(response, request) {
988
+ const brokerProof = response.properties?.DPoP;
989
+ if (brokerProof !== undefined) {
990
+ return brokerProof;
991
+ }
992
+ const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
993
+ return dpopProofGenerator.generateResourceProof({
994
+ htu: request.resourceRequestUri,
995
+ htm: request.resourceRequestMethod,
996
+ accessToken: response.access_token,
997
+ nonce: request.extraParametersNoCache?.pop_nonce,
998
+ }, request.keyId, this.correlationId);
999
+ }
1000
+ /**
1001
+ * Removes a generated DPoP request key and clears its request metadata.
1002
+ * @param request - Broker request whose generated key should be removed.
1003
+ */
1004
+ async resetGeneratedDpopRequestKey(request) {
1005
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
1006
+ return;
1007
+ }
1008
+ const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
1009
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
1010
+ try {
1011
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
1012
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
1013
+ }
1014
+ this.performanceClient.addFields({
1015
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
1016
+ }, this.correlationId);
1017
+ cleanupMeasurement.end({ success: true });
1018
+ request.keyId = undefined;
1019
+ request.reqCnf = undefined;
1020
+ }
1021
+ catch (error) {
1022
+ this.performanceClient.addFields({
1023
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
1024
+ }, this.correlationId);
1025
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
1026
+ cleanupMeasurement.end({ success: false }, error);
1027
+ throw error;
1028
+ }
1029
+ }
1030
+ /**
1031
+ * Attempts to remove a generated DPoP request key without replacing an
1032
+ * existing operation error with a cleanup failure.
1033
+ * @param request - Broker request whose generated key should be removed.
1034
+ */
1035
+ async resetGeneratedDpopRequestKeyBestEffort(request) {
1036
+ try {
1037
+ await this.resetGeneratedDpopRequestKey(request);
1038
+ }
1039
+ catch {
1040
+ this.logger.error("1kxxak", this.correlationId);
1041
+ this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
1042
+ request.keyId = undefined;
1043
+ request.reqCnf = undefined;
1044
+ }
1045
+ }
1046
+ /**
1047
+ * Records that a DPoP request is about to be dispatched to the platform broker.
1048
+ * @param request - Broker request about to cross the provider boundary.
1049
+ */
1050
+ addDpopBrokerAttemptTelemetry(request) {
1051
+ if (!this.isDpopBrokerRequest(request)) {
1052
+ return;
1053
+ }
1054
+ this.performanceClient.addFields({
1055
+ "ext.brokerDpopAttempted": 1,
1056
+ }, this.correlationId);
1057
+ }
1058
+ /**
1059
+ * Determines whether a request uses the DPoP broker protocol.
1060
+ * @param request - Broker request to inspect.
1061
+ * @returns Whether the request uses a DPoP token type.
1062
+ */
1063
+ isDpopBrokerRequest(request) {
1064
+ return this.isDpopBrokerTokenType(request.tokenType);
1065
+ }
1066
+ /**
1067
+ * Determines whether a token type represents a DPoP broker request.
1068
+ * @param tokenType - Token type to inspect.
1069
+ * @returns Whether the token type is a supported DPoP broker token type.
1070
+ */
1071
+ isDpopBrokerTokenType(tokenType) {
1072
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
1073
+ return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
1074
+ normalizedTokenType ===
1075
+ Constants.AuthenticationScheme.DPOP.toLowerCase());
1076
+ }
1077
+ /**
1078
+ * Removes a DPoP key while reporting cleanup failures.
1079
+ * @param keyId - Identifier of the DPoP key to remove.
1080
+ * @returns Whether the key was removed successfully.
1081
+ */
1082
+ async removeDpopKey(keyId) {
1083
+ try {
1084
+ await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
1085
+ return true;
1086
+ }
1087
+ catch {
1088
+ this.logger.error("1w60e4", this.correlationId);
1089
+ return false;
1090
+ }
1091
+ }
660
1092
  async getCanonicalAuthority(request) {
661
1093
  const requestAuthority = request.authority || this.config.auth.authority;
662
1094
  const { azureCloudOptions, account } = request;
@@ -695,29 +1127,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
695
1127
  }
696
1128
  }
697
1129
  /**
698
- * Handles extra broker request parameters
699
- * @param request {PlatformAuthRequest}
700
- * @private
1130
+ * Handles extra broker request parameters.
1131
+ * @param request - Platform broker request.
1132
+ * @param embeddedClientId - Embedded application client identifier.
701
1133
  */
702
1134
  handleExtraBrokerParams(request, embeddedClientId) {
703
- const hasExtraBrokerParams = request.extraParameters &&
704
- request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_CLIENT_ID) &&
705
- request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_REDIRECT_URI) &&
706
- request.extraParameters.hasOwnProperty(AADServerParamKeys.CLIENT_ID);
1135
+ const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
1136
+ const hasExtraBrokerParams = hasOwnParameter(AADServerParamKeys.BROKER_CLIENT_ID) &&
1137
+ hasOwnParameter(AADServerParamKeys.BROKER_REDIRECT_URI) &&
1138
+ hasOwnParameter(AADServerParamKeys.CLIENT_ID);
707
1139
  if (!embeddedClientId && !hasExtraBrokerParams) {
708
1140
  return;
709
1141
  }
710
- let child_client_id = "";
711
- const child_redirect_uri = request.redirectUri;
1142
+ const childRedirectUri = request.redirectUri;
1143
+ const childClientId = embeddedClientId ||
1144
+ request.extraParameters?.[AADServerParamKeys.CLIENT_ID] ||
1145
+ "";
712
1146
  if (embeddedClientId) {
713
1147
  request.redirectUri = this.config.auth.redirectUri;
714
- child_client_id = embeddedClientId;
715
1148
  }
716
1149
  else if (request.extraParameters) {
717
1150
  request.redirectUri =
718
1151
  request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
719
- child_client_id =
720
- request.extraParameters[AADServerParamKeys.CLIENT_ID];
721
1152
  }
722
1153
  const {
723
1154
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -728,15 +1159,20 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
728
1159
  [AADServerParamKeys.CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
729
1160
  request.extraParameters = {
730
1161
  ...remainingExtraParameters,
731
- child_client_id,
732
- child_redirect_uri,
1162
+ child_client_id: childClientId,
1163
+ child_redirect_uri: childRedirectUri,
733
1164
  };
734
1165
  this.performanceClient?.addFields({
735
- embeddedClientId: child_client_id,
736
- embeddedRedirectUri: child_redirect_uri,
1166
+ embeddedClientId: childClientId,
1167
+ embeddedRedirectUri: childRedirectUri,
737
1168
  }, this.correlationId);
738
1169
  }
739
- }
1170
+ }
1171
+ /**
1172
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
1173
+ * This does not constrain the binding selected by the platform broker.
1174
+ */
1175
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
740
1176
 
741
1177
  export { PlatformAuthInteractionClient };
742
1178
  //# sourceMappingURL=PlatformAuthInteractionClient.mjs.map