@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
@@ -5,22 +5,25 @@
5
5
 
6
6
  import {
7
7
  AADServerParamKeys,
8
- AccessTokenEntity,
9
8
  AccountEntity,
10
9
  AccountEntityUtils,
11
10
  AccountInfo,
12
11
  AuthError,
12
+ AuthErrorCodes,
13
13
  AuthToken,
14
14
  AuthorityType,
15
15
  CacheHelpers,
16
16
  ClientAuthErrorCodes,
17
+ ClientConfigurationErrorCodes,
17
18
  CommonSilentFlowRequest,
18
19
  Constants,
20
+ DpopProofGenerator,
19
21
  ICrypto,
20
22
  IPerformanceClient,
21
23
  IdTokenEntity,
22
24
  InProgressPerformanceEvent,
23
25
  Logger,
26
+ JsonWebTokenAlgorithms,
24
27
  PerformanceEvents,
25
28
  PopTokenGenerator,
26
29
  RequestParameterBuilder,
@@ -33,19 +36,27 @@ import {
33
36
  ITokenBindingKeyManager,
34
37
  UrlString,
35
38
  buildAccountToCache,
39
+ createAuthError,
36
40
  createClientAuthError,
41
+ createClientConfigurationError,
37
42
  invokeAsync,
43
+ normalizeDpopResourceRequestContext,
38
44
  updateAccountTenantProfileData,
39
45
  } from "@azure/msal-common/browser";
40
46
  import { IPlatformAuthHandler } from "../broker/nativeBroker/IPlatformAuthHandler.js";
41
47
  import {
42
48
  createPlatformAuthExtraParametersNoCache,
43
- isProofOfPossessionTokenType,
44
- PlatformAuthExtraParametersNoCache,
49
+ PlatformAuthBindingPreference,
50
+ PlatformAuthEnclave,
45
51
  PlatformAuthRequest,
52
+ PlatformAuthTokenType,
46
53
  } from "../broker/nativeBroker/PlatformAuthRequest.js";
47
54
  import {
55
+ BrokerDpopFailureReason,
56
+ BrokerDpopOutcome,
48
57
  MATS,
58
+ NativeResponseProperties,
59
+ NormalizedDpopBrokerResponse,
49
60
  PlatformAuthResponse,
50
61
  } from "../broker/nativeBroker/PlatformAuthResponse.js";
51
62
  import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
@@ -70,6 +81,7 @@ import { PopupRequest } from "../request/PopupRequest.js";
70
81
  import { RedirectRequest } from "../request/RedirectRequest.js";
71
82
  import { SilentRequest } from "../request/SilentRequest.js";
72
83
  import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
84
+ import { isTokenBindingKeyPersistedForRedirect } from "../request/RequestHelpers.js";
73
85
  import { AuthenticationResult } from "../response/AuthenticationResult.js";
74
86
  import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
75
87
  import {
@@ -88,6 +100,8 @@ import {
88
100
  } from "./BaseInteractionClient.js";
89
101
  import { SilentCacheClient } from "./SilentCacheClient.js";
90
102
 
103
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
104
+
91
105
  export class PlatformAuthInteractionClient extends BaseInteractionClient {
92
106
  protected apiId: ApiId;
93
107
  protected accountId: string;
@@ -96,6 +110,13 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
96
110
  protected nativeStorageManager: BrowserCacheManager;
97
111
  protected skus: string;
98
112
 
113
+ /**
114
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
115
+ * This does not constrain the binding selected by the platform broker.
116
+ */
117
+ private static readonly MSAL_DPOP_KEY_STORAGE_LOCATION =
118
+ PlatformAuthEnclave.SOFTWARE;
119
+
99
120
  constructor(
100
121
  config: BrowserConfiguration,
101
122
  browserStorage: BrowserCacheManager,
@@ -221,44 +242,56 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
221
242
  throw e;
222
243
  }
223
244
 
224
- // check if the tokens can be retrieved from internal cache
225
- try {
226
- const result = await this.acquireTokensFromCache(
227
- this.accountId,
228
- nativeRequest
229
- );
230
- // Served from the native internal cache; token did not come directly from the broker
231
- nativeATMeasurement.add({
232
- isNativeBroker: false,
233
- });
234
- nativeATMeasurement.end({
235
- success: true,
236
- fromCache: true,
237
- });
238
- return result;
239
- } catch (e) {
240
- if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
245
+ if (this.apiId === ApiId.acquireTokenSilent_silentFlow) {
246
+ let cachedResult: AuthenticationResult | undefined;
247
+ try {
248
+ cachedResult = await this.acquireTokensFromCache(
249
+ this.accountId,
250
+ nativeRequest,
251
+ cacheLookupPolicy
252
+ );
253
+ } catch (e) {
254
+ if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
255
+ this.logger.info(
256
+ "MSAL internal Cache does not contain tokens, return error as per cache policy",
257
+ this.correlationId
258
+ );
259
+ nativeATMeasurement.add({
260
+ isNativeBroker: false,
261
+ });
262
+ nativeATMeasurement.end({
263
+ success: false,
264
+ });
265
+ await this.resetGeneratedDpopRequestKeyBestEffort(
266
+ nativeRequest
267
+ );
268
+ throw e;
269
+ }
270
+ // continue with a native call for any and all errors
241
271
  this.logger.info(
242
- "MSAL internal Cache does not contain tokens, return error as per cache policy",
272
+ "MSAL internal Cache does not contain tokens, proceed to make a native call",
243
273
  this.correlationId
244
274
  );
275
+ }
276
+
277
+ if (cachedResult) {
278
+ // Served from the native internal cache; token did not come directly from the broker
245
279
  nativeATMeasurement.add({
246
280
  isNativeBroker: false,
247
281
  });
248
282
  nativeATMeasurement.end({
249
- success: false,
283
+ success: true,
284
+ fromCache: true,
250
285
  });
251
- throw e;
286
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
287
+ return cachedResult;
252
288
  }
253
- // continue with a native call for any and all errors
254
- this.logger.info(
255
- "MSAL internal Cache does not contain tokens, proceed to make a native call",
256
- this.correlationId
257
- );
258
289
  }
259
290
 
260
291
  // dispatch the request to the broker
261
292
  try {
293
+ await this.prepareDpopBrokerRequest(nativeRequest);
294
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
262
295
  const validatedResponse: PlatformAuthResponse =
263
296
  await this.platformAuthProvider.sendMessage(nativeRequest);
264
297
 
@@ -291,6 +324,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
291
324
  e
292
325
  );
293
326
  this.setBrokerErrorTelemetry(e);
327
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
294
328
  throw e;
295
329
  }
296
330
  }
@@ -336,6 +370,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
336
370
  ).asArray(),
337
371
  account: cachedAccount,
338
372
  forceRefresh: false,
373
+ ...this.createSilentCacheTokenBindingParameters(request),
339
374
  resource: request.extraParameters?.resource,
340
375
  };
341
376
 
@@ -348,15 +383,65 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
348
383
  }
349
384
 
350
385
  /**
351
- * Fetches the tokens from the cache if un-expired
386
+ * Maps platform-broker token-binding state to silent-cache request fields.
387
+ * @param request
388
+ */
389
+ private createSilentCacheTokenBindingParameters(
390
+ request: PlatformAuthRequest
391
+ ): Pick<
392
+ CommonSilentFlowRequest,
393
+ | "authenticationScheme"
394
+ | "popKid"
395
+ | "dpopJkt"
396
+ | "resourceRequestMethod"
397
+ | "resourceRequestUri"
398
+ > {
399
+ const authenticationScheme = this.isDpopBrokerRequest(request)
400
+ ? Constants.AuthenticationScheme.DPOP
401
+ : (request.tokenType as Constants.AuthenticationScheme);
402
+
403
+ if (
404
+ authenticationScheme !== Constants.AuthenticationScheme.DPOP &&
405
+ authenticationScheme !== Constants.AuthenticationScheme.POP
406
+ ) {
407
+ return { authenticationScheme };
408
+ }
409
+
410
+ return {
411
+ authenticationScheme,
412
+ ...(authenticationScheme === Constants.AuthenticationScheme.DPOP &&
413
+ request.keyId && { dpopJkt: request.keyId }),
414
+ ...(authenticationScheme === Constants.AuthenticationScheme.POP &&
415
+ request.signPopToken === false &&
416
+ request.keyId && { popKid: request.keyId }),
417
+ resourceRequestMethod: request.resourceRequestMethod,
418
+ resourceRequestUri: request.resourceRequestUri,
419
+ };
420
+ }
421
+
422
+ /**
423
+ * Fetches unexpired tokens when allowed by cache policy.
352
424
  * @param nativeAccountId
353
425
  * @param request
354
- * @returns authenticationResult
426
+ * @param cacheLookupPolicy
427
+ * @returns Cached result, or undefined when cache policy bypasses lookup.
355
428
  */
356
429
  protected async acquireTokensFromCache(
357
430
  nativeAccountId: string,
358
- request: PlatformAuthRequest
359
- ): Promise<AuthenticationResult> {
431
+ request: PlatformAuthRequest,
432
+ cacheLookupPolicy: CacheLookupPolicy = CacheLookupPolicy.Default
433
+ ): Promise<AuthenticationResult | undefined> {
434
+ if (
435
+ cacheLookupPolicy === CacheLookupPolicy.RefreshTokenAndNetwork ||
436
+ cacheLookupPolicy === CacheLookupPolicy.Skip
437
+ ) {
438
+ this.logger.verbose(
439
+ "Native cache lookup bypassed for cache policy",
440
+ this.correlationId
441
+ );
442
+ return undefined;
443
+ }
444
+
360
445
  if (!nativeAccountId) {
361
446
  this.logger.warning(
362
447
  "NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided",
@@ -450,9 +535,26 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
450
535
  options?.navigateToLoginRequestUrl ?? true;
451
536
 
452
537
  try {
453
- await this.platformAuthProvider.sendMessage(nativeRequest);
538
+ await this.prepareDpopBrokerRequest(nativeRequest);
539
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
540
+ const response = await this.platformAuthProvider.sendMessage(
541
+ nativeRequest
542
+ );
543
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(
544
+ response,
545
+ nativeRequest
546
+ );
547
+ if (dpopBrokerOutcome === "L3") {
548
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
549
+ }
454
550
  } catch (e) {
455
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
551
+ /*
552
+ * Raw persistent/transient broker errors are retrieved again in
553
+ * phase two. Availability errors are thrown for controller-managed
554
+ * web fallback, while translated cancellation, network, and
555
+ * interaction-required errors are surfaced without being swallowed.
556
+ */
557
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
456
558
  if (e instanceof NativeAuthError) {
457
559
  const serverTelemetryManager = initializeServerTelemetryManager(
458
560
  this.apiId,
@@ -474,8 +576,16 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
474
576
  this.setBrokerErrorTelemetry(e);
475
577
  throw e;
476
578
  }
579
+ } else if (this.isDpopBrokerRequest(nativeRequest)) {
580
+ throw e;
477
581
  }
478
582
  }
583
+ try {
584
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
585
+ } catch (e) {
586
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
587
+ throw e;
588
+ }
479
589
  this.browserStorage.setTemporaryCache(
480
590
  TemporaryCacheKeys.NATIVE_REQUEST,
481
591
  JSON.stringify({
@@ -503,10 +613,20 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
503
613
  this.correlationId
504
614
  );
505
615
  rootMeasurement.end({ success: true });
506
- await this.navigationClient.navigateExternal(
507
- redirectUri,
508
- navigationOptions
509
- ); // Need to treat this as external to ensure handleRedirectPromise is run again
616
+ try {
617
+ await this.navigationClient.navigateExternal(
618
+ redirectUri,
619
+ navigationOptions
620
+ ); // Need to treat this as external to ensure handleRedirectPromise is run again
621
+ } catch (e) {
622
+ this.browserStorage.removeItem(
623
+ this.browserStorage.generateCacheKey(
624
+ TemporaryCacheKeys.NATIVE_REQUEST
625
+ )
626
+ );
627
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
628
+ throw e;
629
+ }
510
630
  }
511
631
 
512
632
  /**
@@ -567,6 +687,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
567
687
  const reqTimestamp = TimeUtils.nowSeconds();
568
688
 
569
689
  try {
690
+ await this.prepareDpopBrokerRequest(request, true);
691
+ this.addDpopBrokerAttemptTelemetry(request);
570
692
  this.logger.verbose(
571
693
  "NativeInteractionClient - handleRedirectPromise sending message to native broker.",
572
694
  this.correlationId
@@ -593,7 +715,20 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
593
715
  serverTelemetryManager.clearNativeBrokerErrorCode();
594
716
  return authResult;
595
717
  } catch (e) {
718
+ if (e instanceof NativeAuthError) {
719
+ const serverTelemetryManager = initializeServerTelemetryManager(
720
+ this.apiId,
721
+ this.config.auth.clientId,
722
+ this.correlationId,
723
+ this.browserStorage,
724
+ this.logger,
725
+ undefined,
726
+ this.config.system.serverTelemetryEnabled
727
+ );
728
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
729
+ }
596
730
  this.setBrokerErrorTelemetry(e);
731
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
597
732
  throw e;
598
733
  }
599
734
  }
@@ -627,6 +762,11 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
627
762
  this.correlationId
628
763
  );
629
764
 
765
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(
766
+ response,
767
+ request
768
+ );
769
+
630
770
  // generate identifiers
631
771
  const idTokenClaims = AuthToken.extractTokenClaims(
632
772
  response.id_token,
@@ -712,14 +852,23 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
712
852
  reqTimestamp
713
853
  );
714
854
 
855
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
715
856
  // cache accounts and tokens in the appropriate storage
857
+ const shouldRemoveGeneratedDpopKey =
858
+ isL3DpopResponse ||
859
+ (this.isDpopBrokerRequest(request) &&
860
+ storeInCache?.accessToken === false);
861
+ if (shouldRemoveGeneratedDpopKey) {
862
+ await this.resetGeneratedDpopRequestKey(request);
863
+ }
864
+
716
865
  await invokeAsync(
717
866
  this.cacheAccount.bind(this),
718
867
  BrowserPerformanceEvents.PlatformAuthCacheAccount,
719
868
  this.logger,
720
869
  this.performanceClient,
721
870
  this.correlationId
722
- )(baseAccount, AuthToken.isKmsi(idTokenClaims));
871
+ )(baseAccount, AuthToken.isKmsi(idTokenClaims), !isL3DpopResponse);
723
872
  await invokeAsync(
724
873
  this.cacheNativeTokens.bind(this),
725
874
  BrowserPerformanceEvents.PlatformAuthCacheNativeTokens,
@@ -734,7 +883,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
734
883
  result.tenantId,
735
884
  reqTimestamp,
736
885
  authority.getPreferredCache(), // environment
737
- storeInCache
886
+ storeInCache,
887
+ dpopBrokerOutcome
738
888
  );
739
889
 
740
890
  return result;
@@ -856,7 +1006,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
856
1006
  ): Promise<AuthenticationResult> {
857
1007
  // Add Native Broker fields to Telemetry
858
1008
  const mats = this.addTelemetryFromNativeResponse(
859
- response.properties.MATS
1009
+ response.properties?.MATS
860
1010
  );
861
1011
 
862
1012
  // If scopes not returned in server response, use request scopes
@@ -900,10 +1050,17 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
900
1050
  response,
901
1051
  request
902
1052
  );
903
- const tokenType =
904
- request.tokenType === Constants.AuthenticationScheme.POP
905
- ? Constants.AuthenticationScheme.POP
906
- : Constants.AuthenticationScheme.BEARER;
1053
+ const isDpopRequest = this.isDpopBrokerRequest(request);
1054
+ let tokenType: Constants.AuthenticationScheme =
1055
+ Constants.AuthenticationScheme.BEARER;
1056
+ if (isDpopRequest) {
1057
+ tokenType = Constants.AuthenticationScheme.DPOP;
1058
+ } else if (request.tokenType === Constants.AuthenticationScheme.POP) {
1059
+ tokenType = Constants.AuthenticationScheme.POP;
1060
+ }
1061
+ const dpopProof = isDpopRequest
1062
+ ? await this.generateDpopProof(response, request)
1063
+ : undefined;
907
1064
 
908
1065
  const result: AuthenticationResult = {
909
1066
  authority: authority,
@@ -920,6 +1077,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
920
1077
  reqTimestamp + response.expires_in
921
1078
  ),
922
1079
  tokenType: tokenType,
1080
+ dpopProof,
923
1081
  correlationId: this.correlationId,
924
1082
  state: response.state,
925
1083
  fromPlatformBroker: true,
@@ -937,7 +1095,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
937
1095
  */
938
1096
  async cacheAccount(
939
1097
  accountEntity: AccountEntity,
940
- kmsi: boolean
1098
+ kmsi: boolean,
1099
+ clearExistingTokens: boolean = true
941
1100
  ): Promise<void> {
942
1101
  // Store the account info and hence `nativeAccountId` in browser cache
943
1102
  await this.browserStorage.setAccount(
@@ -946,11 +1105,13 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
946
1105
  kmsi,
947
1106
  this.apiId
948
1107
  );
949
- // Remove any existing cached tokens for this account in browser storage
950
- this.browserStorage.removeAccountContext(
951
- AccountEntityUtils.getAccountInfo(accountEntity),
952
- this.correlationId
953
- );
1108
+ // Remove cached web access and refresh tokens, preserving ID tokens.
1109
+ if (clearExistingTokens) {
1110
+ this.browserStorage.removeAccountContext(
1111
+ AccountEntityUtils.getAccountInfo(accountEntity),
1112
+ this.correlationId
1113
+ );
1114
+ }
954
1115
  }
955
1116
 
956
1117
  /**
@@ -971,7 +1132,8 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
971
1132
  tenantId: string,
972
1133
  reqTimestamp: number,
973
1134
  environment: string,
974
- storeInCache?: StoreInCache
1135
+ storeInCache?: StoreInCache,
1136
+ dpopBrokerOutcome: "none" | "L1" | "L3" = "none"
975
1137
  ): Promise<void> {
976
1138
  const cachedIdToken: IdTokenEntity | null =
977
1139
  CacheHelpers.createIdTokenEntity(
@@ -982,6 +1144,23 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
982
1144
  idTokenClaims.tid || ""
983
1145
  );
984
1146
 
1147
+ // save idtoken credential in configured browser storage
1148
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
1149
+ await this.browserStorage.setIdTokenCredential(
1150
+ cachedIdToken,
1151
+ this.correlationId,
1152
+ AuthToken.isKmsi(idTokenClaims)
1153
+ );
1154
+ }
1155
+
1156
+ if (dpopBrokerOutcome === "L3") {
1157
+ return;
1158
+ }
1159
+
1160
+ if (storeInCache?.accessToken === false) {
1161
+ return;
1162
+ }
1163
+
985
1164
  // cache accessToken in inmemory storage
986
1165
  const expiresIn: number =
987
1166
  request.tokenType === Constants.AuthenticationScheme.POP
@@ -994,45 +1173,32 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
994
1173
  response.scope,
995
1174
  request.scope
996
1175
  );
997
-
998
1176
  const additionalCacheKeyComponents = request.attributeTokens
999
- ? {
1000
- attribute_tokens: request.attributeTokens,
1001
- }
1177
+ ? { attribute_tokens: request.attributeTokens }
1002
1178
  : undefined;
1003
-
1004
- const cachedAccessToken: AccessTokenEntity | null =
1005
- CacheHelpers.createAccessTokenEntity(
1006
- homeAccountIdentifier,
1007
- environment,
1008
- response.access_token,
1009
- request.clientId,
1010
- idTokenClaims.tid || tenantId,
1011
- responseScopes.printScopes(),
1012
- tokenExpirationSeconds,
1013
- 0,
1014
- base64Decode,
1015
- request.correlationId,
1016
- undefined,
1017
- request.tokenType as Constants.AuthenticationScheme,
1018
- undefined,
1019
- request.keyId,
1020
- additionalCacheKeyComponents
1021
- );
1022
-
1179
+ const cachedAccessToken = CacheHelpers.createAccessTokenEntity(
1180
+ homeAccountIdentifier,
1181
+ environment,
1182
+ response.access_token,
1183
+ request.clientId,
1184
+ idTokenClaims.tid || tenantId,
1185
+ responseScopes.printScopes(),
1186
+ tokenExpirationSeconds,
1187
+ 0,
1188
+ base64Decode,
1189
+ request.correlationId,
1190
+ undefined,
1191
+ this.isDpopBrokerRequest(request)
1192
+ ? Constants.AuthenticationScheme.DPOP
1193
+ : (request.tokenType as Constants.AuthenticationScheme),
1194
+ undefined,
1195
+ request.keyId,
1196
+ additionalCacheKeyComponents
1197
+ );
1023
1198
  if (request.extraParameters?.resource) {
1024
1199
  cachedAccessToken.resource = request.extraParameters.resource;
1025
1200
  }
1026
1201
 
1027
- // save idtoken credential in configured browser storage
1028
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
1029
- await this.browserStorage.setIdTokenCredential(
1030
- cachedIdToken,
1031
- this.correlationId,
1032
- AuthToken.isKmsi(idTokenClaims)
1033
- );
1034
- }
1035
-
1036
1202
  // save access token credential in memory storage
1037
1203
  const nativeCacheRecord = {
1038
1204
  accessToken: cachedAccessToken,
@@ -1149,15 +1315,12 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1149
1315
  ? undefined
1150
1316
  : this.config.auth.clientCapabilities;
1151
1317
 
1152
- /*
1153
- * 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.
1154
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
1155
- */
1156
- const { scopes, claims, extraParametersNoCache, dpopNonce } =
1157
- request as (PopupRequest | SsoSilentRequest) & {
1158
- extraParametersNoCache?: PlatformAuthExtraParametersNoCache;
1159
- dpopNonce?: string;
1160
- };
1318
+ const { scopes, claims, dpopNonce } = request as (
1319
+ | PopupRequest
1320
+ | SsoSilentRequest
1321
+ ) & {
1322
+ dpopNonce?: string;
1323
+ };
1161
1324
  const scopeSet = new ScopeSet(
1162
1325
  [...(scopes || []), ...Constants.OIDC_DEFAULT_SCOPES],
1163
1326
  this.correlationId
@@ -1198,36 +1361,16 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1198
1361
  loginHint: request.loginHint,
1199
1362
  extraParameters: {
1200
1363
  ...request.extraParameters,
1201
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
1364
+ // Native broker resource is set for MCP scenarios.
1365
+ ...(request.resource && { resource: request.resource }),
1202
1366
  },
1203
1367
  extendedExpiryToken: false, // Make this configurable?
1204
1368
  keyId: request.popKid,
1205
- resourceRequestMethod: request.resourceRequestMethod,
1206
- resourceRequestUri: request.resourceRequestUri,
1207
- shrClaims: request.shrClaims,
1208
- shrNonce: request.shrNonce,
1209
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(
1210
- extraParametersNoCache,
1211
- isProofOfPossessionTokenType(request.authenticationScheme),
1212
- request.resourceRequestMethod,
1213
- request.resourceRequestUri,
1214
- dpopNonce
1215
- ),
1216
1369
  };
1217
1370
 
1218
1371
  if (hasAttributeTokens) {
1219
1372
  validatedRequest.attributeTokens =
1220
- CacheHelpers.serializeAttributeTokens(
1221
- request.attributeTokens as Array<string>
1222
- );
1223
- }
1224
-
1225
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
1226
- if (validatedRequest.signPopToken && !!request.popKid) {
1227
- throw createBrowserAuthError(
1228
- BrowserAuthErrorCodes.invalidPopTokenRequest,
1229
- this.correlationId
1230
- );
1373
+ CacheHelpers.serializeAttributeTokens(request.attributeTokens);
1231
1374
  }
1232
1375
 
1233
1376
  this.handleExtraBrokerParams(
@@ -1242,23 +1385,19 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1242
1385
  if (
1243
1386
  request.authenticationScheme === Constants.AuthenticationScheme.POP
1244
1387
  ) {
1245
- // add POP request type
1246
1388
  const shrParameters: SignedHttpRequestParameters = {
1247
- resourceRequestUri: request.resourceRequestUri,
1248
1389
  resourceRequestMethod: request.resourceRequestMethod,
1390
+ resourceRequestUri: request.resourceRequestUri,
1249
1391
  shrClaims: request.shrClaims,
1250
1392
  shrNonce: request.shrNonce,
1251
1393
  correlationId: this.correlationId,
1252
1394
  };
1253
-
1254
1395
  const popTokenGenerator = new PopTokenGenerator(
1255
1396
  this.browserCrypto,
1256
1397
  this.tokenBindingKeyManager,
1257
1398
  this.performanceClient
1258
1399
  );
1259
1400
 
1260
- // generate reqCnf if not provided in the request
1261
- let reqCnfData;
1262
1401
  if (!validatedRequest.keyId) {
1263
1402
  const generatedReqCnfData = await invokeAsync(
1264
1403
  popTokenGenerator.generateCnf.bind(popTokenGenerator),
@@ -1267,24 +1406,625 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1267
1406
  this.performanceClient,
1268
1407
  this.correlationId
1269
1408
  )(shrParameters, this.logger);
1270
- reqCnfData = generatedReqCnfData.reqCnfString;
1409
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
1271
1410
  validatedRequest.keyId = generatedReqCnfData.kid;
1272
1411
  validatedRequest.signPopToken = true;
1273
1412
  } else {
1274
- reqCnfData = this.browserCrypto.base64UrlEncode(
1413
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(
1275
1414
  JSON.stringify({ kid: validatedRequest.keyId })
1276
1415
  );
1277
1416
  validatedRequest.signPopToken = false;
1278
1417
  }
1279
1418
 
1280
- // SPAs require whole string to be passed to broker
1281
- validatedRequest.reqCnf = reqCnfData;
1419
+ validatedRequest.resourceRequestMethod =
1420
+ request.resourceRequestMethod;
1421
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
1422
+ validatedRequest.shrClaims = request.shrClaims;
1423
+ validatedRequest.shrNonce = request.shrNonce;
1424
+ } else if (
1425
+ request.authenticationScheme === Constants.AuthenticationScheme.DPOP
1426
+ ) {
1427
+ Object.assign(
1428
+ validatedRequest,
1429
+ this.createDpopRequestParameters(request)
1430
+ );
1282
1431
  }
1432
+
1433
+ validatedRequest.extraParametersNoCache =
1434
+ createPlatformAuthExtraParametersNoCache(
1435
+ validatedRequest.tokenType,
1436
+ validatedRequest.resourceRequestMethod,
1437
+ validatedRequest.resourceRequestUri,
1438
+ dpopNonce
1439
+ );
1283
1440
  this.addRequestSKUs(validatedRequest);
1284
1441
 
1285
1442
  return validatedRequest;
1286
1443
  }
1287
1444
 
1445
+ /**
1446
+ * Creates and validates the broker-specific parameters for a DPoP request.
1447
+ * @param request - Developer-provided token request.
1448
+ * @returns Broker parameters for a DPoP token and resource proof.
1449
+ */
1450
+ private createDpopRequestParameters(
1451
+ request: PopupRequest | SsoSilentRequest
1452
+ ): Partial<PlatformAuthRequest> {
1453
+ if (request.popKid) {
1454
+ throw createBrowserAuthError(
1455
+ DPOP_POP_KID_NOT_SUPPORTED,
1456
+ this.correlationId
1457
+ );
1458
+ }
1459
+
1460
+ if (
1461
+ !request.resourceRequestMethod?.trim() ||
1462
+ !request.resourceRequestUri?.trim()
1463
+ ) {
1464
+ throw createClientConfigurationError(
1465
+ ClientConfigurationErrorCodes.dpopMissingResourceContext,
1466
+ this.correlationId
1467
+ );
1468
+ }
1469
+
1470
+ const resourceContext = normalizeDpopResourceRequestContext(
1471
+ {
1472
+ htm: request.resourceRequestMethod,
1473
+ htu: request.resourceRequestUri,
1474
+ },
1475
+ this.correlationId
1476
+ );
1477
+
1478
+ return {
1479
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
1480
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
1481
+ keyId: request.dpopJkt,
1482
+ resourceRequestMethod: resourceContext.htm,
1483
+ resourceRequestUri: resourceContext.htu,
1484
+ };
1485
+ }
1486
+
1487
+ /**
1488
+ * Provisions the local key and confirmation data for a DPoP broker request.
1489
+ * @param request - Broker request to prepare.
1490
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
1491
+ */
1492
+ private async prepareDpopBrokerRequest(
1493
+ request: PlatformAuthRequest,
1494
+ reuseExistingKey: boolean = false
1495
+ ): Promise<void> {
1496
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
1497
+ return;
1498
+ }
1499
+
1500
+ /*
1501
+ * Phase one clears both fields after an L3 response or non-fatal broker
1502
+ * error. In that case phase two must provision a replacement. If either
1503
+ * field remains, treat it as a retained binding and validate it fully.
1504
+ */
1505
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
1506
+ if (!request.keyId || !request.reqCnf) {
1507
+ throw createAuthError(
1508
+ AuthErrorCodes.unexpectedError,
1509
+ this.correlationId,
1510
+ "DPoP request key binding is incomplete after redirect."
1511
+ );
1512
+ }
1513
+
1514
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
1515
+ if (request.reqCnf !== expectedReqCnf) {
1516
+ throw createAuthError(
1517
+ AuthErrorCodes.unexpectedError,
1518
+ this.correlationId,
1519
+ "DPoP request key binding is invalid after redirect."
1520
+ );
1521
+ }
1522
+ const hasKey =
1523
+ this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
1524
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(
1525
+ request.keyId,
1526
+ this.correlationId
1527
+ )
1528
+ : await this.tokenBindingKeyManager
1529
+ .getTokenBindingPublicKeyJwk(
1530
+ request.keyId,
1531
+ this.correlationId
1532
+ )
1533
+ .then(
1534
+ () => true,
1535
+ () => false
1536
+ );
1537
+ if (!hasKey) {
1538
+ throw createAuthError(
1539
+ AuthErrorCodes.unexpectedError,
1540
+ this.correlationId,
1541
+ "DPoP request key is unavailable after redirect."
1542
+ );
1543
+ }
1544
+ return;
1545
+ }
1546
+
1547
+ if (request.reqCnf) {
1548
+ throw createAuthError(
1549
+ AuthErrorCodes.unexpectedError,
1550
+ this.correlationId,
1551
+ "Unexpected preexisting DPoP request key."
1552
+ );
1553
+ }
1554
+
1555
+ if (!request.keyId) {
1556
+ request.keyId =
1557
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
1558
+ tokenBindingKeyType:
1559
+ Constants.AuthenticationScheme.DPOP.toLowerCase(),
1560
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
1561
+ correlationId: this.correlationId,
1562
+ });
1563
+ }
1564
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
1565
+ }
1566
+
1567
+ /**
1568
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
1569
+ * @param keyId - Browser-managed DPoP key identifier.
1570
+ * @returns Encoded broker confirmation claim.
1571
+ */
1572
+ private createDpopBrokerReqCnf(keyId: string): string {
1573
+ return this.browserCrypto.base64UrlEncode(
1574
+ JSON.stringify({
1575
+ kid: keyId,
1576
+ xms_ksl:
1577
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
1578
+ })
1579
+ );
1580
+ }
1581
+
1582
+ /**
1583
+ * Ensures an owned DPoP key can survive redirect navigation before the
1584
+ * request metadata is persisted for phase two.
1585
+ */
1586
+ private async ensureRedirectDpopKeyIsPersisted(
1587
+ request: PlatformAuthRequest
1588
+ ): Promise<void> {
1589
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
1590
+ return;
1591
+ }
1592
+
1593
+ if (
1594
+ !(await isTokenBindingKeyPersistedForRedirect(
1595
+ request,
1596
+ this.tokenBindingKeyManager
1597
+ ))
1598
+ ) {
1599
+ throw createAuthError(
1600
+ AuthErrorCodes.unexpectedError,
1601
+ this.correlationId,
1602
+ "DPoP request key could not be persisted for redirect."
1603
+ );
1604
+ }
1605
+ }
1606
+
1607
+ /**
1608
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
1609
+ * @param response - Broker response to validate.
1610
+ * @param request - Broker request associated with the response.
1611
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
1612
+ */
1613
+ private validateDpopBrokerOutcome(
1614
+ response: PlatformAuthResponse,
1615
+ request: PlatformAuthRequest
1616
+ ): BrokerDpopOutcome {
1617
+ const isDpopRequest = this.isDpopBrokerRequest(request);
1618
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
1619
+ const normalizedRequestTokenType = request.tokenType
1620
+ ?.trim()
1621
+ .toLowerCase();
1622
+ const bindingPreferenceSent =
1623
+ request.bindingPreferenceSent ??
1624
+ request.preferBinding !== undefined;
1625
+ const hasDpopResponse =
1626
+ this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
1627
+ normalizedResponse.proof !== undefined ||
1628
+ normalizedResponse.hasBindingAttested;
1629
+
1630
+ if (!isDpopRequest) {
1631
+ if (hasDpopResponse) {
1632
+ this.throwInvalidDpopResponse(
1633
+ "unexpected_response",
1634
+ "Unexpected DPoP broker response."
1635
+ );
1636
+ }
1637
+ return "none";
1638
+ }
1639
+
1640
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
1641
+ this.throwInvalidDpopResponse(
1642
+ "unknown_token_type",
1643
+ "Unknown DPoP broker response."
1644
+ );
1645
+ }
1646
+
1647
+ this.validateNormalizedDpopBrokerResponse(
1648
+ normalizedResponse,
1649
+ bindingPreferenceSent
1650
+ );
1651
+
1652
+ if (
1653
+ normalizedResponse.tokenType ===
1654
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()
1655
+ ) {
1656
+ return this.validateDpopBrokerL3Outcome(
1657
+ normalizedRequestTokenType,
1658
+ normalizedResponse
1659
+ );
1660
+ }
1661
+
1662
+ return this.validateDpopBrokerL1Outcome(
1663
+ request,
1664
+ normalizedRequestTokenType,
1665
+ normalizedResponse,
1666
+ bindingPreferenceSent
1667
+ );
1668
+ }
1669
+
1670
+ /**
1671
+ * Normalizes the canonical DPoP fields returned under response properties.
1672
+ */
1673
+ private normalizeDpopBrokerResponse(
1674
+ response: PlatformAuthResponse
1675
+ ): NormalizedDpopBrokerResponse {
1676
+ const responseProperties = response.properties as
1677
+ | NativeResponseProperties
1678
+ | undefined;
1679
+ const rawTokenType = responseProperties?.token_type;
1680
+ const tokenType =
1681
+ typeof rawTokenType === "string"
1682
+ ? rawTokenType.trim().toLowerCase()
1683
+ : undefined;
1684
+ const rawBindingAttested = responseProperties?.binding_attested;
1685
+ let bindingAttested: boolean | undefined;
1686
+
1687
+ if (typeof rawBindingAttested === "string") {
1688
+ const normalizedBindingAttested = rawBindingAttested
1689
+ .trim()
1690
+ .toLowerCase();
1691
+ if (normalizedBindingAttested === "true") {
1692
+ bindingAttested = true;
1693
+ } else if (normalizedBindingAttested === "false") {
1694
+ bindingAttested = false;
1695
+ }
1696
+ }
1697
+
1698
+ return {
1699
+ tokenType,
1700
+ proof: responseProperties?.DPoP,
1701
+ bindingAttested,
1702
+ hasBindingAttested: rawBindingAttested !== undefined,
1703
+ hasMalformedBindingAttested:
1704
+ rawBindingAttested !== undefined &&
1705
+ bindingAttested === undefined,
1706
+ };
1707
+ }
1708
+
1709
+ /**
1710
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
1711
+ */
1712
+ private validateNormalizedDpopBrokerResponse(
1713
+ normalizedResponse: NormalizedDpopBrokerResponse,
1714
+ bindingPreferenceSent: boolean
1715
+ ): void {
1716
+ if (normalizedResponse.hasMalformedBindingAttested) {
1717
+ this.throwInvalidDpopResponse(
1718
+ "invalid_attestation",
1719
+ "Conflicting DPoP broker response."
1720
+ );
1721
+ }
1722
+
1723
+ if (
1724
+ bindingPreferenceSent &&
1725
+ normalizedResponse.bindingAttested === undefined
1726
+ ) {
1727
+ this.throwInvalidDpopResponse(
1728
+ "missing_attestation",
1729
+ "Conflicting DPoP broker response."
1730
+ );
1731
+ }
1732
+ }
1733
+
1734
+ /**
1735
+ * Validates a broker-returned L3 DPoP proof outcome.
1736
+ */
1737
+ private validateDpopBrokerL3Outcome(
1738
+ normalizedRequestTokenType: string | undefined,
1739
+ normalizedResponse: NormalizedDpopBrokerResponse
1740
+ ): "L3" {
1741
+ const dpopWithProofTokenType =
1742
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
1743
+
1744
+ if (
1745
+ typeof normalizedResponse.proof !== "string" ||
1746
+ normalizedResponse.proof.trim().length === 0
1747
+ ) {
1748
+ this.throwInvalidDpopResponse(
1749
+ "missing_proof",
1750
+ "Malformed DPoP broker response."
1751
+ );
1752
+ }
1753
+
1754
+ if (normalizedResponse.bindingAttested !== true) {
1755
+ this.throwInvalidDpopResponse(
1756
+ "invalid_attestation",
1757
+ "Malformed DPoP broker response."
1758
+ );
1759
+ }
1760
+ if (
1761
+ normalizedRequestTokenType !== dpopWithProofTokenType ||
1762
+ normalizedResponse.tokenType !== dpopWithProofTokenType
1763
+ ) {
1764
+ this.throwInvalidDpopResponse(
1765
+ "conflicting_fields",
1766
+ "Malformed DPoP broker response."
1767
+ );
1768
+ }
1769
+
1770
+ this.performanceClient.addFields(
1771
+ {
1772
+ "ext.brokerDpopOutcome": "l3",
1773
+ "ext.brokerDpopBindingLevel": "L3",
1774
+ },
1775
+ this.correlationId
1776
+ );
1777
+ return "L3";
1778
+ }
1779
+
1780
+ /**
1781
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
1782
+ */
1783
+ private validateDpopBrokerL1Outcome(
1784
+ request: PlatformAuthRequest,
1785
+ normalizedRequestTokenType: string | undefined,
1786
+ normalizedResponse: NormalizedDpopBrokerResponse,
1787
+ bindingPreferenceSent: boolean
1788
+ ): "L1" {
1789
+ if (normalizedResponse.proof !== undefined) {
1790
+ this.throwInvalidDpopResponse(
1791
+ "conflicting_fields",
1792
+ "Malformed DPoP broker L1 response."
1793
+ );
1794
+ }
1795
+
1796
+ if (
1797
+ normalizedRequestTokenType !==
1798
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()
1799
+ ) {
1800
+ this.throwInvalidDpopResponse(
1801
+ "conflicting_fields",
1802
+ "Malformed DPoP broker L1 response."
1803
+ );
1804
+ }
1805
+
1806
+ if (
1807
+ normalizedResponse.bindingAttested !== false &&
1808
+ !(
1809
+ !bindingPreferenceSent &&
1810
+ normalizedResponse.bindingAttested === undefined
1811
+ )
1812
+ ) {
1813
+ this.throwInvalidDpopResponse(
1814
+ "invalid_attestation",
1815
+ "Malformed DPoP broker L1 response."
1816
+ );
1817
+ }
1818
+
1819
+ if (!request.reqCnf || !request.keyId) {
1820
+ this.throwInvalidDpopResponse(
1821
+ "missing_l1_binding",
1822
+ "Malformed DPoP broker L1 response."
1823
+ );
1824
+ }
1825
+
1826
+ this.performanceClient.addFields(
1827
+ {
1828
+ "ext.brokerDpopOutcome": "l1",
1829
+ "ext.brokerDpopBindingLevel": "L1",
1830
+ },
1831
+ this.correlationId
1832
+ );
1833
+ return "L1";
1834
+ }
1835
+
1836
+ /**
1837
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
1838
+ */
1839
+ private throwInvalidDpopResponse(
1840
+ failureReason: BrokerDpopFailureReason,
1841
+ message: string
1842
+ ): never {
1843
+ this.performanceClient.addFields(
1844
+ {
1845
+ "ext.brokerDpopOutcome": "invalid_response",
1846
+ "ext.brokerDpopFailureReason": failureReason,
1847
+ },
1848
+ this.correlationId
1849
+ );
1850
+ throw createAuthError(
1851
+ AuthErrorCodes.unexpectedError,
1852
+ this.correlationId,
1853
+ message
1854
+ );
1855
+ }
1856
+
1857
+ /**
1858
+ * Returns the broker proof or signs an L1 resource proof with the local key.
1859
+ * @param response - Broker response containing the access token and optional proof.
1860
+ * @param request - Broker request containing the proof context and local key.
1861
+ * @returns The resource proof for the broker access token.
1862
+ */
1863
+ private async generateDpopProof(
1864
+ response: PlatformAuthResponse,
1865
+ request: PlatformAuthRequest
1866
+ ): Promise<string> {
1867
+ const brokerProof = response.properties?.DPoP;
1868
+ if (brokerProof !== undefined) {
1869
+ return brokerProof;
1870
+ }
1871
+
1872
+ const dpopProofGenerator = new DpopProofGenerator(
1873
+ this.browserCrypto,
1874
+ this.tokenBindingKeyManager
1875
+ );
1876
+ return dpopProofGenerator.generateResourceProof(
1877
+ {
1878
+ htu: request.resourceRequestUri,
1879
+ htm: request.resourceRequestMethod,
1880
+ accessToken: response.access_token,
1881
+ nonce: request.extraParametersNoCache?.pop_nonce,
1882
+ },
1883
+ request.keyId as string,
1884
+ this.correlationId
1885
+ );
1886
+ }
1887
+
1888
+ /**
1889
+ * Removes a generated DPoP request key and clears its request metadata.
1890
+ * @param request - Broker request whose generated key should be removed.
1891
+ */
1892
+ private async resetGeneratedDpopRequestKey(
1893
+ request: PlatformAuthRequest
1894
+ ): Promise<void> {
1895
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
1896
+ return;
1897
+ }
1898
+
1899
+ const cleanupMeasurement = this.performanceClient.startMeasurement(
1900
+ BrowserPerformanceEvents.PlatformAuthDpopKeyCleanup,
1901
+ this.correlationId
1902
+ );
1903
+ this.performanceClient.incrementFields(
1904
+ { "ext.brokerDpopKeyCleanupAttemptCount": 1 },
1905
+ this.correlationId
1906
+ );
1907
+
1908
+ try {
1909
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
1910
+ throw createAuthError(
1911
+ AuthErrorCodes.unexpectedError,
1912
+ this.correlationId,
1913
+ "Failed to remove generated DPoP request key."
1914
+ );
1915
+ }
1916
+
1917
+ this.performanceClient.addFields(
1918
+ {
1919
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
1920
+ },
1921
+ this.correlationId
1922
+ );
1923
+ cleanupMeasurement.end({ success: true });
1924
+ request.keyId = undefined;
1925
+ request.reqCnf = undefined;
1926
+ } catch (error) {
1927
+ this.performanceClient.addFields(
1928
+ {
1929
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
1930
+ },
1931
+ this.correlationId
1932
+ );
1933
+ this.performanceClient.incrementFields(
1934
+ { "ext.brokerDpopKeyCleanupFailureCount": 1 },
1935
+ this.correlationId
1936
+ );
1937
+ cleanupMeasurement.end({ success: false }, error);
1938
+ throw error;
1939
+ }
1940
+ }
1941
+
1942
+ /**
1943
+ * Attempts to remove a generated DPoP request key without replacing an
1944
+ * existing operation error with a cleanup failure.
1945
+ * @param request - Broker request whose generated key should be removed.
1946
+ */
1947
+ private async resetGeneratedDpopRequestKeyBestEffort(
1948
+ request: PlatformAuthRequest
1949
+ ): Promise<void> {
1950
+ try {
1951
+ await this.resetGeneratedDpopRequestKey(request);
1952
+ } catch {
1953
+ this.logger.error(
1954
+ "Failed to remove generated DPoP request key after an operation error.",
1955
+ this.correlationId
1956
+ );
1957
+ this.performanceClient.incrementFields(
1958
+ { removeTokenBindingKeyFailure: 1 },
1959
+ this.correlationId
1960
+ );
1961
+
1962
+ request.keyId = undefined;
1963
+ request.reqCnf = undefined;
1964
+ }
1965
+ }
1966
+
1967
+ /**
1968
+ * Records that a DPoP request is about to be dispatched to the platform broker.
1969
+ * @param request - Broker request about to cross the provider boundary.
1970
+ */
1971
+ private addDpopBrokerAttemptTelemetry(request: PlatformAuthRequest): void {
1972
+ if (!this.isDpopBrokerRequest(request)) {
1973
+ return;
1974
+ }
1975
+
1976
+ this.performanceClient.addFields(
1977
+ {
1978
+ "ext.brokerDpopAttempted": 1,
1979
+ },
1980
+ this.correlationId
1981
+ );
1982
+ }
1983
+
1984
+ /**
1985
+ * Determines whether a request uses the DPoP broker protocol.
1986
+ * @param request - Broker request to inspect.
1987
+ * @returns Whether the request uses a DPoP token type.
1988
+ */
1989
+ private isDpopBrokerRequest(request: PlatformAuthRequest): boolean {
1990
+ return this.isDpopBrokerTokenType(request.tokenType);
1991
+ }
1992
+
1993
+ /**
1994
+ * Determines whether a token type represents a DPoP broker request.
1995
+ * @param tokenType - Token type to inspect.
1996
+ * @returns Whether the token type is a supported DPoP broker token type.
1997
+ */
1998
+ private isDpopBrokerTokenType(tokenType: string | undefined): boolean {
1999
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
2000
+ return (
2001
+ normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
2002
+ normalizedTokenType ===
2003
+ Constants.AuthenticationScheme.DPOP.toLowerCase()
2004
+ );
2005
+ }
2006
+
2007
+ /**
2008
+ * Removes a DPoP key while reporting cleanup failures.
2009
+ * @param keyId - Identifier of the DPoP key to remove.
2010
+ * @returns Whether the key was removed successfully.
2011
+ */
2012
+ private async removeDpopKey(keyId: string): Promise<boolean> {
2013
+ try {
2014
+ await this.tokenBindingKeyManager.removeTokenBindingKey(
2015
+ keyId,
2016
+ this.correlationId
2017
+ );
2018
+ return true;
2019
+ } catch {
2020
+ this.logger.error(
2021
+ "Failed to remove unused DPoP key",
2022
+ this.correlationId
2023
+ );
2024
+ return false;
2025
+ }
2026
+ }
2027
+
1288
2028
  private async getCanonicalAuthority(
1289
2029
  request: PopupRequest | SsoSilentRequest
1290
2030
  ): Promise<UrlString> {
@@ -1362,41 +2102,39 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1362
2102
  }
1363
2103
 
1364
2104
  /**
1365
- * Handles extra broker request parameters
1366
- * @param request {PlatformAuthRequest}
1367
- * @private
2105
+ * Handles extra broker request parameters.
2106
+ * @param request - Platform broker request.
2107
+ * @param embeddedClientId - Embedded application client identifier.
1368
2108
  */
1369
2109
  private handleExtraBrokerParams(
1370
2110
  request: PlatformAuthRequest,
1371
2111
  embeddedClientId?: string
1372
2112
  ): void {
1373
- const hasExtraBrokerParams =
1374
- request.extraParameters &&
1375
- request.extraParameters.hasOwnProperty(
1376
- AADServerParamKeys.BROKER_CLIENT_ID
1377
- ) &&
1378
- request.extraParameters.hasOwnProperty(
1379
- AADServerParamKeys.BROKER_REDIRECT_URI
1380
- ) &&
1381
- request.extraParameters.hasOwnProperty(
1382
- AADServerParamKeys.CLIENT_ID
2113
+ const hasOwnParameter = (parameter: string): boolean =>
2114
+ Object.prototype.hasOwnProperty.call(
2115
+ request.extraParameters,
2116
+ parameter
1383
2117
  );
2118
+ const hasExtraBrokerParams =
2119
+ hasOwnParameter(AADServerParamKeys.BROKER_CLIENT_ID) &&
2120
+ hasOwnParameter(AADServerParamKeys.BROKER_REDIRECT_URI) &&
2121
+ hasOwnParameter(AADServerParamKeys.CLIENT_ID);
1384
2122
 
1385
2123
  if (!embeddedClientId && !hasExtraBrokerParams) {
1386
2124
  return;
1387
2125
  }
1388
2126
 
1389
- let child_client_id: string = "";
1390
- const child_redirect_uri = request.redirectUri;
2127
+ const childRedirectUri = request.redirectUri;
2128
+ const childClientId =
2129
+ embeddedClientId ||
2130
+ request.extraParameters?.[AADServerParamKeys.CLIENT_ID] ||
2131
+ "";
1391
2132
 
1392
2133
  if (embeddedClientId) {
1393
2134
  request.redirectUri = this.config.auth.redirectUri;
1394
- child_client_id = embeddedClientId;
1395
2135
  } else if (request.extraParameters) {
1396
2136
  request.redirectUri =
1397
2137
  request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
1398
- child_client_id =
1399
- request.extraParameters[AADServerParamKeys.CLIENT_ID];
1400
2138
  }
1401
2139
 
1402
2140
  const {
@@ -1411,14 +2149,14 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
1411
2149
 
1412
2150
  request.extraParameters = {
1413
2151
  ...remainingExtraParameters,
1414
- child_client_id,
1415
- child_redirect_uri,
2152
+ child_client_id: childClientId,
2153
+ child_redirect_uri: childRedirectUri,
1416
2154
  };
1417
2155
 
1418
2156
  this.performanceClient?.addFields(
1419
2157
  {
1420
- embeddedClientId: child_client_id,
1421
- embeddedRedirectUri: child_redirect_uri,
2158
+ embeddedClientId: childClientId,
2159
+ embeddedRedirectUri: childRedirectUri,
1422
2160
  },
1423
2161
  this.correlationId
1424
2162
  );