@azure/msal-browser 5.25.1 → 5.27.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 (516) hide show
  1. package/README.md +2 -0
  2. package/dist/app/IPublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientApplication.mjs +54 -14
  4. package/dist/app/PublicClientApplication.mjs.map +1 -1
  5. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  7. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
  9. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +1 -1
  10. package/dist/cache/AccountManager.mjs +1 -1
  11. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  12. package/dist/cache/BrowserCacheManager.mjs +1 -1
  13. package/dist/cache/CacheHelpers.mjs +1 -1
  14. package/dist/cache/CacheKeys.mjs +1 -1
  15. package/dist/cache/CookieStorage.mjs +1 -1
  16. package/dist/cache/DatabaseStorage.mjs +1 -1
  17. package/dist/cache/EncryptedData.mjs +1 -1
  18. package/dist/cache/LocalStorage.mjs +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/SessionStorage.mjs +1 -1
  21. package/dist/cache/TokenCache.mjs +1 -1
  22. package/dist/config/Configuration.mjs +32 -4
  23. package/dist/config/Configuration.mjs.map +1 -1
  24. package/dist/controllers/NestedAppAuthController.mjs +7 -2
  25. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  26. package/dist/controllers/StandardController.mjs +36 -5
  27. package/dist/controllers/StandardController.mjs.map +1 -1
  28. package/dist/crypto/BrowserCrypto.mjs +1 -1
  29. package/dist/crypto/CryptoOps.mjs +1 -1
  30. package/dist/crypto/PkceGenerator.mjs +1 -1
  31. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  32. package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
  33. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  34. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  35. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +49 -19
  36. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  37. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  38. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  39. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +8 -7
  56. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -1
  57. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +4 -3
  58. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -1
  59. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +174 -0
  60. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs.map +1 -0
  61. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +67 -17
  62. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  63. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +3 -4
  64. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
  65. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +7 -15
  66. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  67. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
  68. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
  69. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +1 -5
  70. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  71. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +3 -2
  72. package/dist/custom_auth/core/error/CustomAuthApiError.mjs.map +1 -1
  73. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  74. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  75. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  76. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  77. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  78. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  79. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  80. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  81. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  82. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  83. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  84. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  85. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  86. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  87. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  88. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  89. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  90. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  91. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  92. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  93. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  94. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +61 -52
  95. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  96. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +6 -3
  97. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -1
  98. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +1 -1
  99. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  100. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  101. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  102. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +1 -2
  109. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  110. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +12 -10
  111. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs.map +1 -1
  112. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +1 -1
  113. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +3 -3
  114. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs.map +1 -1
  115. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +3 -7
  117. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +2 -1
  119. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs.map +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +1 -1
  122. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  123. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  124. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +1 -1
  125. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  126. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +8 -2
  127. package/dist/custom_auth/core/utils/ArgumentValidator.mjs.map +1 -1
  128. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  129. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  130. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  131. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  132. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  133. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  134. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  135. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  136. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  137. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  138. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  139. package/dist/custom_auth/index.mjs +2 -11
  140. package/dist/custom_auth/index.mjs.map +1 -1
  141. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  142. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  143. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  144. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  145. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  146. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  147. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  148. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  149. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  150. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  151. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  152. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +1 -3
  153. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  154. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  155. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  156. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  157. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  158. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  159. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  160. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  161. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  162. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  163. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  164. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  165. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  166. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  167. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +5 -5
  168. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
  169. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +5 -16
  170. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -1
  171. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +35 -0
  172. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs.map +1 -0
  173. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  174. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  175. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  176. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  177. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  178. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  179. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  180. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  181. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  182. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  183. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  184. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  185. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  186. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  187. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -3
  188. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -1
  189. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
  190. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -3
  191. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +1 -1
  193. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  194. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  195. package/dist/encode/Base64Decode.mjs +1 -1
  196. package/dist/encode/Base64Encode.mjs +1 -1
  197. package/dist/error/BrowserAuthError.mjs +1 -1
  198. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  199. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  200. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  201. package/dist/error/NativeAuthError.mjs +1 -1
  202. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  203. package/dist/error/NestedAppAuthError.mjs +1 -1
  204. package/dist/event/EventHandler.mjs +1 -1
  205. package/dist/event/EventMessage.mjs +1 -1
  206. package/dist/event/EventType.mjs +1 -1
  207. package/dist/index.mjs +1 -1
  208. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  209. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  210. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +1 -1
  211. package/dist/interaction_client/PopupClient.mjs +31 -3
  212. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  213. package/dist/interaction_client/RedirectClient.mjs +5 -5
  214. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  215. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  216. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  217. package/dist/interaction_client/SilentIframeClient.mjs +4 -3
  218. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  219. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  220. package/dist/interaction_client/StandardInteractionClient.mjs +7 -1
  221. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  222. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  223. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  224. package/dist/log-strings-mapping.json +27 -7
  225. package/dist/naa/BridgeError.mjs +1 -1
  226. package/dist/naa/BridgeProxy.mjs +1 -1
  227. package/dist/naa/BridgeStatusCode.mjs +1 -1
  228. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  229. package/dist/navigation/NavigationClient.mjs +1 -1
  230. package/dist/network/FetchClient.mjs +1 -1
  231. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  232. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  233. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  234. package/dist/packageMetadata.mjs +2 -2
  235. package/dist/popup_relay/constants.mjs +1 -1
  236. package/dist/popup_relay/index.mjs +1 -1
  237. package/dist/popup_relay/relayClient.mjs +1 -1
  238. package/dist/protocol/Authorize.mjs +23 -13
  239. package/dist/protocol/Authorize.mjs.map +1 -1
  240. package/dist/redirect_bridge/index.mjs +1 -1
  241. package/dist/request/RequestHelpers.mjs +1 -1
  242. package/dist/request/SilentRequestHelpers.mjs +9 -3
  243. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  244. package/dist/response/ResponseHandler.mjs +1 -1
  245. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  246. package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
  247. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  248. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  249. package/dist/utils/BrowserConstants.mjs +1 -1
  250. package/dist/utils/BrowserDetection.mjs +53 -0
  251. package/dist/utils/BrowserDetection.mjs.map +1 -0
  252. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  253. package/dist/utils/BrowserUtils.mjs +7 -2
  254. package/dist/utils/BrowserUtils.mjs.map +1 -1
  255. package/dist/utils/Helpers.mjs +1 -1
  256. package/dist/utils/IframeMonitor.mjs +81 -0
  257. package/dist/utils/IframeMonitor.mjs.map +1 -0
  258. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  259. package/dist/utils/PopupMonitor.mjs +119 -0
  260. package/dist/utils/PopupMonitor.mjs.map +1 -0
  261. package/dist/utils/PopupOriginCheck.mjs +88 -0
  262. package/dist/utils/PopupOriginCheck.mjs.map +1 -0
  263. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  264. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  265. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  266. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  267. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  268. package/dist/webBrokerBridge/index.mjs +1 -1
  269. package/lib/custom-auth-path/log-strings-mapping.json +27 -7
  270. package/lib/custom-auth-path/msal-custom-auth.cjs +1157 -718
  271. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  272. package/lib/custom-auth-path/msal-custom-auth.js +1157 -718
  273. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  274. package/lib/log-strings-mapping.json +27 -3
  275. package/lib/msal-browser.cjs +678 -134
  276. package/lib/msal-browser.cjs.map +1 -1
  277. package/lib/msal-browser.js +678 -134
  278. package/lib/msal-browser.js.map +1 -1
  279. package/lib/msal-browser.min.js +2 -2
  280. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  281. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  282. package/lib/popup-relay/msal-popup-relay.js +2 -2
  283. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  284. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  285. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  286. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  287. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  288. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  289. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  290. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  291. package/package.json +2 -2
  292. package/src/app/PublicClientApplication.ts +108 -8
  293. package/src/config/Configuration.ts +63 -6
  294. package/src/controllers/NestedAppAuthController.ts +6 -1
  295. package/src/controllers/StandardController.ts +46 -3
  296. package/src/custom_auth/CustomAuthActionInputs.ts +16 -6
  297. package/src/custom_auth/controller/CustomAuthStandardController.ts +78 -17
  298. package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +18 -30
  299. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +1 -0
  300. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.ts +239 -0
  301. package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +2 -5
  302. package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +0 -2
  303. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +13 -10
  304. package/src/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.ts +19 -0
  305. package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +3 -6
  306. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +4 -6
  307. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +114 -17
  308. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +6 -3
  309. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +17 -19
  310. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +5 -5
  311. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +0 -4
  312. package/src/custom_auth/core/error/CustomAuthApiError.ts +2 -1
  313. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +3 -4
  314. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +75 -68
  315. package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +6 -3
  316. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +2 -4
  317. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +0 -1
  318. package/src/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.ts +17 -15
  319. package/src/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.ts +1 -1
  320. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +3 -11
  321. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +2 -3
  322. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.ts +1 -0
  323. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +2 -0
  324. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +1 -1
  325. package/src/custom_auth/core/utils/ArgumentValidator.ts +13 -0
  326. package/src/custom_auth/index.ts +4 -14
  327. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -10
  328. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +0 -2
  329. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +3 -6
  330. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -4
  331. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -4
  332. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +5 -4
  333. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +4 -23
  334. package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.ts +56 -0
  335. package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +1 -5
  336. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -5
  337. package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +0 -2
  338. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +0 -2
  339. package/src/interaction_client/PopupClient.ts +45 -1
  340. package/src/interaction_client/RedirectClient.ts +9 -5
  341. package/src/interaction_client/SilentIframeClient.ts +9 -2
  342. package/src/interaction_client/StandardInteractionClient.ts +6 -0
  343. package/src/packageMetadata.ts +1 -1
  344. package/src/protocol/Authorize.ts +34 -28
  345. package/src/request/SilentRequestHelpers.ts +11 -2
  346. package/src/utils/BrowserDetection.ts +85 -0
  347. package/src/utils/BrowserUtils.ts +8 -1
  348. package/src/utils/IframeMonitor.ts +98 -0
  349. package/src/utils/PopupMonitor.ts +158 -0
  350. package/src/utils/PopupOriginCheck.ts +94 -0
  351. package/types/app/PublicClientApplication.d.ts +6 -4
  352. package/types/app/PublicClientApplication.d.ts.map +1 -1
  353. package/types/config/Configuration.d.ts +16 -0
  354. package/types/config/Configuration.d.ts.map +1 -1
  355. package/types/controllers/NestedAppAuthController.d.ts.map +1 -1
  356. package/types/controllers/StandardController.d.ts.map +1 -1
  357. package/types/custom_auth/CustomAuthActionInputs.d.ts +16 -5
  358. package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
  359. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  360. package/types/custom_auth/controller/CustomAuthStandardController.d.ts +1 -0
  361. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  362. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +9 -11
  363. package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -1
  364. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +1 -0
  365. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -1
  366. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts +90 -0
  367. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts.map +1 -0
  368. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +1 -2
  369. package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +1 -1
  370. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +1 -2
  371. package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -1
  372. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +8 -7
  373. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -1
  374. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts +13 -0
  375. package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts.map +1 -0
  376. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +2 -3
  377. package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -1
  378. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +5 -6
  379. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  380. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +9 -6
  381. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  382. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
  383. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +2 -2
  384. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  385. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +5 -3
  386. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  387. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  388. package/types/custom_auth/core/error/CustomAuthApiError.d.ts +2 -1
  389. package/types/custom_auth/core/error/CustomAuthApiError.d.ts.map +1 -1
  390. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -3
  391. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  392. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +2 -2
  393. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  394. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +2 -2
  395. package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -1
  396. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +2 -4
  397. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  398. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +0 -1
  399. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  400. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts +2 -2
  401. package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts.map +1 -1
  402. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts +1 -1
  403. package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts.map +1 -1
  404. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  405. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +1 -2
  406. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  407. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts +2 -0
  408. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -1
  409. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +1 -1
  410. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  411. package/types/custom_auth/core/utils/ArgumentValidator.d.ts +1 -0
  412. package/types/custom_auth/core/utils/ArgumentValidator.d.ts.map +1 -1
  413. package/types/custom_auth/index.d.ts +3 -12
  414. package/types/custom_auth/index.d.ts.map +1 -1
  415. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +5 -7
  416. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  417. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  418. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +4 -6
  419. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -1
  420. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +3 -4
  421. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  422. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +3 -4
  423. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
  424. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
  425. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +4 -9
  426. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -1
  427. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts +9 -0
  428. package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts.map +1 -0
  429. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +1 -2
  430. package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -1
  431. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +1 -2
  432. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  433. package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -1
  434. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +1 -1
  435. package/types/interaction_client/PopupClient.d.ts +12 -0
  436. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  437. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  438. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  439. package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  440. package/types/packageMetadata.d.ts +1 -1
  441. package/types/protocol/Authorize.d.ts.map +1 -1
  442. package/types/request/SilentRequestHelpers.d.ts +1 -1
  443. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  444. package/types/utils/BrowserDetection.d.ts +17 -0
  445. package/types/utils/BrowserDetection.d.ts.map +1 -0
  446. package/types/utils/BrowserUtils.d.ts +2 -1
  447. package/types/utils/BrowserUtils.d.ts.map +1 -1
  448. package/types/utils/IframeMonitor.d.ts +17 -0
  449. package/types/utils/IframeMonitor.d.ts.map +1 -0
  450. package/types/utils/PopupMonitor.d.ts +37 -0
  451. package/types/utils/PopupMonitor.d.ts.map +1 -0
  452. package/types/utils/PopupOriginCheck.d.ts +27 -0
  453. package/types/utils/PopupOriginCheck.d.ts.map +1 -0
  454. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs +0 -102
  455. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs.map +0 -1
  456. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs +0 -20
  457. package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs.map +0 -1
  458. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs +0 -36
  459. package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs.map +0 -1
  460. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs +0 -29
  461. package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs.map +0 -1
  462. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs +0 -36
  463. package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs.map +0 -1
  464. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs +0 -61
  465. package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs.map +0 -1
  466. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs +0 -29
  467. package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs.map +0 -1
  468. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs +0 -18
  469. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs.map +0 -1
  470. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs +0 -37
  471. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs.map +0 -1
  472. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs +0 -23
  473. package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs.map +0 -1
  474. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs +0 -25
  475. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs.map +0 -1
  476. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs +0 -33
  477. package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs.map +0 -1
  478. package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.ts +0 -146
  479. package/src/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.ts +0 -15
  480. package/src/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.ts +0 -33
  481. package/src/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.ts +0 -25
  482. package/src/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.ts +0 -18
  483. package/src/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.ts +0 -59
  484. package/src/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.ts +0 -76
  485. package/src/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.ts +0 -25
  486. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.ts +0 -13
  487. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.ts +0 -35
  488. package/src/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.ts +0 -19
  489. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.ts +0 -21
  490. package/src/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.ts +0 -32
  491. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts +0 -40
  492. package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts.map +0 -1
  493. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts +0 -11
  494. package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts.map +0 -1
  495. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts +0 -23
  496. package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts.map +0 -1
  497. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts +0 -18
  498. package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts.map +0 -1
  499. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts +0 -7
  500. package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts.map +0 -1
  501. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts +0 -17
  502. package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts.map +0 -1
  503. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts +0 -18
  504. package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts.map +0 -1
  505. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts +0 -18
  506. package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts.map +0 -1
  507. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts +0 -9
  508. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts.map +0 -1
  509. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts +0 -22
  510. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts.map +0 -1
  511. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts +0 -12
  512. package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts.map +0 -1
  513. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts +0 -14
  514. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts.map +0 -1
  515. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts +0 -20
  516. package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts.map +0 -1
@@ -54,6 +54,7 @@ import {
54
54
  INTERACTION_TYPE,
55
55
  } from "../utils/BrowserConstants.js";
56
56
  import * as BrowserUtils from "../utils/BrowserUtils.js";
57
+ import { cancelPendingPopupPollingResponse } from "../utils/PopupMonitor.js";
57
58
  import { RedirectRequest } from "../request/RedirectRequest.js";
58
59
  import { PopupRequest } from "../request/PopupRequest.js";
59
60
  import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
@@ -473,7 +474,39 @@ export class StandardController implements IController {
473
474
  private async handleRedirectPromiseInternal(
474
475
  options?: HandleRedirectPromiseOptions
475
476
  ): Promise<AuthenticationResult | null> {
476
- if (!this.browserStorage.isInteractionInProgress(true)) {
477
+ // Preserve the response for RedirectClient before removing it from the URL.
478
+ const responseString =
479
+ options?.hash ||
480
+ (this.config.auth.OIDCOptions.responseMode ===
481
+ Constants.ResponseMode.QUERY
482
+ ? window.location.search
483
+ : window.location.hash);
484
+ const anyClientInteractionInProgress =
485
+ this.browserStorage.isInteractionInProgress(false);
486
+ const currentClientInteraction =
487
+ this.browserStorage.isInteractionInProgress(true);
488
+ const isBridgeCallback =
489
+ BrowserUtils.isInPopup() ||
490
+ (BrowserUtils.isInIframe() &&
491
+ !this.config.system.allowRedirectInIframe);
492
+ /*
493
+ * Clear recognized response fragments for:
494
+ * - Stale callbacks with no pending interaction.
495
+ * - This client's login callback, even if request setup or response validation fails.
496
+ * - This client's logout callback containing state, before the SIGNOUT early return.
497
+ * Leave another client's callback untouched. clearHash preserves query strings
498
+ * and application routes, and does nothing when no response fragment is present.
499
+ * Skip popup and non-redirect iframe callbacks: legacy apps may call HRP
500
+ * before their redirect bridge reads and broadcasts the response.
501
+ */
502
+ if (
503
+ !isBridgeCallback &&
504
+ (!anyClientInteractionInProgress || currentClientInteraction)
505
+ ) {
506
+ BrowserUtils.clearHash(window);
507
+ }
508
+
509
+ if (!currentClientInteraction) {
477
510
  this.logger.info(
478
511
  "handleRedirectPromise called but there is no interaction in progress, returning null.",
479
512
  ""
@@ -489,7 +522,7 @@ export class StandardController implements IController {
489
522
  ""
490
523
  );
491
524
  this.browserStorage.setInteractionInProgress(false);
492
- return Promise.resolve(null);
525
+ return null;
493
526
  }
494
527
 
495
528
  const loggedInAccounts = this.getAllAccounts();
@@ -571,7 +604,14 @@ export class StandardController implements IController {
571
604
  this.logger,
572
605
  this.performanceClient,
573
606
  rootMeasurement.event.correlationId
574
- )(standardRequest, codeVerifier, rootMeasurement, options);
607
+ )(
608
+ standardRequest,
609
+ codeVerifier,
610
+ rootMeasurement,
611
+ options?.hash
612
+ ? options
613
+ : { ...options, hash: responseString }
614
+ );
575
615
  }
576
616
  } catch (e) {
577
617
  this.browserStorage.resetRequestCache("");
@@ -840,6 +880,9 @@ export class StandardController implements IController {
840
880
  request.overrideInteractionInProgress,
841
881
  correlationId
842
882
  );
883
+ if (request.overrideInteractionInProgress) {
884
+ cancelPendingPopupPollingResponse(this.logger);
885
+ }
843
886
  } catch (e) {
844
887
  // Since this function is syncronous we need to reject
845
888
  return Promise.reject(e);
@@ -39,13 +39,23 @@ export type SignInWithContinuationTokenInputs = {
39
39
  claims?: string;
40
40
  };
41
41
 
42
- export type SignInInputsV2 = SignInInputs;
43
-
44
- export type ResetPasswordInputsV2 = ResetPasswordInputs;
42
+ export type SignInInputsV2 = CustomAuthActionInputs & {
43
+ username: string;
44
+ password?: string;
45
+ scopes?: Array<string> | null;
46
+ claims?: string;
47
+ };
45
48
 
46
- export type SignUpInputsV2 = SignUpInputs & {
47
- scopes?: Array<string>;
49
+ export type ResetPasswordInputsV2 = CustomAuthActionInputs & {
50
+ username: string;
51
+ scopes?: Array<string> | null;
48
52
  claims?: string;
49
53
  };
50
54
 
51
- export type SignInContinuationInputsV2 = SignInWithContinuationTokenInputs;
55
+ export type SignUpInputsV2 = CustomAuthActionInputs & {
56
+ username: string;
57
+ password?: string;
58
+ attributes?: UserAccountAttributes;
59
+ scopes?: Array<string> | null;
60
+ claims?: string;
61
+ };
@@ -30,29 +30,28 @@ import { ResetPasswordStartResult } from "../reset_password/auth_flow/result/Res
30
30
  import { ResetPasswordStartResultV2 } from "../core/auth_flow/v2/result/ResetPasswordStartResultV2.js";
31
31
  import { CustomAuthApiClientV2 } from "../core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.js";
32
32
  import { FlowInteractionClientV2 } from "../core/interaction_client/v2/FlowInteractionClientV2.js";
33
- import { AuthMethodSelectionRequiredStateV2 } from "../core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.js";
34
- import { ResetPasswordStartErrorV2 } from "../core/auth_flow/v2/error/ResetPasswordStartErrorV2.js";
35
33
  import { CustomAuthResultV2 } from "../core/auth_flow/v2/CustomAuthResultV2.js";
36
34
  import { CustomAuthFlowScenarioV2 } from "../core/auth_flow/v2/CustomAuthFlowScenarioV2.js";
37
- import { SignInStartErrorV2 } from "../sign_in/auth_flow/v2/error_type/SignInStartErrorV2.js";
38
35
  import { SignInStartResultV2 } from "../sign_in/auth_flow/v2/result/SignInStartResultV2.js";
39
- import { SignUpStartErrorV2 } from "../sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.js";
40
36
  import { SignUpStartResultV2 } from "../sign_up/auth_flow/v2/result/SignUpStartResultV2.js";
41
- import { CompletedStateV2 } from "../core/auth_flow/v2/state/CompletedStateV2.js";
42
37
  import {
43
38
  FLOW_COMPLETED_V2,
44
39
  FLOW_ATTRIBUTES_REQUIRED_V2,
45
40
  FLOW_CODE_REQUIRED_V2,
41
+ FLOW_METHOD_SELECTION_REQUIRED_V2,
46
42
  FLOW_MFA_REQUIRED_V2,
47
43
  FLOW_PASSWORD_REQUIRED_V2,
48
44
  FLOW_SIGN_UP_PASSWORD_REQUIRED_V2,
49
45
  } from "../core/interaction_client/v2/result/FlowActionResultV2.js";
50
- import { PasswordRequiredStateV2 } from "../sign_in/auth_flow/v2/state/PasswordRequiredStateV2.js";
46
+ import { AuthenticationFactorV2 } from "../core/network_client/custom_auth_api/v2/result/BaseResultsV2.js";
51
47
  import { CodeRequiredStateV2 } from "../core/auth_flow/v2/state/CodeRequiredStateV2.js";
52
- import { MFARequiredStateV2 } from "../core/auth_flow/v2/state/MFARequiredStateV2.js";
53
- import { AttributesRequiredStateV2 } from "../sign_up/auth_flow/v2/state/AttributesRequiredStateV2.js";
54
- import { SignUpPasswordRequiredStateV2 } from "../sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.js";
48
+ import { AuthMethodSelectionRequiredStateV2 } from "../core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.js";
49
+ import { CompletedStateV2 } from "../core/auth_flow/v2/state/CompletedStateV2.js";
50
+ import { SignInStateTransitionHandlerV2 } from "../sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.js";
51
+ import { PasswordRequiredStateV2 } from "../sign_in/auth_flow/v2/state/PasswordRequiredStateV2.js";
55
52
  import { SignUpStateTransitionHandlerV2 } from "../sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.js";
53
+ import { SignUpPasswordRequiredStateV2 } from "../sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.js";
54
+ import { AttributesRequiredStateV2 } from "../sign_up/auth_flow/v2/state/AttributesRequiredStateV2.js";
56
55
  import { CustomAuthAuthority } from "../core/CustomAuthAuthority.js";
57
56
  import { DefaultPackageInfo } from "../CustomAuthConstants.js";
58
57
  import {
@@ -108,6 +107,8 @@ export class CustomAuthStandardController
108
107
  private readonly flowClientV2: FlowInteractionClientV2;
109
108
  private readonly signUpStateTransitionHandlerV2 =
110
109
  new SignUpStateTransitionHandlerV2();
110
+ private readonly signInStateTransitionHandlerV2 =
111
+ new SignInStateTransitionHandlerV2();
111
112
 
112
113
  /*
113
114
  * Constructor for CustomAuthStandardController.
@@ -652,6 +653,20 @@ export class CustomAuthStandardController
652
653
  inputs.username,
653
654
  correlationId
654
655
  );
656
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
657
+ ArgumentValidator.ensureArgumentIsStringArray(
658
+ "inputs.scopes",
659
+ inputs.scopes,
660
+ correlationId
661
+ );
662
+ }
663
+ if (inputs.claims) {
664
+ ArgumentValidator.ensureArgumentIsJSONString(
665
+ "inputs.claims",
666
+ inputs.claims,
667
+ correlationId
668
+ );
669
+ }
655
670
  this.ensureUserNotSignedIn(correlationId);
656
671
 
657
672
  this.logger.verbose(
@@ -662,6 +677,8 @@ export class CustomAuthStandardController
662
677
  const result = await this.flowClientV2.resetPassword({
663
678
  correlationId,
664
679
  username: inputs.username,
680
+ scopes: inputs.scopes,
681
+ claims: inputs.claims,
665
682
  });
666
683
 
667
684
  this.logger.verbose(
@@ -697,6 +714,7 @@ export class CustomAuthStandardController
697
714
  continuationState: result.continuationState,
698
715
  cacheClient: this.cacheClient,
699
716
  methods: result.methods,
717
+ authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
700
718
  }),
701
719
  undefined,
702
720
  result.continuationState.scenario
@@ -708,7 +726,6 @@ export class CustomAuthStandardController
708
726
  );
709
727
 
710
728
  return CustomAuthResultV2.createWithError(error, {
711
- errorType: ResetPasswordStartErrorV2,
712
729
  scenario: CustomAuthFlowScenarioV2.PasswordReset,
713
730
  correlationId,
714
731
  });
@@ -729,6 +746,13 @@ export class CustomAuthStandardController
729
746
  inputs.username,
730
747
  correlationId
731
748
  );
749
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
750
+ ArgumentValidator.ensureArgumentIsStringArray(
751
+ "inputs.scopes",
752
+ inputs.scopes,
753
+ correlationId
754
+ );
755
+ }
732
756
  if (inputs.claims) {
733
757
  ArgumentValidator.ensureArgumentIsJSONString(
734
758
  "inputs.claims",
@@ -748,6 +772,7 @@ export class CustomAuthStandardController
748
772
  username: inputs.username,
749
773
  password: inputs.password,
750
774
  scopes: inputs.scopes,
775
+ claims: inputs.claims,
751
776
  });
752
777
 
753
778
  if (result.type === FLOW_COMPLETED_V2) {
@@ -764,16 +789,15 @@ export class CustomAuthStandardController
764
789
  );
765
790
  }
766
791
 
767
- if (result.type === FLOW_MFA_REQUIRED_V2) {
792
+ if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
768
793
  return new CustomAuthResultV2(
769
- new MFARequiredStateV2({
794
+ new PasswordRequiredStateV2({
770
795
  correlationId: result.correlationId,
771
796
  logger: this.logger,
772
797
  config: this.customAuthConfig,
773
798
  flowClient: this.flowClientV2,
774
799
  continuationState: result.continuationState,
775
800
  cacheClient: this.cacheClient,
776
- methods: result.methods,
777
801
  }),
778
802
  undefined,
779
803
  result.continuationState.scenario
@@ -789,6 +813,8 @@ export class CustomAuthStandardController
789
813
  flowClient: this.flowClientV2,
790
814
  continuationState: result.continuationState,
791
815
  cacheClient: this.cacheClient,
816
+ signInStateTransitionHandler:
817
+ this.signInStateTransitionHandlerV2,
792
818
  method: result.method,
793
819
  sentTo: result.sentTo,
794
820
  channel: result.channel,
@@ -799,15 +825,38 @@ export class CustomAuthStandardController
799
825
  );
800
826
  }
801
827
 
802
- if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
828
+ if (result.type === FLOW_METHOD_SELECTION_REQUIRED_V2) {
803
829
  return new CustomAuthResultV2(
804
- new PasswordRequiredStateV2({
830
+ new AuthMethodSelectionRequiredStateV2({
805
831
  correlationId: result.correlationId,
806
832
  logger: this.logger,
807
833
  config: this.customAuthConfig,
808
834
  flowClient: this.flowClientV2,
809
835
  continuationState: result.continuationState,
810
836
  cacheClient: this.cacheClient,
837
+ methods: result.methods,
838
+ authenticationFactor:
839
+ AuthenticationFactorV2.SINGLE_FACTOR,
840
+ signInStateTransitionHandler:
841
+ this.signInStateTransitionHandlerV2,
842
+ }),
843
+ undefined,
844
+ result.continuationState.scenario
845
+ );
846
+ }
847
+
848
+ if (result.type === FLOW_MFA_REQUIRED_V2) {
849
+ return new CustomAuthResultV2(
850
+ new AuthMethodSelectionRequiredStateV2({
851
+ correlationId: result.correlationId,
852
+ logger: this.logger,
853
+ config: this.customAuthConfig,
854
+ flowClient: this.flowClientV2,
855
+ continuationState: result.continuationState,
856
+ cacheClient: this.cacheClient,
857
+ methods: result.methods,
858
+ authenticationFactor:
859
+ AuthenticationFactorV2.MULTI_FACTOR,
811
860
  }),
812
861
  undefined,
813
862
  result.continuationState.scenario
@@ -825,7 +874,6 @@ export class CustomAuthStandardController
825
874
  );
826
875
 
827
876
  return CustomAuthResultV2.createWithError(error, {
828
- errorType: SignInStartErrorV2,
829
877
  scenario: CustomAuthFlowScenarioV2.SignIn,
830
878
  correlationId,
831
879
  });
@@ -858,6 +906,20 @@ export class CustomAuthStandardController
858
906
  correlationId
859
907
  );
860
908
  }
909
+ if (inputs.scopes !== undefined && inputs.scopes !== null) {
910
+ ArgumentValidator.ensureArgumentIsStringArray(
911
+ "inputs.scopes",
912
+ inputs.scopes,
913
+ correlationId
914
+ );
915
+ }
916
+ if (inputs.claims) {
917
+ ArgumentValidator.ensureArgumentIsJSONString(
918
+ "inputs.claims",
919
+ inputs.claims,
920
+ correlationId
921
+ );
922
+ }
861
923
  this.ensureUserNotSignedIn(correlationId);
862
924
 
863
925
  this.logger.verbose(
@@ -933,7 +995,6 @@ export class CustomAuthStandardController
933
995
  );
934
996
 
935
997
  return CustomAuthResultV2.createWithError(error, {
936
- errorType: SignUpStartErrorV2,
937
998
  scenario: CustomAuthFlowScenarioV2.SignUp,
938
999
  correlationId,
939
1000
  });
@@ -9,14 +9,10 @@ import { CustomAuthError } from "../../error/CustomAuthError.js";
9
9
  import { MsalCustomAuthError } from "../../error/MsalCustomAuthError.js";
10
10
  import { UnexpectedError } from "../../error/UnexpectedError.js";
11
11
  import { FailedStateV2 } from "./state/FailedStateV2.js";
12
- import { AuthFlowErrorBaseV2 } from "./error/AuthFlowErrorBaseV2.js";
12
+ import { AuthFlowErrorV2 } from "./error/AuthFlowErrorV2.js";
13
13
  import { CustomAuthFlowScenarioV2 } from "./CustomAuthFlowScenarioV2.js";
14
14
 
15
- type CreateWithErrorOptions<TError extends AuthFlowErrorBaseV2> = {
16
- errorType: new (
17
- errorData: CustomAuthError,
18
- scenario?: CustomAuthFlowScenarioV2
19
- ) => TError;
15
+ type CreateWithErrorOptions = {
20
16
  scenario?: CustomAuthFlowScenarioV2;
21
17
  correlationId?: string;
22
18
  };
@@ -27,7 +23,6 @@ type CreateWithErrorOptions<TError extends AuthFlowErrorBaseV2> = {
27
23
  */
28
24
  export class CustomAuthResultV2<
29
25
  TState extends AuthFlowStateBase,
30
- TError extends AuthFlowErrorBaseV2,
31
26
  TData = void
32
27
  > {
33
28
  constructor(
@@ -36,7 +31,7 @@ export class CustomAuthResultV2<
36
31
  public readonly scenario: CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2.Unknown
37
32
  ) {}
38
33
 
39
- error?: TError;
34
+ error?: AuthFlowErrorV2;
40
35
 
41
36
  /**
42
37
  * Narrows the result to a specific state by its `stateType` discriminator.
@@ -52,7 +47,7 @@ export class CustomAuthResultV2<
52
47
 
53
48
  /**
54
49
  * Checks whether the result is in the terminal failed state. A failed result
55
- * contains the flow-specific error.
50
+ * contains the unified V2 flow error.
56
51
  * @returns True (and narrows `state`) when the operation failed.
57
52
  */
58
53
  isFailed(): this is this & {
@@ -63,35 +58,28 @@ export class CustomAuthResultV2<
63
58
 
64
59
  /**
65
60
  * Creates a failed result from the supplied error. The result uses the
66
- * shared {@link FailedStateV2} terminal state.
61
+ * shared {@link FailedStateV2} terminal state and unified V2 flow error.
67
62
  * @param error - The error that occurred.
68
- * @param options - The flow-error type and error context.
69
- * @returns A failed result carrying the flow-specific error.
63
+ * @param options - The flow-error context.
64
+ * @returns A failed result carrying the unified V2 flow error.
70
65
  */
71
- static createWithError<
72
- TState extends AuthFlowStateBase,
73
- TError extends AuthFlowErrorBaseV2,
74
- TData = void
75
- >(
66
+ static createWithError<TState extends AuthFlowStateBase, TData = void>(
76
67
  error: unknown,
77
- options: CreateWithErrorOptions<TError>
78
- ): CustomAuthResultV2<TState | FailedStateV2, TError, TData> {
79
- const {
80
- errorType: ErrorType,
81
- scenario = CustomAuthFlowScenarioV2.Unknown,
82
- correlationId,
83
- } = options;
68
+ options: CreateWithErrorOptions
69
+ ): CustomAuthResultV2<TState | FailedStateV2, TData> {
70
+ const { scenario = CustomAuthFlowScenarioV2.Unknown, correlationId } =
71
+ options;
84
72
  const errorData = CustomAuthResultV2.createErrorData(
85
73
  error,
86
74
  correlationId
87
75
  );
88
- const flowError = new ErrorType(errorData, scenario);
76
+ const flowError = new AuthFlowErrorV2(errorData, scenario);
89
77
 
90
- const result = new CustomAuthResultV2<
91
- TState | FailedStateV2,
92
- TError,
93
- TData
94
- >(new FailedStateV2(), undefined, scenario);
78
+ const result = new CustomAuthResultV2<TState | FailedStateV2, TData>(
79
+ new FailedStateV2(),
80
+ undefined,
81
+ scenario
82
+ );
95
83
  result.error = flowError;
96
84
 
97
85
  return result;
@@ -6,3 +6,4 @@
6
6
  export const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
7
7
  export const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
8
8
  export const PASSWORD_TOO_WEAK = "passwordTooWeak";
9
+ export const USER_NOT_FOUND = "userNotFound";
@@ -0,0 +1,239 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { CustomAuthError } from "../../../error/CustomAuthError.js";
7
+ import { CustomAuthApiError } from "../../../error/CustomAuthApiError.js";
8
+ import { InvalidArgumentError } from "../../../error/InvalidArgumentError.js";
9
+ import { WEB_REDIRECT_REQUIRED } from "../../../network_client/custom_auth_api/v2/ErrorCodesV2.js";
10
+ import {
11
+ INVALID_ONE_TIME_CODE,
12
+ INVALID_USERNAME_OR_PASSWORD,
13
+ PASSWORD_TOO_WEAK,
14
+ USER_NOT_FOUND,
15
+ } from "./AuthFlowErrorSubcodesV2.js";
16
+ import { CustomAuthFlowScenarioV2 } from "../CustomAuthFlowScenarioV2.js";
17
+ import type { AttributeValidationDetailV2 } from "../../../network_client/custom_auth_api/v2/response/ErrorResponsesV2.js";
18
+
19
+ /**
20
+ * Error returned by a native authentication V2 operation. Use its classifiers
21
+ * to handle known failures while retaining raw diagnostics through `errorData`.
22
+ */
23
+ export class AuthFlowErrorV2 {
24
+ readonly scenario: CustomAuthFlowScenarioV2;
25
+
26
+ constructor(
27
+ public errorData: CustomAuthError,
28
+ scenario: CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2.Unknown
29
+ ) {
30
+ this.scenario = scenario;
31
+ }
32
+
33
+ get correlationId(): string | undefined {
34
+ return this.errorData.correlationId;
35
+ }
36
+
37
+ get errorCodes(): number[] | undefined {
38
+ return this.errorData.errorCodes;
39
+ }
40
+
41
+ get errorDescription(): string | undefined {
42
+ return this.errorData.errorDescription;
43
+ }
44
+
45
+ get innerErrorCode(): string | undefined {
46
+ return this.errorData instanceof CustomAuthApiError
47
+ ? this.errorData.innerErrorCode
48
+ : undefined;
49
+ }
50
+
51
+ /**
52
+ * Gets the attribute ids that the service reports as required.
53
+ */
54
+ get requiredAttributes(): readonly string[] {
55
+ return this.getAttributeIdsByCode("attributeRequired");
56
+ }
57
+
58
+ /**
59
+ * Gets the attribute ids whose submitted values failed validation.
60
+ */
61
+ get invalidAttributes(): readonly string[] {
62
+ return this.getAttributeIdsByCode("attributeValidationFailed");
63
+ }
64
+
65
+ /**
66
+ * Checks if the error requires the flow to continue in the browser. The
67
+ * server surfaces this as the `web_redirect_required` OAuth suberror, so a
68
+ * browser hand-off arrives as a `FailedStateV2` on which this detector
69
+ * returns true.
70
+ * @returns True if the browser is required, false otherwise.
71
+ */
72
+ isBrowserRequired(): boolean {
73
+ return this.errorData.subError === WEB_REDIRECT_REQUIRED;
74
+ }
75
+
76
+ /**
77
+ * Checks if the error is due to a caller-supplied argument failing
78
+ * client-side validation before the request was issued (for example an empty
79
+ * username, code, or password, or an unknown method id). Use it to prompt the
80
+ * user to correct the input rather than treating it as a server failure.
81
+ * @returns True if the input was invalid, false otherwise.
82
+ */
83
+ isInvalidInput(): boolean {
84
+ return this.errorData instanceof InvalidArgumentError;
85
+ }
86
+
87
+ /**
88
+ * Checks whether the service rejected the username parameter. Use it to ask
89
+ * the user to correct the supplied username.
90
+ * @returns True when the username is invalid, otherwise false.
91
+ */
92
+ isInvalidUsername(): boolean {
93
+ return this.isUserInvalidError();
94
+ }
95
+
96
+ /**
97
+ * Checks whether the supplied username does not identify an account. Use it
98
+ * to distinguish a missing account from other request failures.
99
+ * @returns True when the service reports that the user was not found.
100
+ */
101
+ isUserNotFound(): boolean {
102
+ return this.isUserNotFoundError();
103
+ }
104
+
105
+ /**
106
+ * Checks whether the service rejected the supplied sign-in credentials. This
107
+ * classifier does not identify new-password policy failures.
108
+ * @returns True when the username or password is incorrect.
109
+ */
110
+ isInvalidCredentials(): boolean {
111
+ return this.isPasswordIncorrectError();
112
+ }
113
+
114
+ /**
115
+ * Checks whether the service rejected a one-time code. Use it to prompt the
116
+ * user to re-enter the code or request a new one.
117
+ * @returns True when the one-time code is invalid, otherwise false.
118
+ */
119
+ isInvalidCode(): boolean {
120
+ return this.isInvalidCodeError();
121
+ }
122
+
123
+ /**
124
+ * Checks whether a new password violates password policy. It recognizes
125
+ * both weak-password responses and password-targeted validation details.
126
+ * @returns True when the new password is invalid, otherwise false.
127
+ */
128
+ isInvalidPassword(): boolean {
129
+ return (
130
+ this.isInvalidPasswordError() ||
131
+ this.isPasswordPolicyViolationError()
132
+ );
133
+ }
134
+
135
+ /**
136
+ * Checks whether an account already exists for the supplied identifier.
137
+ * This can occur at different stages while completing sign-up.
138
+ * @returns True if the account already exists, otherwise false.
139
+ */
140
+ isUserAlreadyExists(): boolean {
141
+ return this.getAttributeValidationDetails().some(
142
+ (detail) => detail.code === "userAlreadyExists"
143
+ );
144
+ }
145
+
146
+ /**
147
+ * Checks whether the service requires attributes omitted from the request.
148
+ * Use it to collect the required attributes before resubmitting.
149
+ * @returns True when required attributes are missing, otherwise false.
150
+ */
151
+ isMissingRequiredAttributes(): boolean {
152
+ return this.requiredAttributes.length > 0;
153
+ }
154
+
155
+ private isUserNotFoundError(): boolean {
156
+ return (
157
+ this.errorData.error === "invalidRequest" &&
158
+ (this.innerErrorCode === USER_NOT_FOUND ||
159
+ this.errorData.errorDescription?.includes("AADSTS50034") ===
160
+ true)
161
+ );
162
+ }
163
+
164
+ private isUserInvalidError(): boolean {
165
+ return (
166
+ this.errorData.error === "invalidRequest" &&
167
+ this.errorData.errorDescription?.includes("AADSTS90100") === true &&
168
+ this.errorData.errorDescription
169
+ .toLowerCase()
170
+ .includes("username parameter")
171
+ );
172
+ }
173
+
174
+ private isInvalidCodeError(): boolean {
175
+ return (
176
+ this.errorData.error === "invalidGrant" &&
177
+ this.innerErrorCode === INVALID_ONE_TIME_CODE
178
+ );
179
+ }
180
+
181
+ private isInvalidPasswordError(): boolean {
182
+ return (
183
+ this.errorData.error === "invalidRequest" &&
184
+ this.innerErrorCode === PASSWORD_TOO_WEAK
185
+ );
186
+ }
187
+
188
+ private isPasswordPolicyViolationError(): boolean {
189
+ return this.getAttributeValidationDetails().some((detail) => {
190
+ const attributeIds: unknown = detail.attributeIds;
191
+
192
+ return (
193
+ detail.code === "passwordPolicyViolation" &&
194
+ Array.isArray(attributeIds) &&
195
+ attributeIds.some(
196
+ (attributeId: unknown) =>
197
+ typeof attributeId === "string" &&
198
+ attributeId.toLowerCase() === "password"
199
+ )
200
+ );
201
+ });
202
+ }
203
+
204
+ private isPasswordIncorrectError(): boolean {
205
+ return (
206
+ this.errorData.error === "invalidGrant" &&
207
+ this.innerErrorCode === INVALID_USERNAME_OR_PASSWORD
208
+ );
209
+ }
210
+
211
+ private getAttributeValidationDetails(): AttributeValidationDetailV2[] {
212
+ const details = (
213
+ this.errorData as CustomAuthError & {
214
+ attributeValidationDetails?: unknown;
215
+ }
216
+ ).attributeValidationDetails;
217
+
218
+ return Array.isArray(details)
219
+ ? details.filter(
220
+ (detail): detail is AttributeValidationDetailV2 =>
221
+ typeof detail === "object" && detail !== null
222
+ )
223
+ : [];
224
+ }
225
+
226
+ private getAttributeIdsByCode(code: string): string[] {
227
+ const attributeIds = this.getAttributeValidationDetails().flatMap(
228
+ (detail) =>
229
+ detail.code === code && Array.isArray(detail.attributeIds)
230
+ ? detail.attributeIds.filter(
231
+ (attributeId): attributeId is string =>
232
+ typeof attributeId === "string"
233
+ )
234
+ : []
235
+ );
236
+
237
+ return [...new Set(attributeIds)];
238
+ }
239
+ }