@azure/msal-browser 5.22.0 → 5.23.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.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +23 -3
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +5 -2
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +49 -0
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -0
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1 -1
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/CacheKeys.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/EncryptedData.mjs +1 -1
- package/dist/cache/LocalStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +27 -2
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +192 -2
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
- package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +21 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +80 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs +102 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +12 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs +20 -0
- package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs +29 -0
- package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +76 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +134 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +23 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +22 -0
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs +61 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +87 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +3 -2
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs.map +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +602 -0
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +67 -0
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +46 -0
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +3 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +30 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +193 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +236 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +26 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +66 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +97 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +56 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +23 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +14 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +3 -2
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs.map +1 -1
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +38 -0
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -0
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +20 -3
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
- package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
- package/dist/custom_auth/index.mjs +23 -1
- package/dist/custom_auth/index.mjs.map +1 -1
- package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs +29 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs.map +1 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +59 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs +18 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs +37 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs +23 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +70 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +61 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs +25 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs +33 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +40 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +25 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +47 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +60 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +8 -2
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +11 -8
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +189 -5
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/popup_relay/constants.mjs +1 -1
- package/dist/popup_relay/index.mjs +1 -1
- package/dist/popup_relay/relayClient.mjs +1 -1
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
- package/dist/webBrokerBridge/PerfEventNames.mjs +38 -0
- package/dist/webBrokerBridge/PerfEventNames.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
- package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
- package/dist/webBrokerBridge/index.mjs +2 -1
- package/dist/webBrokerBridge/index.mjs.map +1 -1
- package/lib/custom-auth-path/log-strings-mapping.json +195 -11
- package/lib/custom-auth-path/msal-custom-auth.cjs +2975 -198
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +2975 -198
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +2 -2
- package/lib/msal-browser.cjs +155 -81
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +155 -81
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
- package/lib/popup-relay/msal-popup-relay.js +2 -2
- package/lib/popup-relay/msal-popup-relay.js.map +1 -1
- package/lib/popup-relay/msal-popup-relay.min.js +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
- package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +59 -1
- package/lib/web-broker-bridge/msal-web-broker-bridge.cjs.map +1 -1
- package/package.json +1 -1
- package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +40 -2
- package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +4 -1
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +118 -6
- package/src/broker/nativeBroker/PlatformAuthResponse.ts +14 -1
- package/src/custom_auth/CustomAuthActionInputs.ts +11 -0
- package/src/custom_auth/CustomAuthPublicClientApplication.ts +40 -4
- package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +44 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +360 -1
- package/src/custom_auth/controller/ICustomAuthStandardController.ts +14 -0
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +20 -0
- package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +133 -0
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.ts +146 -0
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +8 -0
- package/src/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.ts +33 -0
- package/src/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.ts +25 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +25 -0
- package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +30 -0
- package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +40 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +100 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.ts +59 -0
- package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +53 -0
- package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +196 -0
- package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +16 -0
- package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +44 -0
- package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.ts +76 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +119 -0
- package/src/custom_auth/core/error/CustomAuthApiError.ts +3 -1
- package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +35 -0
- package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +1145 -0
- package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +150 -0
- package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +66 -0
- package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +185 -0
- package/src/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.ts +1 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +30 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.ts +423 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +553 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.ts +24 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.ts +81 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +177 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +129 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.ts +68 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +50 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.ts +20 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +202 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +111 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +26 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +44 -0
- package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +64 -0
- package/src/custom_auth/core/telemetry/PublicApiId.ts +18 -0
- package/src/custom_auth/index.ts +96 -0
- package/src/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.ts +25 -0
- package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +33 -0
- package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +69 -0
- package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.ts +9 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.ts +13 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.ts +35 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.ts +19 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +31 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +32 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +22 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +96 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +83 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +12 -0
- package/src/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.ts +21 -0
- package/src/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.ts +32 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +28 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +20 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +48 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +34 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +63 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +24 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +112 -0
- package/src/interaction_client/PlatformAuthInteractionClient.ts +23 -2
- package/src/interaction_client/RedirectClient.ts +15 -5
- package/src/packageMetadata.ts +1 -1
- package/src/webBrokerBridge/PerfEventNames.ts +43 -0
- package/src/webBrokerBridge/index.ts +26 -0
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts +1 -0
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +68 -5
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +12 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthActionInputs.d.ts +7 -0
- package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/custom_auth/CustomAuthPublicClientApplication.d.ts +27 -5
- package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +30 -0
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -0
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts +11 -2
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/controller/ICustomAuthStandardController.d.ts +7 -1
- package/types/custom_auth/controller/ICustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +53 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts +40 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +4 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts +23 -0
- package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts +7 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +15 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +16 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +16 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +23 -0
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +21 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts +17 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +25 -0
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +28 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +10 -0
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +25 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/error/CustomAuthApiError.d.ts +3 -1
- package/types/custom_auth/core/error/CustomAuthApiError.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +21 -0
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +35 -0
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +26 -0
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +43 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +80 -0
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +17 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts +31 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +23 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts +19 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts +2 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +15 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +52 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts +3 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts +37 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts +12 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +133 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +70 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +10 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +33 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +4 -0
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts +16 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
- package/types/custom_auth/index.d.ts +37 -0
- package/types/custom_auth/index.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts +18 -0
- package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +22 -0
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +19 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts +3 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts +9 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts +22 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts +12 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +21 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +17 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +9 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +17 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +24 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +4 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts +14 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts +20 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +15 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +8 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +15 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +11 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +19 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +14 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +10 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -0
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/webBrokerBridge/PerfEventNames.d.ts +30 -0
- package/types/webBrokerBridge/PerfEventNames.d.ts.map +1 -0
- package/types/webBrokerBridge/index.d.ts +1 -0
- package/types/webBrokerBridge/index.d.ts.map +1 -1
|
@@ -0,0 +1,1145 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ICrypto,
|
|
8
|
+
IPerformanceClient,
|
|
9
|
+
Logger,
|
|
10
|
+
} from "@azure/msal-common/browser";
|
|
11
|
+
import { InteractionClientBaseV2 } from "./InteractionClientBaseV2.js";
|
|
12
|
+
import {
|
|
13
|
+
FlowStartParamsV2,
|
|
14
|
+
FlowSignInStartParamsV2,
|
|
15
|
+
FlowSignUpStartParamsV2,
|
|
16
|
+
FlowChallengeParamsV2,
|
|
17
|
+
FlowSubmitCodeParamsV2,
|
|
18
|
+
FlowSubmitNewPasswordParamsV2,
|
|
19
|
+
FlowSubmitSignInPasswordParamsV2,
|
|
20
|
+
FlowSubmitSignUpAttributesParamsV2,
|
|
21
|
+
FlowSignInWithContinuationParamsV2,
|
|
22
|
+
} from "./parameter/FlowParamsV2.js";
|
|
23
|
+
import {
|
|
24
|
+
createFlowMethodSelectionRequiredResultV2,
|
|
25
|
+
createFlowCodeRequiredResultV2,
|
|
26
|
+
createFlowPasswordRequiredResultV2,
|
|
27
|
+
createFlowSignUpPasswordRequiredResultV2,
|
|
28
|
+
createFlowMFARequiredResultV2,
|
|
29
|
+
createFlowNewPasswordRequiredResultV2,
|
|
30
|
+
createFlowAttributesRequiredResultV2,
|
|
31
|
+
createFlowSignInContinuationRequiredResultV2,
|
|
32
|
+
createFlowCompletedResultV2,
|
|
33
|
+
FLOW_CODE_REQUIRED_V2,
|
|
34
|
+
FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2,
|
|
35
|
+
} from "./result/FlowActionResultV2.js";
|
|
36
|
+
import type {
|
|
37
|
+
FlowMethodSelectionRequiredResultV2,
|
|
38
|
+
FlowCodeRequiredResultV2,
|
|
39
|
+
FlowSignInCodeRequiredResultV2,
|
|
40
|
+
FlowResetPasswordCodeRequiredResultV2,
|
|
41
|
+
FlowPasswordRequiredResultV2,
|
|
42
|
+
FlowSignUpPasswordRequiredResultV2,
|
|
43
|
+
FlowMFARequiredResultV2,
|
|
44
|
+
FlowAttributesRequiredResultV2,
|
|
45
|
+
FlowSignInContinuationRequiredResultV2,
|
|
46
|
+
FlowCompletedResultV2,
|
|
47
|
+
FlowSignUpActionResultV2,
|
|
48
|
+
FlowSubmitCodeResultV2,
|
|
49
|
+
} from "./result/FlowActionResultV2.js";
|
|
50
|
+
import { BrowserConfiguration } from "../../../../config/Configuration.js";
|
|
51
|
+
import { BrowserCacheManager } from "../../../../cache/BrowserCacheManager.js";
|
|
52
|
+
import { EventHandler } from "../../../../event/EventHandler.js";
|
|
53
|
+
import { INavigationClient } from "../../../../navigation/INavigationClient.js";
|
|
54
|
+
import { CustomAuthAuthority } from "../../CustomAuthAuthority.js";
|
|
55
|
+
import { CustomAuthApiClientV2 } from "../../network_client/custom_auth_api/v2/CustomAuthApiClientV2.js";
|
|
56
|
+
import { CustomAuthError } from "../../error/CustomAuthError.js";
|
|
57
|
+
import {
|
|
58
|
+
CONTINUATION_LINK_MISSING,
|
|
59
|
+
RESET_PASSWORD_UNSUPPORTED,
|
|
60
|
+
RESET_PASSWORD_TIMEOUT,
|
|
61
|
+
SIGN_IN_UNSUPPORTED,
|
|
62
|
+
SIGN_UP_UNSUPPORTED,
|
|
63
|
+
UNSUPPORTED_FLOW_STEP,
|
|
64
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
65
|
+
} from "../../network_client/custom_auth_api/v2/ErrorCodesV2.js";
|
|
66
|
+
import { CustomAuthFlowScenarioV2 } from "../../auth_flow/v2/CustomAuthFlowScenarioV2.js";
|
|
67
|
+
import * as PublicApiId from "../../telemetry/PublicApiId.js";
|
|
68
|
+
import {
|
|
69
|
+
getPublicApiIdV2,
|
|
70
|
+
FlowStepV2,
|
|
71
|
+
} from "../../telemetry/FlowApiIdHelperV2.js";
|
|
72
|
+
import {
|
|
73
|
+
AuthenticationFactorV2,
|
|
74
|
+
ChallengeNextActionV2,
|
|
75
|
+
type ChallengeVerificationResultV2,
|
|
76
|
+
VerifyNextActionV2,
|
|
77
|
+
type VerifyResultV2,
|
|
78
|
+
} from "../../network_client/custom_auth_api/v2/result/BaseResultsV2.js";
|
|
79
|
+
import { AuthenticationMethodTypeV2 } from "../../network_client/custom_auth_api/v2/ApiClientConstantsV2.js";
|
|
80
|
+
import type { FlowContinuationStateV2 } from "./FlowContinuationStateV2.js";
|
|
81
|
+
import type { AuthenticationMethodV2 } from "../../auth_flow/v2/AuthenticationMethodV2.js";
|
|
82
|
+
import {
|
|
83
|
+
SignUpSubmitAttributesNextActionV2,
|
|
84
|
+
type SignUpSubmitAttributesApiResultV2,
|
|
85
|
+
} from "../../network_client/custom_auth_api/v2/result/SignUpResultsV2.js";
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
* Polls up to five times for password-update completion, waiting 1.5 seconds
|
|
89
|
+
* between attempts. The first request runs immediately.
|
|
90
|
+
*/
|
|
91
|
+
const POLL_MAX_ATTEMPTS = 5;
|
|
92
|
+
// TODO: Replace this fallback with the server-provided polling interval once available.
|
|
93
|
+
const POLL_INTERVAL_MS = 1500;
|
|
94
|
+
|
|
95
|
+
const delay = (ms: number): Promise<void> =>
|
|
96
|
+
new Promise((resolve) => setTimeout(resolve, ms));
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
* Drives server-directed Native Auth V2 flows using opaque continuation state
|
|
100
|
+
* and HAL links. Each operation returns only its valid discriminated results.
|
|
101
|
+
*/
|
|
102
|
+
export class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
103
|
+
constructor(
|
|
104
|
+
config: BrowserConfiguration,
|
|
105
|
+
storageImpl: BrowserCacheManager,
|
|
106
|
+
browserCrypto: ICrypto,
|
|
107
|
+
logger: Logger,
|
|
108
|
+
eventHandler: EventHandler,
|
|
109
|
+
navigationClient: INavigationClient,
|
|
110
|
+
performanceClient: IPerformanceClient,
|
|
111
|
+
customAuthAuthority: CustomAuthAuthority,
|
|
112
|
+
protected apiClient: CustomAuthApiClientV2
|
|
113
|
+
) {
|
|
114
|
+
super(
|
|
115
|
+
config,
|
|
116
|
+
storageImpl,
|
|
117
|
+
browserCrypto,
|
|
118
|
+
logger,
|
|
119
|
+
eventHandler,
|
|
120
|
+
navigationClient,
|
|
121
|
+
performanceClient,
|
|
122
|
+
customAuthAuthority
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* Starts sign-in using the preferred supported method offered by the server.
|
|
128
|
+
*/
|
|
129
|
+
async signIn(
|
|
130
|
+
parameters: FlowSignInStartParamsV2
|
|
131
|
+
): Promise<
|
|
132
|
+
| FlowPasswordRequiredResultV2
|
|
133
|
+
| FlowSignInCodeRequiredResultV2
|
|
134
|
+
| FlowMFARequiredResultV2
|
|
135
|
+
| FlowCompletedResultV2
|
|
136
|
+
> {
|
|
137
|
+
const correlationId = parameters.correlationId;
|
|
138
|
+
const context = this.createRequestContext(
|
|
139
|
+
PublicApiId.SIGN_IN_V2_START,
|
|
140
|
+
correlationId
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
this.logger.verbose("Starting V2 sign-in.", correlationId);
|
|
144
|
+
|
|
145
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(
|
|
146
|
+
context
|
|
147
|
+
);
|
|
148
|
+
const startResult = await this.apiClient.signInStart(
|
|
149
|
+
this.requireLink(correlationId, entryResult.signInHref, {
|
|
150
|
+
code: SIGN_IN_UNSUPPORTED,
|
|
151
|
+
message:
|
|
152
|
+
"The authorize-challenge entry response did not include a sign-in link.",
|
|
153
|
+
}),
|
|
154
|
+
{
|
|
155
|
+
continuationToken: entryResult.continuationToken,
|
|
156
|
+
username: parameters.username,
|
|
157
|
+
},
|
|
158
|
+
context
|
|
159
|
+
);
|
|
160
|
+
this.ensureAuthenticationFactor(
|
|
161
|
+
startResult.authenticationFactor,
|
|
162
|
+
AuthenticationFactorV2.SINGLE_FACTOR,
|
|
163
|
+
"sign-in start",
|
|
164
|
+
correlationId
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const continuationState: FlowContinuationStateV2 = {
|
|
168
|
+
continuationToken: startResult.continuationToken,
|
|
169
|
+
scenario: CustomAuthFlowScenarioV2.SignIn,
|
|
170
|
+
links: {},
|
|
171
|
+
tokenRequest: {
|
|
172
|
+
scopes: parameters.scopes,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
const methods = startResult.methods.map((method) => ({
|
|
176
|
+
id: method.id,
|
|
177
|
+
type: method.type ?? "",
|
|
178
|
+
hint: method.hint,
|
|
179
|
+
challengeHref: method.challengeHref,
|
|
180
|
+
}));
|
|
181
|
+
const selectedMethod = this.selectSignInMethod(
|
|
182
|
+
methods,
|
|
183
|
+
parameters.password !== undefined,
|
|
184
|
+
correlationId
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const challengeResult = await this.requestChallenge({
|
|
188
|
+
correlationId,
|
|
189
|
+
continuationState: {
|
|
190
|
+
...continuationState,
|
|
191
|
+
links: {
|
|
192
|
+
...continuationState.links,
|
|
193
|
+
challenge: selectedMethod.challengeHref,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2) {
|
|
199
|
+
return {
|
|
200
|
+
...challengeResult,
|
|
201
|
+
method: selectedMethod,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (parameters.password) {
|
|
206
|
+
return this.submitSignInPassword({
|
|
207
|
+
correlationId,
|
|
208
|
+
continuationState: challengeResult.continuationState,
|
|
209
|
+
password: parameters.password,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return challengeResult;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/*
|
|
217
|
+
* Starts sign-up and resolves the server-provided attribute-submission transition.
|
|
218
|
+
*/
|
|
219
|
+
async signUp(
|
|
220
|
+
parameters: FlowSignUpStartParamsV2
|
|
221
|
+
): Promise<
|
|
222
|
+
| FlowCodeRequiredResultV2
|
|
223
|
+
| FlowSignUpPasswordRequiredResultV2
|
|
224
|
+
| FlowAttributesRequiredResultV2
|
|
225
|
+
> {
|
|
226
|
+
const correlationId = parameters.correlationId;
|
|
227
|
+
const context = this.createRequestContext(
|
|
228
|
+
PublicApiId.SIGN_UP_V2_START,
|
|
229
|
+
correlationId
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
this.logger.verbose("Starting V2 sign-up.", correlationId);
|
|
233
|
+
|
|
234
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(
|
|
235
|
+
context,
|
|
236
|
+
parameters.scopes
|
|
237
|
+
);
|
|
238
|
+
const startResult = await this.apiClient.signUpStart(
|
|
239
|
+
this.requireLink(correlationId, entryResult.signUpHref, {
|
|
240
|
+
code: SIGN_UP_UNSUPPORTED,
|
|
241
|
+
message:
|
|
242
|
+
"The authorize-challenge entry response did not include a sign-up link.",
|
|
243
|
+
}),
|
|
244
|
+
{
|
|
245
|
+
continuationToken: entryResult.continuationToken,
|
|
246
|
+
},
|
|
247
|
+
context
|
|
248
|
+
);
|
|
249
|
+
const attributes = Object.fromEntries(
|
|
250
|
+
Object.entries(parameters.attributes ?? {}).filter(
|
|
251
|
+
([name]) =>
|
|
252
|
+
name.toLowerCase() !== "email" &&
|
|
253
|
+
name.toLowerCase() !== "password"
|
|
254
|
+
)
|
|
255
|
+
);
|
|
256
|
+
attributes.email = parameters.username;
|
|
257
|
+
if (parameters.password !== undefined) {
|
|
258
|
+
attributes.password = parameters.password;
|
|
259
|
+
}
|
|
260
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(
|
|
261
|
+
startResult.submitAttributesHref,
|
|
262
|
+
{
|
|
263
|
+
continuationToken: startResult.continuationToken,
|
|
264
|
+
attributes,
|
|
265
|
+
},
|
|
266
|
+
context
|
|
267
|
+
);
|
|
268
|
+
const continuationState: FlowContinuationStateV2 = {
|
|
269
|
+
continuationToken: startResult.continuationToken,
|
|
270
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
271
|
+
links: {},
|
|
272
|
+
tokenRequest: {
|
|
273
|
+
scopes: parameters.scopes,
|
|
274
|
+
},
|
|
275
|
+
signUp: {
|
|
276
|
+
passwordWasSupplied: attributes.password !== undefined,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const result = this.toSignUpActionResult(
|
|
281
|
+
submitResult,
|
|
282
|
+
continuationState,
|
|
283
|
+
correlationId
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
287
|
+
const message =
|
|
288
|
+
"Initial sign-up attribute submission cannot complete without code verification or additional attributes.";
|
|
289
|
+
this.logger.error(message, correlationId);
|
|
290
|
+
throw new CustomAuthError(
|
|
291
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
292
|
+
message,
|
|
293
|
+
correlationId
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return result;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/*
|
|
301
|
+
* Starts password reset, automatically challenging a sole method or
|
|
302
|
+
* returning multiple methods for selection.
|
|
303
|
+
*/
|
|
304
|
+
async resetPassword(
|
|
305
|
+
parameters: FlowStartParamsV2
|
|
306
|
+
): Promise<
|
|
307
|
+
| FlowMethodSelectionRequiredResultV2
|
|
308
|
+
| FlowResetPasswordCodeRequiredResultV2
|
|
309
|
+
> {
|
|
310
|
+
const correlationId = parameters.correlationId;
|
|
311
|
+
const context = this.createRequestContext(
|
|
312
|
+
PublicApiId.RESET_PASSWORD_V2_START,
|
|
313
|
+
correlationId
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
this.logger.verbose(
|
|
317
|
+
"Starting V2 self-service password reset.",
|
|
318
|
+
correlationId
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(
|
|
322
|
+
context
|
|
323
|
+
);
|
|
324
|
+
const startResult = await this.apiClient.resetPasswordStart(
|
|
325
|
+
this.requireLink(correlationId, entryResult.resetPasswordHref, {
|
|
326
|
+
code: RESET_PASSWORD_UNSUPPORTED,
|
|
327
|
+
message:
|
|
328
|
+
"The authorize-challenge entry response did not include a reset-password link.",
|
|
329
|
+
}),
|
|
330
|
+
{
|
|
331
|
+
username: parameters.username,
|
|
332
|
+
continuationToken: entryResult.continuationToken,
|
|
333
|
+
},
|
|
334
|
+
context
|
|
335
|
+
);
|
|
336
|
+
this.ensureAuthenticationFactor(
|
|
337
|
+
startResult.authenticationFactor,
|
|
338
|
+
AuthenticationFactorV2.SINGLE_FACTOR,
|
|
339
|
+
"password-reset start",
|
|
340
|
+
correlationId
|
|
341
|
+
);
|
|
342
|
+
const continuationState: FlowContinuationStateV2 = {
|
|
343
|
+
continuationToken: startResult.continuationToken,
|
|
344
|
+
scenario: CustomAuthFlowScenarioV2.PasswordReset,
|
|
345
|
+
links: {},
|
|
346
|
+
};
|
|
347
|
+
const methods = startResult.methods.map((method) => ({
|
|
348
|
+
id: method.id,
|
|
349
|
+
type: method.type ?? "",
|
|
350
|
+
hint: method.hint,
|
|
351
|
+
challengeHref: method.challengeHref,
|
|
352
|
+
}));
|
|
353
|
+
|
|
354
|
+
if (methods.length === 0) {
|
|
355
|
+
const message =
|
|
356
|
+
"The password-reset start response did not include an authentication method.";
|
|
357
|
+
this.logger.error(message, correlationId);
|
|
358
|
+
throw new CustomAuthError(
|
|
359
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
360
|
+
message,
|
|
361
|
+
correlationId
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (methods.length === 1) {
|
|
366
|
+
const selectedMethod = methods[0];
|
|
367
|
+
const challengeResult = await this.requestChallenge({
|
|
368
|
+
correlationId,
|
|
369
|
+
continuationState: {
|
|
370
|
+
...continuationState,
|
|
371
|
+
links: {
|
|
372
|
+
challenge: selectedMethod.challengeHref,
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
if (
|
|
378
|
+
challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
379
|
+
(challengeResult.channel?.toLowerCase() ===
|
|
380
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
381
|
+
challengeResult.channel?.toLowerCase() ===
|
|
382
|
+
AuthenticationMethodTypeV2.SMS)
|
|
383
|
+
) {
|
|
384
|
+
return {
|
|
385
|
+
...challengeResult,
|
|
386
|
+
method: selectedMethod,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const channel =
|
|
391
|
+
challengeResult.type === FLOW_CODE_REQUIRED_V2
|
|
392
|
+
? challengeResult.channel
|
|
393
|
+
: AuthenticationMethodTypeV2.PASSWORD;
|
|
394
|
+
const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
|
|
395
|
+
this.logger.error(message, correlationId);
|
|
396
|
+
throw new CustomAuthError(
|
|
397
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
398
|
+
message,
|
|
399
|
+
correlationId
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
this.logger.verbose(
|
|
404
|
+
"V2 self-service password reset method selection required.",
|
|
405
|
+
correlationId
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
return createFlowMethodSelectionRequiredResultV2({
|
|
409
|
+
correlationId,
|
|
410
|
+
continuationState,
|
|
411
|
+
methods,
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/*
|
|
416
|
+
* Requests a one-time code for the selected authentication method. Returns
|
|
417
|
+
* the continuation state and code metadata needed for verification.
|
|
418
|
+
*/
|
|
419
|
+
async requestChallenge(
|
|
420
|
+
parameters: FlowChallengeParamsV2
|
|
421
|
+
): Promise<FlowCodeRequiredResultV2 | FlowPasswordRequiredResultV2> {
|
|
422
|
+
const challengeResult = await this.sendMethodChallenge(
|
|
423
|
+
parameters,
|
|
424
|
+
"requestChallenge"
|
|
425
|
+
);
|
|
426
|
+
const challengeType =
|
|
427
|
+
challengeResult.type ?? AuthenticationMethodTypeV2.EMAIL;
|
|
428
|
+
const continuationState = this.createChallengeContinuationState(
|
|
429
|
+
parameters.continuationState,
|
|
430
|
+
challengeResult
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
if (
|
|
434
|
+
challengeType.toLowerCase() === AuthenticationMethodTypeV2.PASSWORD
|
|
435
|
+
) {
|
|
436
|
+
return createFlowPasswordRequiredResultV2({
|
|
437
|
+
correlationId: parameters.correlationId,
|
|
438
|
+
continuationState,
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
return createFlowCodeRequiredResultV2({
|
|
443
|
+
correlationId: parameters.correlationId,
|
|
444
|
+
continuationState,
|
|
445
|
+
channel: challengeType,
|
|
446
|
+
sentTo: challengeResult.hint,
|
|
447
|
+
codeLength: challengeResult.codeLength,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/*
|
|
452
|
+
* Verifies the submitted one-time code using the server-provided link. The
|
|
453
|
+
* response determines the next required action.
|
|
454
|
+
*/
|
|
455
|
+
async submitCode(
|
|
456
|
+
parameters: FlowSubmitCodeParamsV2
|
|
457
|
+
): Promise<FlowSubmitCodeResultV2> {
|
|
458
|
+
const continuationState = parameters.continuationState;
|
|
459
|
+
const correlationId = parameters.correlationId;
|
|
460
|
+
const context = this.createRequestContext(
|
|
461
|
+
this.resolveStepApiId(
|
|
462
|
+
continuationState.scenario,
|
|
463
|
+
"submitCode",
|
|
464
|
+
correlationId
|
|
465
|
+
),
|
|
466
|
+
correlationId
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
this.logger.verbose("Submitting V2 one-time code.", correlationId);
|
|
470
|
+
|
|
471
|
+
const verifyHref = this.requireLink(
|
|
472
|
+
correlationId,
|
|
473
|
+
continuationState.links.verify
|
|
474
|
+
);
|
|
475
|
+
const verifyRequest = {
|
|
476
|
+
continuationToken: continuationState.continuationToken,
|
|
477
|
+
otp: parameters.code,
|
|
478
|
+
};
|
|
479
|
+
const verifyResult = await this.apiClient.verifyChallenge(
|
|
480
|
+
verifyHref,
|
|
481
|
+
verifyRequest,
|
|
482
|
+
context
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
if (
|
|
486
|
+
continuationState.scenario ===
|
|
487
|
+
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
488
|
+
verifyResult.nextAction === VerifyNextActionV2.UPDATE
|
|
489
|
+
) {
|
|
490
|
+
return createFlowNewPasswordRequiredResultV2({
|
|
491
|
+
correlationId,
|
|
492
|
+
continuationState: {
|
|
493
|
+
continuationToken: verifyResult.continuationToken,
|
|
494
|
+
scenario: continuationState.scenario,
|
|
495
|
+
links: { update: verifyResult.updateHref },
|
|
496
|
+
},
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
501
|
+
return this.handleSignInVerification(
|
|
502
|
+
continuationState,
|
|
503
|
+
verifyResult,
|
|
504
|
+
correlationId
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (
|
|
509
|
+
continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
510
|
+
verifyResult.nextAction === VerifyNextActionV2.COLLECT_ATTRIBUTES
|
|
511
|
+
) {
|
|
512
|
+
const requiredPasswordAttribute = verifyResult.attributes.find(
|
|
513
|
+
(attribute) =>
|
|
514
|
+
attribute.attributeId.toLowerCase() === "password" &&
|
|
515
|
+
attribute.required === true
|
|
516
|
+
);
|
|
517
|
+
const nextContinuationState: FlowContinuationStateV2 = {
|
|
518
|
+
continuationToken: verifyResult.continuationToken,
|
|
519
|
+
scenario: continuationState.scenario,
|
|
520
|
+
links: {
|
|
521
|
+
submitAttributes: verifyResult.submitAttributesHref,
|
|
522
|
+
},
|
|
523
|
+
tokenRequest: continuationState.tokenRequest,
|
|
524
|
+
signUp: continuationState.signUp,
|
|
525
|
+
};
|
|
526
|
+
const attributes = verifyResult.attributes.filter(
|
|
527
|
+
(attribute) =>
|
|
528
|
+
attribute.attributeId.toLowerCase() !== "password"
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
if (
|
|
532
|
+
requiredPasswordAttribute &&
|
|
533
|
+
continuationState.signUp?.passwordWasSupplied !== true
|
|
534
|
+
) {
|
|
535
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
536
|
+
correlationId,
|
|
537
|
+
continuationState: nextContinuationState,
|
|
538
|
+
attributes,
|
|
539
|
+
requiredPasswordAttribute,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return createFlowAttributesRequiredResultV2({
|
|
544
|
+
correlationId,
|
|
545
|
+
continuationState: nextContinuationState,
|
|
546
|
+
attributes,
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
if (
|
|
551
|
+
continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
552
|
+
verifyResult.nextAction === VerifyNextActionV2.CONTINUE
|
|
553
|
+
) {
|
|
554
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
555
|
+
correlationId,
|
|
556
|
+
continuationState: {
|
|
557
|
+
continuationToken: verifyResult.continuationToken,
|
|
558
|
+
scenario: continuationState.scenario,
|
|
559
|
+
links: {},
|
|
560
|
+
tokenRequest: continuationState.tokenRequest,
|
|
561
|
+
},
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
|
|
566
|
+
this.logger.error(message, correlationId);
|
|
567
|
+
|
|
568
|
+
throw new CustomAuthError(
|
|
569
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
570
|
+
message,
|
|
571
|
+
correlationId
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/*
|
|
576
|
+
* Requests a new one-time code using the server-provided resend link.
|
|
577
|
+
* Returns refreshed continuation state and code metadata.
|
|
578
|
+
*/
|
|
579
|
+
async resendCode(
|
|
580
|
+
parameters: FlowChallengeParamsV2
|
|
581
|
+
): Promise<FlowCodeRequiredResultV2> {
|
|
582
|
+
const challengeResult = await this.sendMethodChallenge(
|
|
583
|
+
parameters,
|
|
584
|
+
"resendCode"
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
return createFlowCodeRequiredResultV2({
|
|
588
|
+
correlationId: parameters.correlationId,
|
|
589
|
+
continuationState: this.createChallengeContinuationState(
|
|
590
|
+
parameters.continuationState,
|
|
591
|
+
challengeResult
|
|
592
|
+
),
|
|
593
|
+
channel: challengeResult.type,
|
|
594
|
+
sentTo: challengeResult.hint,
|
|
595
|
+
codeLength: challengeResult.codeLength,
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
async submitSignUpAttributes(
|
|
600
|
+
parameters: FlowSubmitSignUpAttributesParamsV2
|
|
601
|
+
): Promise<FlowSignUpActionResultV2> {
|
|
602
|
+
const { continuationState, correlationId, attributes } = parameters;
|
|
603
|
+
const context = this.createRequestContext(
|
|
604
|
+
this.resolveStepApiId(
|
|
605
|
+
continuationState.scenario,
|
|
606
|
+
"submitAttributes",
|
|
607
|
+
correlationId
|
|
608
|
+
),
|
|
609
|
+
correlationId
|
|
610
|
+
);
|
|
611
|
+
|
|
612
|
+
this.logger.verbose(
|
|
613
|
+
"Submitting additional V2 sign-up attributes.",
|
|
614
|
+
correlationId
|
|
615
|
+
);
|
|
616
|
+
|
|
617
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(
|
|
618
|
+
this.requireLink(
|
|
619
|
+
correlationId,
|
|
620
|
+
continuationState.links.submitAttributes
|
|
621
|
+
),
|
|
622
|
+
{
|
|
623
|
+
continuationToken: continuationState.continuationToken,
|
|
624
|
+
attributes,
|
|
625
|
+
},
|
|
626
|
+
context
|
|
627
|
+
);
|
|
628
|
+
|
|
629
|
+
return this.toSignUpActionResult(
|
|
630
|
+
submitResult,
|
|
631
|
+
{
|
|
632
|
+
...continuationState,
|
|
633
|
+
signUp: {
|
|
634
|
+
passwordWasSupplied:
|
|
635
|
+
continuationState.signUp?.passwordWasSupplied ===
|
|
636
|
+
true || attributes.password !== undefined,
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
correlationId
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/*
|
|
644
|
+
* Submits the new password and polls until the reset completes. The result
|
|
645
|
+
* contains the continuation state required for explicit sign-in.
|
|
646
|
+
*/
|
|
647
|
+
async submitNewPassword(
|
|
648
|
+
parameters: FlowSubmitNewPasswordParamsV2
|
|
649
|
+
): Promise<FlowSignInContinuationRequiredResultV2> {
|
|
650
|
+
const continuationState = parameters.continuationState;
|
|
651
|
+
const correlationId = parameters.correlationId;
|
|
652
|
+
const context = this.createRequestContext(
|
|
653
|
+
this.resolveStepApiId(
|
|
654
|
+
continuationState.scenario,
|
|
655
|
+
"submitNewPassword",
|
|
656
|
+
correlationId
|
|
657
|
+
),
|
|
658
|
+
correlationId
|
|
659
|
+
);
|
|
660
|
+
|
|
661
|
+
this.logger.verbose("Submitting V2 new password.", correlationId);
|
|
662
|
+
|
|
663
|
+
const updateResult = await this.apiClient.submitNewPassword(
|
|
664
|
+
this.requireLink(correlationId, continuationState.links.update),
|
|
665
|
+
{
|
|
666
|
+
continuationToken: continuationState.continuationToken,
|
|
667
|
+
newPassword: parameters.newPassword,
|
|
668
|
+
},
|
|
669
|
+
context
|
|
670
|
+
);
|
|
671
|
+
|
|
672
|
+
let pollToken = updateResult.continuationToken;
|
|
673
|
+
let pollHref = updateResult.pollHref;
|
|
674
|
+
let completionToken: string | undefined;
|
|
675
|
+
|
|
676
|
+
for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
|
|
677
|
+
const pollResult = await this.apiClient.poll(
|
|
678
|
+
pollHref,
|
|
679
|
+
{ continuationToken: pollToken },
|
|
680
|
+
context
|
|
681
|
+
);
|
|
682
|
+
|
|
683
|
+
if (pollResult.isCompleted) {
|
|
684
|
+
completionToken = pollResult.continuationToken;
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
pollToken = pollResult.continuationToken;
|
|
689
|
+
pollHref = pollResult.pollHref ?? pollHref;
|
|
690
|
+
|
|
691
|
+
if (attempt < POLL_MAX_ATTEMPTS) {
|
|
692
|
+
await delay(POLL_INTERVAL_MS);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (!completionToken) {
|
|
697
|
+
const message =
|
|
698
|
+
"The password reset did not complete within the allotted number of polling attempts.";
|
|
699
|
+
this.logger.error(message, correlationId);
|
|
700
|
+
|
|
701
|
+
throw new CustomAuthError(
|
|
702
|
+
RESET_PASSWORD_TIMEOUT,
|
|
703
|
+
message,
|
|
704
|
+
correlationId
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
this.logger.verbose(
|
|
709
|
+
"V2 password reset applied; sign-in required.",
|
|
710
|
+
correlationId
|
|
711
|
+
);
|
|
712
|
+
|
|
713
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
714
|
+
correlationId,
|
|
715
|
+
continuationState: {
|
|
716
|
+
continuationToken: completionToken,
|
|
717
|
+
scenario: continuationState.scenario,
|
|
718
|
+
links: {},
|
|
719
|
+
},
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/*
|
|
724
|
+
* Verifies a sign-in password and returns the next sign-in action.
|
|
725
|
+
*/
|
|
726
|
+
async submitSignInPassword(
|
|
727
|
+
parameters: FlowSubmitSignInPasswordParamsV2
|
|
728
|
+
): Promise<FlowMFARequiredResultV2 | FlowCompletedResultV2> {
|
|
729
|
+
const verifyResult = await this.verifySignInPassword(parameters);
|
|
730
|
+
|
|
731
|
+
return this.handleSignInVerification(
|
|
732
|
+
parameters.continuationState,
|
|
733
|
+
verifyResult,
|
|
734
|
+
parameters.correlationId
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/*
|
|
739
|
+
* Redeems the completed flow continuation for tokens. Returns the
|
|
740
|
+
* authentication result after validating and caching the response.
|
|
741
|
+
*/
|
|
742
|
+
async signInWithContinuation(
|
|
743
|
+
parameters: FlowSignInWithContinuationParamsV2
|
|
744
|
+
): Promise<FlowCompletedResultV2> {
|
|
745
|
+
const continuationState = parameters.continuationState;
|
|
746
|
+
const correlationId = parameters.correlationId;
|
|
747
|
+
const apiId = this.resolveStepApiId(
|
|
748
|
+
continuationState.scenario,
|
|
749
|
+
"signInWithContinuation",
|
|
750
|
+
correlationId
|
|
751
|
+
);
|
|
752
|
+
const context = this.createRequestContext(apiId, correlationId);
|
|
753
|
+
|
|
754
|
+
this.logger.verbose(
|
|
755
|
+
"Signing in with a V2 continuation.",
|
|
756
|
+
correlationId
|
|
757
|
+
);
|
|
758
|
+
|
|
759
|
+
const scopes = this.getScopes(parameters.scopes);
|
|
760
|
+
|
|
761
|
+
const tokenResponse = await this.apiClient.completeWithTokens(
|
|
762
|
+
{
|
|
763
|
+
continuationToken: continuationState.continuationToken,
|
|
764
|
+
scopes,
|
|
765
|
+
},
|
|
766
|
+
context
|
|
767
|
+
);
|
|
768
|
+
|
|
769
|
+
const authenticationResult = await this.handleTokenResponse(
|
|
770
|
+
tokenResponse,
|
|
771
|
+
scopes,
|
|
772
|
+
correlationId,
|
|
773
|
+
apiId
|
|
774
|
+
);
|
|
775
|
+
|
|
776
|
+
this.logger.verbose(
|
|
777
|
+
"V2 continuation sign-in completed.",
|
|
778
|
+
correlationId
|
|
779
|
+
);
|
|
780
|
+
|
|
781
|
+
return createFlowCompletedResultV2({
|
|
782
|
+
correlationId,
|
|
783
|
+
authenticationResult,
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
private async handleSignInVerification(
|
|
788
|
+
continuationState: FlowContinuationStateV2,
|
|
789
|
+
verifyResult: VerifyResultV2,
|
|
790
|
+
correlationId: string
|
|
791
|
+
): Promise<FlowMFARequiredResultV2 | FlowCompletedResultV2> {
|
|
792
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CHALLENGE) {
|
|
793
|
+
this.ensureAuthenticationFactor(
|
|
794
|
+
verifyResult.authenticationFactor,
|
|
795
|
+
AuthenticationFactorV2.MULTI_FACTOR,
|
|
796
|
+
"after sign-in verification",
|
|
797
|
+
correlationId
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
return createFlowMFARequiredResultV2({
|
|
801
|
+
correlationId,
|
|
802
|
+
continuationState: {
|
|
803
|
+
continuationToken: verifyResult.continuationToken,
|
|
804
|
+
scenario: continuationState.scenario,
|
|
805
|
+
links: {},
|
|
806
|
+
tokenRequest: continuationState.tokenRequest,
|
|
807
|
+
},
|
|
808
|
+
methods: verifyResult.methods.map((method) => ({
|
|
809
|
+
id: method.id,
|
|
810
|
+
type: method.type ?? "",
|
|
811
|
+
hint: method.hint,
|
|
812
|
+
challengeHref: method.challengeHref,
|
|
813
|
+
})),
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
818
|
+
return this.completeSignInAfterVerification(
|
|
819
|
+
continuationState,
|
|
820
|
+
verifyResult.continuationToken,
|
|
821
|
+
correlationId
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
|
|
826
|
+
this.logger.error(message, correlationId);
|
|
827
|
+
throw new CustomAuthError(
|
|
828
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
829
|
+
message,
|
|
830
|
+
correlationId
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
private selectSignInMethod(
|
|
835
|
+
methods: AuthenticationMethodV2[],
|
|
836
|
+
passwordProvided: boolean,
|
|
837
|
+
correlationId: string
|
|
838
|
+
): AuthenticationMethodV2 {
|
|
839
|
+
const passwordMethod = methods.find(
|
|
840
|
+
(method) =>
|
|
841
|
+
method.type.toLowerCase() ===
|
|
842
|
+
AuthenticationMethodTypeV2.PASSWORD
|
|
843
|
+
);
|
|
844
|
+
const emailMethod = methods.find(
|
|
845
|
+
(method) =>
|
|
846
|
+
method.type.toLowerCase() === AuthenticationMethodTypeV2.EMAIL
|
|
847
|
+
);
|
|
848
|
+
|
|
849
|
+
if (passwordProvided) {
|
|
850
|
+
if (passwordMethod) {
|
|
851
|
+
return passwordMethod;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
const message =
|
|
855
|
+
"A password was supplied, but the sign-in response did not include a password method.";
|
|
856
|
+
this.logger.error(message, correlationId);
|
|
857
|
+
throw new CustomAuthError(
|
|
858
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
859
|
+
message,
|
|
860
|
+
correlationId
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
const selectedMethod = emailMethod ?? passwordMethod;
|
|
865
|
+
if (selectedMethod) {
|
|
866
|
+
return selectedMethod;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const message =
|
|
870
|
+
"The sign-in start response did not include a supported email or password method.";
|
|
871
|
+
this.logger.error(message, correlationId);
|
|
872
|
+
throw new CustomAuthError(
|
|
873
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
874
|
+
message,
|
|
875
|
+
correlationId
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
private toSignUpActionResult(
|
|
880
|
+
result: SignUpSubmitAttributesApiResultV2,
|
|
881
|
+
continuationState: FlowContinuationStateV2,
|
|
882
|
+
correlationId: string
|
|
883
|
+
): FlowSignUpActionResultV2 {
|
|
884
|
+
const nextAction: string = result.nextAction;
|
|
885
|
+
|
|
886
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
887
|
+
return createFlowCodeRequiredResultV2({
|
|
888
|
+
correlationId,
|
|
889
|
+
continuationState: {
|
|
890
|
+
continuationToken: result.continuationToken,
|
|
891
|
+
scenario: continuationState.scenario,
|
|
892
|
+
links: {
|
|
893
|
+
verify: result.verifyHref,
|
|
894
|
+
resend: result.resendHref,
|
|
895
|
+
},
|
|
896
|
+
tokenRequest: continuationState.tokenRequest,
|
|
897
|
+
signUp: continuationState.signUp,
|
|
898
|
+
},
|
|
899
|
+
channel: result.type,
|
|
900
|
+
sentTo: result.hint,
|
|
901
|
+
codeLength: result.codeLength,
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
if (
|
|
906
|
+
result.nextAction ===
|
|
907
|
+
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES
|
|
908
|
+
) {
|
|
909
|
+
const requiredPasswordAttribute = result.attributes.find(
|
|
910
|
+
(attribute) =>
|
|
911
|
+
attribute.attributeId.toLowerCase() === "password" &&
|
|
912
|
+
attribute.required === true
|
|
913
|
+
);
|
|
914
|
+
const nextContinuationState: FlowContinuationStateV2 = {
|
|
915
|
+
continuationToken: result.continuationToken,
|
|
916
|
+
scenario: continuationState.scenario,
|
|
917
|
+
links: {
|
|
918
|
+
submitAttributes: result.submitAttributesHref,
|
|
919
|
+
},
|
|
920
|
+
tokenRequest: continuationState.tokenRequest,
|
|
921
|
+
signUp: continuationState.signUp,
|
|
922
|
+
};
|
|
923
|
+
const attributes = result.attributes.filter(
|
|
924
|
+
(attribute) =>
|
|
925
|
+
attribute.attributeId.toLowerCase() !== "password"
|
|
926
|
+
);
|
|
927
|
+
|
|
928
|
+
if (
|
|
929
|
+
requiredPasswordAttribute &&
|
|
930
|
+
continuationState.signUp?.passwordWasSupplied !== true
|
|
931
|
+
) {
|
|
932
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
933
|
+
correlationId,
|
|
934
|
+
continuationState: nextContinuationState,
|
|
935
|
+
attributes,
|
|
936
|
+
requiredPasswordAttribute,
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
return createFlowAttributesRequiredResultV2({
|
|
941
|
+
correlationId,
|
|
942
|
+
continuationState: nextContinuationState,
|
|
943
|
+
attributes,
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
|
|
948
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
949
|
+
correlationId,
|
|
950
|
+
continuationState: {
|
|
951
|
+
continuationToken: result.continuationToken,
|
|
952
|
+
scenario: continuationState.scenario,
|
|
953
|
+
links: {},
|
|
954
|
+
tokenRequest: continuationState.tokenRequest,
|
|
955
|
+
},
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
|
|
960
|
+
this.logger.error(message, correlationId);
|
|
961
|
+
throw new CustomAuthError(
|
|
962
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
963
|
+
message,
|
|
964
|
+
correlationId
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
private ensureAuthenticationFactor(
|
|
969
|
+
authenticationFactor: AuthenticationFactorV2,
|
|
970
|
+
expectedFactor: AuthenticationFactorV2,
|
|
971
|
+
transition: string,
|
|
972
|
+
correlationId: string
|
|
973
|
+
): void {
|
|
974
|
+
if (authenticationFactor === expectedFactor) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const message = `Authentication factor '${authenticationFactor}' is not supported for ${transition}.`;
|
|
979
|
+
this.logger.error(message, correlationId);
|
|
980
|
+
throw new CustomAuthError(
|
|
981
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
982
|
+
message,
|
|
983
|
+
correlationId
|
|
984
|
+
);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
private async verifySignInPassword(
|
|
988
|
+
parameters: FlowSubmitSignInPasswordParamsV2
|
|
989
|
+
): Promise<VerifyResultV2> {
|
|
990
|
+
const { continuationState, correlationId } = parameters;
|
|
991
|
+
const context = this.createRequestContext(
|
|
992
|
+
this.resolveStepApiId(
|
|
993
|
+
continuationState.scenario,
|
|
994
|
+
"submitPassword",
|
|
995
|
+
correlationId
|
|
996
|
+
),
|
|
997
|
+
correlationId
|
|
998
|
+
);
|
|
999
|
+
|
|
1000
|
+
this.logger.verbose("Submitting V2 sign-in password.", correlationId);
|
|
1001
|
+
|
|
1002
|
+
return this.apiClient.verifyChallenge(
|
|
1003
|
+
this.requireLink(correlationId, continuationState.links.verify),
|
|
1004
|
+
{
|
|
1005
|
+
continuationToken: continuationState.continuationToken,
|
|
1006
|
+
password: parameters.password,
|
|
1007
|
+
},
|
|
1008
|
+
context
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
private completeSignInAfterVerification(
|
|
1013
|
+
continuationState: FlowContinuationStateV2,
|
|
1014
|
+
continuationToken: string,
|
|
1015
|
+
correlationId: string
|
|
1016
|
+
): Promise<FlowCompletedResultV2> {
|
|
1017
|
+
return this.signInWithContinuation({
|
|
1018
|
+
correlationId,
|
|
1019
|
+
continuationState: {
|
|
1020
|
+
continuationToken,
|
|
1021
|
+
scenario: continuationState.scenario,
|
|
1022
|
+
links: {},
|
|
1023
|
+
tokenRequest: continuationState.tokenRequest,
|
|
1024
|
+
},
|
|
1025
|
+
scopes: continuationState.tokenRequest?.scopes,
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
private async sendMethodChallenge(
|
|
1030
|
+
parameters: FlowChallengeParamsV2,
|
|
1031
|
+
step: "requestChallenge" | "resendCode"
|
|
1032
|
+
): Promise<ChallengeVerificationResultV2> {
|
|
1033
|
+
const continuationState = parameters.continuationState;
|
|
1034
|
+
const correlationId = parameters.correlationId;
|
|
1035
|
+
const challengeHref =
|
|
1036
|
+
step === "resendCode"
|
|
1037
|
+
? continuationState.links.resend
|
|
1038
|
+
: continuationState.links.challenge;
|
|
1039
|
+
const context = this.createRequestContext(
|
|
1040
|
+
this.resolveStepApiId(
|
|
1041
|
+
continuationState.scenario,
|
|
1042
|
+
step,
|
|
1043
|
+
correlationId
|
|
1044
|
+
),
|
|
1045
|
+
correlationId
|
|
1046
|
+
);
|
|
1047
|
+
|
|
1048
|
+
this.logger.verbose(
|
|
1049
|
+
step === "resendCode"
|
|
1050
|
+
? "Resending V2 one-time code."
|
|
1051
|
+
: "Requesting V2 challenge.",
|
|
1052
|
+
correlationId
|
|
1053
|
+
);
|
|
1054
|
+
|
|
1055
|
+
const challengeResult = await this.apiClient.requestChallenge(
|
|
1056
|
+
this.requireLink(correlationId, challengeHref),
|
|
1057
|
+
{ continuationToken: continuationState.continuationToken },
|
|
1058
|
+
context
|
|
1059
|
+
);
|
|
1060
|
+
const nextAction: string = challengeResult.nextAction;
|
|
1061
|
+
|
|
1062
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.VERIFY) {
|
|
1063
|
+
return challengeResult;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.RISK_VERIFY) {
|
|
1067
|
+
return this.apiClient.verifyRisk(
|
|
1068
|
+
challengeResult.riskVerifyHref,
|
|
1069
|
+
{ continuationToken: challengeResult.continuationToken },
|
|
1070
|
+
context
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const message = `Challenge next action '${nextAction}' is not supported.`;
|
|
1075
|
+
this.logger.error(message, correlationId);
|
|
1076
|
+
throw new CustomAuthError(
|
|
1077
|
+
UNSUPPORTED_FLOW_TRANSITION,
|
|
1078
|
+
message,
|
|
1079
|
+
correlationId
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
private createChallengeContinuationState(
|
|
1084
|
+
continuationState: FlowContinuationStateV2,
|
|
1085
|
+
challengeResult: ChallengeVerificationResultV2
|
|
1086
|
+
): FlowContinuationStateV2 {
|
|
1087
|
+
return {
|
|
1088
|
+
continuationToken: challengeResult.continuationToken,
|
|
1089
|
+
scenario: continuationState.scenario,
|
|
1090
|
+
links: {
|
|
1091
|
+
challenge: continuationState.links.challenge,
|
|
1092
|
+
verify: challengeResult.verifyHref,
|
|
1093
|
+
resend:
|
|
1094
|
+
challengeResult.resendHref ??
|
|
1095
|
+
continuationState.links.resend,
|
|
1096
|
+
},
|
|
1097
|
+
...(continuationState.tokenRequest && {
|
|
1098
|
+
tokenRequest: continuationState.tokenRequest,
|
|
1099
|
+
}),
|
|
1100
|
+
...(continuationState.signUp && {
|
|
1101
|
+
signUp: continuationState.signUp,
|
|
1102
|
+
}),
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
private resolveStepApiId(
|
|
1107
|
+
scenario: CustomAuthFlowScenarioV2,
|
|
1108
|
+
step: FlowStepV2,
|
|
1109
|
+
correlationId: string
|
|
1110
|
+
): number {
|
|
1111
|
+
const apiId = getPublicApiIdV2(scenario, step);
|
|
1112
|
+
|
|
1113
|
+
if (apiId === undefined) {
|
|
1114
|
+
const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
|
|
1115
|
+
this.logger.error(message, correlationId);
|
|
1116
|
+
|
|
1117
|
+
throw new CustomAuthError(
|
|
1118
|
+
UNSUPPORTED_FLOW_STEP,
|
|
1119
|
+
message,
|
|
1120
|
+
correlationId
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
return apiId;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
private requireLink(
|
|
1128
|
+
correlationId: string,
|
|
1129
|
+
href: string | undefined,
|
|
1130
|
+
missingLinkError?: { code: string; message: string }
|
|
1131
|
+
): string {
|
|
1132
|
+
if (!href) {
|
|
1133
|
+
const errorCode =
|
|
1134
|
+
missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
|
|
1135
|
+
const message =
|
|
1136
|
+
missingLinkError?.message ??
|
|
1137
|
+
"The continuation state is missing a link required to advance the flow.";
|
|
1138
|
+
this.logger.error(message, correlationId);
|
|
1139
|
+
|
|
1140
|
+
throw new CustomAuthError(errorCode, message, correlationId);
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
return href;
|
|
1144
|
+
}
|
|
1145
|
+
}
|