@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.23.0 2026-09-23 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msalCustomAuth = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
9
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
const CLI_DATA = "clidata";
|
|
61
61
|
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
62
62
|
|
|
63
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
63
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
64
64
|
/*
|
|
65
65
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
66
66
|
* Licensed under the MIT License.
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
// Token renewal offset default in seconds
|
|
295
295
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
296
296
|
|
|
297
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
297
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
298
298
|
/*
|
|
299
299
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
300
300
|
* Licensed under the MIT License.
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
326
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
327
327
|
|
|
328
328
|
/*
|
|
329
329
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -346,7 +346,7 @@
|
|
|
346
346
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
349
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
350
350
|
/*
|
|
351
351
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
352
352
|
* Licensed under the MIT License.
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
const resourceParameterRequired = "resource_parameter_required";
|
|
385
385
|
const misplacedResourceParam = "misplaced_resource_parameter";
|
|
386
386
|
|
|
387
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
387
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
388
388
|
|
|
389
389
|
/*
|
|
390
390
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -422,7 +422,7 @@
|
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
425
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
426
426
|
|
|
427
427
|
/*
|
|
428
428
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -488,7 +488,7 @@
|
|
|
488
488
|
return matches[2];
|
|
489
489
|
}
|
|
490
490
|
|
|
491
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
491
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
492
492
|
|
|
493
493
|
/*
|
|
494
494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -576,7 +576,7 @@
|
|
|
576
576
|
return updatedAccountInfo;
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
579
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
580
580
|
/*
|
|
581
581
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
582
582
|
* Licensed under the MIT License.
|
|
@@ -590,7 +590,7 @@
|
|
|
590
590
|
Ciam: 3,
|
|
591
591
|
};
|
|
592
592
|
|
|
593
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
593
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
594
594
|
/*
|
|
595
595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
596
596
|
* Licensed under the MIT License.
|
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
return null;
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
615
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
616
616
|
/*
|
|
617
617
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
618
618
|
* Licensed under the MIT License.
|
|
@@ -636,7 +636,7 @@
|
|
|
636
636
|
EAR: "EAR",
|
|
637
637
|
};
|
|
638
638
|
|
|
639
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
639
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
640
640
|
/**
|
|
641
641
|
* Returns the AccountInfo interface for this account.
|
|
642
642
|
* @internal
|
|
@@ -825,7 +825,7 @@
|
|
|
825
825
|
entity.hasOwnProperty("authorityType"));
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
828
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
829
829
|
/*
|
|
830
830
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
831
831
|
* Licensed under the MIT License.
|
|
@@ -835,7 +835,7 @@
|
|
|
835
835
|
*/
|
|
836
836
|
const unexpectedError = "unexpected_error";
|
|
837
837
|
|
|
838
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
838
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
839
839
|
|
|
840
840
|
/*
|
|
841
841
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -855,7 +855,7 @@
|
|
|
855
855
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
858
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
859
859
|
/*
|
|
860
860
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
861
861
|
* Licensed under the MIT License.
|
|
@@ -886,7 +886,7 @@
|
|
|
886
886
|
const invalidDpopNonce = "invalid_dpop_nonce";
|
|
887
887
|
const dpopMissingResourceContext = "dpop_missing_resource_context";
|
|
888
888
|
|
|
889
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
889
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
890
890
|
/*
|
|
891
891
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
892
892
|
* Licensed under the MIT License.
|
|
@@ -898,7 +898,7 @@
|
|
|
898
898
|
response.hasOwnProperty("jwks_uri"));
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
901
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
902
902
|
/*
|
|
903
903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
904
904
|
* Licensed under the MIT License.
|
|
@@ -978,7 +978,7 @@
|
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
|
|
981
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
981
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
982
982
|
|
|
983
983
|
/*
|
|
984
984
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1136,7 +1136,7 @@
|
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
1138
|
|
|
1139
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1139
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1140
1140
|
|
|
1141
1141
|
/*
|
|
1142
1142
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1290,7 +1290,7 @@
|
|
|
1290
1290
|
return null;
|
|
1291
1291
|
}
|
|
1292
1292
|
|
|
1293
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1293
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1294
1294
|
/*
|
|
1295
1295
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1296
1296
|
* Licensed under the MIT License.
|
|
@@ -1299,7 +1299,7 @@
|
|
|
1299
1299
|
// AzureCloudInstance is not specified.
|
|
1300
1300
|
None: "none"};
|
|
1301
1301
|
|
|
1302
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1302
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1303
1303
|
/*
|
|
1304
1304
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1305
1305
|
* Licensed under the MIT License.
|
|
@@ -1309,7 +1309,7 @@
|
|
|
1309
1309
|
response.hasOwnProperty("metadata"));
|
|
1310
1310
|
}
|
|
1311
1311
|
|
|
1312
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1312
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1313
1313
|
/*
|
|
1314
1314
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1315
1315
|
* Licensed under the MIT License.
|
|
@@ -1319,7 +1319,7 @@
|
|
|
1319
1319
|
response.hasOwnProperty("error_description"));
|
|
1320
1320
|
}
|
|
1321
1321
|
|
|
1322
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1322
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1323
1323
|
/*
|
|
1324
1324
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1325
1325
|
* Licensed under the MIT License.
|
|
@@ -1390,7 +1390,7 @@
|
|
|
1390
1390
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1391
1391
|
const SetUserData = "setUserData";
|
|
1392
1392
|
|
|
1393
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1393
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1394
1394
|
/*
|
|
1395
1395
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1396
1396
|
* Licensed under the MIT License.
|
|
@@ -1483,7 +1483,7 @@
|
|
|
1483
1483
|
};
|
|
1484
1484
|
};
|
|
1485
1485
|
|
|
1486
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1486
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1487
1487
|
|
|
1488
1488
|
/*
|
|
1489
1489
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1594,7 +1594,7 @@
|
|
|
1594
1594
|
},
|
|
1595
1595
|
};
|
|
1596
1596
|
|
|
1597
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1597
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1598
1598
|
/*
|
|
1599
1599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1600
1600
|
* Licensed under the MIT License.
|
|
@@ -1659,7 +1659,7 @@
|
|
|
1659
1659
|
return cachedAtSec > nowSeconds();
|
|
1660
1660
|
}
|
|
1661
1661
|
|
|
1662
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1662
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1663
1663
|
|
|
1664
1664
|
/*
|
|
1665
1665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1946,7 +1946,7 @@
|
|
|
1946
1946
|
return [...attributeTokens].sort().join(" ");
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
1949
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1950
1950
|
|
|
1951
1951
|
/*
|
|
1952
1952
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2914,7 +2914,7 @@
|
|
|
2914
2914
|
};
|
|
2915
2915
|
}
|
|
2916
2916
|
|
|
2917
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
2917
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
2918
2918
|
|
|
2919
2919
|
/*
|
|
2920
2920
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2948,7 +2948,7 @@
|
|
|
2948
2948
|
}
|
|
2949
2949
|
}
|
|
2950
2950
|
|
|
2951
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
2951
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
2952
2952
|
|
|
2953
2953
|
/*
|
|
2954
2954
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3144,7 +3144,7 @@
|
|
|
3144
3144
|
}
|
|
3145
3145
|
}
|
|
3146
3146
|
|
|
3147
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
3147
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3148
3148
|
|
|
3149
3149
|
/*
|
|
3150
3150
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3630,7 +3630,7 @@
|
|
|
3630
3630
|
}
|
|
3631
3631
|
}
|
|
3632
3632
|
|
|
3633
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
3633
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3634
3634
|
|
|
3635
3635
|
/*
|
|
3636
3636
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3752,7 +3752,7 @@
|
|
|
3752
3752
|
}
|
|
3753
3753
|
}
|
|
3754
3754
|
|
|
3755
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
3755
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3756
3756
|
|
|
3757
3757
|
/*
|
|
3758
3758
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3800,7 +3800,7 @@
|
|
|
3800
3800
|
},
|
|
3801
3801
|
};
|
|
3802
3802
|
|
|
3803
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
3803
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3804
3804
|
|
|
3805
3805
|
/*
|
|
3806
3806
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3823,7 +3823,7 @@
|
|
|
3823
3823
|
},
|
|
3824
3824
|
};
|
|
3825
3825
|
|
|
3826
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
3826
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3827
3827
|
/*
|
|
3828
3828
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3829
3829
|
* Licensed under the MIT License.
|
|
@@ -4098,12 +4098,12 @@
|
|
|
4098
4098
|
}
|
|
4099
4099
|
}
|
|
4100
4100
|
|
|
4101
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
4101
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4102
4102
|
/* eslint-disable header/header */
|
|
4103
4103
|
const name$1 = "@azure/msal-common";
|
|
4104
4104
|
const version$1 = "16.14.1";
|
|
4105
4105
|
|
|
4106
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
4106
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4107
4107
|
/*
|
|
4108
4108
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4109
4109
|
* Licensed under the MIT License.
|
|
@@ -4111,7 +4111,7 @@
|
|
|
4111
4111
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4112
4112
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4113
4113
|
|
|
4114
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
4114
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4115
4115
|
|
|
4116
4116
|
/*
|
|
4117
4117
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4149,7 +4149,7 @@
|
|
|
4149
4149
|
}
|
|
4150
4150
|
}
|
|
4151
4151
|
|
|
4152
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
4152
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4153
4153
|
|
|
4154
4154
|
/*
|
|
4155
4155
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5336,7 +5336,7 @@
|
|
|
5336
5336
|
}
|
|
5337
5337
|
}
|
|
5338
5338
|
|
|
5339
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5339
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5340
5340
|
/*
|
|
5341
5341
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5342
5342
|
* Licensed under the MIT License.
|
|
@@ -5350,7 +5350,7 @@
|
|
|
5350
5350
|
const PerformanceEventStatus = {
|
|
5351
5351
|
InProgress: 1};
|
|
5352
5352
|
|
|
5353
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5353
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5354
5354
|
|
|
5355
5355
|
/*
|
|
5356
5356
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5408,7 +5408,7 @@
|
|
|
5408
5408
|
}
|
|
5409
5409
|
}
|
|
5410
5410
|
|
|
5411
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5411
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5412
5412
|
|
|
5413
5413
|
/*
|
|
5414
5414
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5506,7 +5506,7 @@
|
|
|
5506
5506
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5507
5507
|
}
|
|
5508
5508
|
|
|
5509
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5509
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5510
5510
|
/*
|
|
5511
5511
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5512
5512
|
* Licensed under the MIT License.
|
|
@@ -5533,7 +5533,7 @@
|
|
|
5533
5533
|
}
|
|
5534
5534
|
}
|
|
5535
5535
|
|
|
5536
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5536
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5537
5537
|
|
|
5538
5538
|
/*
|
|
5539
5539
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5554,7 +5554,7 @@
|
|
|
5554
5554
|
return new JoseHeaderError(code, correlationId);
|
|
5555
5555
|
}
|
|
5556
5556
|
|
|
5557
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5557
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5558
5558
|
/*
|
|
5559
5559
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5560
5560
|
* Licensed under the MIT License.
|
|
@@ -5579,7 +5579,7 @@
|
|
|
5579
5579
|
return Object.getPrototypeOf(value) === proto;
|
|
5580
5580
|
}
|
|
5581
5581
|
|
|
5582
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5582
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5583
5583
|
/*
|
|
5584
5584
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5585
5585
|
* Licensed under the MIT License.
|
|
@@ -5589,7 +5589,7 @@
|
|
|
5589
5589
|
const missingJwkError = "missing_jwk_error";
|
|
5590
5590
|
const invalidJwkError = "invalid_jwk_error";
|
|
5591
5591
|
|
|
5592
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5592
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5593
5593
|
|
|
5594
5594
|
/*
|
|
5595
5595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5655,7 +5655,7 @@
|
|
|
5655
5655
|
}
|
|
5656
5656
|
}
|
|
5657
5657
|
|
|
5658
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5658
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5659
5659
|
|
|
5660
5660
|
/*
|
|
5661
5661
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5756,7 +5756,7 @@
|
|
|
5756
5756
|
}
|
|
5757
5757
|
}
|
|
5758
5758
|
|
|
5759
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5759
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5760
5760
|
|
|
5761
5761
|
/*
|
|
5762
5762
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5901,7 +5901,7 @@
|
|
|
5901
5901
|
}
|
|
5902
5902
|
}
|
|
5903
5903
|
|
|
5904
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5904
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5905
5905
|
/*
|
|
5906
5906
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5907
5907
|
* Licensed under the MIT License.
|
|
@@ -5952,7 +5952,7 @@
|
|
|
5952
5952
|
*/
|
|
5953
5953
|
const interruptedUser = "interrupted_user";
|
|
5954
5954
|
|
|
5955
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
5955
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5956
5956
|
|
|
5957
5957
|
/*
|
|
5958
5958
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6019,7 +6019,7 @@
|
|
|
6019
6019
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6020
6020
|
}
|
|
6021
6021
|
|
|
6022
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6022
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6023
6023
|
|
|
6024
6024
|
/*
|
|
6025
6025
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6038,7 +6038,7 @@
|
|
|
6038
6038
|
}
|
|
6039
6039
|
}
|
|
6040
6040
|
|
|
6041
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6041
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6042
6042
|
|
|
6043
6043
|
/*
|
|
6044
6044
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6109,7 +6109,7 @@
|
|
|
6109
6109
|
}
|
|
6110
6110
|
}
|
|
6111
6111
|
|
|
6112
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6112
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6113
6113
|
|
|
6114
6114
|
/*
|
|
6115
6115
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6537,7 +6537,7 @@
|
|
|
6537
6537
|
return baseAccount;
|
|
6538
6538
|
}
|
|
6539
6539
|
|
|
6540
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6540
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6541
6541
|
/*
|
|
6542
6542
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6543
6543
|
* Licensed under the MIT License.
|
|
@@ -6547,7 +6547,7 @@
|
|
|
6547
6547
|
UPN: "UPN",
|
|
6548
6548
|
};
|
|
6549
6549
|
|
|
6550
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6550
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6551
6551
|
/*
|
|
6552
6552
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6553
6553
|
* Licensed under the MIT License.
|
|
@@ -6566,7 +6566,7 @@
|
|
|
6566
6566
|
}
|
|
6567
6567
|
}
|
|
6568
6568
|
|
|
6569
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6569
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6570
6570
|
|
|
6571
6571
|
/*
|
|
6572
6572
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6590,7 +6590,7 @@
|
|
|
6590
6590
|
};
|
|
6591
6591
|
}
|
|
6592
6592
|
|
|
6593
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6593
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6594
6594
|
|
|
6595
6595
|
/*
|
|
6596
6596
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6676,7 +6676,7 @@
|
|
|
6676
6676
|
}
|
|
6677
6677
|
}
|
|
6678
6678
|
|
|
6679
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6679
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6680
6680
|
|
|
6681
6681
|
/*
|
|
6682
6682
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6707,7 +6707,7 @@
|
|
|
6707
6707
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6708
6708
|
}
|
|
6709
6709
|
|
|
6710
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6710
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6711
6711
|
|
|
6712
6712
|
/*
|
|
6713
6713
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6840,7 +6840,7 @@
|
|
|
6840
6840
|
return response;
|
|
6841
6841
|
}
|
|
6842
6842
|
|
|
6843
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
6843
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6844
6844
|
|
|
6845
6845
|
/*
|
|
6846
6846
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7104,7 +7104,7 @@
|
|
|
7104
7104
|
}
|
|
7105
7105
|
}
|
|
7106
7106
|
|
|
7107
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
7107
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7108
7108
|
|
|
7109
7109
|
/*
|
|
7110
7110
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7331,7 +7331,7 @@
|
|
|
7331
7331
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7332
7332
|
}
|
|
7333
7333
|
|
|
7334
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
7334
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7335
7335
|
|
|
7336
7336
|
/*
|
|
7337
7337
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7565,7 +7565,7 @@
|
|
|
7565
7565
|
}
|
|
7566
7566
|
}
|
|
7567
7567
|
|
|
7568
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
7568
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7569
7569
|
|
|
7570
7570
|
/*
|
|
7571
7571
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7858,7 +7858,7 @@
|
|
|
7858
7858
|
clearNativeBrokerErrorCode() { }
|
|
7859
7859
|
}
|
|
7860
7860
|
|
|
7861
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
7861
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7862
7862
|
|
|
7863
7863
|
/*
|
|
7864
7864
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7985,7 +7985,7 @@
|
|
|
7985
7985
|
}
|
|
7986
7986
|
}
|
|
7987
7987
|
|
|
7988
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
7988
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7989
7989
|
|
|
7990
7990
|
/*
|
|
7991
7991
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8001,7 +8001,7 @@
|
|
|
8001
8001
|
},
|
|
8002
8002
|
};
|
|
8003
8003
|
|
|
8004
|
-
/*! @azure/msal-common v16.14.1 2026-09-
|
|
8004
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
8005
8005
|
|
|
8006
8006
|
/*
|
|
8007
8007
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8156,12 +8156,13 @@
|
|
|
8156
8156
|
* Custom Auth API error.
|
|
8157
8157
|
*/
|
|
8158
8158
|
class CustomAuthApiError extends CustomAuthError {
|
|
8159
|
-
constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp) {
|
|
8159
|
+
constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp, attributeValidationDetails) {
|
|
8160
8160
|
super(error, errorDescription, correlationId, errorCodes, subError);
|
|
8161
8161
|
this.attributes = attributes;
|
|
8162
8162
|
this.continuationToken = continuationToken;
|
|
8163
8163
|
this.traceId = traceId;
|
|
8164
8164
|
this.timestamp = timestamp;
|
|
8165
|
+
this.attributeValidationDetails = attributeValidationDetails;
|
|
8165
8166
|
Object.setPrototypeOf(this, CustomAuthApiError.prototype);
|
|
8166
8167
|
}
|
|
8167
8168
|
}
|
|
@@ -8193,15 +8194,15 @@
|
|
|
8193
8194
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8194
8195
|
* Licensed under the MIT License.
|
|
8195
8196
|
*/
|
|
8196
|
-
const CONTINUATION_TOKEN_MISSING = "continuation_token_missing";
|
|
8197
|
-
const INVALID_RESPONSE_BODY = "invalid_response_body";
|
|
8197
|
+
const CONTINUATION_TOKEN_MISSING$1 = "continuation_token_missing";
|
|
8198
|
+
const INVALID_RESPONSE_BODY$1 = "invalid_response_body";
|
|
8198
8199
|
const UNSUPPORTED_CHALLENGE_TYPE = "unsupported_challenge_type";
|
|
8199
8200
|
const ACCESS_TOKEN_MISSING = "access_token_missing";
|
|
8200
8201
|
const ID_TOKEN_MISSING = "id_token_missing";
|
|
8201
8202
|
const REFRESH_TOKEN_MISSING = "refresh_token_missing";
|
|
8202
8203
|
const INVALID_EXPIRES_IN = "invalid_expires_in";
|
|
8203
8204
|
const INVALID_TOKEN_TYPE = "invalid_token_type";
|
|
8204
|
-
const HTTP_REQUEST_FAILED = "http_request_failed";
|
|
8205
|
+
const HTTP_REQUEST_FAILED$1 = "http_request_failed";
|
|
8205
8206
|
const INVALID_REQUEST = "invalid_request";
|
|
8206
8207
|
const USER_NOT_FOUND = "user_not_found";
|
|
8207
8208
|
const INVALID_GRANT = "invalid_grant";
|
|
@@ -8219,7 +8220,7 @@
|
|
|
8219
8220
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8220
8221
|
* Licensed under the MIT License.
|
|
8221
8222
|
*/
|
|
8222
|
-
const PASSWORD_TOO_WEAK = "password_too_weak";
|
|
8223
|
+
const PASSWORD_TOO_WEAK$1 = "password_too_weak";
|
|
8223
8224
|
const PASSWORD_TOO_SHORT = "password_too_short";
|
|
8224
8225
|
const PASSWORD_TOO_LONG = "password_too_long";
|
|
8225
8226
|
const PASSWORD_RECENTLY_USED = "password_recently_used";
|
|
@@ -8287,7 +8288,7 @@
|
|
|
8287
8288
|
PASSWORD_RECENTLY_USED,
|
|
8288
8289
|
PASSWORD_TOO_LONG,
|
|
8289
8290
|
PASSWORD_TOO_SHORT,
|
|
8290
|
-
PASSWORD_TOO_WEAK,
|
|
8291
|
+
PASSWORD_TOO_WEAK$1,
|
|
8291
8292
|
]);
|
|
8292
8293
|
return (this.errorData instanceof CustomAuthApiError &&
|
|
8293
8294
|
this.errorData.error === INVALID_GRANT &&
|
|
@@ -8429,7 +8430,7 @@
|
|
|
8429
8430
|
|
|
8430
8431
|
/* eslint-disable header/header */
|
|
8431
8432
|
const name = "@azure/msal-browser";
|
|
8432
|
-
const version = "5.
|
|
8433
|
+
const version = "5.23.0";
|
|
8433
8434
|
|
|
8434
8435
|
/*
|
|
8435
8436
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11395,7 +11396,24 @@
|
|
|
11395
11396
|
const JIT_SUBMIT_CHALLENGE = 100082;
|
|
11396
11397
|
// MFA
|
|
11397
11398
|
const MFA_REQUEST_CHALLENGE = 100101;
|
|
11398
|
-
const MFA_SUBMIT_CHALLENGE = 100102;
|
|
11399
|
+
const MFA_SUBMIT_CHALLENGE = 100102;
|
|
11400
|
+
// Native Auth V2 (server-driven HAL flows) API Ids
|
|
11401
|
+
const RESET_PASSWORD_V2_START = 100201;
|
|
11402
|
+
const RESET_PASSWORD_V2_SUBMIT_CODE = 100202;
|
|
11403
|
+
const RESET_PASSWORD_V2_RESEND_CODE = 100203;
|
|
11404
|
+
const RESET_PASSWORD_V2_SUBMIT = 100204;
|
|
11405
|
+
const RESET_PASSWORD_V2_CHALLENGE = 100205;
|
|
11406
|
+
const SIGN_IN_V2_START = 100206;
|
|
11407
|
+
const SIGN_IN_V2_CHALLENGE = 100207;
|
|
11408
|
+
const SIGN_IN_V2_SUBMIT_PASSWORD = 100208;
|
|
11409
|
+
const SIGN_IN_V2_COMPLETE = 100209;
|
|
11410
|
+
const SIGN_IN_V2_SUBMIT_CODE = 100210;
|
|
11411
|
+
const SIGN_UP_V2_START = 100211;
|
|
11412
|
+
const SIGN_UP_V2_CHALLENGE = 100212;
|
|
11413
|
+
const SIGN_UP_V2_SUBMIT_CODE = 100213;
|
|
11414
|
+
const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
|
|
11415
|
+
const SIGN_UP_V2_RESEND_CODE = 100215;
|
|
11416
|
+
const SIGN_UP_V2_COMPLETE = 100216;
|
|
11399
11417
|
|
|
11400
11418
|
/*
|
|
11401
11419
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11992,16 +12010,2468 @@
|
|
|
11992
12010
|
return result;
|
|
11993
12011
|
}
|
|
11994
12012
|
/**
|
|
11995
|
-
* Checks if the result is in a failed state.
|
|
12013
|
+
* Checks if the result is in a failed state.
|
|
12014
|
+
*/
|
|
12015
|
+
isFailed() {
|
|
12016
|
+
return this.state.stateType === RESET_PASSWORD_FAILED_STATE_TYPE;
|
|
12017
|
+
}
|
|
12018
|
+
/**
|
|
12019
|
+
* Checks if the result is in a code required state.
|
|
12020
|
+
*/
|
|
12021
|
+
isCodeRequired() {
|
|
12022
|
+
return this.state.stateType === RESET_PASSWORD_CODE_REQUIRED_STATE_TYPE;
|
|
12023
|
+
}
|
|
12024
|
+
}
|
|
12025
|
+
|
|
12026
|
+
/*
|
|
12027
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12028
|
+
* Licensed under the MIT License.
|
|
12029
|
+
*/
|
|
12030
|
+
/**
|
|
12031
|
+
* Represents an HTTP method type.
|
|
12032
|
+
*/
|
|
12033
|
+
const HttpMethod = {
|
|
12034
|
+
GET: "GET",
|
|
12035
|
+
POST: "POST",
|
|
12036
|
+
PUT: "PUT"};
|
|
12037
|
+
|
|
12038
|
+
/*
|
|
12039
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12040
|
+
* Licensed under the MIT License.
|
|
12041
|
+
*/
|
|
12042
|
+
class ParsedUrlError extends CustomAuthError {
|
|
12043
|
+
constructor(error, message, correlationId) {
|
|
12044
|
+
super(error, message, correlationId);
|
|
12045
|
+
Object.setPrototypeOf(this, ParsedUrlError.prototype);
|
|
12046
|
+
}
|
|
12047
|
+
}
|
|
12048
|
+
|
|
12049
|
+
/*
|
|
12050
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12051
|
+
* Licensed under the MIT License.
|
|
12052
|
+
*/
|
|
12053
|
+
const InvalidUrl = "invalid_url";
|
|
12054
|
+
|
|
12055
|
+
/*
|
|
12056
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12057
|
+
* Licensed under the MIT License.
|
|
12058
|
+
*/
|
|
12059
|
+
function parseUrl(url) {
|
|
12060
|
+
try {
|
|
12061
|
+
return new URL(url);
|
|
12062
|
+
}
|
|
12063
|
+
catch (e) {
|
|
12064
|
+
throw new ParsedUrlError(InvalidUrl, `The URL "${url}" is invalid: ${e}`);
|
|
12065
|
+
}
|
|
12066
|
+
}
|
|
12067
|
+
function buildUrl(baseUrl, path, queryParams) {
|
|
12068
|
+
const newBaseUrl = !baseUrl.endsWith("/") ? `${baseUrl}/` : baseUrl;
|
|
12069
|
+
const newPath = path.startsWith("/") ? path.slice(1) : path;
|
|
12070
|
+
const url = new URL(newPath, newBaseUrl);
|
|
12071
|
+
// Add query parameters if provided
|
|
12072
|
+
if (queryParams) {
|
|
12073
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
12074
|
+
if (value !== undefined && value !== null) {
|
|
12075
|
+
url.searchParams.set(key, String(value));
|
|
12076
|
+
}
|
|
12077
|
+
});
|
|
12078
|
+
}
|
|
12079
|
+
return url;
|
|
12080
|
+
}
|
|
12081
|
+
|
|
12082
|
+
/*
|
|
12083
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12084
|
+
* Licensed under the MIT License.
|
|
12085
|
+
*/
|
|
12086
|
+
/**
|
|
12087
|
+
* Filters the headers returned by a {@link CustomAuthRequestInterceptor},
|
|
12088
|
+
* keeping only those that conform to the custom-auth header naming rules.
|
|
12089
|
+
*
|
|
12090
|
+
* Rules (mirrors the iOS / Android native auth implementations):
|
|
12091
|
+
* - Header names must start with `x-` (case-insensitive); others are dropped.
|
|
12092
|
+
* - Header names that start with any reserved prefix (`x-client-`, `x-ms-`,
|
|
12093
|
+
* `x-broker-`, `x-app-`) are dropped.
|
|
12094
|
+
* - Headers with empty/whitespace-only names or null/undefined values are dropped.
|
|
12095
|
+
*
|
|
12096
|
+
* Dropped headers are logged as warnings (PII-safe) when a logger is provided.
|
|
12097
|
+
*
|
|
12098
|
+
* @param headers - Raw headers returned by the interceptor.
|
|
12099
|
+
* @param logger - Optional logger used to emit warnings for dropped headers.
|
|
12100
|
+
* @param correlationId - Optional correlation id forwarded to the logger.
|
|
12101
|
+
* @returns A new record containing only the headers that pass the filter,
|
|
12102
|
+
* preserving the original casing of header names.
|
|
12103
|
+
*/
|
|
12104
|
+
function filterCustomHeaders(headers, logger, correlationId) {
|
|
12105
|
+
const filtered = {};
|
|
12106
|
+
if (!headers) {
|
|
12107
|
+
return filtered;
|
|
12108
|
+
}
|
|
12109
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
12110
|
+
if (!name || value === undefined || value === null) {
|
|
12111
|
+
continue;
|
|
12112
|
+
}
|
|
12113
|
+
const trimmedName = name.trim();
|
|
12114
|
+
if (!trimmedName) {
|
|
12115
|
+
continue;
|
|
12116
|
+
}
|
|
12117
|
+
const lowerName = trimmedName.toLowerCase();
|
|
12118
|
+
if (!lowerName.startsWith(CustomHeaderConstants.REQUIRED_PREFIX)) {
|
|
12119
|
+
logger?.warningPii(`Additional header field "${trimmedName}" must start with the "${CustomHeaderConstants.REQUIRED_PREFIX}" prefix. Ignoring.`, correlationId ?? "");
|
|
12120
|
+
continue;
|
|
12121
|
+
}
|
|
12122
|
+
const reservedPrefix = CustomHeaderConstants.RESERVED_PREFIXES.find((prefix) => lowerName.startsWith(prefix));
|
|
12123
|
+
if (reservedPrefix) {
|
|
12124
|
+
logger?.warningPii(`Additional header field "${trimmedName}" uses reserved prefix "${reservedPrefix}". Ignoring.`, correlationId ?? "");
|
|
12125
|
+
continue;
|
|
12126
|
+
}
|
|
12127
|
+
filtered[trimmedName] = value;
|
|
12128
|
+
}
|
|
12129
|
+
return filtered;
|
|
12130
|
+
}
|
|
12131
|
+
|
|
12132
|
+
/*
|
|
12133
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12134
|
+
* Licensed under the MIT License.
|
|
12135
|
+
*/
|
|
12136
|
+
const HTTP_REQUEST_FAILED = "http_request_failed";
|
|
12137
|
+
const REDIRECT_TO_WEB = "redirect_to_web";
|
|
12138
|
+
const UNEXPECTED_ERROR = "unexpected_error";
|
|
12139
|
+
const AUTH_CODE_MISSING = "authorization_code_missing";
|
|
12140
|
+
const INVALID_TOKEN_RESPONSE = "invalid_token_response";
|
|
12141
|
+
const INVALID_RESPONSE_BODY = "invalid_response_body";
|
|
12142
|
+
const CONTINUATION_TOKEN_MISSING = "continuation_token_missing";
|
|
12143
|
+
const INVALID_HAL_RESPONSE = "invalid_hal_response";
|
|
12144
|
+
const RESET_PASSWORD_UNSUPPORTED = "reset_password_unsupported";
|
|
12145
|
+
const SIGN_IN_UNSUPPORTED = "sign_in_unsupported";
|
|
12146
|
+
const SIGN_UP_UNSUPPORTED = "sign_up_unsupported";
|
|
12147
|
+
const CONTINUATION_LINK_MISSING = "continuation_link_missing";
|
|
12148
|
+
const RESET_PASSWORD_TIMEOUT = "reset_password_timeout";
|
|
12149
|
+
const UNSUPPORTED_FLOW_STEP = "unsupported_flow_step";
|
|
12150
|
+
const UNSUPPORTED_FLOW_TRANSITION = "unsupported_flow_transition";
|
|
12151
|
+
const NO_AUTHENTICATION_METHODS = "no_authentication_methods";
|
|
12152
|
+
const UNEXPECTED_AUTHENTICATION_FACTOR = "unexpected_authentication_factor";
|
|
12153
|
+
|
|
12154
|
+
/*
|
|
12155
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12156
|
+
* Licensed under the MIT License.
|
|
12157
|
+
*/
|
|
12158
|
+
/*
|
|
12159
|
+
* Normalizes nested HAL and flat OAuth error bodies into a `ServerErrorV2`.
|
|
12160
|
+
* Returns `undefined` when the response contains no recognized error.
|
|
12161
|
+
*/
|
|
12162
|
+
function normalizeServerErrorV2(body) {
|
|
12163
|
+
const error = body.error;
|
|
12164
|
+
if (error && typeof error === "object") {
|
|
12165
|
+
return normalizeHalError(body);
|
|
12166
|
+
}
|
|
12167
|
+
if (typeof error === "string") {
|
|
12168
|
+
return normalizeOAuthError(body);
|
|
12169
|
+
}
|
|
12170
|
+
return undefined;
|
|
12171
|
+
}
|
|
12172
|
+
function normalizeHalError(response) {
|
|
12173
|
+
const error = response.error ?? {};
|
|
12174
|
+
return {
|
|
12175
|
+
code: readString(error.code) ?? UNEXPECTED_ERROR,
|
|
12176
|
+
message: readString(error.message),
|
|
12177
|
+
innerErrorCode: readString(error.innerError?.code),
|
|
12178
|
+
attributeValidationDetails: error.innerError?.details,
|
|
12179
|
+
correlationId: readString(error.correlationId),
|
|
12180
|
+
traceId: readString(error.traceId),
|
|
12181
|
+
timestamp: readString(error.timestamp),
|
|
12182
|
+
};
|
|
12183
|
+
}
|
|
12184
|
+
function normalizeOAuthError(response) {
|
|
12185
|
+
return {
|
|
12186
|
+
code: readString(response.error) ?? UNEXPECTED_ERROR,
|
|
12187
|
+
message: readString(response.error_description),
|
|
12188
|
+
errorCodes: readNumberArray(response.error_codes),
|
|
12189
|
+
correlationId: readString(response.correlation_id),
|
|
12190
|
+
traceId: readString(response.trace_id),
|
|
12191
|
+
timestamp: readString(response.timestamp),
|
|
12192
|
+
};
|
|
12193
|
+
}
|
|
12194
|
+
function readString(value) {
|
|
12195
|
+
return typeof value === "string" ? value : undefined;
|
|
12196
|
+
}
|
|
12197
|
+
function readNumberArray(value) {
|
|
12198
|
+
if (Array.isArray(value) && value.every((v) => typeof v === "number")) {
|
|
12199
|
+
return value;
|
|
12200
|
+
}
|
|
12201
|
+
return undefined;
|
|
12202
|
+
}
|
|
12203
|
+
|
|
12204
|
+
/*
|
|
12205
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12206
|
+
* Licensed under the MIT License.
|
|
12207
|
+
*/
|
|
12208
|
+
// Content type used by V2 JSON `/api` requests.
|
|
12209
|
+
const JSON_CONTENT_TYPE = "application/json";
|
|
12210
|
+
// Server action returned after successful credential verification.
|
|
12211
|
+
const UPDATE_RELATION = "update";
|
|
12212
|
+
const CHALLENGE_RELATION = "challenge";
|
|
12213
|
+
const VERIFY_RELATION = "verify";
|
|
12214
|
+
const RISK_VERIFY_RELATION = "riskverify";
|
|
12215
|
+
const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
|
|
12216
|
+
const AuthenticationMethodTypeV2 = {
|
|
12217
|
+
EMAIL: "email",
|
|
12218
|
+
PASSWORD: "password",
|
|
12219
|
+
SMS: "sms",
|
|
12220
|
+
};
|
|
12221
|
+
/*
|
|
12222
|
+
* Known `state` values on a HAL response. Kept open (the body field is typed as string) because
|
|
12223
|
+
* the server may introduce new values; response parsing and flow logic branch on these constants.
|
|
12224
|
+
*/
|
|
12225
|
+
const ResponseStateV2 = {
|
|
12226
|
+
CONTINUE: "continue",
|
|
12227
|
+
WEB_FALLBACK_REQUIRED: "webFallbackRequired",
|
|
12228
|
+
};
|
|
12229
|
+
|
|
12230
|
+
/*
|
|
12231
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12232
|
+
* Licensed under the MIT License.
|
|
12233
|
+
*/
|
|
12234
|
+
/*
|
|
12235
|
+
* Turns a raw HTTP response from a V2 endpoint into a typed, checked envelope, and validates HAL
|
|
12236
|
+
* relations. Raw-preserving: the body keeps its HAL `_links`/`_embedded` shape so the api-client
|
|
12237
|
+
* navigates typed hrefs directly. Parsing never throws on a non-200 status - every V2 response
|
|
12238
|
+
* (including the entry response) carries a meaningful body, so only a non-object body is a hard
|
|
12239
|
+
* failure; the wire error is normalized onto the envelope (`error`). Required response values use
|
|
12240
|
+
* shared guards after callers read their strongly typed response properties directly.
|
|
12241
|
+
*/
|
|
12242
|
+
class ResponseHandlerV2 {
|
|
12243
|
+
constructor(logger) {
|
|
12244
|
+
this.logger = logger;
|
|
12245
|
+
}
|
|
12246
|
+
async parseResponse(response, requestCorrelationId) {
|
|
12247
|
+
const correlationId = response.headers.get(HttpHeaderKeys.X_MS_REQUEST_ID) ??
|
|
12248
|
+
requestCorrelationId;
|
|
12249
|
+
const json = await this.parseBody(response, correlationId);
|
|
12250
|
+
const state = typeof json.state === "string" ? json.state : undefined;
|
|
12251
|
+
const continuationToken = (typeof json.continuationToken === "string"
|
|
12252
|
+
? json.continuationToken
|
|
12253
|
+
: undefined) ??
|
|
12254
|
+
(typeof json.continuation_token === "string"
|
|
12255
|
+
? json.continuation_token
|
|
12256
|
+
: undefined);
|
|
12257
|
+
const flatError = typeof json.error === "string" ? json.error : undefined;
|
|
12258
|
+
const isWebFallbackRequired = flatError === REDIRECT_TO_WEB ||
|
|
12259
|
+
state === ResponseStateV2.WEB_FALLBACK_REQUIRED;
|
|
12260
|
+
const error = normalizeServerErrorV2(json);
|
|
12261
|
+
// Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
|
|
12262
|
+
json.correlationId = correlationId;
|
|
12263
|
+
return {
|
|
12264
|
+
statusCode: response.status,
|
|
12265
|
+
correlationId,
|
|
12266
|
+
continuationToken,
|
|
12267
|
+
isWebFallbackRequired,
|
|
12268
|
+
error,
|
|
12269
|
+
body: json,
|
|
12270
|
+
};
|
|
12271
|
+
}
|
|
12272
|
+
// Required href; throws when it is absent.
|
|
12273
|
+
requireHref(href, relation, correlationId, missingHrefError) {
|
|
12274
|
+
if (!href) {
|
|
12275
|
+
const errorCode = missingHrefError?.code ?? INVALID_HAL_RESPONSE;
|
|
12276
|
+
const errorMessage = missingHrefError?.message ??
|
|
12277
|
+
`Invalid HAL response: missing '${relation}' link`;
|
|
12278
|
+
this.logger?.error(errorMessage, correlationId);
|
|
12279
|
+
throw new CustomAuthApiError(errorCode, errorMessage, correlationId);
|
|
12280
|
+
}
|
|
12281
|
+
return href;
|
|
12282
|
+
}
|
|
12283
|
+
// Required continuation token to advance the flow; throws when absent.
|
|
12284
|
+
requireContinuationToken(continuationToken, correlationId) {
|
|
12285
|
+
if (!continuationToken) {
|
|
12286
|
+
this.logger?.error("V2 HAL response is missing the required continuation token", correlationId);
|
|
12287
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response", correlationId);
|
|
12288
|
+
}
|
|
12289
|
+
return continuationToken;
|
|
12290
|
+
}
|
|
12291
|
+
// Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
|
|
12292
|
+
requireMethods(methods, correlationId) {
|
|
12293
|
+
if (!methods?.length) {
|
|
12294
|
+
this.logger?.error("V2 HAL response is missing the required embedded authentication methods", correlationId);
|
|
12295
|
+
throw new CustomAuthApiError(NO_AUTHENTICATION_METHODS, "Invalid HAL response: no embedded authentication methods", correlationId);
|
|
12296
|
+
}
|
|
12297
|
+
return methods;
|
|
12298
|
+
}
|
|
12299
|
+
async parseBody(response, correlationId) {
|
|
12300
|
+
let json;
|
|
12301
|
+
try {
|
|
12302
|
+
json = await response.json();
|
|
12303
|
+
}
|
|
12304
|
+
catch (e) {
|
|
12305
|
+
this.logger?.error("V2 response serialization failed: body is not valid JSON", correlationId);
|
|
12306
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, `V2 response body is not valid JSON: '${e}'`, correlationId);
|
|
12307
|
+
}
|
|
12308
|
+
// response.json() accepts primitives/arrays; every V2 body must be a JSON object.
|
|
12309
|
+
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
12310
|
+
this.logger?.error("V2 response serialization failed: body is not a JSON object", correlationId);
|
|
12311
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "V2 response body is not a JSON object", correlationId);
|
|
12312
|
+
}
|
|
12313
|
+
return json;
|
|
12314
|
+
}
|
|
12315
|
+
}
|
|
12316
|
+
|
|
12317
|
+
/*
|
|
12318
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12319
|
+
* Licensed under the MIT License.
|
|
12320
|
+
*/
|
|
12321
|
+
const API_MARKERS = ["/api/", "/oauth2/"];
|
|
12322
|
+
/*
|
|
12323
|
+
* Resolves a HAL href against the configured authority. Absolute HTTP(S) URLs
|
|
12324
|
+
* pass through; relative URLs retain their API path and query while using the
|
|
12325
|
+
* configured tenant path.
|
|
12326
|
+
*
|
|
12327
|
+
* TODO: Remove tenant-path rewriting once the service consistently returns links that can be
|
|
12328
|
+
* resolved directly against the configured authority.
|
|
12329
|
+
*/
|
|
12330
|
+
function resolveHrefV2(base, href) {
|
|
12331
|
+
const trimmed = href.trim();
|
|
12332
|
+
if (!trimmed) {
|
|
12333
|
+
throw new ParsedUrlError(InvalidUrl, "The HAL href cannot be empty");
|
|
12334
|
+
}
|
|
12335
|
+
const absolute = tryParseAbsolute(trimmed);
|
|
12336
|
+
if (absolute) {
|
|
12337
|
+
return absolute;
|
|
12338
|
+
}
|
|
12339
|
+
let resolved;
|
|
12340
|
+
try {
|
|
12341
|
+
resolved = new URL(trimmed, base.origin);
|
|
12342
|
+
}
|
|
12343
|
+
catch (e) {
|
|
12344
|
+
throw new ParsedUrlError(InvalidUrl, `The HAL href "${href}" could not be resolved: ${e}`);
|
|
12345
|
+
}
|
|
12346
|
+
if (resolved.protocol !== "http:" && resolved.protocol !== "https:") {
|
|
12347
|
+
throw new ParsedUrlError(InvalidUrl, `The HAL href "${href}" must use the HTTP or HTTPS protocol`);
|
|
12348
|
+
}
|
|
12349
|
+
const tenantPath = base.pathname.endsWith("/")
|
|
12350
|
+
? base.pathname.slice(0, -1)
|
|
12351
|
+
: base.pathname;
|
|
12352
|
+
resolved.pathname = tenantPath + apiPath(resolved.pathname);
|
|
12353
|
+
return resolved;
|
|
12354
|
+
}
|
|
12355
|
+
function tryParseAbsolute(href) {
|
|
12356
|
+
try {
|
|
12357
|
+
const url = new URL(href);
|
|
12358
|
+
return url.protocol === "http:" || url.protocol === "https:"
|
|
12359
|
+
? url
|
|
12360
|
+
: undefined;
|
|
12361
|
+
}
|
|
12362
|
+
catch {
|
|
12363
|
+
return undefined;
|
|
12364
|
+
}
|
|
12365
|
+
}
|
|
12366
|
+
function apiPath(path) {
|
|
12367
|
+
for (const marker of API_MARKERS) {
|
|
12368
|
+
const index = path.indexOf(marker);
|
|
12369
|
+
if (index >= 0) {
|
|
12370
|
+
return path.slice(index);
|
|
12371
|
+
}
|
|
12372
|
+
}
|
|
12373
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
12374
|
+
}
|
|
12375
|
+
|
|
12376
|
+
/*
|
|
12377
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12378
|
+
* Licensed under the MIT License.
|
|
12379
|
+
*/
|
|
12380
|
+
const SIGNIN_INITIATE = "/oauth2/v2.0/initiate";
|
|
12381
|
+
const SIGNIN_CHALLENGE = "/oauth2/v2.0/challenge";
|
|
12382
|
+
const SIGNIN_TOKEN = "/oauth2/v2.0/token";
|
|
12383
|
+
const SIGNIN_INTROSPECT = "/oauth2/v2.0/introspect";
|
|
12384
|
+
const AUTHORIZE_CHALLENGE = "/oauth2/v2.0/authorize-challenge";
|
|
12385
|
+
const SIGNUP_START = "/signup/v1.0/start";
|
|
12386
|
+
const SIGNUP_CHALLENGE = "/signup/v1.0/challenge";
|
|
12387
|
+
const SIGNUP_CONTINUE = "/signup/v1.0/continue";
|
|
12388
|
+
const RESET_PWD_START = "/resetpassword/v1.0/start";
|
|
12389
|
+
const RESET_PWD_CHALLENGE = "/resetpassword/v1.0/challenge";
|
|
12390
|
+
const RESET_PWD_CONTINUE = "/resetpassword/v1.0/continue";
|
|
12391
|
+
const RESET_PWD_SUBMIT = "/resetpassword/v1.0/submit";
|
|
12392
|
+
const RESET_PWD_POLL = "/resetpassword/v1.0/poll_completion";
|
|
12393
|
+
const REGISTER_INTROSPECT = "/register/v1.0/introspect";
|
|
12394
|
+
const REGISTER_CHALLENGE = "/register/v1.0/challenge";
|
|
12395
|
+
const REGISTER_CONTINUE = "/register/v1.0/continue";
|
|
12396
|
+
|
|
12397
|
+
/*
|
|
12398
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12399
|
+
* Licensed under the MIT License.
|
|
12400
|
+
*/
|
|
12401
|
+
/*
|
|
12402
|
+
* Shared Native Auth V2 network client for OAuth and HAL requests.
|
|
12403
|
+
* Handles serialization, headers, error normalization, and server-provided links.
|
|
12404
|
+
*/
|
|
12405
|
+
class BaseApiClientV2 {
|
|
12406
|
+
constructor(baseUrl, clientId, httpClient, customAuthApiQueryParams, requestInterceptor, logger) {
|
|
12407
|
+
this.clientId = clientId;
|
|
12408
|
+
this.httpClient = httpClient;
|
|
12409
|
+
this.customAuthApiQueryParams = customAuthApiQueryParams;
|
|
12410
|
+
this.requestInterceptor = requestInterceptor;
|
|
12411
|
+
this.logger = logger;
|
|
12412
|
+
this.baseRequestUrl = parseUrl(!baseUrl.endsWith("/") ? `${baseUrl}/` : baseUrl);
|
|
12413
|
+
this.handler = new ResponseHandlerV2(logger);
|
|
12414
|
+
}
|
|
12415
|
+
/*
|
|
12416
|
+
* Starts authorization and returns the initial continuation token and flow links.
|
|
12417
|
+
*/
|
|
12418
|
+
async authorizeChallengeStart(context, scopes) {
|
|
12419
|
+
const request = {
|
|
12420
|
+
client_id: this.clientId,
|
|
12421
|
+
};
|
|
12422
|
+
if (scopes?.length) {
|
|
12423
|
+
request.scope = scopes.join(" ");
|
|
12424
|
+
}
|
|
12425
|
+
const parsedResponse = await this.postOAuthForm(AUTHORIZE_CHALLENGE, request, context);
|
|
12426
|
+
const { continuationToken, correlationId, error, body } = parsedResponse;
|
|
12427
|
+
/*
|
|
12428
|
+
* No token means a genuine server error: surface the normalized server error directly. The
|
|
12429
|
+
* fallback code/message only applies to a malformed response that carries neither a token
|
|
12430
|
+
* nor an error.
|
|
12431
|
+
*/
|
|
12432
|
+
if (!continuationToken) {
|
|
12433
|
+
const apiError = error
|
|
12434
|
+
? this.toApiError(error, correlationId)
|
|
12435
|
+
: new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response", correlationId);
|
|
12436
|
+
this.logger?.error(`V2 authorize-challenge entry failed: '${apiError.error}'`, correlationId);
|
|
12437
|
+
throw apiError;
|
|
12438
|
+
}
|
|
12439
|
+
return {
|
|
12440
|
+
continuationToken,
|
|
12441
|
+
resetPasswordHref: body.reset_password,
|
|
12442
|
+
signInHref: body.sign_in,
|
|
12443
|
+
signUpHref: body.sign_up,
|
|
12444
|
+
};
|
|
12445
|
+
}
|
|
12446
|
+
/*
|
|
12447
|
+
* Redeems a continuation token for an authorization code and then tokens.
|
|
12448
|
+
*/
|
|
12449
|
+
async completeWithTokens(request, context) {
|
|
12450
|
+
const code = await this.authorizeChallengeContinue(request.continuationToken, context);
|
|
12451
|
+
return this.token(code, request.scopes, context);
|
|
12452
|
+
}
|
|
12453
|
+
/*
|
|
12454
|
+
* Redeems a continuation token for an authorization code.
|
|
12455
|
+
*/
|
|
12456
|
+
async authorizeChallengeContinue(continuationToken, context) {
|
|
12457
|
+
const request = {
|
|
12458
|
+
continuation_token: continuationToken,
|
|
12459
|
+
};
|
|
12460
|
+
const parsedResponse = await this.postOAuthForm(AUTHORIZE_CHALLENGE, request, context);
|
|
12461
|
+
this.throwOnApiError(parsedResponse);
|
|
12462
|
+
const code = parsedResponse.body.code;
|
|
12463
|
+
if (!code) {
|
|
12464
|
+
this.logger?.error("V2 authorize-challenge continue response is missing the authorization code", parsedResponse.correlationId);
|
|
12465
|
+
throw new CustomAuthApiError(AUTH_CODE_MISSING, "Authorization code is missing in the response body", parsedResponse.correlationId);
|
|
12466
|
+
}
|
|
12467
|
+
return code;
|
|
12468
|
+
}
|
|
12469
|
+
/*
|
|
12470
|
+
* Exchanges an authorization code for tokens.
|
|
12471
|
+
*/
|
|
12472
|
+
async token(code, scopes, context) {
|
|
12473
|
+
const request = {
|
|
12474
|
+
client_id: this.clientId,
|
|
12475
|
+
grant_type: GrantType$1.AUTHORIZATION_CODE_GRANT,
|
|
12476
|
+
code,
|
|
12477
|
+
// Required so the server returns the client_info blob MSAL uses to build the home account id.
|
|
12478
|
+
client_info: "1",
|
|
12479
|
+
};
|
|
12480
|
+
if (scopes.length > 0) {
|
|
12481
|
+
request.scope = scopes.join(" ");
|
|
12482
|
+
}
|
|
12483
|
+
const parsedResponse = await this.postOAuthForm(SIGNIN_TOKEN, request, context);
|
|
12484
|
+
this.throwOnApiError(parsedResponse);
|
|
12485
|
+
this.ensureTokenResponseIsValid(parsedResponse.body, parsedResponse.correlationId);
|
|
12486
|
+
return parsedResponse.body;
|
|
12487
|
+
}
|
|
12488
|
+
/*
|
|
12489
|
+
* Sends a JSON action request to a server-provided link.
|
|
12490
|
+
*/
|
|
12491
|
+
async sendActionRequest(href, method, body, context) {
|
|
12492
|
+
if (!body.continuationToken) {
|
|
12493
|
+
this.logger?.error("V2 HAL request is missing the continuation token that threads the flow forward", context.correlationId);
|
|
12494
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "The HAL request body did not include a continuation token, so the server-driven reset flow cannot advance", context.correlationId);
|
|
12495
|
+
}
|
|
12496
|
+
const url = resolveHrefV2(this.baseRequestUrl, href);
|
|
12497
|
+
const response = await this.sendRequest(url, method, JSON.stringify(body), JSON_CONTENT_TYPE, context);
|
|
12498
|
+
const parsedResponse = await this.handler.parseResponse(response, context.correlationId);
|
|
12499
|
+
this.throwOnWebFallback(parsedResponse);
|
|
12500
|
+
this.throwOnApiError(parsedResponse);
|
|
12501
|
+
return parsedResponse;
|
|
12502
|
+
}
|
|
12503
|
+
throwOnApiError(parsedResponse) {
|
|
12504
|
+
if (parsedResponse.error) {
|
|
12505
|
+
const apiError = this.toApiError(parsedResponse.error, parsedResponse.correlationId);
|
|
12506
|
+
this.logger?.error(`V2 API returned an error: '${apiError.error}'`, parsedResponse.correlationId);
|
|
12507
|
+
throw apiError;
|
|
12508
|
+
}
|
|
12509
|
+
}
|
|
12510
|
+
async postOAuthForm(endpoint, data, context) {
|
|
12511
|
+
const formData = new URLSearchParams(Object.entries(data));
|
|
12512
|
+
const url = buildUrl(this.baseRequestUrl.href, endpoint, this.customAuthApiQueryParams);
|
|
12513
|
+
const response = await this.sendRequest(url, HttpMethod.POST, formData, URL_FORM_CONTENT_TYPE, context);
|
|
12514
|
+
const parsedResponse = await this.handler.parseResponse(response, context.correlationId);
|
|
12515
|
+
this.throwOnWebFallback(parsedResponse);
|
|
12516
|
+
return parsedResponse;
|
|
12517
|
+
}
|
|
12518
|
+
async sendRequest(url, method, body, contentType, context) {
|
|
12519
|
+
const headers = {
|
|
12520
|
+
...this.getCommonHeaders(context.correlationId, context.telemetryManager, contentType),
|
|
12521
|
+
...(await this.getAdditionalHeaders(url, context.correlationId)),
|
|
12522
|
+
};
|
|
12523
|
+
try {
|
|
12524
|
+
return await this.httpClient.sendAsync(url, {
|
|
12525
|
+
method,
|
|
12526
|
+
body,
|
|
12527
|
+
headers,
|
|
12528
|
+
});
|
|
12529
|
+
}
|
|
12530
|
+
catch (e) {
|
|
12531
|
+
throw new CustomAuthApiError(HTTP_REQUEST_FAILED, `Failed to send request to '${url}': '${e}'`, context.correlationId);
|
|
12532
|
+
}
|
|
12533
|
+
}
|
|
12534
|
+
toApiError(serverError, correlationId) {
|
|
12535
|
+
return new CustomAuthApiError(serverError.code, serverError.message ?? "", serverError.correlationId ?? correlationId, serverError.errorCodes, serverError.innerErrorCode, undefined, undefined, serverError.traceId, serverError.timestamp, serverError.attributeValidationDetails);
|
|
12536
|
+
}
|
|
12537
|
+
throwOnWebFallback(parsedResponse) {
|
|
12538
|
+
if (parsedResponse.isWebFallbackRequired) {
|
|
12539
|
+
throw new CustomAuthApiError(REDIRECT_TO_WEB, "The server requires the flow to continue in a web browser", parsedResponse.correlationId);
|
|
12540
|
+
}
|
|
12541
|
+
}
|
|
12542
|
+
ensureTokenResponseIsValid(tokenResponse, correlationId) {
|
|
12543
|
+
if (!tokenResponse.access_token) {
|
|
12544
|
+
throw new CustomAuthApiError(INVALID_TOKEN_RESPONSE, "Access token is missing in the response body", correlationId);
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12547
|
+
getCommonHeaders(correlationId, telemetryManager, contentType) {
|
|
12548
|
+
return {
|
|
12549
|
+
[HttpHeaderKeys.CONTENT_TYPE]: contentType,
|
|
12550
|
+
[X_CLIENT_SKU]: DefaultPackageInfo.SKU,
|
|
12551
|
+
[X_CLIENT_VER]: DefaultPackageInfo.VERSION,
|
|
12552
|
+
[X_CLIENT_OS]: DefaultPackageInfo.OS,
|
|
12553
|
+
[X_CLIENT_CPU]: DefaultPackageInfo.CPU,
|
|
12554
|
+
[X_CLIENT_CURR_TELEM]: telemetryManager.generateCurrentRequestHeaderValue(),
|
|
12555
|
+
[X_CLIENT_LAST_TELEM]: telemetryManager.generateLastRequestHeaderValue(),
|
|
12556
|
+
[CLIENT_REQUEST_ID]: correlationId,
|
|
12557
|
+
};
|
|
12558
|
+
}
|
|
12559
|
+
async getAdditionalHeaders(url, correlationId) {
|
|
12560
|
+
if (!this.requestInterceptor) {
|
|
12561
|
+
return {};
|
|
12562
|
+
}
|
|
12563
|
+
try {
|
|
12564
|
+
const result = await Promise.resolve(this.requestInterceptor.addAdditionalHeaderFields(url));
|
|
12565
|
+
return filterCustomHeaders(result, this.logger, correlationId);
|
|
12566
|
+
}
|
|
12567
|
+
catch (e) {
|
|
12568
|
+
this.logger?.warningPii(`CustomAuthRequestInterceptor.addAdditionalHeaderFields threw an error; continuing without additional headers: '${e}'`, correlationId);
|
|
12569
|
+
return {};
|
|
12570
|
+
}
|
|
12571
|
+
}
|
|
12572
|
+
}
|
|
12573
|
+
|
|
12574
|
+
/*
|
|
12575
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12576
|
+
* Licensed under the MIT License.
|
|
12577
|
+
*/
|
|
12578
|
+
const AuthenticationFactorV2 = {
|
|
12579
|
+
SINGLE_FACTOR: "singleFactor",
|
|
12580
|
+
MULTI_FACTOR: "multiFactor",
|
|
12581
|
+
};
|
|
12582
|
+
const ChallengeNextActionV2 = {
|
|
12583
|
+
VERIFY: "verify",
|
|
12584
|
+
RISK_VERIFY: "riskVerify",
|
|
12585
|
+
};
|
|
12586
|
+
const VerifyNextActionV2 = {
|
|
12587
|
+
UPDATE: "update",
|
|
12588
|
+
CONTINUE: "continue",
|
|
12589
|
+
CHALLENGE: "challenge",
|
|
12590
|
+
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12591
|
+
};
|
|
12592
|
+
|
|
12593
|
+
/*
|
|
12594
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12595
|
+
* Licensed under the MIT License.
|
|
12596
|
+
*/
|
|
12597
|
+
const SignUpSubmitAttributesNextActionV2 = {
|
|
12598
|
+
VERIFY: "verify",
|
|
12599
|
+
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12600
|
+
CONTINUE: "continue",
|
|
12601
|
+
};
|
|
12602
|
+
|
|
12603
|
+
/*
|
|
12604
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12605
|
+
* Licensed under the MIT License.
|
|
12606
|
+
*/
|
|
12607
|
+
/*
|
|
12608
|
+
* Native Auth V2 network client that follows server-provided HAL links.
|
|
12609
|
+
* Flow-specific entry methods reuse shared challenge, verification, and token operations.
|
|
12610
|
+
*/
|
|
12611
|
+
class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
12612
|
+
/*
|
|
12613
|
+
* Starts the reset-password flow using a server-provided link.
|
|
12614
|
+
*/
|
|
12615
|
+
async resetPasswordStart(resetPasswordHref, request, context) {
|
|
12616
|
+
return this.sendStartRequest(resetPasswordHref, request, context);
|
|
12617
|
+
}
|
|
12618
|
+
/*
|
|
12619
|
+
* Starts sign-in using a server-provided link.
|
|
12620
|
+
*/
|
|
12621
|
+
async signInStart(signInHref, request, context) {
|
|
12622
|
+
const result = await this.sendStartRequest(signInHref, request, context);
|
|
12623
|
+
return result;
|
|
12624
|
+
}
|
|
12625
|
+
/*
|
|
12626
|
+
* Starts sign-up using a server-provided link.
|
|
12627
|
+
*/
|
|
12628
|
+
async signUpStart(signUpHref, request, context) {
|
|
12629
|
+
const parsedResponse = await this.sendActionRequest(signUpHref, HttpMethod.POST, request, context);
|
|
12630
|
+
return {
|
|
12631
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
12632
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", parsedResponse.correlationId),
|
|
12633
|
+
attributes: parsedResponse.body.attributes,
|
|
12634
|
+
};
|
|
12635
|
+
}
|
|
12636
|
+
/*
|
|
12637
|
+
* Submits the initial sign-up attributes. A successful response has already
|
|
12638
|
+
* sent the email code and supplies the links needed to verify or resend it.
|
|
12639
|
+
*/
|
|
12640
|
+
async submitSignUpAttributes(submitAttributesHref, request, context) {
|
|
12641
|
+
const parsedResponse = await this.sendActionRequest(submitAttributesHref, HttpMethod.POST, request, context);
|
|
12642
|
+
const correlationId = parsedResponse.correlationId;
|
|
12643
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
12644
|
+
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
12645
|
+
return {
|
|
12646
|
+
nextAction: SignUpSubmitAttributesNextActionV2.CONTINUE,
|
|
12647
|
+
continuationToken,
|
|
12648
|
+
};
|
|
12649
|
+
}
|
|
12650
|
+
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
12651
|
+
return {
|
|
12652
|
+
nextAction: SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES,
|
|
12653
|
+
continuationToken,
|
|
12654
|
+
attributes: parsedResponse.body.attributes ?? [],
|
|
12655
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
12656
|
+
};
|
|
12657
|
+
}
|
|
12658
|
+
if (parsedResponse.body.action === VERIFY_RELATION) {
|
|
12659
|
+
return {
|
|
12660
|
+
...this.toChallengeVerificationResult(parsedResponse),
|
|
12661
|
+
attributes: parsedResponse.body.attributes,
|
|
12662
|
+
};
|
|
12663
|
+
}
|
|
12664
|
+
const message = "Invalid HAL response: sign-up attribute submission returned no known next action";
|
|
12665
|
+
this.logger?.error(message, correlationId);
|
|
12666
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
12667
|
+
}
|
|
12668
|
+
/*
|
|
12669
|
+
* Requests the selected method's challenge and returns the data needed for verification.
|
|
12670
|
+
*/
|
|
12671
|
+
async requestChallenge(challengeHref, request, context) {
|
|
12672
|
+
const parsedResponse = await this.sendActionRequest(challengeHref, HttpMethod.POST, request, context);
|
|
12673
|
+
return this.toChallengeResult(parsedResponse);
|
|
12674
|
+
}
|
|
12675
|
+
async verifyRisk(riskVerifyHref, request, context) {
|
|
12676
|
+
const parsedResponse = await this.sendActionRequest(riskVerifyHref, HttpMethod.POST, request, context);
|
|
12677
|
+
if (parsedResponse.body.action !== VERIFY_RELATION) {
|
|
12678
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: SMS risk verification returned no known next action", parsedResponse.correlationId);
|
|
12679
|
+
}
|
|
12680
|
+
if (parsedResponse.body.type?.toLowerCase() !==
|
|
12681
|
+
AuthenticationMethodTypeV2.SMS) {
|
|
12682
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: SMS risk verification returned a non-SMS challenge", parsedResponse.correlationId);
|
|
12683
|
+
}
|
|
12684
|
+
return this.toChallengeVerificationResult(parsedResponse);
|
|
12685
|
+
}
|
|
12686
|
+
/*
|
|
12687
|
+
* Verifies the submitted credential and returns the server-directed next action.
|
|
12688
|
+
*/
|
|
12689
|
+
async verifyChallenge(verifyHref, request, context) {
|
|
12690
|
+
const parsedResponse = await this.sendActionRequest(verifyHref, HttpMethod.POST, request, context);
|
|
12691
|
+
return this.toVerifyResult(parsedResponse);
|
|
12692
|
+
}
|
|
12693
|
+
/*
|
|
12694
|
+
* Submits the new password and returns the link used to poll for completion.
|
|
12695
|
+
*/
|
|
12696
|
+
async submitNewPassword(updateHref, request, context) {
|
|
12697
|
+
const parsedResponse = await this.sendActionRequest(updateHref, HttpMethod.PUT, request, context);
|
|
12698
|
+
const nextContinuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12699
|
+
return {
|
|
12700
|
+
continuationToken: nextContinuationToken,
|
|
12701
|
+
pollHref: this.handler.requireHref(parsedResponse.body._links?.poll?.href, "poll", parsedResponse.correlationId),
|
|
12702
|
+
};
|
|
12703
|
+
}
|
|
12704
|
+
/*
|
|
12705
|
+
* Polls once for reset completion and returns the next server-provided link.
|
|
12706
|
+
*/
|
|
12707
|
+
async poll(pollHref, request, context) {
|
|
12708
|
+
const parsedResponse = await this.sendActionRequest(pollHref, HttpMethod.POST, request, context);
|
|
12709
|
+
const isCompleted = parsedResponse.body.state === ResponseStateV2.CONTINUE;
|
|
12710
|
+
return {
|
|
12711
|
+
continuationToken: parsedResponse.continuationToken ?? request.continuationToken,
|
|
12712
|
+
isCompleted,
|
|
12713
|
+
pollHref: isCompleted
|
|
12714
|
+
? undefined
|
|
12715
|
+
: this.handler.requireHref(parsedResponse.body._links?.poll?.href, "poll", parsedResponse.correlationId),
|
|
12716
|
+
};
|
|
12717
|
+
}
|
|
12718
|
+
async sendStartRequest(startHref, request, context) {
|
|
12719
|
+
const parsedResponse = await this.sendActionRequest(startHref, HttpMethod.POST, request, context);
|
|
12720
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12721
|
+
return {
|
|
12722
|
+
continuationToken,
|
|
12723
|
+
methods: this.resolveMethods(parsedResponse.body, parsedResponse.correlationId),
|
|
12724
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
|
|
12725
|
+
scenario: parsedResponse.body.scenario,
|
|
12726
|
+
};
|
|
12727
|
+
}
|
|
12728
|
+
toVerifyResult(parsedResponse) {
|
|
12729
|
+
const correlationId = parsedResponse.correlationId;
|
|
12730
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
12731
|
+
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
12732
|
+
return {
|
|
12733
|
+
nextAction: VerifyNextActionV2.CONTINUE,
|
|
12734
|
+
continuationToken,
|
|
12735
|
+
};
|
|
12736
|
+
}
|
|
12737
|
+
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
12738
|
+
return {
|
|
12739
|
+
nextAction: VerifyNextActionV2.COLLECT_ATTRIBUTES,
|
|
12740
|
+
continuationToken,
|
|
12741
|
+
attributes: parsedResponse.body.attributes ?? [],
|
|
12742
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
12743
|
+
};
|
|
12744
|
+
}
|
|
12745
|
+
if (parsedResponse.body.action === UPDATE_RELATION) {
|
|
12746
|
+
return {
|
|
12747
|
+
nextAction: VerifyNextActionV2.UPDATE,
|
|
12748
|
+
continuationToken,
|
|
12749
|
+
updateHref: this.handler.requireHref(parsedResponse.body._links?.update?.href, "update", correlationId),
|
|
12750
|
+
};
|
|
12751
|
+
}
|
|
12752
|
+
if (parsedResponse.body.action === CHALLENGE_RELATION) {
|
|
12753
|
+
return {
|
|
12754
|
+
nextAction: VerifyNextActionV2.CHALLENGE,
|
|
12755
|
+
continuationToken,
|
|
12756
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
|
|
12757
|
+
methods: this.resolveMethods(parsedResponse.body, correlationId),
|
|
12758
|
+
};
|
|
12759
|
+
}
|
|
12760
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: verify returned no known next action", correlationId);
|
|
12761
|
+
}
|
|
12762
|
+
resolveAuthenticationFactor(authenticationFactor, correlationId) {
|
|
12763
|
+
if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR ||
|
|
12764
|
+
authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
|
|
12765
|
+
return authenticationFactor;
|
|
12766
|
+
}
|
|
12767
|
+
const message = authenticationFactor
|
|
12768
|
+
? `Unexpected authentication factor '${authenticationFactor}'.`
|
|
12769
|
+
: "The response did not include an authentication factor.";
|
|
12770
|
+
this.logger?.error(message, correlationId);
|
|
12771
|
+
throw new CustomAuthApiError(UNEXPECTED_AUTHENTICATION_FACTOR, message, correlationId);
|
|
12772
|
+
}
|
|
12773
|
+
toChallengeResult(parsedResponse) {
|
|
12774
|
+
if (parsedResponse.body.action === RISK_VERIFY_RELATION) {
|
|
12775
|
+
const riskResponse = parsedResponse.body;
|
|
12776
|
+
return {
|
|
12777
|
+
nextAction: ChallengeNextActionV2.RISK_VERIFY,
|
|
12778
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
12779
|
+
riskVerifyHref: this.handler.requireHref(riskResponse._links?.riskverify?.href, RISK_VERIFY_RELATION, parsedResponse.correlationId),
|
|
12780
|
+
};
|
|
12781
|
+
}
|
|
12782
|
+
if (parsedResponse.body.action === VERIFY_RELATION) {
|
|
12783
|
+
return this.toChallengeVerificationResult(parsedResponse);
|
|
12784
|
+
}
|
|
12785
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: challenge returned no known next action", parsedResponse.correlationId);
|
|
12786
|
+
}
|
|
12787
|
+
toChallengeVerificationResult(parsedResponse) {
|
|
12788
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12789
|
+
const links = parsedResponse.body._links;
|
|
12790
|
+
const codeMetadata = "hint" in parsedResponse.body ||
|
|
12791
|
+
"codeLength" in parsedResponse.body ||
|
|
12792
|
+
"payload" in parsedResponse.body
|
|
12793
|
+
? parsedResponse.body
|
|
12794
|
+
: undefined;
|
|
12795
|
+
return {
|
|
12796
|
+
nextAction: ChallengeNextActionV2.VERIFY,
|
|
12797
|
+
continuationToken,
|
|
12798
|
+
verifyHref: this.handler.requireHref(links?.verify?.href, "verify", parsedResponse.correlationId),
|
|
12799
|
+
resendHref: links && "resend" in links ? links.resend?.href : undefined,
|
|
12800
|
+
codeLength: codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength,
|
|
12801
|
+
hint: codeMetadata?.hint,
|
|
12802
|
+
type: parsedResponse.body.type,
|
|
12803
|
+
};
|
|
12804
|
+
}
|
|
12805
|
+
resolveMethods(body, correlationId) {
|
|
12806
|
+
const methods = this.handler.requireMethods(body._embedded?.methods, correlationId);
|
|
12807
|
+
const resolved = [];
|
|
12808
|
+
methods.forEach((method, index) => {
|
|
12809
|
+
const href = method._links?.challenge?.href;
|
|
12810
|
+
if (href) {
|
|
12811
|
+
resolved.push({
|
|
12812
|
+
id: method.id ?? method.type ?? `method-${index}`,
|
|
12813
|
+
type: method.type,
|
|
12814
|
+
hint: method.hint,
|
|
12815
|
+
challengeHref: href,
|
|
12816
|
+
});
|
|
12817
|
+
}
|
|
12818
|
+
});
|
|
12819
|
+
if (resolved.length === 0) {
|
|
12820
|
+
this.logger?.error("V2 start response has no authentication method advertising a challenge link", correlationId);
|
|
12821
|
+
throw new CustomAuthApiError(NO_AUTHENTICATION_METHODS, "The flow-start response contains no authentication method with a challenge link", correlationId);
|
|
12822
|
+
}
|
|
12823
|
+
return resolved;
|
|
12824
|
+
}
|
|
12825
|
+
}
|
|
12826
|
+
|
|
12827
|
+
/*
|
|
12828
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12829
|
+
* Licensed under the MIT License.
|
|
12830
|
+
*/
|
|
12831
|
+
/*
|
|
12832
|
+
* Shared base for Native Auth V2 interaction clients. It extends
|
|
12833
|
+
* `StandardInteractionClient` for common browser infrastructure while keeping
|
|
12834
|
+
* V1 and V2 token handling independent.
|
|
12835
|
+
*/
|
|
12836
|
+
class InteractionClientBaseV2 extends StandardInteractionClient {
|
|
12837
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority) {
|
|
12838
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, "");
|
|
12839
|
+
this.customAuthAuthority = customAuthAuthority;
|
|
12840
|
+
this.tokenResponseHandler = new ResponseHandler(this.config.auth.clientId, this.browserStorage, this.browserCrypto, this.logger, this.performanceClient, null, null);
|
|
12841
|
+
}
|
|
12842
|
+
// Required by the base contract. After sign-in, use CustomAuthAccountData.getAccessToken().
|
|
12843
|
+
acquireToken(
|
|
12844
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12845
|
+
request) {
|
|
12846
|
+
throw new MethodNotImplementedError("InteractionClientBaseV2.acquireToken");
|
|
12847
|
+
}
|
|
12848
|
+
// Required by the base contract. After sign-in, use CustomAuthAccountData.signOut().
|
|
12849
|
+
logout(
|
|
12850
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12851
|
+
request) {
|
|
12852
|
+
throw new MethodNotImplementedError("InteractionClientBaseV2.logout");
|
|
12853
|
+
}
|
|
12854
|
+
getScopes(scopes) {
|
|
12855
|
+
const requestedScopes = scopes?.filter((scope) => !!scope) ?? [];
|
|
12856
|
+
const seenScopes = new Set(requestedScopes.map((scope) => scope.toLowerCase()));
|
|
12857
|
+
const defaultScopes = [
|
|
12858
|
+
OPENID_SCOPE,
|
|
12859
|
+
PROFILE_SCOPE,
|
|
12860
|
+
OFFLINE_ACCESS_SCOPE,
|
|
12861
|
+
];
|
|
12862
|
+
return [
|
|
12863
|
+
...requestedScopes,
|
|
12864
|
+
...defaultScopes.filter((scope) => !seenScopes.has(scope.toLowerCase())),
|
|
12865
|
+
];
|
|
12866
|
+
}
|
|
12867
|
+
async handleTokenResponse(tokenResponse, requestScopes, correlationId, apiId) {
|
|
12868
|
+
this.logger.verbose("Processing V2 token response.", correlationId);
|
|
12869
|
+
const requestTimestamp = Math.round(new Date().getTime() / 1000.0);
|
|
12870
|
+
const result = await this.tokenResponseHandler.handleServerTokenResponse(tokenResponse, this.customAuthAuthority, requestTimestamp, {
|
|
12871
|
+
authority: this.customAuthAuthority.canonicalAuthority,
|
|
12872
|
+
correlationId,
|
|
12873
|
+
scopes: requestScopes,
|
|
12874
|
+
}, apiId);
|
|
12875
|
+
return result;
|
|
12876
|
+
}
|
|
12877
|
+
createRequestContext(apiId, correlationId) {
|
|
12878
|
+
return {
|
|
12879
|
+
correlationId,
|
|
12880
|
+
telemetryManager: initializeServerTelemetryManager(apiId, this.config.auth.clientId, correlationId, this.browserStorage, this.logger),
|
|
12881
|
+
};
|
|
12882
|
+
}
|
|
12883
|
+
}
|
|
12884
|
+
|
|
12885
|
+
/*
|
|
12886
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12887
|
+
* Licensed under the MIT License.
|
|
12888
|
+
*/
|
|
12889
|
+
// Result type discriminators.
|
|
12890
|
+
const FLOW_METHOD_SELECTION_REQUIRED_V2 = "FlowMethodSelectionRequiredResultV2";
|
|
12891
|
+
const FLOW_CODE_REQUIRED_V2 = "FlowCodeRequiredResultV2";
|
|
12892
|
+
const FLOW_PASSWORD_REQUIRED_V2 = "FlowPasswordRequiredResultV2";
|
|
12893
|
+
const FLOW_SIGN_UP_PASSWORD_REQUIRED_V2 = "FlowSignUpPasswordRequiredResultV2";
|
|
12894
|
+
const FLOW_MFA_REQUIRED_V2 = "FlowMFARequiredResultV2";
|
|
12895
|
+
const FLOW_NEW_PASSWORD_REQUIRED_V2 = "FlowNewPasswordRequiredResultV2";
|
|
12896
|
+
const FLOW_ATTRIBUTES_REQUIRED_V2 = "FlowAttributesRequiredResultV2";
|
|
12897
|
+
const FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 = "FlowSignInContinuationRequiredResultV2";
|
|
12898
|
+
const FLOW_COMPLETED_V2 = "FlowCompletedResultV2";
|
|
12899
|
+
function createFlowMethodSelectionRequiredResultV2(input) {
|
|
12900
|
+
return { type: FLOW_METHOD_SELECTION_REQUIRED_V2, ...input };
|
|
12901
|
+
}
|
|
12902
|
+
function createFlowCodeRequiredResultV2(input) {
|
|
12903
|
+
return { type: FLOW_CODE_REQUIRED_V2, ...input };
|
|
12904
|
+
}
|
|
12905
|
+
function createFlowPasswordRequiredResultV2(input) {
|
|
12906
|
+
return { type: FLOW_PASSWORD_REQUIRED_V2, ...input };
|
|
12907
|
+
}
|
|
12908
|
+
function createFlowSignUpPasswordRequiredResultV2(input) {
|
|
12909
|
+
return { type: FLOW_SIGN_UP_PASSWORD_REQUIRED_V2, ...input };
|
|
12910
|
+
}
|
|
12911
|
+
function createFlowMFARequiredResultV2(input) {
|
|
12912
|
+
return { type: FLOW_MFA_REQUIRED_V2, ...input };
|
|
12913
|
+
}
|
|
12914
|
+
function createFlowNewPasswordRequiredResultV2(input) {
|
|
12915
|
+
return { type: FLOW_NEW_PASSWORD_REQUIRED_V2, ...input };
|
|
12916
|
+
}
|
|
12917
|
+
function createFlowAttributesRequiredResultV2(input) {
|
|
12918
|
+
return { type: FLOW_ATTRIBUTES_REQUIRED_V2, ...input };
|
|
12919
|
+
}
|
|
12920
|
+
function createFlowSignInContinuationRequiredResultV2(input) {
|
|
12921
|
+
return { type: FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2, ...input };
|
|
12922
|
+
}
|
|
12923
|
+
function createFlowCompletedResultV2(input) {
|
|
12924
|
+
return { type: FLOW_COMPLETED_V2, ...input };
|
|
12925
|
+
}
|
|
12926
|
+
|
|
12927
|
+
/*
|
|
12928
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12929
|
+
* Licensed under the MIT License.
|
|
12930
|
+
*/
|
|
12931
|
+
/**
|
|
12932
|
+
* The native auth V2 flow that a result or error originates from (sign-in,
|
|
12933
|
+
* sign-up, or password reset). It lets a shared result or error type report
|
|
12934
|
+
* which entry flow produced it; `Unknown` is used when the flow cannot be
|
|
12935
|
+
* determined.
|
|
12936
|
+
*/
|
|
12937
|
+
const CustomAuthFlowScenarioV2 = {
|
|
12938
|
+
SignIn: "signIn",
|
|
12939
|
+
SignUp: "signUp",
|
|
12940
|
+
PasswordReset: "passwordReset",
|
|
12941
|
+
Unknown: "unknown",
|
|
12942
|
+
};
|
|
12943
|
+
|
|
12944
|
+
/*
|
|
12945
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12946
|
+
* Licensed under the MIT License.
|
|
12947
|
+
*/
|
|
12948
|
+
const FLOW_STEP_API_IDS_V2 = {
|
|
12949
|
+
[CustomAuthFlowScenarioV2.PasswordReset]: {
|
|
12950
|
+
requestChallenge: RESET_PASSWORD_V2_CHALLENGE,
|
|
12951
|
+
submitCode: RESET_PASSWORD_V2_SUBMIT_CODE,
|
|
12952
|
+
resendCode: RESET_PASSWORD_V2_RESEND_CODE,
|
|
12953
|
+
submitNewPassword: RESET_PASSWORD_V2_SUBMIT,
|
|
12954
|
+
signInWithContinuation: SIGN_IN_AFTER_PASSWORD_RESET,
|
|
12955
|
+
},
|
|
12956
|
+
[CustomAuthFlowScenarioV2.SignIn]: {
|
|
12957
|
+
requestChallenge: SIGN_IN_V2_CHALLENGE,
|
|
12958
|
+
submitCode: SIGN_IN_V2_SUBMIT_CODE,
|
|
12959
|
+
resendCode: SIGN_IN_V2_CHALLENGE,
|
|
12960
|
+
submitPassword: SIGN_IN_V2_SUBMIT_PASSWORD,
|
|
12961
|
+
signInWithContinuation: SIGN_IN_V2_COMPLETE,
|
|
12962
|
+
},
|
|
12963
|
+
[CustomAuthFlowScenarioV2.SignUp]: {
|
|
12964
|
+
requestChallenge: SIGN_UP_V2_CHALLENGE,
|
|
12965
|
+
submitCode: SIGN_UP_V2_SUBMIT_CODE,
|
|
12966
|
+
resendCode: SIGN_UP_V2_RESEND_CODE,
|
|
12967
|
+
submitAttributes: SIGN_UP_V2_SUBMIT_ATTRIBUTES,
|
|
12968
|
+
signInWithContinuation: SIGN_UP_V2_COMPLETE,
|
|
12969
|
+
},
|
|
12970
|
+
};
|
|
12971
|
+
function getPublicApiIdV2(scenario, step) {
|
|
12972
|
+
return FLOW_STEP_API_IDS_V2[scenario]?.[step];
|
|
12973
|
+
}
|
|
12974
|
+
|
|
12975
|
+
/*
|
|
12976
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12977
|
+
* Licensed under the MIT License.
|
|
12978
|
+
*/
|
|
12979
|
+
/*
|
|
12980
|
+
* Polls up to five times for password-update completion, waiting 1.5 seconds
|
|
12981
|
+
* between attempts. The first request runs immediately.
|
|
12982
|
+
*/
|
|
12983
|
+
const POLL_MAX_ATTEMPTS = 5;
|
|
12984
|
+
// TODO: Replace this fallback with the server-provided polling interval once available.
|
|
12985
|
+
const POLL_INTERVAL_MS = 1500;
|
|
12986
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
12987
|
+
/*
|
|
12988
|
+
* Drives server-directed Native Auth V2 flows using opaque continuation state
|
|
12989
|
+
* and HAL links. Each operation returns only its valid discriminated results.
|
|
12990
|
+
*/
|
|
12991
|
+
class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
12992
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority, apiClient) {
|
|
12993
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority);
|
|
12994
|
+
this.apiClient = apiClient;
|
|
12995
|
+
}
|
|
12996
|
+
/*
|
|
12997
|
+
* Starts sign-in using the preferred supported method offered by the server.
|
|
12998
|
+
*/
|
|
12999
|
+
async signIn(parameters) {
|
|
13000
|
+
const correlationId = parameters.correlationId;
|
|
13001
|
+
const context = this.createRequestContext(SIGN_IN_V2_START, correlationId);
|
|
13002
|
+
this.logger.verbose("Starting V2 sign-in.", correlationId);
|
|
13003
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context);
|
|
13004
|
+
const startResult = await this.apiClient.signInStart(this.requireLink(correlationId, entryResult.signInHref, {
|
|
13005
|
+
code: SIGN_IN_UNSUPPORTED,
|
|
13006
|
+
message: "The authorize-challenge entry response did not include a sign-in link.",
|
|
13007
|
+
}), {
|
|
13008
|
+
continuationToken: entryResult.continuationToken,
|
|
13009
|
+
username: parameters.username,
|
|
13010
|
+
}, context);
|
|
13011
|
+
this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "sign-in start", correlationId);
|
|
13012
|
+
const continuationState = {
|
|
13013
|
+
continuationToken: startResult.continuationToken,
|
|
13014
|
+
scenario: CustomAuthFlowScenarioV2.SignIn,
|
|
13015
|
+
links: {},
|
|
13016
|
+
tokenRequest: {
|
|
13017
|
+
scopes: parameters.scopes,
|
|
13018
|
+
},
|
|
13019
|
+
};
|
|
13020
|
+
const methods = startResult.methods.map((method) => ({
|
|
13021
|
+
id: method.id,
|
|
13022
|
+
type: method.type ?? "",
|
|
13023
|
+
hint: method.hint,
|
|
13024
|
+
challengeHref: method.challengeHref,
|
|
13025
|
+
}));
|
|
13026
|
+
const selectedMethod = this.selectSignInMethod(methods, parameters.password !== undefined, correlationId);
|
|
13027
|
+
const challengeResult = await this.requestChallenge({
|
|
13028
|
+
correlationId,
|
|
13029
|
+
continuationState: {
|
|
13030
|
+
...continuationState,
|
|
13031
|
+
links: {
|
|
13032
|
+
...continuationState.links,
|
|
13033
|
+
challenge: selectedMethod.challengeHref,
|
|
13034
|
+
},
|
|
13035
|
+
},
|
|
13036
|
+
});
|
|
13037
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2) {
|
|
13038
|
+
return {
|
|
13039
|
+
...challengeResult,
|
|
13040
|
+
method: selectedMethod,
|
|
13041
|
+
};
|
|
13042
|
+
}
|
|
13043
|
+
if (parameters.password) {
|
|
13044
|
+
return this.submitSignInPassword({
|
|
13045
|
+
correlationId,
|
|
13046
|
+
continuationState: challengeResult.continuationState,
|
|
13047
|
+
password: parameters.password,
|
|
13048
|
+
});
|
|
13049
|
+
}
|
|
13050
|
+
return challengeResult;
|
|
13051
|
+
}
|
|
13052
|
+
/*
|
|
13053
|
+
* Starts sign-up and resolves the server-provided attribute-submission transition.
|
|
13054
|
+
*/
|
|
13055
|
+
async signUp(parameters) {
|
|
13056
|
+
const correlationId = parameters.correlationId;
|
|
13057
|
+
const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
|
|
13058
|
+
this.logger.verbose("Starting V2 sign-up.", correlationId);
|
|
13059
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context, parameters.scopes);
|
|
13060
|
+
const startResult = await this.apiClient.signUpStart(this.requireLink(correlationId, entryResult.signUpHref, {
|
|
13061
|
+
code: SIGN_UP_UNSUPPORTED,
|
|
13062
|
+
message: "The authorize-challenge entry response did not include a sign-up link.",
|
|
13063
|
+
}), {
|
|
13064
|
+
continuationToken: entryResult.continuationToken,
|
|
13065
|
+
}, context);
|
|
13066
|
+
const attributes = Object.fromEntries(Object.entries(parameters.attributes ?? {}).filter(([name]) => name.toLowerCase() !== "email" &&
|
|
13067
|
+
name.toLowerCase() !== "password"));
|
|
13068
|
+
attributes.email = parameters.username;
|
|
13069
|
+
if (parameters.password !== undefined) {
|
|
13070
|
+
attributes.password = parameters.password;
|
|
13071
|
+
}
|
|
13072
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(startResult.submitAttributesHref, {
|
|
13073
|
+
continuationToken: startResult.continuationToken,
|
|
13074
|
+
attributes,
|
|
13075
|
+
}, context);
|
|
13076
|
+
const continuationState = {
|
|
13077
|
+
continuationToken: startResult.continuationToken,
|
|
13078
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
13079
|
+
links: {},
|
|
13080
|
+
tokenRequest: {
|
|
13081
|
+
scopes: parameters.scopes,
|
|
13082
|
+
},
|
|
13083
|
+
signUp: {
|
|
13084
|
+
passwordWasSupplied: attributes.password !== undefined,
|
|
13085
|
+
},
|
|
13086
|
+
};
|
|
13087
|
+
const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
|
|
13088
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
13089
|
+
const message = "Initial sign-up attribute submission cannot complete without code verification or additional attributes.";
|
|
13090
|
+
this.logger.error(message, correlationId);
|
|
13091
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13092
|
+
}
|
|
13093
|
+
return result;
|
|
13094
|
+
}
|
|
13095
|
+
/*
|
|
13096
|
+
* Starts password reset, automatically challenging a sole method or
|
|
13097
|
+
* returning multiple methods for selection.
|
|
13098
|
+
*/
|
|
13099
|
+
async resetPassword(parameters) {
|
|
13100
|
+
const correlationId = parameters.correlationId;
|
|
13101
|
+
const context = this.createRequestContext(RESET_PASSWORD_V2_START, correlationId);
|
|
13102
|
+
this.logger.verbose("Starting V2 self-service password reset.", correlationId);
|
|
13103
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context);
|
|
13104
|
+
const startResult = await this.apiClient.resetPasswordStart(this.requireLink(correlationId, entryResult.resetPasswordHref, {
|
|
13105
|
+
code: RESET_PASSWORD_UNSUPPORTED,
|
|
13106
|
+
message: "The authorize-challenge entry response did not include a reset-password link.",
|
|
13107
|
+
}), {
|
|
13108
|
+
username: parameters.username,
|
|
13109
|
+
continuationToken: entryResult.continuationToken,
|
|
13110
|
+
}, context);
|
|
13111
|
+
this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "password-reset start", correlationId);
|
|
13112
|
+
const continuationState = {
|
|
13113
|
+
continuationToken: startResult.continuationToken,
|
|
13114
|
+
scenario: CustomAuthFlowScenarioV2.PasswordReset,
|
|
13115
|
+
links: {},
|
|
13116
|
+
};
|
|
13117
|
+
const methods = startResult.methods.map((method) => ({
|
|
13118
|
+
id: method.id,
|
|
13119
|
+
type: method.type ?? "",
|
|
13120
|
+
hint: method.hint,
|
|
13121
|
+
challengeHref: method.challengeHref,
|
|
13122
|
+
}));
|
|
13123
|
+
if (methods.length === 0) {
|
|
13124
|
+
const message = "The password-reset start response did not include an authentication method.";
|
|
13125
|
+
this.logger.error(message, correlationId);
|
|
13126
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13127
|
+
}
|
|
13128
|
+
if (methods.length === 1) {
|
|
13129
|
+
const selectedMethod = methods[0];
|
|
13130
|
+
const challengeResult = await this.requestChallenge({
|
|
13131
|
+
correlationId,
|
|
13132
|
+
continuationState: {
|
|
13133
|
+
...continuationState,
|
|
13134
|
+
links: {
|
|
13135
|
+
challenge: selectedMethod.challengeHref,
|
|
13136
|
+
},
|
|
13137
|
+
},
|
|
13138
|
+
});
|
|
13139
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
13140
|
+
(challengeResult.channel?.toLowerCase() ===
|
|
13141
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
13142
|
+
challengeResult.channel?.toLowerCase() ===
|
|
13143
|
+
AuthenticationMethodTypeV2.SMS)) {
|
|
13144
|
+
return {
|
|
13145
|
+
...challengeResult,
|
|
13146
|
+
method: selectedMethod,
|
|
13147
|
+
};
|
|
13148
|
+
}
|
|
13149
|
+
const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
|
|
13150
|
+
? challengeResult.channel
|
|
13151
|
+
: AuthenticationMethodTypeV2.PASSWORD;
|
|
13152
|
+
const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
|
|
13153
|
+
this.logger.error(message, correlationId);
|
|
13154
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13155
|
+
}
|
|
13156
|
+
this.logger.verbose("V2 self-service password reset method selection required.", correlationId);
|
|
13157
|
+
return createFlowMethodSelectionRequiredResultV2({
|
|
13158
|
+
correlationId,
|
|
13159
|
+
continuationState,
|
|
13160
|
+
methods,
|
|
13161
|
+
});
|
|
13162
|
+
}
|
|
13163
|
+
/*
|
|
13164
|
+
* Requests a one-time code for the selected authentication method. Returns
|
|
13165
|
+
* the continuation state and code metadata needed for verification.
|
|
13166
|
+
*/
|
|
13167
|
+
async requestChallenge(parameters) {
|
|
13168
|
+
const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
|
|
13169
|
+
const challengeType = challengeResult.type ?? AuthenticationMethodTypeV2.EMAIL;
|
|
13170
|
+
const continuationState = this.createChallengeContinuationState(parameters.continuationState, challengeResult);
|
|
13171
|
+
if (challengeType.toLowerCase() === AuthenticationMethodTypeV2.PASSWORD) {
|
|
13172
|
+
return createFlowPasswordRequiredResultV2({
|
|
13173
|
+
correlationId: parameters.correlationId,
|
|
13174
|
+
continuationState,
|
|
13175
|
+
});
|
|
13176
|
+
}
|
|
13177
|
+
return createFlowCodeRequiredResultV2({
|
|
13178
|
+
correlationId: parameters.correlationId,
|
|
13179
|
+
continuationState,
|
|
13180
|
+
channel: challengeType,
|
|
13181
|
+
sentTo: challengeResult.hint,
|
|
13182
|
+
codeLength: challengeResult.codeLength,
|
|
13183
|
+
});
|
|
13184
|
+
}
|
|
13185
|
+
/*
|
|
13186
|
+
* Verifies the submitted one-time code using the server-provided link. The
|
|
13187
|
+
* response determines the next required action.
|
|
13188
|
+
*/
|
|
13189
|
+
async submitCode(parameters) {
|
|
13190
|
+
const continuationState = parameters.continuationState;
|
|
13191
|
+
const correlationId = parameters.correlationId;
|
|
13192
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId), correlationId);
|
|
13193
|
+
this.logger.verbose("Submitting V2 one-time code.", correlationId);
|
|
13194
|
+
const verifyHref = this.requireLink(correlationId, continuationState.links.verify);
|
|
13195
|
+
const verifyRequest = {
|
|
13196
|
+
continuationToken: continuationState.continuationToken,
|
|
13197
|
+
otp: parameters.code,
|
|
13198
|
+
};
|
|
13199
|
+
const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
|
|
13200
|
+
if (continuationState.scenario ===
|
|
13201
|
+
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
13202
|
+
verifyResult.nextAction === VerifyNextActionV2.UPDATE) {
|
|
13203
|
+
return createFlowNewPasswordRequiredResultV2({
|
|
13204
|
+
correlationId,
|
|
13205
|
+
continuationState: {
|
|
13206
|
+
continuationToken: verifyResult.continuationToken,
|
|
13207
|
+
scenario: continuationState.scenario,
|
|
13208
|
+
links: { update: verifyResult.updateHref },
|
|
13209
|
+
},
|
|
13210
|
+
});
|
|
13211
|
+
}
|
|
13212
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
13213
|
+
return this.handleSignInVerification(continuationState, verifyResult, correlationId);
|
|
13214
|
+
}
|
|
13215
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13216
|
+
verifyResult.nextAction === VerifyNextActionV2.COLLECT_ATTRIBUTES) {
|
|
13217
|
+
const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13218
|
+
attribute.required === true);
|
|
13219
|
+
const nextContinuationState = {
|
|
13220
|
+
continuationToken: verifyResult.continuationToken,
|
|
13221
|
+
scenario: continuationState.scenario,
|
|
13222
|
+
links: {
|
|
13223
|
+
submitAttributes: verifyResult.submitAttributesHref,
|
|
13224
|
+
},
|
|
13225
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13226
|
+
signUp: continuationState.signUp,
|
|
13227
|
+
};
|
|
13228
|
+
const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13229
|
+
if (requiredPasswordAttribute &&
|
|
13230
|
+
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13231
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
13232
|
+
correlationId,
|
|
13233
|
+
continuationState: nextContinuationState,
|
|
13234
|
+
attributes,
|
|
13235
|
+
requiredPasswordAttribute,
|
|
13236
|
+
});
|
|
13237
|
+
}
|
|
13238
|
+
return createFlowAttributesRequiredResultV2({
|
|
13239
|
+
correlationId,
|
|
13240
|
+
continuationState: nextContinuationState,
|
|
13241
|
+
attributes,
|
|
13242
|
+
});
|
|
13243
|
+
}
|
|
13244
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13245
|
+
verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
13246
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13247
|
+
correlationId,
|
|
13248
|
+
continuationState: {
|
|
13249
|
+
continuationToken: verifyResult.continuationToken,
|
|
13250
|
+
scenario: continuationState.scenario,
|
|
13251
|
+
links: {},
|
|
13252
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13253
|
+
},
|
|
13254
|
+
});
|
|
13255
|
+
}
|
|
13256
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
|
|
13257
|
+
this.logger.error(message, correlationId);
|
|
13258
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13259
|
+
}
|
|
13260
|
+
/*
|
|
13261
|
+
* Requests a new one-time code using the server-provided resend link.
|
|
13262
|
+
* Returns refreshed continuation state and code metadata.
|
|
13263
|
+
*/
|
|
13264
|
+
async resendCode(parameters) {
|
|
13265
|
+
const challengeResult = await this.sendMethodChallenge(parameters, "resendCode");
|
|
13266
|
+
return createFlowCodeRequiredResultV2({
|
|
13267
|
+
correlationId: parameters.correlationId,
|
|
13268
|
+
continuationState: this.createChallengeContinuationState(parameters.continuationState, challengeResult),
|
|
13269
|
+
channel: challengeResult.type,
|
|
13270
|
+
sentTo: challengeResult.hint,
|
|
13271
|
+
codeLength: challengeResult.codeLength,
|
|
13272
|
+
});
|
|
13273
|
+
}
|
|
13274
|
+
async submitSignUpAttributes(parameters) {
|
|
13275
|
+
const { continuationState, correlationId, attributes } = parameters;
|
|
13276
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitAttributes", correlationId), correlationId);
|
|
13277
|
+
this.logger.verbose("Submitting additional V2 sign-up attributes.", correlationId);
|
|
13278
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(this.requireLink(correlationId, continuationState.links.submitAttributes), {
|
|
13279
|
+
continuationToken: continuationState.continuationToken,
|
|
13280
|
+
attributes,
|
|
13281
|
+
}, context);
|
|
13282
|
+
return this.toSignUpActionResult(submitResult, {
|
|
13283
|
+
...continuationState,
|
|
13284
|
+
signUp: {
|
|
13285
|
+
passwordWasSupplied: continuationState.signUp?.passwordWasSupplied ===
|
|
13286
|
+
true || attributes.password !== undefined,
|
|
13287
|
+
},
|
|
13288
|
+
}, correlationId);
|
|
13289
|
+
}
|
|
13290
|
+
/*
|
|
13291
|
+
* Submits the new password and polls until the reset completes. The result
|
|
13292
|
+
* contains the continuation state required for explicit sign-in.
|
|
13293
|
+
*/
|
|
13294
|
+
async submitNewPassword(parameters) {
|
|
13295
|
+
const continuationState = parameters.continuationState;
|
|
13296
|
+
const correlationId = parameters.correlationId;
|
|
13297
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitNewPassword", correlationId), correlationId);
|
|
13298
|
+
this.logger.verbose("Submitting V2 new password.", correlationId);
|
|
13299
|
+
const updateResult = await this.apiClient.submitNewPassword(this.requireLink(correlationId, continuationState.links.update), {
|
|
13300
|
+
continuationToken: continuationState.continuationToken,
|
|
13301
|
+
newPassword: parameters.newPassword,
|
|
13302
|
+
}, context);
|
|
13303
|
+
let pollToken = updateResult.continuationToken;
|
|
13304
|
+
let pollHref = updateResult.pollHref;
|
|
13305
|
+
let completionToken;
|
|
13306
|
+
for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
|
|
13307
|
+
const pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
|
|
13308
|
+
if (pollResult.isCompleted) {
|
|
13309
|
+
completionToken = pollResult.continuationToken;
|
|
13310
|
+
break;
|
|
13311
|
+
}
|
|
13312
|
+
pollToken = pollResult.continuationToken;
|
|
13313
|
+
pollHref = pollResult.pollHref ?? pollHref;
|
|
13314
|
+
if (attempt < POLL_MAX_ATTEMPTS) {
|
|
13315
|
+
await delay(POLL_INTERVAL_MS);
|
|
13316
|
+
}
|
|
13317
|
+
}
|
|
13318
|
+
if (!completionToken) {
|
|
13319
|
+
const message = "The password reset did not complete within the allotted number of polling attempts.";
|
|
13320
|
+
this.logger.error(message, correlationId);
|
|
13321
|
+
throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
|
|
13322
|
+
}
|
|
13323
|
+
this.logger.verbose("V2 password reset applied; sign-in required.", correlationId);
|
|
13324
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13325
|
+
correlationId,
|
|
13326
|
+
continuationState: {
|
|
13327
|
+
continuationToken: completionToken,
|
|
13328
|
+
scenario: continuationState.scenario,
|
|
13329
|
+
links: {},
|
|
13330
|
+
},
|
|
13331
|
+
});
|
|
13332
|
+
}
|
|
13333
|
+
/*
|
|
13334
|
+
* Verifies a sign-in password and returns the next sign-in action.
|
|
13335
|
+
*/
|
|
13336
|
+
async submitSignInPassword(parameters) {
|
|
13337
|
+
const verifyResult = await this.verifySignInPassword(parameters);
|
|
13338
|
+
return this.handleSignInVerification(parameters.continuationState, verifyResult, parameters.correlationId);
|
|
13339
|
+
}
|
|
13340
|
+
/*
|
|
13341
|
+
* Redeems the completed flow continuation for tokens. Returns the
|
|
13342
|
+
* authentication result after validating and caching the response.
|
|
13343
|
+
*/
|
|
13344
|
+
async signInWithContinuation(parameters) {
|
|
13345
|
+
const continuationState = parameters.continuationState;
|
|
13346
|
+
const correlationId = parameters.correlationId;
|
|
13347
|
+
const apiId = this.resolveStepApiId(continuationState.scenario, "signInWithContinuation", correlationId);
|
|
13348
|
+
const context = this.createRequestContext(apiId, correlationId);
|
|
13349
|
+
this.logger.verbose("Signing in with a V2 continuation.", correlationId);
|
|
13350
|
+
const scopes = this.getScopes(parameters.scopes);
|
|
13351
|
+
const tokenResponse = await this.apiClient.completeWithTokens({
|
|
13352
|
+
continuationToken: continuationState.continuationToken,
|
|
13353
|
+
scopes,
|
|
13354
|
+
}, context);
|
|
13355
|
+
const authenticationResult = await this.handleTokenResponse(tokenResponse, scopes, correlationId, apiId);
|
|
13356
|
+
this.logger.verbose("V2 continuation sign-in completed.", correlationId);
|
|
13357
|
+
return createFlowCompletedResultV2({
|
|
13358
|
+
correlationId,
|
|
13359
|
+
authenticationResult,
|
|
13360
|
+
});
|
|
13361
|
+
}
|
|
13362
|
+
async handleSignInVerification(continuationState, verifyResult, correlationId) {
|
|
13363
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CHALLENGE) {
|
|
13364
|
+
this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
|
|
13365
|
+
return createFlowMFARequiredResultV2({
|
|
13366
|
+
correlationId,
|
|
13367
|
+
continuationState: {
|
|
13368
|
+
continuationToken: verifyResult.continuationToken,
|
|
13369
|
+
scenario: continuationState.scenario,
|
|
13370
|
+
links: {},
|
|
13371
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13372
|
+
},
|
|
13373
|
+
methods: verifyResult.methods.map((method) => ({
|
|
13374
|
+
id: method.id,
|
|
13375
|
+
type: method.type ?? "",
|
|
13376
|
+
hint: method.hint,
|
|
13377
|
+
challengeHref: method.challengeHref,
|
|
13378
|
+
})),
|
|
13379
|
+
});
|
|
13380
|
+
}
|
|
13381
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
13382
|
+
return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
|
|
13383
|
+
}
|
|
13384
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
|
|
13385
|
+
this.logger.error(message, correlationId);
|
|
13386
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13387
|
+
}
|
|
13388
|
+
selectSignInMethod(methods, passwordProvided, correlationId) {
|
|
13389
|
+
const passwordMethod = methods.find((method) => method.type.toLowerCase() ===
|
|
13390
|
+
AuthenticationMethodTypeV2.PASSWORD);
|
|
13391
|
+
const emailMethod = methods.find((method) => method.type.toLowerCase() === AuthenticationMethodTypeV2.EMAIL);
|
|
13392
|
+
if (passwordProvided) {
|
|
13393
|
+
if (passwordMethod) {
|
|
13394
|
+
return passwordMethod;
|
|
13395
|
+
}
|
|
13396
|
+
const message = "A password was supplied, but the sign-in response did not include a password method.";
|
|
13397
|
+
this.logger.error(message, correlationId);
|
|
13398
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13399
|
+
}
|
|
13400
|
+
const selectedMethod = emailMethod ?? passwordMethod;
|
|
13401
|
+
if (selectedMethod) {
|
|
13402
|
+
return selectedMethod;
|
|
13403
|
+
}
|
|
13404
|
+
const message = "The sign-in start response did not include a supported email or password method.";
|
|
13405
|
+
this.logger.error(message, correlationId);
|
|
13406
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13407
|
+
}
|
|
13408
|
+
toSignUpActionResult(result, continuationState, correlationId) {
|
|
13409
|
+
const nextAction = result.nextAction;
|
|
13410
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
13411
|
+
return createFlowCodeRequiredResultV2({
|
|
13412
|
+
correlationId,
|
|
13413
|
+
continuationState: {
|
|
13414
|
+
continuationToken: result.continuationToken,
|
|
13415
|
+
scenario: continuationState.scenario,
|
|
13416
|
+
links: {
|
|
13417
|
+
verify: result.verifyHref,
|
|
13418
|
+
resend: result.resendHref,
|
|
13419
|
+
},
|
|
13420
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13421
|
+
signUp: continuationState.signUp,
|
|
13422
|
+
},
|
|
13423
|
+
channel: result.type,
|
|
13424
|
+
sentTo: result.hint,
|
|
13425
|
+
codeLength: result.codeLength,
|
|
13426
|
+
});
|
|
13427
|
+
}
|
|
13428
|
+
if (result.nextAction ===
|
|
13429
|
+
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
|
|
13430
|
+
const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13431
|
+
attribute.required === true);
|
|
13432
|
+
const nextContinuationState = {
|
|
13433
|
+
continuationToken: result.continuationToken,
|
|
13434
|
+
scenario: continuationState.scenario,
|
|
13435
|
+
links: {
|
|
13436
|
+
submitAttributes: result.submitAttributesHref,
|
|
13437
|
+
},
|
|
13438
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13439
|
+
signUp: continuationState.signUp,
|
|
13440
|
+
};
|
|
13441
|
+
const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13442
|
+
if (requiredPasswordAttribute &&
|
|
13443
|
+
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13444
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
13445
|
+
correlationId,
|
|
13446
|
+
continuationState: nextContinuationState,
|
|
13447
|
+
attributes,
|
|
13448
|
+
requiredPasswordAttribute,
|
|
13449
|
+
});
|
|
13450
|
+
}
|
|
13451
|
+
return createFlowAttributesRequiredResultV2({
|
|
13452
|
+
correlationId,
|
|
13453
|
+
continuationState: nextContinuationState,
|
|
13454
|
+
attributes,
|
|
13455
|
+
});
|
|
13456
|
+
}
|
|
13457
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
|
|
13458
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13459
|
+
correlationId,
|
|
13460
|
+
continuationState: {
|
|
13461
|
+
continuationToken: result.continuationToken,
|
|
13462
|
+
scenario: continuationState.scenario,
|
|
13463
|
+
links: {},
|
|
13464
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13465
|
+
},
|
|
13466
|
+
});
|
|
13467
|
+
}
|
|
13468
|
+
const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
|
|
13469
|
+
this.logger.error(message, correlationId);
|
|
13470
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13471
|
+
}
|
|
13472
|
+
ensureAuthenticationFactor(authenticationFactor, expectedFactor, transition, correlationId) {
|
|
13473
|
+
if (authenticationFactor === expectedFactor) {
|
|
13474
|
+
return;
|
|
13475
|
+
}
|
|
13476
|
+
const message = `Authentication factor '${authenticationFactor}' is not supported for ${transition}.`;
|
|
13477
|
+
this.logger.error(message, correlationId);
|
|
13478
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13479
|
+
}
|
|
13480
|
+
async verifySignInPassword(parameters) {
|
|
13481
|
+
const { continuationState, correlationId } = parameters;
|
|
13482
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitPassword", correlationId), correlationId);
|
|
13483
|
+
this.logger.verbose("Submitting V2 sign-in password.", correlationId);
|
|
13484
|
+
return this.apiClient.verifyChallenge(this.requireLink(correlationId, continuationState.links.verify), {
|
|
13485
|
+
continuationToken: continuationState.continuationToken,
|
|
13486
|
+
password: parameters.password,
|
|
13487
|
+
}, context);
|
|
13488
|
+
}
|
|
13489
|
+
completeSignInAfterVerification(continuationState, continuationToken, correlationId) {
|
|
13490
|
+
return this.signInWithContinuation({
|
|
13491
|
+
correlationId,
|
|
13492
|
+
continuationState: {
|
|
13493
|
+
continuationToken,
|
|
13494
|
+
scenario: continuationState.scenario,
|
|
13495
|
+
links: {},
|
|
13496
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13497
|
+
},
|
|
13498
|
+
scopes: continuationState.tokenRequest?.scopes,
|
|
13499
|
+
});
|
|
13500
|
+
}
|
|
13501
|
+
async sendMethodChallenge(parameters, step) {
|
|
13502
|
+
const continuationState = parameters.continuationState;
|
|
13503
|
+
const correlationId = parameters.correlationId;
|
|
13504
|
+
const challengeHref = step === "resendCode"
|
|
13505
|
+
? continuationState.links.resend
|
|
13506
|
+
: continuationState.links.challenge;
|
|
13507
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId), correlationId);
|
|
13508
|
+
this.logger.verbose(step === "resendCode"
|
|
13509
|
+
? "Resending V2 one-time code."
|
|
13510
|
+
: "Requesting V2 challenge.", correlationId);
|
|
13511
|
+
const challengeResult = await this.apiClient.requestChallenge(this.requireLink(correlationId, challengeHref), { continuationToken: continuationState.continuationToken }, context);
|
|
13512
|
+
const nextAction = challengeResult.nextAction;
|
|
13513
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.VERIFY) {
|
|
13514
|
+
return challengeResult;
|
|
13515
|
+
}
|
|
13516
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.RISK_VERIFY) {
|
|
13517
|
+
return this.apiClient.verifyRisk(challengeResult.riskVerifyHref, { continuationToken: challengeResult.continuationToken }, context);
|
|
13518
|
+
}
|
|
13519
|
+
const message = `Challenge next action '${nextAction}' is not supported.`;
|
|
13520
|
+
this.logger.error(message, correlationId);
|
|
13521
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13522
|
+
}
|
|
13523
|
+
createChallengeContinuationState(continuationState, challengeResult) {
|
|
13524
|
+
return {
|
|
13525
|
+
continuationToken: challengeResult.continuationToken,
|
|
13526
|
+
scenario: continuationState.scenario,
|
|
13527
|
+
links: {
|
|
13528
|
+
challenge: continuationState.links.challenge,
|
|
13529
|
+
verify: challengeResult.verifyHref,
|
|
13530
|
+
resend: challengeResult.resendHref ??
|
|
13531
|
+
continuationState.links.resend,
|
|
13532
|
+
},
|
|
13533
|
+
...(continuationState.tokenRequest && {
|
|
13534
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13535
|
+
}),
|
|
13536
|
+
...(continuationState.signUp && {
|
|
13537
|
+
signUp: continuationState.signUp,
|
|
13538
|
+
}),
|
|
13539
|
+
};
|
|
13540
|
+
}
|
|
13541
|
+
resolveStepApiId(scenario, step, correlationId) {
|
|
13542
|
+
const apiId = getPublicApiIdV2(scenario, step);
|
|
13543
|
+
if (apiId === undefined) {
|
|
13544
|
+
const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
|
|
13545
|
+
this.logger.error(message, correlationId);
|
|
13546
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_STEP, message, correlationId);
|
|
13547
|
+
}
|
|
13548
|
+
return apiId;
|
|
13549
|
+
}
|
|
13550
|
+
requireLink(correlationId, href, missingLinkError) {
|
|
13551
|
+
if (!href) {
|
|
13552
|
+
const errorCode = missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
|
|
13553
|
+
const message = missingLinkError?.message ??
|
|
13554
|
+
"The continuation state is missing a link required to advance the flow.";
|
|
13555
|
+
this.logger.error(message, correlationId);
|
|
13556
|
+
throw new CustomAuthError(errorCode, message, correlationId);
|
|
13557
|
+
}
|
|
13558
|
+
return href;
|
|
13559
|
+
}
|
|
13560
|
+
}
|
|
13561
|
+
|
|
13562
|
+
/*
|
|
13563
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13564
|
+
* Licensed under the MIT License.
|
|
13565
|
+
*/
|
|
13566
|
+
/**
|
|
13567
|
+
* Terminal state indicating the operation failed.
|
|
13568
|
+
*
|
|
13569
|
+
* The error is carried by the result's `error` payload, not by this state.
|
|
13570
|
+
*/
|
|
13571
|
+
class FailedStateV2 extends AuthFlowStateBase {
|
|
13572
|
+
constructor() {
|
|
13573
|
+
super(...arguments);
|
|
13574
|
+
this.stateType = "failed";
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13577
|
+
|
|
13578
|
+
/*
|
|
13579
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13580
|
+
* Licensed under the MIT License.
|
|
13581
|
+
*/
|
|
13582
|
+
/**
|
|
13583
|
+
* Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
|
|
13584
|
+
* to narrow the state before accessing its members.
|
|
13585
|
+
*/
|
|
13586
|
+
class CustomAuthResultV2 {
|
|
13587
|
+
constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
13588
|
+
this.state = state;
|
|
13589
|
+
this.data = data;
|
|
13590
|
+
this.scenario = scenario;
|
|
13591
|
+
}
|
|
13592
|
+
/**
|
|
13593
|
+
* Narrows the result to a specific state by its `stateType` discriminator.
|
|
13594
|
+
* A successful match makes the state's properties available without a cast.
|
|
13595
|
+
* @param stateType - The state type to test for.
|
|
13596
|
+
* @returns True (and narrows `state`) when the current state matches `stateType`.
|
|
13597
|
+
*/
|
|
13598
|
+
isState(stateType) {
|
|
13599
|
+
return this.state.stateType === stateType;
|
|
13600
|
+
}
|
|
13601
|
+
/**
|
|
13602
|
+
* Checks whether the result is in the terminal failed state. A failed result
|
|
13603
|
+
* contains the flow-specific error.
|
|
13604
|
+
* @returns True (and narrows `state`) when the operation failed.
|
|
13605
|
+
*/
|
|
13606
|
+
isFailed() {
|
|
13607
|
+
return this.state.stateType === "failed";
|
|
13608
|
+
}
|
|
13609
|
+
/**
|
|
13610
|
+
* Creates a failed result from the supplied error. The result uses the
|
|
13611
|
+
* shared {@link FailedStateV2} terminal state.
|
|
13612
|
+
* @param error - The error that occurred.
|
|
13613
|
+
* @param options - The flow-error type and error context.
|
|
13614
|
+
* @returns A failed result carrying the flow-specific error.
|
|
13615
|
+
*/
|
|
13616
|
+
static createWithError(error, options) {
|
|
13617
|
+
const { errorType: ErrorType, scenario = CustomAuthFlowScenarioV2.Unknown, correlationId, } = options;
|
|
13618
|
+
const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
|
|
13619
|
+
const flowError = new ErrorType(errorData, scenario);
|
|
13620
|
+
const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
|
|
13621
|
+
result.error = flowError;
|
|
13622
|
+
return result;
|
|
13623
|
+
}
|
|
13624
|
+
static createErrorData(error, correlationId) {
|
|
13625
|
+
if (error instanceof CustomAuthError) {
|
|
13626
|
+
return error;
|
|
13627
|
+
}
|
|
13628
|
+
if (error instanceof AuthError) {
|
|
13629
|
+
const errorCodes = [];
|
|
13630
|
+
if ("errorNo" in error) {
|
|
13631
|
+
if (typeof error.errorNo === "string") {
|
|
13632
|
+
const code = Number(error.errorNo);
|
|
13633
|
+
if (!isNaN(code)) {
|
|
13634
|
+
errorCodes.push(code);
|
|
13635
|
+
}
|
|
13636
|
+
}
|
|
13637
|
+
else if (typeof error.errorNo === "number") {
|
|
13638
|
+
errorCodes.push(error.errorNo);
|
|
13639
|
+
}
|
|
13640
|
+
}
|
|
13641
|
+
return new MsalCustomAuthError(error.errorCode, error.errorMessage, error.subError, errorCodes, error.correlationId);
|
|
13642
|
+
}
|
|
13643
|
+
return new UnexpectedError(error, correlationId);
|
|
13644
|
+
}
|
|
13645
|
+
}
|
|
13646
|
+
|
|
13647
|
+
/*
|
|
13648
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13649
|
+
* Licensed under the MIT License.
|
|
13650
|
+
*/
|
|
13651
|
+
const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
|
|
13652
|
+
const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
|
|
13653
|
+
const PASSWORD_TOO_WEAK = "passwordTooWeak";
|
|
13654
|
+
|
|
13655
|
+
/*
|
|
13656
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13657
|
+
* Licensed under the MIT License.
|
|
13658
|
+
*/
|
|
13659
|
+
/*
|
|
13660
|
+
* Standalone V2 error base; intentionally does NOT extend the V1 AuthFlowErrorBase.
|
|
13661
|
+
* Provides the detectors common to every V2 flow; each per-action subclass adds only
|
|
13662
|
+
* the detectors relevant to its own action.
|
|
13663
|
+
*/
|
|
13664
|
+
class AuthFlowErrorBaseV2 {
|
|
13665
|
+
constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
13666
|
+
this.errorData = errorData;
|
|
13667
|
+
this.scenario = scenario;
|
|
13668
|
+
}
|
|
13669
|
+
get correlationId() {
|
|
13670
|
+
return this.errorData.correlationId;
|
|
13671
|
+
}
|
|
13672
|
+
get errorCodes() {
|
|
13673
|
+
return this.errorData.errorCodes;
|
|
13674
|
+
}
|
|
13675
|
+
get errorDescription() {
|
|
13676
|
+
return this.errorData.errorDescription;
|
|
13677
|
+
}
|
|
13678
|
+
/**
|
|
13679
|
+
* Checks if the error requires the flow to continue in the browser. The
|
|
13680
|
+
* server surfaces this as a `redirect_to_web` failure, so a browser hand-off
|
|
13681
|
+
* always arrives as a `FailedStateV2` on which this detector returns true.
|
|
13682
|
+
* @returns True if the browser is required, false otherwise.
|
|
13683
|
+
*/
|
|
13684
|
+
isBrowserRequired() {
|
|
13685
|
+
return this.errorData.error === REDIRECT_TO_WEB;
|
|
13686
|
+
}
|
|
13687
|
+
/**
|
|
13688
|
+
* Checks if the error is due to a caller-supplied argument failing
|
|
13689
|
+
* client-side validation before the request was issued (for example an empty
|
|
13690
|
+
* username, code, or password, or an unknown method id). Use it to prompt the
|
|
13691
|
+
* user to correct the input rather than treating it as a server failure.
|
|
13692
|
+
* @returns True if the input was invalid, false otherwise.
|
|
13693
|
+
*/
|
|
13694
|
+
isInvalidInput() {
|
|
13695
|
+
return this.errorData instanceof InvalidArgumentError;
|
|
13696
|
+
}
|
|
13697
|
+
/**
|
|
13698
|
+
* Checks whether an account already exists for the supplied identifier.
|
|
13699
|
+
* This can occur at different stages while completing sign-up.
|
|
13700
|
+
* @returns True if the account already exists, otherwise false.
|
|
13701
|
+
*/
|
|
13702
|
+
isUserAlreadyExists() {
|
|
13703
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "userAlreadyExists");
|
|
13704
|
+
}
|
|
13705
|
+
/*
|
|
13706
|
+
* User-not-found arrives as AADSTS50034. The nested `/api` error carries no
|
|
13707
|
+
* innerError and no error_codes array, so the AADSTS marker in the message is
|
|
13708
|
+
* the only signal.
|
|
13709
|
+
*/
|
|
13710
|
+
// TODO: Use the service-provided suberror when it becomes available.
|
|
13711
|
+
isUserNotFoundError() {
|
|
13712
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13713
|
+
this.errorData.errorDescription?.includes("AADSTS50034") === true);
|
|
13714
|
+
}
|
|
13715
|
+
isUserInvalidError() {
|
|
13716
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13717
|
+
this.errorData.errorDescription?.includes("AADSTS90100") === true &&
|
|
13718
|
+
this.errorData.errorDescription
|
|
13719
|
+
.toLowerCase()
|
|
13720
|
+
.includes("username parameter"));
|
|
13721
|
+
}
|
|
13722
|
+
// The verification endpoint uses this outer/inner code pair for an invalid one-time code.
|
|
13723
|
+
isInvalidCodeError() {
|
|
13724
|
+
return (this.errorData.error === "invalidGrant" &&
|
|
13725
|
+
this.errorData.subError === INVALID_ONE_TIME_CODE);
|
|
13726
|
+
}
|
|
13727
|
+
// New password rejected by policy: inner `passwordTooWeak` (AADSTS120002).
|
|
13728
|
+
isInvalidPasswordError() {
|
|
13729
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13730
|
+
this.errorData.subError === PASSWORD_TOO_WEAK);
|
|
13731
|
+
}
|
|
13732
|
+
isPasswordPolicyViolationError() {
|
|
13733
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "passwordPolicyViolation" &&
|
|
13734
|
+
detail.attributeIds?.some((attributeId) => attributeId.toLowerCase() === "password") === true);
|
|
13735
|
+
}
|
|
13736
|
+
isPasswordIncorrectError() {
|
|
13737
|
+
return (this.errorData.error === "invalidGrant" &&
|
|
13738
|
+
this.errorData.subError === INVALID_USERNAME_OR_PASSWORD);
|
|
13739
|
+
}
|
|
13740
|
+
getAttributeValidationDetails() {
|
|
13741
|
+
const details = this.errorData.attributeValidationDetails;
|
|
13742
|
+
return Array.isArray(details)
|
|
13743
|
+
? details.filter((detail) => typeof detail === "object" && detail !== null)
|
|
13744
|
+
: [];
|
|
13745
|
+
}
|
|
13746
|
+
}
|
|
13747
|
+
|
|
13748
|
+
/*
|
|
13749
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13750
|
+
* Licensed under the MIT License.
|
|
13751
|
+
*/
|
|
13752
|
+
/**
|
|
13753
|
+
* Error raised when requesting (or resending) a challenge for a selected
|
|
13754
|
+
* authentication method. It is a shared action error bound to the shared
|
|
13755
|
+
* `RequestChallengeResultV2` and returned regardless of which entry flow reached
|
|
13756
|
+
* it. It currently exposes no action-specific detectors — only the inherited
|
|
13757
|
+
* `isBrowserRequired()`.
|
|
13758
|
+
*/
|
|
13759
|
+
class RequestChallengeErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13760
|
+
}
|
|
13761
|
+
|
|
13762
|
+
/*
|
|
13763
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13764
|
+
* Licensed under the MIT License.
|
|
13765
|
+
*/
|
|
13766
|
+
/**
|
|
13767
|
+
* Error raised when verifying a challenge (submitting a one-time code). It
|
|
13768
|
+
* exposes the detectors relevant to code verification so the app can respond to
|
|
13769
|
+
* a rejected code specifically. Unrecognised failures carry no specific
|
|
13770
|
+
* detector; inspect the error code (`unexpected_error` when the server gives
|
|
13771
|
+
* none) and `errorDescription`.
|
|
13772
|
+
*/
|
|
13773
|
+
class VerifyChallengeErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13774
|
+
/**
|
|
13775
|
+
* Checks if the error is due to the provided code being invalid or expired.
|
|
13776
|
+
* Use it to prompt the user to re-enter the code or request a new one, rather
|
|
13777
|
+
* than restarting the whole flow.
|
|
13778
|
+
* @returns True if the code is invalid, false otherwise.
|
|
13779
|
+
*/
|
|
13780
|
+
isInvalidCode() {
|
|
13781
|
+
return this.isInvalidCodeError();
|
|
13782
|
+
}
|
|
13783
|
+
}
|
|
13784
|
+
|
|
13785
|
+
/*
|
|
13786
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13787
|
+
* Licensed under the MIT License.
|
|
13788
|
+
*/
|
|
13789
|
+
/**
|
|
13790
|
+
* Terminal state indicating the operation completed successfully.
|
|
13791
|
+
*
|
|
13792
|
+
* Completion data (for example the signed-in account) is carried by the
|
|
13793
|
+
* result's `data` payload, not by this state.
|
|
13794
|
+
*/
|
|
13795
|
+
class CompletedStateV2 extends AuthFlowStateBase {
|
|
13796
|
+
constructor() {
|
|
13797
|
+
super(...arguments);
|
|
13798
|
+
this.stateType = "completed";
|
|
13799
|
+
}
|
|
13800
|
+
}
|
|
13801
|
+
|
|
13802
|
+
/*
|
|
13803
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13804
|
+
* Licensed under the MIT License.
|
|
13805
|
+
*/
|
|
13806
|
+
/**
|
|
13807
|
+
* Error raised when redeeming a completed V2 flow's continuation for tokens.
|
|
13808
|
+
* It adds no action-specific detectors beyond the inherited
|
|
13809
|
+
* `isBrowserRequired()`; the app typically retries or starts sign-in explicitly.
|
|
13810
|
+
*/
|
|
13811
|
+
class SignInContinuationErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13812
|
+
}
|
|
13813
|
+
|
|
13814
|
+
/*
|
|
13815
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13816
|
+
* Licensed under the MIT License.
|
|
13817
|
+
*/
|
|
13818
|
+
/**
|
|
13819
|
+
* Shared state returned when a completed V2 flow can sign the user in by
|
|
13820
|
+
* redeeming its continuation. Password reset and sign-up can both surface this
|
|
13821
|
+
* state without duplicating the token-acquisition behavior.
|
|
13822
|
+
*/
|
|
13823
|
+
class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
|
|
13824
|
+
constructor() {
|
|
13825
|
+
super(...arguments);
|
|
13826
|
+
this.stateType = "signInContinuation";
|
|
13827
|
+
}
|
|
13828
|
+
/**
|
|
13829
|
+
* Signs the user in using the continuation established by the completed V2
|
|
13830
|
+
* flow. On success the returned result reaches the completed state
|
|
13831
|
+
* carrying the signed-in account data; on failure the result's error reports
|
|
13832
|
+
* why the follow-up sign-in could not complete.
|
|
13833
|
+
* @param inputs - Optional scopes requested for the issued token. Claims
|
|
13834
|
+
* are accepted for API alignment but are not sent until the V2 service
|
|
13835
|
+
* supports them on authorize-challenge.
|
|
13836
|
+
* @returns The result of signing in after the password reset.
|
|
13837
|
+
*/
|
|
13838
|
+
async signIn(inputs) {
|
|
13839
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
13840
|
+
try {
|
|
13841
|
+
if (inputs?.claims) {
|
|
13842
|
+
ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
|
|
13843
|
+
}
|
|
13844
|
+
logger.verbose("Signing in with a V2 continuation.", correlationId);
|
|
13845
|
+
const result = await flowClient.signInWithContinuation({
|
|
13846
|
+
correlationId,
|
|
13847
|
+
continuationState,
|
|
13848
|
+
scopes: inputs?.scopes,
|
|
13849
|
+
});
|
|
13850
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
13851
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
13852
|
+
}
|
|
13853
|
+
catch (error) {
|
|
13854
|
+
logger.errorPii(`Failed to sign in with a V2 continuation. Error: '${error}'.`, correlationId);
|
|
13855
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
13856
|
+
errorType: SignInContinuationErrorV2,
|
|
13857
|
+
scenario: continuationState.scenario,
|
|
13858
|
+
correlationId,
|
|
13859
|
+
});
|
|
13860
|
+
}
|
|
13861
|
+
}
|
|
13862
|
+
}
|
|
13863
|
+
|
|
13864
|
+
/*
|
|
13865
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13866
|
+
* Licensed under the MIT License.
|
|
13867
|
+
*/
|
|
13868
|
+
/**
|
|
13869
|
+
* Error raised when submitting a new password. It exposes the detectors relevant
|
|
13870
|
+
* to password submission so the app can react to a rejected password
|
|
13871
|
+
* specifically. Unrecognised failures carry no specific detector; inspect the
|
|
13872
|
+
* error code (`unexpected_error` when the server gives none) and
|
|
13873
|
+
* `errorDescription`.
|
|
13874
|
+
*/
|
|
13875
|
+
class SubmitNewPasswordErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13876
|
+
/**
|
|
13877
|
+
* Checks if the error is due to the new password being invalid, for example
|
|
13878
|
+
* because it fails the tenant's complexity policy. Use it to prompt the user
|
|
13879
|
+
* for a stronger password rather than restarting the reset flow.
|
|
13880
|
+
* @returns True if the new password is invalid, false otherwise.
|
|
13881
|
+
*/
|
|
13882
|
+
isInvalidPassword() {
|
|
13883
|
+
return this.isInvalidPasswordError();
|
|
13884
|
+
}
|
|
13885
|
+
}
|
|
13886
|
+
|
|
13887
|
+
/*
|
|
13888
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13889
|
+
* Licensed under the MIT License.
|
|
13890
|
+
*/
|
|
13891
|
+
/**
|
|
13892
|
+
* State returned when the user must supply a new password to complete the flow.
|
|
13893
|
+
* A successful submission returns `SignInContinuationStateV2` so the app can
|
|
13894
|
+
* sign the user in.
|
|
13895
|
+
*/
|
|
13896
|
+
class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
13897
|
+
constructor() {
|
|
13898
|
+
super(...arguments);
|
|
13899
|
+
this.stateType = "newPasswordRequired";
|
|
13900
|
+
}
|
|
13901
|
+
/**
|
|
13902
|
+
* Submits the new password to complete the reset. The result either allows
|
|
13903
|
+
* sign-in or reports that the password was rejected.
|
|
13904
|
+
* @param password - The new password to set.
|
|
13905
|
+
* @returns The result of submitting the new password.
|
|
13906
|
+
*/
|
|
13907
|
+
async submitNewPassword(password) {
|
|
13908
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
13909
|
+
try {
|
|
13910
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
13911
|
+
logger.verbose("Submitting V2 new password.", correlationId);
|
|
13912
|
+
const result = await flowClient.submitNewPassword({
|
|
13913
|
+
correlationId,
|
|
13914
|
+
continuationState,
|
|
13915
|
+
newPassword: password,
|
|
13916
|
+
});
|
|
13917
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
13918
|
+
correlationId: result.correlationId,
|
|
13919
|
+
logger,
|
|
13920
|
+
config: this.stateParameters.config,
|
|
13921
|
+
flowClient,
|
|
13922
|
+
continuationState: result.continuationState,
|
|
13923
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
13924
|
+
}), undefined, result.continuationState.scenario);
|
|
13925
|
+
}
|
|
13926
|
+
catch (error) {
|
|
13927
|
+
logger.errorPii(`Failed to submit V2 new password. Error: '${error}'.`, correlationId);
|
|
13928
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
13929
|
+
errorType: SubmitNewPasswordErrorV2,
|
|
13930
|
+
scenario: continuationState.scenario,
|
|
13931
|
+
correlationId,
|
|
13932
|
+
});
|
|
13933
|
+
}
|
|
13934
|
+
}
|
|
13935
|
+
}
|
|
13936
|
+
|
|
13937
|
+
/*
|
|
13938
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13939
|
+
* Licensed under the MIT License.
|
|
13940
|
+
*/
|
|
13941
|
+
class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
13942
|
+
constructor(stateParameters) {
|
|
13943
|
+
super(stateParameters);
|
|
13944
|
+
this.method = stateParameters.method;
|
|
13945
|
+
this.sentTo = stateParameters.sentTo;
|
|
13946
|
+
this.channel = stateParameters.channel;
|
|
13947
|
+
this.codeLength = stateParameters.codeLength;
|
|
13948
|
+
}
|
|
13949
|
+
async submitCodeCore(code) {
|
|
13950
|
+
if (this.codeLength) {
|
|
13951
|
+
this.ensureCodeIsValid(code, this.codeLength);
|
|
13952
|
+
}
|
|
13953
|
+
return this.stateParameters.flowClient.submitCode({
|
|
13954
|
+
correlationId: this.stateParameters.correlationId,
|
|
13955
|
+
continuationState: this.stateParameters.continuationState,
|
|
13956
|
+
code,
|
|
13957
|
+
});
|
|
13958
|
+
}
|
|
13959
|
+
async resendCodeCore() {
|
|
13960
|
+
return this.stateParameters.flowClient.resendCode({
|
|
13961
|
+
correlationId: this.stateParameters.correlationId,
|
|
13962
|
+
continuationState: this.stateParameters.continuationState,
|
|
13963
|
+
});
|
|
13964
|
+
}
|
|
13965
|
+
}
|
|
13966
|
+
|
|
13967
|
+
/*
|
|
13968
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13969
|
+
* Licensed under the MIT License.
|
|
13970
|
+
*/
|
|
13971
|
+
/**
|
|
13972
|
+
* State returned when sign-in requires verification of an email or SMS MFA
|
|
13973
|
+
* challenge. It allows the app to submit the challenge or request a replacement.
|
|
13974
|
+
*/
|
|
13975
|
+
class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
13976
|
+
constructor() {
|
|
13977
|
+
super(...arguments);
|
|
13978
|
+
this.stateType = "mfaVerificationRequired";
|
|
13979
|
+
}
|
|
13980
|
+
/**
|
|
13981
|
+
* Submits the email or SMS challenge as the second authentication factor.
|
|
13982
|
+
* Successful verification completes sign-in.
|
|
13983
|
+
* @param challenge - The challenge value to submit.
|
|
13984
|
+
* @returns The result of submitting the MFA challenge.
|
|
13985
|
+
*/
|
|
13986
|
+
async submitChallenge(challenge) {
|
|
13987
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
13988
|
+
try {
|
|
13989
|
+
logger.verbose("Submitting V2 MFA challenge.", correlationId);
|
|
13990
|
+
const result = await this.submitCodeCore(challenge);
|
|
13991
|
+
if (result.type !== FLOW_COMPLETED_V2) {
|
|
13992
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
|
|
13993
|
+
}
|
|
13994
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
13995
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
13996
|
+
}
|
|
13997
|
+
catch (error) {
|
|
13998
|
+
logger.errorPii(`Failed to submit V2 MFA challenge. Error: '${error}'.`, correlationId);
|
|
13999
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14000
|
+
errorType: VerifyChallengeErrorV2,
|
|
14001
|
+
scenario: continuationState.scenario,
|
|
14002
|
+
correlationId,
|
|
14003
|
+
});
|
|
14004
|
+
}
|
|
14005
|
+
}
|
|
14006
|
+
/**
|
|
14007
|
+
* Requests a replacement challenge for the selected MFA method. The
|
|
14008
|
+
* returned state contains the refreshed email or SMS challenge metadata.
|
|
14009
|
+
* @returns The result of requesting a replacement MFA challenge.
|
|
14010
|
+
*/
|
|
14011
|
+
async resendChallenge() {
|
|
14012
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14013
|
+
try {
|
|
14014
|
+
logger.verbose("Resending V2 MFA challenge.", correlationId);
|
|
14015
|
+
const result = await this.resendCodeCore();
|
|
14016
|
+
return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
|
|
14017
|
+
correlationId: result.correlationId,
|
|
14018
|
+
logger,
|
|
14019
|
+
config: this.stateParameters.config,
|
|
14020
|
+
flowClient: this.stateParameters.flowClient,
|
|
14021
|
+
continuationState: result.continuationState,
|
|
14022
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14023
|
+
method: this.method,
|
|
14024
|
+
sentTo: result.sentTo,
|
|
14025
|
+
channel: result.channel,
|
|
14026
|
+
codeLength: result.codeLength,
|
|
14027
|
+
}), undefined, result.continuationState.scenario);
|
|
14028
|
+
}
|
|
14029
|
+
catch (error) {
|
|
14030
|
+
logger.errorPii(`Failed to resend V2 MFA challenge. Error: '${error}'.`, correlationId);
|
|
14031
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14032
|
+
errorType: RequestChallengeErrorV2,
|
|
14033
|
+
scenario: continuationState.scenario,
|
|
14034
|
+
correlationId,
|
|
14035
|
+
});
|
|
14036
|
+
}
|
|
14037
|
+
}
|
|
14038
|
+
}
|
|
14039
|
+
|
|
14040
|
+
/*
|
|
14041
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14042
|
+
* Licensed under the MIT License.
|
|
14043
|
+
*/
|
|
14044
|
+
class AuthenticationMethodSelectionStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14045
|
+
constructor(stateParameters) {
|
|
14046
|
+
super(stateParameters);
|
|
14047
|
+
this.methods = stateParameters.methods;
|
|
14048
|
+
}
|
|
14049
|
+
async requestSelectedMethodChallenge(method) {
|
|
14050
|
+
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
14051
|
+
const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
|
|
14052
|
+
if (!selectedMethod) {
|
|
14053
|
+
throw new InvalidArgumentError("method", correlationId);
|
|
14054
|
+
}
|
|
14055
|
+
const result = await flowClient.requestChallenge({
|
|
14056
|
+
correlationId,
|
|
14057
|
+
continuationState: {
|
|
14058
|
+
...continuationState,
|
|
14059
|
+
links: {
|
|
14060
|
+
...continuationState.links,
|
|
14061
|
+
challenge: selectedMethod.challengeHref,
|
|
14062
|
+
},
|
|
14063
|
+
},
|
|
14064
|
+
});
|
|
14065
|
+
return { result, selectedMethod };
|
|
14066
|
+
}
|
|
14067
|
+
}
|
|
14068
|
+
|
|
14069
|
+
/*
|
|
14070
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14071
|
+
* Licensed under the MIT License.
|
|
14072
|
+
*/
|
|
14073
|
+
/**
|
|
14074
|
+
* State returned when sign-in requires a registered multi-factor
|
|
14075
|
+
* authentication method.
|
|
14076
|
+
*/
|
|
14077
|
+
class MFARequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
|
|
14078
|
+
constructor() {
|
|
14079
|
+
super(...arguments);
|
|
14080
|
+
this.stateType = "mfaRequired";
|
|
14081
|
+
}
|
|
14082
|
+
/**
|
|
14083
|
+
* Requests a challenge for a registered MFA method.
|
|
14084
|
+
* @param method - A method from {@link methods}.
|
|
14085
|
+
* @returns A result requiring challenge verification or describing failure.
|
|
14086
|
+
*/
|
|
14087
|
+
async requestChallenge(method) {
|
|
14088
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14089
|
+
try {
|
|
14090
|
+
const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
|
|
14091
|
+
if (result.type !== FLOW_CODE_REQUIRED_V2) {
|
|
14092
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA method selection expected a code challenge but received '${result.type}'.`, correlationId);
|
|
14093
|
+
}
|
|
14094
|
+
return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
|
|
14095
|
+
correlationId: result.correlationId,
|
|
14096
|
+
logger,
|
|
14097
|
+
config: this.stateParameters.config,
|
|
14098
|
+
flowClient,
|
|
14099
|
+
continuationState: result.continuationState,
|
|
14100
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14101
|
+
method: selectedMethod,
|
|
14102
|
+
sentTo: result.sentTo,
|
|
14103
|
+
channel: result.channel,
|
|
14104
|
+
codeLength: result.codeLength,
|
|
14105
|
+
}), undefined, result.continuationState.scenario);
|
|
14106
|
+
}
|
|
14107
|
+
catch (error) {
|
|
14108
|
+
logger.errorPii(`Failed to request V2 MFA challenge. Error: '${error}'.`, correlationId);
|
|
14109
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14110
|
+
errorType: RequestChallengeErrorV2,
|
|
14111
|
+
scenario: continuationState.scenario,
|
|
14112
|
+
correlationId,
|
|
14113
|
+
});
|
|
14114
|
+
}
|
|
14115
|
+
}
|
|
14116
|
+
}
|
|
14117
|
+
|
|
14118
|
+
/*
|
|
14119
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14120
|
+
* Licensed under the MIT License.
|
|
14121
|
+
*/
|
|
14122
|
+
/**
|
|
14123
|
+
* State returned when first-factor email authentication requires a one-time
|
|
14124
|
+
* code. It allows the app to submit the code or request a replacement.
|
|
14125
|
+
*/
|
|
14126
|
+
class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
14127
|
+
constructor() {
|
|
14128
|
+
super(...arguments);
|
|
14129
|
+
this.stateType = "codeRequired";
|
|
14130
|
+
}
|
|
14131
|
+
/**
|
|
14132
|
+
* Submits the first-factor email code and advances the active flow. The
|
|
14133
|
+
* result may complete the operation or require another flow-specific step.
|
|
14134
|
+
* @param code - The code to submit.
|
|
14135
|
+
* @returns The result of submitting the first-factor code.
|
|
14136
|
+
*/
|
|
14137
|
+
async submitCode(code) {
|
|
14138
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14139
|
+
try {
|
|
14140
|
+
logger.verbose("Submitting V2 first-factor code.", correlationId);
|
|
14141
|
+
const result = await this.submitCodeCore(code);
|
|
14142
|
+
const resultType = result.type;
|
|
14143
|
+
if (result.type === FLOW_NEW_PASSWORD_REQUIRED_V2) {
|
|
14144
|
+
return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
|
|
14145
|
+
correlationId: result.correlationId,
|
|
14146
|
+
logger,
|
|
14147
|
+
config: this.stateParameters.config,
|
|
14148
|
+
flowClient: this.stateParameters.flowClient,
|
|
14149
|
+
continuationState: result.continuationState,
|
|
14150
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14151
|
+
}), undefined, result.continuationState.scenario);
|
|
14152
|
+
}
|
|
14153
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2 ||
|
|
14154
|
+
result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
14155
|
+
const signUpStateTransitionHandler = this.stateParameters.signUpStateTransitionHandler;
|
|
14156
|
+
if (!signUpStateTransitionHandler) {
|
|
14157
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-up state transition handler is missing.", correlationId);
|
|
14158
|
+
}
|
|
14159
|
+
return signUpStateTransitionHandler.handleVerification(result, {
|
|
14160
|
+
...this.stateParameters,
|
|
14161
|
+
signUpStateTransitionHandler,
|
|
14162
|
+
});
|
|
14163
|
+
}
|
|
14164
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14165
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14166
|
+
correlationId: result.correlationId,
|
|
14167
|
+
logger,
|
|
14168
|
+
config: this.stateParameters.config,
|
|
14169
|
+
flowClient: this.stateParameters.flowClient,
|
|
14170
|
+
continuationState: result.continuationState,
|
|
14171
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14172
|
+
}), undefined, result.continuationState.scenario);
|
|
14173
|
+
}
|
|
14174
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14175
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
14176
|
+
correlationId: result.correlationId,
|
|
14177
|
+
logger,
|
|
14178
|
+
config: this.stateParameters.config,
|
|
14179
|
+
flowClient: this.stateParameters.flowClient,
|
|
14180
|
+
continuationState: result.continuationState,
|
|
14181
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14182
|
+
methods: result.methods,
|
|
14183
|
+
}), undefined, result.continuationState.scenario);
|
|
14184
|
+
}
|
|
14185
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
14186
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14187
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14188
|
+
}
|
|
14189
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Code submission result type '${resultType}' is not supported.`, correlationId);
|
|
14190
|
+
}
|
|
14191
|
+
catch (error) {
|
|
14192
|
+
logger.errorPii(`Failed to submit V2 first-factor code. Error: '${error}'.`, correlationId);
|
|
14193
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14194
|
+
errorType: VerifyChallengeErrorV2,
|
|
14195
|
+
scenario: continuationState.scenario,
|
|
14196
|
+
correlationId,
|
|
14197
|
+
});
|
|
14198
|
+
}
|
|
14199
|
+
}
|
|
14200
|
+
/**
|
|
14201
|
+
* Requests a replacement first-factor email code. The returned state
|
|
14202
|
+
* contains the refreshed challenge metadata.
|
|
14203
|
+
* @returns The result of requesting a replacement code.
|
|
14204
|
+
*/
|
|
14205
|
+
async resendCode() {
|
|
14206
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14207
|
+
try {
|
|
14208
|
+
logger.verbose("Resending V2 first-factor code.", correlationId);
|
|
14209
|
+
const result = await this.resendCodeCore();
|
|
14210
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14211
|
+
correlationId: result.correlationId,
|
|
14212
|
+
logger,
|
|
14213
|
+
config: this.stateParameters.config,
|
|
14214
|
+
flowClient: this.stateParameters.flowClient,
|
|
14215
|
+
continuationState: result.continuationState,
|
|
14216
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14217
|
+
signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
|
|
14218
|
+
method: this.method,
|
|
14219
|
+
sentTo: result.sentTo,
|
|
14220
|
+
channel: result.channel,
|
|
14221
|
+
codeLength: result.codeLength,
|
|
14222
|
+
}), undefined, result.continuationState.scenario);
|
|
14223
|
+
}
|
|
14224
|
+
catch (error) {
|
|
14225
|
+
logger.errorPii(`Failed to resend V2 first-factor code. Error: '${error}'.`, correlationId);
|
|
14226
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14227
|
+
errorType: RequestChallengeErrorV2,
|
|
14228
|
+
scenario: continuationState.scenario,
|
|
14229
|
+
correlationId,
|
|
14230
|
+
});
|
|
14231
|
+
}
|
|
14232
|
+
}
|
|
14233
|
+
}
|
|
14234
|
+
|
|
14235
|
+
/*
|
|
14236
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14237
|
+
* Licensed under the MIT License.
|
|
14238
|
+
*/
|
|
14239
|
+
/**
|
|
14240
|
+
* State returned when the user must select one of several authentication
|
|
14241
|
+
* methods before a challenge can be issued. It exposes the list of offered
|
|
14242
|
+
* methods and lets the app request a challenge for the chosen one. The flow
|
|
14243
|
+
* stays on this state until a challenge is successfully requested.
|
|
14244
|
+
*/
|
|
14245
|
+
class AuthMethodSelectionRequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
|
|
14246
|
+
constructor() {
|
|
14247
|
+
super(...arguments);
|
|
14248
|
+
this.stateType = "authMethodSelectionRequired";
|
|
14249
|
+
}
|
|
14250
|
+
/**
|
|
14251
|
+
* Requests a challenge for the selected authentication method. The returned
|
|
14252
|
+
* state identifies the credential the application must collect.
|
|
14253
|
+
* @param method - The method to challenge, from {@link methods}.
|
|
14254
|
+
* @returns The result of requesting the challenge.
|
|
14255
|
+
*/
|
|
14256
|
+
async requestChallenge(method) {
|
|
14257
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14258
|
+
try {
|
|
14259
|
+
logger.verbose("Requesting challenge for the selected V2 method.", correlationId);
|
|
14260
|
+
const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
|
|
14261
|
+
const resultType = result.type;
|
|
14262
|
+
const commonStateParameters = {
|
|
14263
|
+
correlationId: result.correlationId,
|
|
14264
|
+
logger,
|
|
14265
|
+
config: this.stateParameters.config,
|
|
14266
|
+
flowClient,
|
|
14267
|
+
continuationState: result.continuationState,
|
|
14268
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14269
|
+
};
|
|
14270
|
+
if (result.type === FLOW_CODE_REQUIRED_V2 &&
|
|
14271
|
+
(result.channel?.toLowerCase() ===
|
|
14272
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
14273
|
+
result.channel?.toLowerCase() ===
|
|
14274
|
+
AuthenticationMethodTypeV2.SMS)) {
|
|
14275
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14276
|
+
...commonStateParameters,
|
|
14277
|
+
method: selectedMethod,
|
|
14278
|
+
sentTo: result.sentTo,
|
|
14279
|
+
channel: result.channel,
|
|
14280
|
+
codeLength: result.codeLength,
|
|
14281
|
+
}), undefined, result.continuationState.scenario);
|
|
14282
|
+
}
|
|
14283
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Challenge type '${resultType}' with channel '${result.type === FLOW_CODE_REQUIRED_V2
|
|
14284
|
+
? result.channel
|
|
14285
|
+
: AuthenticationMethodTypeV2.PASSWORD}' is not supported for password reset.`, correlationId);
|
|
14286
|
+
}
|
|
14287
|
+
catch (error) {
|
|
14288
|
+
logger.errorPii(`Failed to request V2 challenge. Error: '${error}'.`, correlationId);
|
|
14289
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14290
|
+
errorType: RequestChallengeErrorV2,
|
|
14291
|
+
scenario: continuationState.scenario,
|
|
14292
|
+
correlationId,
|
|
14293
|
+
});
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14296
|
+
}
|
|
14297
|
+
|
|
14298
|
+
/*
|
|
14299
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14300
|
+
* Licensed under the MIT License.
|
|
14301
|
+
*/
|
|
14302
|
+
/**
|
|
14303
|
+
* Error raised by the first call of the native auth V2 reset-password flow
|
|
14304
|
+
* (`resetPasswordV2`). It surfaces only the detectors relevant to starting a
|
|
14305
|
+
* password reset, so an app inspecting `result.error` sees a small, focused set.
|
|
14306
|
+
* Any unrecognised failure carries no specific detector; inspect the error code
|
|
14307
|
+
* (`unexpected_error` when the server gives none) and `errorDescription`.
|
|
14308
|
+
*/
|
|
14309
|
+
class ResetPasswordStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14310
|
+
/**
|
|
14311
|
+
* Checks if the supplied username is empty or invalid.
|
|
14312
|
+
* @returns True if the username is invalid, false otherwise.
|
|
14313
|
+
*/
|
|
14314
|
+
isInvalidUsername() {
|
|
14315
|
+
return this.isUserInvalidError();
|
|
14316
|
+
}
|
|
14317
|
+
/**
|
|
14318
|
+
* Checks if the error is due to the user not being found. Use it to tell the
|
|
14319
|
+
* user no account matches the supplied username, rather than exposing a
|
|
14320
|
+
* generic failure that hides the real cause.
|
|
14321
|
+
* @returns True if the user was not found, false otherwise.
|
|
14322
|
+
*/
|
|
14323
|
+
isUserNotFound() {
|
|
14324
|
+
return this.isUserNotFoundError();
|
|
14325
|
+
}
|
|
14326
|
+
}
|
|
14327
|
+
|
|
14328
|
+
/*
|
|
14329
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14330
|
+
* Licensed under the MIT License.
|
|
14331
|
+
*/
|
|
14332
|
+
/**
|
|
14333
|
+
* Error returned when native auth V2 sign-in cannot start.
|
|
14334
|
+
*/
|
|
14335
|
+
class SignInStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14336
|
+
/**
|
|
14337
|
+
* Checks whether the service rejected the username parameter.
|
|
14338
|
+
* @returns True when the username was empty or invalid.
|
|
14339
|
+
*/
|
|
14340
|
+
isInvalidUsername() {
|
|
14341
|
+
return this.isUserInvalidError();
|
|
14342
|
+
}
|
|
14343
|
+
/**
|
|
14344
|
+
* Checks whether the supplied username does not identify an account.
|
|
14345
|
+
* @returns True when the service reports that the user was not found.
|
|
14346
|
+
*/
|
|
14347
|
+
isUserNotFound() {
|
|
14348
|
+
return this.isUserNotFoundError();
|
|
14349
|
+
}
|
|
14350
|
+
/**
|
|
14351
|
+
* Checks whether an automatically submitted password was rejected.
|
|
14352
|
+
* @returns True when the password is incorrect.
|
|
14353
|
+
*/
|
|
14354
|
+
isInvalidPassword() {
|
|
14355
|
+
return this.isPasswordIncorrectError();
|
|
14356
|
+
}
|
|
14357
|
+
}
|
|
14358
|
+
|
|
14359
|
+
/*
|
|
14360
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14361
|
+
* Licensed under the MIT License.
|
|
14362
|
+
*/
|
|
14363
|
+
/**
|
|
14364
|
+
* Error returned when native auth V2 sign-up cannot start. It exposes
|
|
14365
|
+
* detectors for failures that an app can correct without restarting the flow.
|
|
14366
|
+
*/
|
|
14367
|
+
class SignUpStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14368
|
+
/**
|
|
14369
|
+
* Checks whether an upfront password violates the tenant's password policy.
|
|
14370
|
+
* Use it to prompt the user for a stronger password.
|
|
14371
|
+
* @returns True when the password violates policy, otherwise false.
|
|
14372
|
+
*/
|
|
14373
|
+
isInvalidPassword() {
|
|
14374
|
+
return this.isPasswordPolicyViolationError();
|
|
14375
|
+
}
|
|
14376
|
+
}
|
|
14377
|
+
|
|
14378
|
+
/*
|
|
14379
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14380
|
+
* Licensed under the MIT License.
|
|
14381
|
+
*/
|
|
14382
|
+
/**
|
|
14383
|
+
* Error returned when a password cannot be submitted for V2 sign-in.
|
|
14384
|
+
*/
|
|
14385
|
+
class SubmitPasswordErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14386
|
+
/**
|
|
14387
|
+
* Checks whether the supplied password was rejected.
|
|
14388
|
+
* @returns True when the password is incorrect.
|
|
14389
|
+
*/
|
|
14390
|
+
isInvalidPassword() {
|
|
14391
|
+
return this.isPasswordIncorrectError();
|
|
14392
|
+
}
|
|
14393
|
+
}
|
|
14394
|
+
|
|
14395
|
+
/*
|
|
14396
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14397
|
+
* Licensed under the MIT License.
|
|
14398
|
+
*/
|
|
14399
|
+
/**
|
|
14400
|
+
* State returned when the selected sign-in method requires the user's
|
|
14401
|
+
* password.
|
|
14402
|
+
*/
|
|
14403
|
+
class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14404
|
+
constructor() {
|
|
14405
|
+
super(...arguments);
|
|
14406
|
+
this.stateType = "passwordRequired";
|
|
14407
|
+
}
|
|
14408
|
+
/**
|
|
14409
|
+
* Submits the password and advances sign-in.
|
|
14410
|
+
* @param password - The account password.
|
|
14411
|
+
* @returns A completed sign-in, MFA selection, or password submission error.
|
|
14412
|
+
*/
|
|
14413
|
+
async submitPassword(password) {
|
|
14414
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14415
|
+
try {
|
|
14416
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
14417
|
+
const result = await flowClient.submitSignInPassword({
|
|
14418
|
+
correlationId,
|
|
14419
|
+
continuationState,
|
|
14420
|
+
password,
|
|
14421
|
+
});
|
|
14422
|
+
const resultType = result.type;
|
|
14423
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
14424
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14425
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14426
|
+
}
|
|
14427
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14428
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
14429
|
+
correlationId: result.correlationId,
|
|
14430
|
+
logger,
|
|
14431
|
+
config: this.stateParameters.config,
|
|
14432
|
+
flowClient,
|
|
14433
|
+
continuationState: result.continuationState,
|
|
14434
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14435
|
+
methods: result.methods,
|
|
14436
|
+
}), undefined, result.continuationState.scenario);
|
|
14437
|
+
}
|
|
14438
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
|
|
14439
|
+
}
|
|
14440
|
+
catch (error) {
|
|
14441
|
+
logger.errorPii(`Failed to submit V2 sign-in password. Error: '${error}'.`, correlationId);
|
|
14442
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14443
|
+
errorType: SubmitPasswordErrorV2,
|
|
14444
|
+
scenario: continuationState.scenario,
|
|
14445
|
+
correlationId,
|
|
14446
|
+
});
|
|
14447
|
+
}
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
14450
|
+
|
|
14451
|
+
/*
|
|
14452
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14453
|
+
* Licensed under the MIT License.
|
|
14454
|
+
*/
|
|
14455
|
+
/**
|
|
14456
|
+
* Error returned when additional V2 sign-up attributes cannot be submitted. It
|
|
14457
|
+
* identifies attribute failures that an app can correct and resubmit.
|
|
14458
|
+
*/
|
|
14459
|
+
class SubmitAttributesErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14460
|
+
/**
|
|
14461
|
+
* Checks whether the service requires attributes omitted from the request.
|
|
14462
|
+
* Use it to collect the required attributes before resubmitting.
|
|
14463
|
+
* @returns True when required attributes are missing, otherwise false.
|
|
11996
14464
|
*/
|
|
11997
|
-
|
|
11998
|
-
return this.
|
|
14465
|
+
isMissingRequiredAttributes() {
|
|
14466
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "attributeRequired");
|
|
11999
14467
|
}
|
|
12000
14468
|
/**
|
|
12001
|
-
* Checks
|
|
14469
|
+
* Checks whether a submitted password violates the tenant's password policy.
|
|
14470
|
+
* Use it to prompt the user for a stronger password.
|
|
14471
|
+
* @returns True when the password violates policy, otherwise false.
|
|
12002
14472
|
*/
|
|
12003
|
-
|
|
12004
|
-
return this.
|
|
14473
|
+
isInvalidPassword() {
|
|
14474
|
+
return this.isPasswordPolicyViolationError();
|
|
12005
14475
|
}
|
|
12006
14476
|
}
|
|
12007
14477
|
|
|
@@ -12009,30 +14479,50 @@
|
|
|
12009
14479
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12010
14480
|
* Licensed under the MIT License.
|
|
12011
14481
|
*/
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
const REGISTER_CONTINUE = "/register/v1.0/continue";
|
|
14482
|
+
class SignUpAttributesRequiredStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14483
|
+
constructor(stateParameters) {
|
|
14484
|
+
super(stateParameters);
|
|
14485
|
+
this.attributes = stateParameters.attributes;
|
|
14486
|
+
}
|
|
14487
|
+
async submitAttributesAction(attributes) {
|
|
14488
|
+
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
14489
|
+
return flowClient.submitSignUpAttributes({
|
|
14490
|
+
correlationId,
|
|
14491
|
+
continuationState,
|
|
14492
|
+
attributes,
|
|
14493
|
+
});
|
|
14494
|
+
}
|
|
14495
|
+
}
|
|
12027
14496
|
|
|
12028
14497
|
/*
|
|
12029
14498
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12030
14499
|
* Licensed under the MIT License.
|
|
12031
14500
|
*/
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
14501
|
+
/**
|
|
14502
|
+
* State returned when sign-up requires profile or custom attributes.
|
|
14503
|
+
*/
|
|
14504
|
+
class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
14505
|
+
constructor() {
|
|
14506
|
+
super(...arguments);
|
|
14507
|
+
this.stateType = "attributesRequired";
|
|
14508
|
+
}
|
|
14509
|
+
/**
|
|
14510
|
+
* Submits the attributes requested by the latest server response.
|
|
14511
|
+
*/
|
|
14512
|
+
async submitAttributes(attributes) {
|
|
14513
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14514
|
+
try {
|
|
14515
|
+
const result = await this.submitAttributesAction(attributes);
|
|
14516
|
+
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "attribute");
|
|
14517
|
+
}
|
|
14518
|
+
catch (error) {
|
|
14519
|
+
logger.errorPii(`Failed to submit V2 sign-up attributes. Error: '${error}'.`, correlationId);
|
|
14520
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14521
|
+
errorType: SubmitAttributesErrorV2,
|
|
14522
|
+
scenario: continuationState.scenario,
|
|
14523
|
+
correlationId,
|
|
14524
|
+
});
|
|
14525
|
+
}
|
|
12036
14526
|
}
|
|
12037
14527
|
}
|
|
12038
14528
|
|
|
@@ -12040,33 +14530,86 @@
|
|
|
12040
14530
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12041
14531
|
* Licensed under the MIT License.
|
|
12042
14532
|
*/
|
|
12043
|
-
|
|
14533
|
+
/**
|
|
14534
|
+
* State returned when sign-up requires a password that was not submitted with
|
|
14535
|
+
* an earlier attribute request.
|
|
14536
|
+
*/
|
|
14537
|
+
class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
14538
|
+
constructor(stateParameters) {
|
|
14539
|
+
super(stateParameters);
|
|
14540
|
+
this.stateType = "passwordRequired";
|
|
14541
|
+
this.requiredPasswordAttribute =
|
|
14542
|
+
stateParameters.requiredPasswordAttribute;
|
|
14543
|
+
}
|
|
14544
|
+
/**
|
|
14545
|
+
* Submits the password and any profile attributes requested alongside it.
|
|
14546
|
+
*/
|
|
14547
|
+
async submitPassword(password, attributes = {}) {
|
|
14548
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14549
|
+
try {
|
|
14550
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
14551
|
+
const result = await this.submitAttributesAction({
|
|
14552
|
+
...attributes,
|
|
14553
|
+
password,
|
|
14554
|
+
});
|
|
14555
|
+
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "password");
|
|
14556
|
+
}
|
|
14557
|
+
catch (error) {
|
|
14558
|
+
logger.errorPii(`Failed to submit V2 sign-up password. Error: '${error}'.`, correlationId);
|
|
14559
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14560
|
+
errorType: SubmitAttributesErrorV2,
|
|
14561
|
+
scenario: continuationState.scenario,
|
|
14562
|
+
correlationId,
|
|
14563
|
+
});
|
|
14564
|
+
}
|
|
14565
|
+
}
|
|
14566
|
+
}
|
|
12044
14567
|
|
|
12045
14568
|
/*
|
|
12046
14569
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12047
14570
|
* Licensed under the MIT License.
|
|
12048
14571
|
*/
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
14572
|
+
class SignUpStateTransitionHandlerV2 {
|
|
14573
|
+
handleAttributeSubmission(result, stateParameters, submission) {
|
|
14574
|
+
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
14575
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
14576
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14577
|
+
...commonStateParameters,
|
|
14578
|
+
sentTo: result.sentTo,
|
|
14579
|
+
channel: result.channel,
|
|
14580
|
+
codeLength: result.codeLength,
|
|
14581
|
+
}), undefined, result.continuationState.scenario);
|
|
14582
|
+
}
|
|
14583
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14584
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario);
|
|
14585
|
+
}
|
|
14586
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
|
|
12052
14587
|
}
|
|
12053
|
-
|
|
12054
|
-
|
|
14588
|
+
handleVerification(result, stateParameters) {
|
|
14589
|
+
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
14590
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
14591
|
+
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
14592
|
+
...commonStateParameters,
|
|
14593
|
+
attributes: result.attributes,
|
|
14594
|
+
}), undefined, result.continuationState.scenario);
|
|
14595
|
+
}
|
|
14596
|
+
return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
|
|
14597
|
+
...commonStateParameters,
|
|
14598
|
+
attributes: result.attributes,
|
|
14599
|
+
requiredPasswordAttribute: result.requiredPasswordAttribute,
|
|
14600
|
+
}), undefined, result.continuationState.scenario);
|
|
12055
14601
|
}
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
}
|
|
12067
|
-
});
|
|
14602
|
+
createCommonStateParameters(result, stateParameters) {
|
|
14603
|
+
return {
|
|
14604
|
+
correlationId: result.correlationId,
|
|
14605
|
+
logger: stateParameters.logger,
|
|
14606
|
+
config: stateParameters.config,
|
|
14607
|
+
flowClient: stateParameters.flowClient,
|
|
14608
|
+
continuationState: result.continuationState,
|
|
14609
|
+
cacheClient: stateParameters.cacheClient,
|
|
14610
|
+
signUpStateTransitionHandler: stateParameters.signUpStateTransitionHandler,
|
|
14611
|
+
};
|
|
12068
14612
|
}
|
|
12069
|
-
return url;
|
|
12070
14613
|
}
|
|
12071
14614
|
|
|
12072
14615
|
/*
|
|
@@ -12396,7 +14939,7 @@
|
|
|
12396
14939
|
if (responseError.error === ATTRIBUTES_REQUIRED) {
|
|
12397
14940
|
if (!responseError.attributes ||
|
|
12398
14941
|
responseError.attributes.length === 0) {
|
|
12399
|
-
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "Attributes are required but required_attributes field is missing in the response body.", correlationId);
|
|
14942
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY$1, "Attributes are required but required_attributes field is missing in the response body.", correlationId);
|
|
12400
14943
|
}
|
|
12401
14944
|
return true;
|
|
12402
14945
|
}
|
|
@@ -12404,7 +14947,7 @@
|
|
|
12404
14947
|
}
|
|
12405
14948
|
readContinuationTokenFromResponeError(responseError, correlationId) {
|
|
12406
14949
|
if (!responseError.continuationToken) {
|
|
12407
|
-
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response body", correlationId);
|
|
14950
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING$1, "Continuation token is missing in the response body", correlationId);
|
|
12408
14951
|
}
|
|
12409
14952
|
return responseError.continuationToken;
|
|
12410
14953
|
}
|
|
@@ -12432,56 +14975,6 @@
|
|
|
12432
14975
|
}
|
|
12433
14976
|
}
|
|
12434
14977
|
|
|
12435
|
-
/*
|
|
12436
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12437
|
-
* Licensed under the MIT License.
|
|
12438
|
-
*/
|
|
12439
|
-
/**
|
|
12440
|
-
* Filters the headers returned by a {@link CustomAuthRequestInterceptor},
|
|
12441
|
-
* keeping only those that conform to the custom-auth header naming rules.
|
|
12442
|
-
*
|
|
12443
|
-
* Rules (mirrors the iOS / Android native auth implementations):
|
|
12444
|
-
* - Header names must start with `x-` (case-insensitive); others are dropped.
|
|
12445
|
-
* - Header names that start with any reserved prefix (`x-client-`, `x-ms-`,
|
|
12446
|
-
* `x-broker-`, `x-app-`) are dropped.
|
|
12447
|
-
* - Headers with empty/whitespace-only names or null/undefined values are dropped.
|
|
12448
|
-
*
|
|
12449
|
-
* Dropped headers are logged as warnings (PII-safe) when a logger is provided.
|
|
12450
|
-
*
|
|
12451
|
-
* @param headers - Raw headers returned by the interceptor.
|
|
12452
|
-
* @param logger - Optional logger used to emit warnings for dropped headers.
|
|
12453
|
-
* @param correlationId - Optional correlation id forwarded to the logger.
|
|
12454
|
-
* @returns A new record containing only the headers that pass the filter,
|
|
12455
|
-
* preserving the original casing of header names.
|
|
12456
|
-
*/
|
|
12457
|
-
function filterCustomHeaders(headers, logger, correlationId) {
|
|
12458
|
-
const filtered = {};
|
|
12459
|
-
if (!headers) {
|
|
12460
|
-
return filtered;
|
|
12461
|
-
}
|
|
12462
|
-
for (const [name, value] of Object.entries(headers)) {
|
|
12463
|
-
if (!name || value === undefined || value === null) {
|
|
12464
|
-
continue;
|
|
12465
|
-
}
|
|
12466
|
-
const trimmedName = name.trim();
|
|
12467
|
-
if (!trimmedName) {
|
|
12468
|
-
continue;
|
|
12469
|
-
}
|
|
12470
|
-
const lowerName = trimmedName.toLowerCase();
|
|
12471
|
-
if (!lowerName.startsWith(CustomHeaderConstants.REQUIRED_PREFIX)) {
|
|
12472
|
-
logger?.warningPii(`Additional header field "${trimmedName}" must start with the "${CustomHeaderConstants.REQUIRED_PREFIX}" prefix. Ignoring.`, correlationId ?? "");
|
|
12473
|
-
continue;
|
|
12474
|
-
}
|
|
12475
|
-
const reservedPrefix = CustomHeaderConstants.RESERVED_PREFIXES.find((prefix) => lowerName.startsWith(prefix));
|
|
12476
|
-
if (reservedPrefix) {
|
|
12477
|
-
logger?.warningPii(`Additional header field "${trimmedName}" uses reserved prefix "${reservedPrefix}". Ignoring.`, correlationId ?? "");
|
|
12478
|
-
continue;
|
|
12479
|
-
}
|
|
12480
|
-
filtered[trimmedName] = value;
|
|
12481
|
-
}
|
|
12482
|
-
return filtered;
|
|
12483
|
-
}
|
|
12484
|
-
|
|
12485
14978
|
/*
|
|
12486
14979
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12487
14980
|
* Licensed under the MIT License.
|
|
@@ -12509,13 +15002,13 @@
|
|
|
12509
15002
|
response = await this.httpClient.post(url, formData, headers);
|
|
12510
15003
|
}
|
|
12511
15004
|
catch (e) {
|
|
12512
|
-
throw new CustomAuthApiError(HTTP_REQUEST_FAILED, `Failed to perform '${endpoint}' request: ${e}`, correlationId);
|
|
15005
|
+
throw new CustomAuthApiError(HTTP_REQUEST_FAILED$1, `Failed to perform '${endpoint}' request: ${e}`, correlationId);
|
|
12513
15006
|
}
|
|
12514
15007
|
return this.handleApiResponse(response, correlationId);
|
|
12515
15008
|
}
|
|
12516
15009
|
ensureContinuationTokenIsValid(continuationToken, correlationId) {
|
|
12517
15010
|
if (!continuationToken) {
|
|
12518
|
-
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response body", correlationId);
|
|
15011
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING$1, "Continuation token is missing in the response body", correlationId);
|
|
12519
15012
|
}
|
|
12520
15013
|
}
|
|
12521
15014
|
readResponseCorrelationId(response, requestCorrelationId) {
|
|
@@ -12553,7 +15046,7 @@
|
|
|
12553
15046
|
}
|
|
12554
15047
|
const responseError = responseData;
|
|
12555
15048
|
if (!responseError) {
|
|
12556
|
-
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "Response error body is empty or invalid", correlationId);
|
|
15049
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY$1, "Response error body is empty or invalid", correlationId);
|
|
12557
15050
|
}
|
|
12558
15051
|
const attributes = !!responseError.required_attributes &&
|
|
12559
15052
|
responseError.required_attributes.length > 0
|
|
@@ -12911,17 +15404,6 @@
|
|
|
12911
15404
|
}
|
|
12912
15405
|
}
|
|
12913
15406
|
|
|
12914
|
-
/*
|
|
12915
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12916
|
-
* Licensed under the MIT License.
|
|
12917
|
-
*/
|
|
12918
|
-
/**
|
|
12919
|
-
* Represents an HTTP method type.
|
|
12920
|
-
*/
|
|
12921
|
-
const HttpMethod = {
|
|
12922
|
-
GET: "GET",
|
|
12923
|
-
POST: "POST"};
|
|
12924
|
-
|
|
12925
15407
|
/*
|
|
12926
15408
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12927
15409
|
* Licensed under the MIT License.
|
|
@@ -17751,6 +20233,49 @@
|
|
|
17751
20233
|
}
|
|
17752
20234
|
}
|
|
17753
20235
|
|
|
20236
|
+
/*
|
|
20237
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20238
|
+
* Licensed under the MIT License.
|
|
20239
|
+
*/
|
|
20240
|
+
/**
|
|
20241
|
+
* Token types supported by the platform broker request contract.
|
|
20242
|
+
*/
|
|
20243
|
+
const PlatformAuthTokenType = {
|
|
20244
|
+
DPOP_WITH_PROOF: "dpop+proof",
|
|
20245
|
+
};
|
|
20246
|
+
const PROOF_OF_POSSESSION_TOKEN_TYPES = [
|
|
20247
|
+
AuthenticationScheme.POP,
|
|
20248
|
+
AuthenticationScheme.DPOP,
|
|
20249
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF,
|
|
20250
|
+
];
|
|
20251
|
+
/**
|
|
20252
|
+
* Returns whether a platform broker token type requires proof request metadata.
|
|
20253
|
+
*/
|
|
20254
|
+
function isProofOfPossessionTokenType(tokenType) {
|
|
20255
|
+
return (tokenType !== undefined &&
|
|
20256
|
+
PROOF_OF_POSSESSION_TOKEN_TYPES.includes(tokenType));
|
|
20257
|
+
}
|
|
20258
|
+
/**
|
|
20259
|
+
* Adds canonical proof request fields to the broker no-cache property bag.
|
|
20260
|
+
*/
|
|
20261
|
+
function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
|
|
20262
|
+
if (!isProofOfPossessionRequest) {
|
|
20263
|
+
return extraParametersNoCache;
|
|
20264
|
+
}
|
|
20265
|
+
return {
|
|
20266
|
+
...extraParametersNoCache,
|
|
20267
|
+
...(resourceRequestMethod && {
|
|
20268
|
+
pop_method: resourceRequestMethod,
|
|
20269
|
+
}),
|
|
20270
|
+
...(resourceRequestUri && {
|
|
20271
|
+
pop_url: resourceRequestUri,
|
|
20272
|
+
}),
|
|
20273
|
+
...(dpopNonce && {
|
|
20274
|
+
pop_nonce: dpopNonce,
|
|
20275
|
+
}),
|
|
20276
|
+
};
|
|
20277
|
+
}
|
|
20278
|
+
|
|
17754
20279
|
/*
|
|
17755
20280
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
17756
20281
|
* Licensed under the MIT License.
|
|
@@ -18029,6 +20554,7 @@
|
|
|
18029
20554
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
18030
20555
|
account: cachedAccount,
|
|
18031
20556
|
forceRefresh: false,
|
|
20557
|
+
resource: request.extraParameters?.resource,
|
|
18032
20558
|
};
|
|
18033
20559
|
// Preserve FMI partition semantics for silent cache filtering.
|
|
18034
20560
|
if (request.attributeTokens) {
|
|
@@ -18366,6 +20892,9 @@
|
|
|
18366
20892
|
}
|
|
18367
20893
|
: undefined;
|
|
18368
20894
|
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
20895
|
+
if (request.extraParameters?.resource) {
|
|
20896
|
+
cachedAccessToken.resource = request.extraParameters.resource;
|
|
20897
|
+
}
|
|
18369
20898
|
// save idtoken credential in configured browser storage
|
|
18370
20899
|
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
18371
20900
|
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
@@ -18450,7 +20979,7 @@
|
|
|
18450
20979
|
* scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
|
|
18451
20980
|
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
18452
20981
|
*/
|
|
18453
|
-
const { scopes, claims } = request;
|
|
20982
|
+
const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
|
|
18454
20983
|
const scopeSet = new ScopeSet(scopes || [], this.correlationId);
|
|
18455
20984
|
scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
|
|
18456
20985
|
const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
|
|
@@ -18483,6 +21012,7 @@
|
|
|
18483
21012
|
resourceRequestUri: request.resourceRequestUri,
|
|
18484
21013
|
shrClaims: request.shrClaims,
|
|
18485
21014
|
shrNonce: request.shrNonce,
|
|
21015
|
+
extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
|
|
18486
21016
|
};
|
|
18487
21017
|
if (hasAttributeTokens) {
|
|
18488
21018
|
validatedRequest.attributeTokens =
|
|
@@ -19310,9 +21840,12 @@
|
|
|
19310
21840
|
async sendMessage(request) {
|
|
19311
21841
|
this.logger.trace(`'${this.platformAuthType}' - sendMessage called.`, request.correlationId);
|
|
19312
21842
|
// fall back to native calls
|
|
21843
|
+
const extensionRequest = { ...request };
|
|
21844
|
+
delete extensionRequest.resourceRequestMethod;
|
|
21845
|
+
delete extensionRequest.resourceRequestUri;
|
|
19313
21846
|
const messageBody = {
|
|
19314
21847
|
method: NativeExtensionMethod.GetToken,
|
|
19315
|
-
request:
|
|
21848
|
+
request: extensionRequest,
|
|
19316
21849
|
};
|
|
19317
21850
|
const req = {
|
|
19318
21851
|
channel: PlatformAuthConstants.CHANNEL_ID,
|
|
@@ -19603,7 +22136,9 @@
|
|
|
19603
22136
|
}
|
|
19604
22137
|
initializePlatformDOMRequest(request) {
|
|
19605
22138
|
this.logger.trace(`'${this.platformAuthType}' - initializeNativeDOMRequest called`, request.correlationId);
|
|
19606
|
-
const { accountId, clientId, authority, scope, redirectUri, correlationId, state, extraParameters, ...remainingProperties } = request;
|
|
22139
|
+
const { accountId, clientId, authority, scope, redirectUri, correlationId, state, preferBinding, enclave, reqCnf, extraParametersNoCache, extraParameters, ...remainingProperties } = request;
|
|
22140
|
+
delete remainingProperties.resourceRequestMethod;
|
|
22141
|
+
delete remainingProperties.resourceRequestUri;
|
|
19607
22142
|
const validExtraParameters = this.getDOMExtraParams(remainingProperties, correlationId);
|
|
19608
22143
|
const platformDOMRequest = {
|
|
19609
22144
|
accountId: accountId,
|
|
@@ -19619,6 +22154,10 @@
|
|
|
19619
22154
|
redirectUri: redirectUri,
|
|
19620
22155
|
scope: scope,
|
|
19621
22156
|
state: state,
|
|
22157
|
+
preferBinding: preferBinding,
|
|
22158
|
+
enclave: enclave,
|
|
22159
|
+
requestConfirmation: reqCnf,
|
|
22160
|
+
extraParametersNoCache,
|
|
19622
22161
|
};
|
|
19623
22162
|
return platformDOMRequest;
|
|
19624
22163
|
}
|
|
@@ -19652,6 +22191,8 @@
|
|
|
19652
22191
|
}
|
|
19653
22192
|
convertToPlatformBrokerResponse(response, correlationId) {
|
|
19654
22193
|
this.logger.trace(`'${this.platformAuthType}' - convertToNativeResponse called`, correlationId);
|
|
22194
|
+
const responseProperties = response.properties || {};
|
|
22195
|
+
const bindingAttested = this.parseDOMBoolean(responseProperties.binding_attested, "binding_attested", correlationId);
|
|
19655
22196
|
const nativeResponse = {
|
|
19656
22197
|
access_token: response.accessToken,
|
|
19657
22198
|
id_token: response.idToken,
|
|
@@ -19660,12 +22201,24 @@
|
|
|
19660
22201
|
expires_in: response.expiresIn,
|
|
19661
22202
|
scope: response.scopes,
|
|
19662
22203
|
state: response.state || "",
|
|
19663
|
-
properties:
|
|
22204
|
+
properties: responseProperties,
|
|
19664
22205
|
extendedLifetimeToken: response.extendedLifetimeToken ?? false,
|
|
19665
22206
|
shr: response.proofOfPossessionPayload,
|
|
22207
|
+
token_type: responseProperties.token_type,
|
|
22208
|
+
DPoP: responseProperties.dpop_proof,
|
|
22209
|
+
binding_attested: bindingAttested,
|
|
19666
22210
|
};
|
|
19667
22211
|
return nativeResponse;
|
|
19668
22212
|
}
|
|
22213
|
+
parseDOMBoolean(value, propertyName, correlationId) {
|
|
22214
|
+
if (value === undefined) {
|
|
22215
|
+
return undefined;
|
|
22216
|
+
}
|
|
22217
|
+
if (value === "true" || value === "false") {
|
|
22218
|
+
return value === "true";
|
|
22219
|
+
}
|
|
22220
|
+
throw createAuthError(unexpectedError, correlationId, `Platform broker returned invalid ${propertyName} value.`);
|
|
22221
|
+
}
|
|
19669
22222
|
getDOMExtraParams(extraParameters, correlationId) {
|
|
19670
22223
|
try {
|
|
19671
22224
|
const stringifiedProperties = {};
|
|
@@ -20293,12 +22846,17 @@
|
|
|
20293
22846
|
async acquireToken(request) {
|
|
20294
22847
|
const validRequest = await invokeAsync(initializeAuthorizationRequest, StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Redirect, this.config, this.browserCrypto, this.browserStorage, this.logger, this.performanceClient, this.correlationId);
|
|
20295
22848
|
validRequest.platformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, request.authenticationScheme);
|
|
22849
|
+
let rejectBackButtonCancellation;
|
|
22850
|
+
const backButtonCancellation = new Promise((_, reject) => {
|
|
22851
|
+
rejectBackButtonCancellation = reject;
|
|
22852
|
+
});
|
|
20296
22853
|
const handleBackButton = (event) => {
|
|
20297
22854
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
20298
22855
|
if (event.persisted) {
|
|
20299
22856
|
this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.", this.correlationId);
|
|
20300
22857
|
this.browserStorage.resetRequestCache(this.correlationId);
|
|
20301
22858
|
this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, this.correlationId, InteractionType.Redirect);
|
|
22859
|
+
rejectBackButtonCancellation(createBrowserAuthError(userCancelled, this.correlationId));
|
|
20302
22860
|
}
|
|
20303
22861
|
};
|
|
20304
22862
|
const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
@@ -20308,12 +22866,10 @@
|
|
|
20308
22866
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
20309
22867
|
window.addEventListener("pageshow", handleBackButton);
|
|
20310
22868
|
try {
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
await this.executeCodeFlow(validRequest);
|
|
20316
|
-
}
|
|
22869
|
+
const redirectOperation = this.config.system.protocolMode === ProtocolMode.EAR
|
|
22870
|
+
? this.executeEarFlow(validRequest)
|
|
22871
|
+
: this.executeCodeFlow(validRequest);
|
|
22872
|
+
await Promise.race([redirectOperation, backButtonCancellation]);
|
|
20317
22873
|
}
|
|
20318
22874
|
catch (e) {
|
|
20319
22875
|
if (e instanceof AuthError) {
|
|
@@ -22690,9 +25246,11 @@
|
|
|
22690
25246
|
* Constructor for CustomAuthStandardController.
|
|
22691
25247
|
* @param operatingContext - The operating context for the controller.
|
|
22692
25248
|
* @param customAuthApiClient - The client to use for custom auth API operations.
|
|
25249
|
+
* @param customAuthApiClientV2 - The client to use for V2 custom auth API operations.
|
|
22693
25250
|
*/
|
|
22694
|
-
constructor(operatingContext, customAuthApiClient) {
|
|
25251
|
+
constructor(operatingContext, customAuthApiClient, customAuthApiClientV2) {
|
|
22695
25252
|
super(operatingContext);
|
|
25253
|
+
this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
|
|
22696
25254
|
if (!this.isBrowserEnvironment) {
|
|
22697
25255
|
this.logger.verbose("The SDK can only be used in a browser environment.", "");
|
|
22698
25256
|
throw new UnsupportedEnvironmentError();
|
|
@@ -22709,6 +25267,8 @@
|
|
|
22709
25267
|
this.jitClient = interactionClientFactory.create(JitClient);
|
|
22710
25268
|
this.mfaClient = interactionClientFactory.create(MfaClient);
|
|
22711
25269
|
this.cacheClient = interactionClientFactory.create(CustomAuthSilentCacheClient);
|
|
25270
|
+
this.flowClientV2 = new FlowInteractionClientV2(this.customAuthConfig, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.authority, customAuthApiClientV2 ??
|
|
25271
|
+
new CustomAuthApiClientV2(this.authority.getCustomAuthApiDomain(), this.customAuthConfig.auth.clientId, new FetchHttpClient(this.logger), this.customAuthConfig.customAuth?.customAuthApiQueryParams, this.customAuthConfig.customAuth?.requestInterceptor, this.logger));
|
|
22712
25272
|
}
|
|
22713
25273
|
/*
|
|
22714
25274
|
* Gets the current account from the cache.
|
|
@@ -22963,6 +25523,176 @@
|
|
|
22963
25523
|
return ResetPasswordStartResult.createWithError(error);
|
|
22964
25524
|
}
|
|
22965
25525
|
}
|
|
25526
|
+
async resetPasswordV2(inputs) {
|
|
25527
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25528
|
+
try {
|
|
25529
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25530
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25531
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25532
|
+
this.logger.verbose("Starting native auth V2 password-reset flow.", correlationId);
|
|
25533
|
+
const result = await this.flowClientV2.resetPassword({
|
|
25534
|
+
correlationId,
|
|
25535
|
+
username: inputs.username,
|
|
25536
|
+
});
|
|
25537
|
+
this.logger.verbose("Native auth V2 password-reset flow started.", correlationId);
|
|
25538
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25539
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25540
|
+
correlationId: result.correlationId,
|
|
25541
|
+
logger: this.logger,
|
|
25542
|
+
config: this.customAuthConfig,
|
|
25543
|
+
flowClient: this.flowClientV2,
|
|
25544
|
+
continuationState: result.continuationState,
|
|
25545
|
+
cacheClient: this.cacheClient,
|
|
25546
|
+
method: result.method,
|
|
25547
|
+
sentTo: result.sentTo,
|
|
25548
|
+
channel: result.channel,
|
|
25549
|
+
codeLength: result.codeLength,
|
|
25550
|
+
}), undefined, result.continuationState.scenario);
|
|
25551
|
+
}
|
|
25552
|
+
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
25553
|
+
correlationId: result.correlationId,
|
|
25554
|
+
logger: this.logger,
|
|
25555
|
+
config: this.customAuthConfig,
|
|
25556
|
+
flowClient: this.flowClientV2,
|
|
25557
|
+
continuationState: result.continuationState,
|
|
25558
|
+
cacheClient: this.cacheClient,
|
|
25559
|
+
methods: result.methods,
|
|
25560
|
+
}), undefined, result.continuationState.scenario);
|
|
25561
|
+
}
|
|
25562
|
+
catch (error) {
|
|
25563
|
+
this.logger.errorPii(`An error occurred during native auth V2 reset-password: '${error}'`, correlationId);
|
|
25564
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25565
|
+
errorType: ResetPasswordStartErrorV2,
|
|
25566
|
+
scenario: CustomAuthFlowScenarioV2.PasswordReset,
|
|
25567
|
+
correlationId,
|
|
25568
|
+
});
|
|
25569
|
+
}
|
|
25570
|
+
}
|
|
25571
|
+
async signInV2(inputs) {
|
|
25572
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25573
|
+
try {
|
|
25574
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25575
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25576
|
+
if (inputs.claims) {
|
|
25577
|
+
ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
|
|
25578
|
+
}
|
|
25579
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25580
|
+
this.logger.verbose("Starting native auth V2 sign-in.", correlationId);
|
|
25581
|
+
const result = await this.flowClientV2.signIn({
|
|
25582
|
+
correlationId,
|
|
25583
|
+
username: inputs.username,
|
|
25584
|
+
password: inputs.password,
|
|
25585
|
+
scopes: inputs.scopes,
|
|
25586
|
+
});
|
|
25587
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
25588
|
+
return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
|
|
25589
|
+
}
|
|
25590
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
25591
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
25592
|
+
correlationId: result.correlationId,
|
|
25593
|
+
logger: this.logger,
|
|
25594
|
+
config: this.customAuthConfig,
|
|
25595
|
+
flowClient: this.flowClientV2,
|
|
25596
|
+
continuationState: result.continuationState,
|
|
25597
|
+
cacheClient: this.cacheClient,
|
|
25598
|
+
methods: result.methods,
|
|
25599
|
+
}), undefined, result.continuationState.scenario);
|
|
25600
|
+
}
|
|
25601
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25602
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25603
|
+
correlationId: result.correlationId,
|
|
25604
|
+
logger: this.logger,
|
|
25605
|
+
config: this.customAuthConfig,
|
|
25606
|
+
flowClient: this.flowClientV2,
|
|
25607
|
+
continuationState: result.continuationState,
|
|
25608
|
+
cacheClient: this.cacheClient,
|
|
25609
|
+
method: result.method,
|
|
25610
|
+
sentTo: result.sentTo,
|
|
25611
|
+
channel: result.channel,
|
|
25612
|
+
codeLength: result.codeLength,
|
|
25613
|
+
}), undefined, result.continuationState.scenario);
|
|
25614
|
+
}
|
|
25615
|
+
if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
|
|
25616
|
+
return new CustomAuthResultV2(new PasswordRequiredStateV2({
|
|
25617
|
+
correlationId: result.correlationId,
|
|
25618
|
+
logger: this.logger,
|
|
25619
|
+
config: this.customAuthConfig,
|
|
25620
|
+
flowClient: this.flowClientV2,
|
|
25621
|
+
continuationState: result.continuationState,
|
|
25622
|
+
cacheClient: this.cacheClient,
|
|
25623
|
+
}), undefined, result.continuationState.scenario);
|
|
25624
|
+
}
|
|
25625
|
+
throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
|
|
25626
|
+
}
|
|
25627
|
+
catch (error) {
|
|
25628
|
+
this.logger.errorPii(`An error occurred during native auth V2 sign-in: '${error}'`, correlationId);
|
|
25629
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25630
|
+
errorType: SignInStartErrorV2,
|
|
25631
|
+
scenario: CustomAuthFlowScenarioV2.SignIn,
|
|
25632
|
+
correlationId,
|
|
25633
|
+
});
|
|
25634
|
+
}
|
|
25635
|
+
}
|
|
25636
|
+
async signUpV2(inputs) {
|
|
25637
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25638
|
+
try {
|
|
25639
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25640
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25641
|
+
if (Object.prototype.hasOwnProperty.call(inputs, "password")) {
|
|
25642
|
+
ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
|
|
25643
|
+
ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
|
|
25644
|
+
}
|
|
25645
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25646
|
+
this.logger.verbose("Starting native auth V2 sign-up.", correlationId);
|
|
25647
|
+
const result = await this.flowClientV2.signUp({
|
|
25648
|
+
correlationId,
|
|
25649
|
+
username: inputs.username,
|
|
25650
|
+
password: inputs.password,
|
|
25651
|
+
attributes: inputs.attributes,
|
|
25652
|
+
scopes: inputs.scopes,
|
|
25653
|
+
claims: inputs.claims,
|
|
25654
|
+
});
|
|
25655
|
+
const commonStateParameters = {
|
|
25656
|
+
correlationId: result.correlationId,
|
|
25657
|
+
logger: this.logger,
|
|
25658
|
+
config: this.customAuthConfig,
|
|
25659
|
+
flowClient: this.flowClientV2,
|
|
25660
|
+
continuationState: result.continuationState,
|
|
25661
|
+
cacheClient: this.cacheClient,
|
|
25662
|
+
signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
|
|
25663
|
+
};
|
|
25664
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25665
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25666
|
+
...commonStateParameters,
|
|
25667
|
+
sentTo: result.sentTo,
|
|
25668
|
+
channel: result.channel,
|
|
25669
|
+
codeLength: result.codeLength,
|
|
25670
|
+
}), undefined, result.continuationState.scenario);
|
|
25671
|
+
}
|
|
25672
|
+
if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
25673
|
+
return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
|
|
25674
|
+
...commonStateParameters,
|
|
25675
|
+
attributes: result.attributes,
|
|
25676
|
+
requiredPasswordAttribute: result.requiredPasswordAttribute,
|
|
25677
|
+
}), undefined, result.continuationState.scenario);
|
|
25678
|
+
}
|
|
25679
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
25680
|
+
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
25681
|
+
...commonStateParameters,
|
|
25682
|
+
attributes: result.attributes,
|
|
25683
|
+
}), undefined, result.continuationState.scenario);
|
|
25684
|
+
}
|
|
25685
|
+
throw new UnexpectedError("Unsupported native auth V2 sign-up result type.", correlationId);
|
|
25686
|
+
}
|
|
25687
|
+
catch (error) {
|
|
25688
|
+
this.logger.errorPii(`An error occurred during native auth V2 sign-up: '${error}'`, correlationId);
|
|
25689
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25690
|
+
errorType: SignUpStartErrorV2,
|
|
25691
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
25692
|
+
correlationId,
|
|
25693
|
+
});
|
|
25694
|
+
}
|
|
25695
|
+
}
|
|
22966
25696
|
getCorrelationId(actionInputs) {
|
|
22967
25697
|
return (actionInputs?.correlationId || this.browserCrypto.createNewGuid());
|
|
22968
25698
|
}
|
|
@@ -23774,7 +26504,7 @@
|
|
|
23774
26504
|
/**
|
|
23775
26505
|
* Creates a new instance of a PublicClientApplication with the given configuration and controller to start Native authentication flows
|
|
23776
26506
|
* @param {CustomAuthConfiguration} config - A configuration object for the PublicClientApplication instance
|
|
23777
|
-
* @returns {Promise<
|
|
26507
|
+
* @returns {Promise<ICustomAuthPublicClientApplicationV2>} - A promise that resolves to a CustomAuthPublicClientApplication instance
|
|
23778
26508
|
*/
|
|
23779
26509
|
static async create(config) {
|
|
23780
26510
|
CustomAuthPublicClientApplication.validateConfig(config);
|
|
@@ -23825,6 +26555,31 @@
|
|
|
23825
26555
|
resetPassword(resetPasswordInputs) {
|
|
23826
26556
|
return this.customAuthController.resetPassword(resetPasswordInputs);
|
|
23827
26557
|
}
|
|
26558
|
+
/**
|
|
26559
|
+
* Starts native auth V2 sign-in and returns the authentication methods
|
|
26560
|
+
* offered for the first factor.
|
|
26561
|
+
* @param inputs - Inputs for the sign-in V2 flow.
|
|
26562
|
+
* @returns A promise that resolves to the sign-in start result.
|
|
26563
|
+
*/
|
|
26564
|
+
signInV2(inputs) {
|
|
26565
|
+
return this.customAuthController.signInV2(inputs);
|
|
26566
|
+
}
|
|
26567
|
+
/**
|
|
26568
|
+
* Starts native auth V2 sign-up.
|
|
26569
|
+
* @param inputs - Inputs for the sign-up V2 flow.
|
|
26570
|
+
* @returns A promise that resolves to the sign-up start result.
|
|
26571
|
+
*/
|
|
26572
|
+
signUpV2(inputs) {
|
|
26573
|
+
return this.customAuthController.signUpV2(inputs);
|
|
26574
|
+
}
|
|
26575
|
+
/**
|
|
26576
|
+
* Initiates the native auth V2 self-service password reset flow.
|
|
26577
|
+
* @param {ResetPasswordInputsV2} inputs - Inputs for the reset-password V2 flow
|
|
26578
|
+
* @returns {Promise<ResetPasswordStartResultV2>} - A promise that resolves to ResetPasswordStartResultV2
|
|
26579
|
+
*/
|
|
26580
|
+
resetPasswordV2(inputs) {
|
|
26581
|
+
return this.customAuthController.resetPasswordV2(inputs);
|
|
26582
|
+
}
|
|
23828
26583
|
/**
|
|
23829
26584
|
* Validates the configuration to ensure it is a valid CustomAuthConfiguration object.
|
|
23830
26585
|
* @param {CustomAuthConfiguration} config - The configuration object for the PublicClientApplication.
|
|
@@ -23864,6 +26619,7 @@
|
|
|
23864
26619
|
}
|
|
23865
26620
|
}
|
|
23866
26621
|
|
|
26622
|
+
exports.AttributesRequiredStateV2 = AttributesRequiredStateV2;
|
|
23867
26623
|
exports.AuthFlowActionRequiredStateBase = AuthFlowActionRequiredStateBase;
|
|
23868
26624
|
exports.AuthFlowStateBase = AuthFlowStateBase;
|
|
23869
26625
|
exports.AuthMethodRegistrationChallengeMethodError = AuthMethodRegistrationChallengeMethodError;
|
|
@@ -23873,11 +26629,17 @@
|
|
|
23873
26629
|
exports.AuthMethodRegistrationRequiredState = AuthMethodRegistrationRequiredState;
|
|
23874
26630
|
exports.AuthMethodRegistrationSubmitChallengeError = AuthMethodRegistrationSubmitChallengeError;
|
|
23875
26631
|
exports.AuthMethodRegistrationSubmitChallengeResult = AuthMethodRegistrationSubmitChallengeResult;
|
|
26632
|
+
exports.AuthMethodSelectionRequiredStateV2 = AuthMethodSelectionRequiredStateV2;
|
|
23876
26633
|
exports.AuthMethodVerificationRequiredState = AuthMethodVerificationRequiredState;
|
|
26634
|
+
exports.CodeRequiredStateV2 = CodeRequiredStateV2;
|
|
26635
|
+
exports.CompletedStateV2 = CompletedStateV2;
|
|
23877
26636
|
exports.CustomAuthAccountData = CustomAuthAccountData;
|
|
23878
26637
|
exports.CustomAuthApiError = CustomAuthApiError;
|
|
23879
26638
|
exports.CustomAuthError = CustomAuthError;
|
|
26639
|
+
exports.CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2;
|
|
23880
26640
|
exports.CustomAuthPublicClientApplication = CustomAuthPublicClientApplication;
|
|
26641
|
+
exports.CustomAuthResultV2 = CustomAuthResultV2;
|
|
26642
|
+
exports.FailedStateV2 = FailedStateV2;
|
|
23881
26643
|
exports.GetAccessTokenResult = GetAccessTokenResult;
|
|
23882
26644
|
exports.GetAccountError = GetAccountError;
|
|
23883
26645
|
exports.GetAccountResult = GetAccountResult;
|
|
@@ -23885,6 +26647,8 @@
|
|
|
23885
26647
|
exports.HttpError = HttpError;
|
|
23886
26648
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
23887
26649
|
exports.InvalidConfigurationError = InvalidConfigurationError;
|
|
26650
|
+
exports.MFARequiredStateV2 = MFARequiredStateV2;
|
|
26651
|
+
exports.MFAVerificationRequiredStateV2 = MFAVerificationRequiredStateV2;
|
|
23888
26652
|
exports.MethodNotImplementedError = MethodNotImplementedError;
|
|
23889
26653
|
exports.MfaAwaitingState = MfaAwaitingState;
|
|
23890
26654
|
exports.MfaCompletedState = MfaCompletedState;
|
|
@@ -23895,8 +26659,11 @@
|
|
|
23895
26659
|
exports.MfaSubmitChallengeResult = MfaSubmitChallengeResult;
|
|
23896
26660
|
exports.MfaVerificationRequiredState = MfaVerificationRequiredState;
|
|
23897
26661
|
exports.MsalCustomAuthError = MsalCustomAuthError;
|
|
26662
|
+
exports.NewPasswordRequiredStateV2 = NewPasswordRequiredStateV2;
|
|
23898
26663
|
exports.NoCachedAccountFoundError = NoCachedAccountFoundError;
|
|
23899
26664
|
exports.ParsedUrlError = ParsedUrlError;
|
|
26665
|
+
exports.PasswordRequiredStateV2 = PasswordRequiredStateV2;
|
|
26666
|
+
exports.RequestChallengeErrorV2 = RequestChallengeErrorV2;
|
|
23900
26667
|
exports.ResetPasswordCodeRequiredState = ResetPasswordCodeRequiredState;
|
|
23901
26668
|
exports.ResetPasswordCompletedState = ResetPasswordCompletedState;
|
|
23902
26669
|
exports.ResetPasswordError = ResetPasswordError;
|
|
@@ -23904,6 +26671,7 @@
|
|
|
23904
26671
|
exports.ResetPasswordPasswordRequiredState = ResetPasswordPasswordRequiredState;
|
|
23905
26672
|
exports.ResetPasswordResendCodeError = ResetPasswordResendCodeError;
|
|
23906
26673
|
exports.ResetPasswordResendCodeResult = ResetPasswordResendCodeResult;
|
|
26674
|
+
exports.ResetPasswordStartErrorV2 = ResetPasswordStartErrorV2;
|
|
23907
26675
|
exports.ResetPasswordStartResult = ResetPasswordStartResult;
|
|
23908
26676
|
exports.ResetPasswordState = ResetPasswordState;
|
|
23909
26677
|
exports.ResetPasswordSubmitCodeError = ResetPasswordSubmitCodeError;
|
|
@@ -23912,13 +26680,16 @@
|
|
|
23912
26680
|
exports.ResetPasswordSubmitPasswordResult = ResetPasswordSubmitPasswordResult;
|
|
23913
26681
|
exports.SignInCodeRequiredState = SignInCodeRequiredState;
|
|
23914
26682
|
exports.SignInCompletedState = SignInCompletedState;
|
|
26683
|
+
exports.SignInContinuationErrorV2 = SignInContinuationErrorV2;
|
|
23915
26684
|
exports.SignInContinuationState = SignInContinuationState;
|
|
26685
|
+
exports.SignInContinuationStateV2 = SignInContinuationStateV2;
|
|
23916
26686
|
exports.SignInError = SignInError;
|
|
23917
26687
|
exports.SignInFailedState = SignInFailedState;
|
|
23918
26688
|
exports.SignInPasswordRequiredState = SignInPasswordRequiredState;
|
|
23919
26689
|
exports.SignInResendCodeError = SignInResendCodeError;
|
|
23920
26690
|
exports.SignInResendCodeResult = SignInResendCodeResult;
|
|
23921
26691
|
exports.SignInResult = SignInResult;
|
|
26692
|
+
exports.SignInStartErrorV2 = SignInStartErrorV2;
|
|
23922
26693
|
exports.SignInState = SignInState;
|
|
23923
26694
|
exports.SignInSubmitCodeError = SignInSubmitCodeError;
|
|
23924
26695
|
exports.SignInSubmitCodeResult = SignInSubmitCodeResult;
|
|
@@ -23932,9 +26703,11 @@
|
|
|
23932
26703
|
exports.SignUpError = SignUpError;
|
|
23933
26704
|
exports.SignUpFailedState = SignUpFailedState;
|
|
23934
26705
|
exports.SignUpPasswordRequiredState = SignUpPasswordRequiredState;
|
|
26706
|
+
exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
|
|
23935
26707
|
exports.SignUpResendCodeError = SignUpResendCodeError;
|
|
23936
26708
|
exports.SignUpResendCodeResult = SignUpResendCodeResult;
|
|
23937
26709
|
exports.SignUpResult = SignUpResult;
|
|
26710
|
+
exports.SignUpStartErrorV2 = SignUpStartErrorV2;
|
|
23938
26711
|
exports.SignUpState = SignUpState;
|
|
23939
26712
|
exports.SignUpSubmitAttributesError = SignUpSubmitAttributesError;
|
|
23940
26713
|
exports.SignUpSubmitAttributesResult = SignUpSubmitAttributesResult;
|
|
@@ -23942,10 +26715,14 @@
|
|
|
23942
26715
|
exports.SignUpSubmitCodeResult = SignUpSubmitCodeResult;
|
|
23943
26716
|
exports.SignUpSubmitPasswordError = SignUpSubmitPasswordError;
|
|
23944
26717
|
exports.SignUpSubmitPasswordResult = SignUpSubmitPasswordResult;
|
|
26718
|
+
exports.SubmitAttributesErrorV2 = SubmitAttributesErrorV2;
|
|
26719
|
+
exports.SubmitNewPasswordErrorV2 = SubmitNewPasswordErrorV2;
|
|
26720
|
+
exports.SubmitPasswordErrorV2 = SubmitPasswordErrorV2;
|
|
23945
26721
|
exports.UnexpectedError = UnexpectedError;
|
|
23946
26722
|
exports.UnsupportedEnvironmentError = UnsupportedEnvironmentError;
|
|
23947
26723
|
exports.UserAccountAttributeError = UserAccountAttributeError;
|
|
23948
26724
|
exports.UserAlreadySignedInError = UserAlreadySignedInError;
|
|
26725
|
+
exports.VerifyChallengeErrorV2 = VerifyChallengeErrorV2;
|
|
23949
26726
|
|
|
23950
26727
|
}));
|
|
23951
26728
|
//# sourceMappingURL=msal-custom-auth.js.map
|