@azure/msal-browser 5.28.0 → 5.29.1
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 +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +1 -1
- 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 +6 -4
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +58 -62
- 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 +3 -5
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +19 -13
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +8 -2
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +58 -69
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +3 -3
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +42 -15
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +17 -4
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -18
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +2 -4
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +2 -3
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +17 -6
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs +110 -0
- package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +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 +2 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs.map +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 +256 -150
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +2 -6
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -3
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
- 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 +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 +1 -7
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +35 -19
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +20 -9
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +1 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +5 -7
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +3 -2
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +17 -2
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs.map +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 +4 -3
- 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/state/NewPasswordRequiredStateV2.mjs +23 -7
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs +24 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.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/state/SignInContinuationStateV2.mjs +4 -7
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +2 -2
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs.map +1 -1
- 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/state/AttributesRequiredStateV2.mjs +17 -8
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs +78 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs +48 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs +49 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +17 -24
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
- 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 +38 -31
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +6 -2
- 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 +5 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +21 -9
- 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/request/SilentRequestHelpers.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/BrowserDetection.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/IframeMonitor.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/utils/PopupMonitor.mjs +1 -1
- package/dist/utils/PopupOriginCheck.mjs +1 -1
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
- package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
- 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 +1 -1
- package/lib/custom-auth-path/log-strings-mapping.json +21 -9
- package/lib/custom-auth-path/msal-custom-auth.cjs +1160 -765
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +1160 -765
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +7 -3
- package/lib/msal-browser.cjs +187 -117
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +187 -117
- 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 +39 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +39 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +2 -2
- package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
- package/package.json +2 -2
- package/src/custom_auth/CustomAuthActionInputs.ts +12 -5
- package/src/custom_auth/CustomAuthPublicClientApplication.ts +5 -3
- package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +5 -3
- package/src/custom_auth/controller/CustomAuthStandardController.ts +79 -110
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +1 -2
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +1 -4
- package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +5 -4
- package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +28 -16
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +6 -0
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.ts +83 -72
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +3 -3
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +7 -5
- package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +10 -6
- package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +9 -6
- package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +4 -6
- package/src/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.ts +36 -0
- package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +6 -8
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +2 -2
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +61 -12
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +21 -3
- package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +30 -24
- package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +1 -3
- package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +11 -2
- package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +1 -2
- package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +26 -7
- package/src/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.ts +179 -0
- package/src/custom_auth/core/error/InvalidArgumentError.ts +1 -1
- package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +12 -12
- package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +394 -238
- package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +2 -6
- package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +2 -15
- package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +63 -26
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +0 -6
- package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +74 -26
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +48 -9
- package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +4 -6
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +0 -6
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +14 -53
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +0 -18
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +32 -13
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +8 -9
- package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +4 -5
- package/src/custom_auth/core/telemetry/PublicApiId.ts +1 -0
- package/src/custom_auth/core/utils/ArgumentValidator.ts +26 -0
- package/src/custom_auth/index.ts +10 -11
- package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
- package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +28 -5
- package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.ts +30 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +4 -8
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +4 -7
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +3 -6
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +0 -3
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.ts +2 -3
- package/src/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.ts +49 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +8 -4
- package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +16 -4
- package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +26 -5
- package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.ts +101 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.ts +53 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.ts +97 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +0 -6
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +25 -48
- package/src/interaction_client/PlatformAuthInteractionClient.ts +53 -38
- package/src/interaction_client/RedirectClient.ts +5 -1
- package/src/interaction_client/StandardInteractionClient.ts +4 -0
- package/src/packageMetadata.ts +1 -1
- package/types/custom_auth/CustomAuthActionInputs.d.ts +12 -5
- 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 +5 -3
- package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +5 -3
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -1
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts +2 -0
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +1 -2
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +1 -4
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +5 -4
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +17 -8
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +6 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts +23 -44
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +3 -3
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +7 -6
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +7 -6
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +8 -7
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +4 -6
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +20 -0
- package/types/custom_auth/core/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +6 -8
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +2 -2
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +3 -6
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +3 -3
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +6 -8
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +1 -3
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -2
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +1 -2
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +5 -6
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +23 -0
- package/types/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/error/InvalidArgumentError.d.ts +1 -0
- package/types/custom_auth/core/error/InvalidArgumentError.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +8 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -10
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +1 -1
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +2 -5
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +22 -3
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +2 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +8 -8
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +18 -6
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +6 -10
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +0 -4
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts +1 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
- package/types/custom_auth/core/utils/ArgumentValidator.d.ts +3 -0
- package/types/custom_auth/core/utils/ArgumentValidator.d.ts.map +1 -1
- package/types/custom_auth/index.d.ts +5 -5
- package/types/custom_auth/index.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +7 -5
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts +7 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +4 -8
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +5 -6
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +3 -6
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +0 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts +3 -2
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts +27 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/ExistingAccountActionResultsV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +6 -3
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +12 -3
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +8 -3
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts +24 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts +18 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts +7 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +0 -4
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +5 -4
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +4 -3
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +0 -82
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +0 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +0 -25
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +0 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +0 -45
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +0 -1
- package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +0 -23
- package/src/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.ts +0 -19
- package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +0 -22
- package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +0 -115
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +0 -34
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +0 -61
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +0 -14
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +0 -1
- package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts +0 -13
- package/types/custom_auth/core/auth_flow/v2/result/ResendCodeResultV2.d.ts.map +0 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +0 -9
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +0 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +0 -17
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +0 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +0 -11
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +0 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +0 -19
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.29.1 2026-11-12 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v16.16.
|
|
5
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -62,7 +62,7 @@ const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
|
62
62
|
*/
|
|
63
63
|
const POPUP_ORIGIN_CHECK_DONE = "pocd";
|
|
64
64
|
|
|
65
|
-
/*! @azure/msal-common v16.16.
|
|
65
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
66
66
|
/*
|
|
67
67
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
68
68
|
* Licensed under the MIT License.
|
|
@@ -296,7 +296,7 @@ const JsonWebTokenTypes = {
|
|
|
296
296
|
// Token renewal offset default in seconds
|
|
297
297
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
298
298
|
|
|
299
|
-
/*! @azure/msal-common v16.16.
|
|
299
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
300
300
|
/*
|
|
301
301
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
302
302
|
* Licensed under the MIT License.
|
|
@@ -325,7 +325,7 @@ function createAuthError(code, correlationId, additionalMessage) {
|
|
|
325
325
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
/*! @azure/msal-common v16.16.
|
|
328
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
329
329
|
|
|
330
330
|
/*
|
|
331
331
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -348,7 +348,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
|
|
|
348
348
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
/*! @azure/msal-common v16.16.
|
|
351
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
352
352
|
/*
|
|
353
353
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
354
354
|
* Licensed under the MIT License.
|
|
@@ -386,7 +386,7 @@ const methodNotImplemented = "method_not_implemented";
|
|
|
386
386
|
const resourceParameterRequired = "resource_parameter_required";
|
|
387
387
|
const misplacedResourceParam = "misplaced_resource_parameter";
|
|
388
388
|
|
|
389
|
-
/*! @azure/msal-common v16.16.
|
|
389
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
390
390
|
|
|
391
391
|
/*
|
|
392
392
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -424,7 +424,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
/*! @azure/msal-common v16.16.
|
|
427
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
428
428
|
|
|
429
429
|
/*
|
|
430
430
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -490,7 +490,7 @@ function getJWSPayload(authToken, correlationId) {
|
|
|
490
490
|
return matches[2];
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
/*! @azure/msal-common v16.16.
|
|
493
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
494
494
|
|
|
495
495
|
/*
|
|
496
496
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -578,7 +578,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
578
578
|
return updatedAccountInfo;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
/*! @azure/msal-common v16.16.
|
|
581
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
582
582
|
/*
|
|
583
583
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
584
584
|
* Licensed under the MIT License.
|
|
@@ -592,7 +592,7 @@ const AuthorityType = {
|
|
|
592
592
|
Ciam: 3,
|
|
593
593
|
};
|
|
594
594
|
|
|
595
|
-
/*! @azure/msal-common v16.16.
|
|
595
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
596
596
|
/*
|
|
597
597
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
598
598
|
* Licensed under the MIT License.
|
|
@@ -614,7 +614,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
614
614
|
return null;
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
/*! @azure/msal-common v16.16.
|
|
617
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
618
618
|
/*
|
|
619
619
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
620
620
|
* Licensed under the MIT License.
|
|
@@ -638,7 +638,7 @@ const ProtocolMode = {
|
|
|
638
638
|
EAR: "EAR",
|
|
639
639
|
};
|
|
640
640
|
|
|
641
|
-
/*! @azure/msal-common v16.16.
|
|
641
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
642
642
|
/**
|
|
643
643
|
* Returns the AccountInfo interface for this account.
|
|
644
644
|
* @internal
|
|
@@ -827,7 +827,7 @@ function isAccountEntity(entity) {
|
|
|
827
827
|
entity.hasOwnProperty("authorityType"));
|
|
828
828
|
}
|
|
829
829
|
|
|
830
|
-
/*! @azure/msal-common v16.16.
|
|
830
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
831
831
|
/*
|
|
832
832
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
833
833
|
* Licensed under the MIT License.
|
|
@@ -837,7 +837,7 @@ function isAccountEntity(entity) {
|
|
|
837
837
|
*/
|
|
838
838
|
const unexpectedError = "unexpected_error";
|
|
839
839
|
|
|
840
|
-
/*! @azure/msal-common v16.16.
|
|
840
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
841
841
|
|
|
842
842
|
/*
|
|
843
843
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -857,7 +857,7 @@ function createClientConfigurationError(errorCode, correlationId) {
|
|
|
857
857
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
858
858
|
}
|
|
859
859
|
|
|
860
|
-
/*! @azure/msal-common v16.16.
|
|
860
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
861
861
|
/*
|
|
862
862
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
863
863
|
* Licensed under the MIT License.
|
|
@@ -897,7 +897,7 @@ function getResponseHeader(headers, name) {
|
|
|
897
897
|
return headerName === undefined ? undefined : headers[headerName];
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
-
/*! @azure/msal-common v16.16.
|
|
900
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
901
901
|
/*
|
|
902
902
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
903
903
|
* Licensed under the MIT License.
|
|
@@ -928,7 +928,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
|
|
|
928
928
|
const invalidDpopNonce = "invalid_dpop_nonce";
|
|
929
929
|
const dpopMissingResourceContext = "dpop_missing_resource_context";
|
|
930
930
|
|
|
931
|
-
/*! @azure/msal-common v16.16.
|
|
931
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
932
932
|
/*
|
|
933
933
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
934
934
|
* Licensed under the MIT License.
|
|
@@ -940,7 +940,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
940
940
|
response.hasOwnProperty("jwks_uri"));
|
|
941
941
|
}
|
|
942
942
|
|
|
943
|
-
/*! @azure/msal-common v16.16.
|
|
943
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
944
944
|
/*
|
|
945
945
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
946
946
|
* Licensed under the MIT License.
|
|
@@ -1020,12 +1020,18 @@ class StringUtils {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
1022
|
|
|
1023
|
-
/*! @azure/msal-common v16.16.
|
|
1023
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1024
1024
|
|
|
1025
1025
|
/*
|
|
1026
1026
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1027
1027
|
* Licensed under the MIT License.
|
|
1028
1028
|
*/
|
|
1029
|
+
// Matches ASCII controls, space, DEL, backslash, or the userinfo separator (@).
|
|
1030
|
+
const UNSAFE_AUTHORITY = /[\x00-\x20\x7f\\@]/;
|
|
1031
|
+
const DEFAULT_PORTS = {
|
|
1032
|
+
"https:": ":443",
|
|
1033
|
+
"http:": ":80",
|
|
1034
|
+
};
|
|
1029
1035
|
/**
|
|
1030
1036
|
* Url object class which can perform various transformations on url strings.
|
|
1031
1037
|
*/
|
|
@@ -1141,6 +1147,29 @@ class UrlString {
|
|
|
1141
1147
|
AbsolutePath: match[5],
|
|
1142
1148
|
QueryString: match[7],
|
|
1143
1149
|
};
|
|
1150
|
+
let parsedUrl;
|
|
1151
|
+
try {
|
|
1152
|
+
parsedUrl = new URL(this.urlString);
|
|
1153
|
+
}
|
|
1154
|
+
catch {
|
|
1155
|
+
throw createClientConfigurationError(urlParseError, this.correlationId);
|
|
1156
|
+
}
|
|
1157
|
+
const host = urlComponents.HostNameAndPort?.toLowerCase();
|
|
1158
|
+
const schemeAndAuthority = `${urlComponents.Protocol}//${host}`;
|
|
1159
|
+
const defaultPort = DEFAULT_PORTS[parsedUrl.protocol] ?? "";
|
|
1160
|
+
/*
|
|
1161
|
+
* Cross-check the original host; reparsing parsedUrl would hide parser differences.
|
|
1162
|
+
* URL has validated IPv6 syntax, so only bracketed hosts need a normalization comparison.
|
|
1163
|
+
*/
|
|
1164
|
+
const hostMatches = host === parsedUrl.host ||
|
|
1165
|
+
host === `${parsedUrl.host}${defaultPort}` ||
|
|
1166
|
+
(host?.startsWith("[") &&
|
|
1167
|
+
new URL(`${urlComponents.Protocol}//${host}`).host ===
|
|
1168
|
+
parsedUrl.host);
|
|
1169
|
+
// Check authority ambiguity without restricting resource paths, queries, or fragments.
|
|
1170
|
+
if (UNSAFE_AUTHORITY.test(schemeAndAuthority) || !hostMatches) {
|
|
1171
|
+
throw createClientConfigurationError(urlParseError, this.correlationId);
|
|
1172
|
+
}
|
|
1144
1173
|
let pathSegments = urlComponents.AbsolutePath.split("/");
|
|
1145
1174
|
pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements
|
|
1146
1175
|
urlComponents.PathSegments = pathSegments;
|
|
@@ -1178,7 +1207,7 @@ class UrlString {
|
|
|
1178
1207
|
}
|
|
1179
1208
|
}
|
|
1180
1209
|
|
|
1181
|
-
/*! @azure/msal-common v16.16.
|
|
1210
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1182
1211
|
|
|
1183
1212
|
/*
|
|
1184
1213
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1332,7 +1361,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
1332
1361
|
return null;
|
|
1333
1362
|
}
|
|
1334
1363
|
|
|
1335
|
-
/*! @azure/msal-common v16.16.
|
|
1364
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1336
1365
|
/*
|
|
1337
1366
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1338
1367
|
* Licensed under the MIT License.
|
|
@@ -1341,7 +1370,7 @@ const AzureCloudInstance = {
|
|
|
1341
1370
|
// AzureCloudInstance is not specified.
|
|
1342
1371
|
None: "none"};
|
|
1343
1372
|
|
|
1344
|
-
/*! @azure/msal-common v16.16.
|
|
1373
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1345
1374
|
/*
|
|
1346
1375
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1347
1376
|
* Licensed under the MIT License.
|
|
@@ -1351,7 +1380,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
1351
1380
|
response.hasOwnProperty("metadata"));
|
|
1352
1381
|
}
|
|
1353
1382
|
|
|
1354
|
-
/*! @azure/msal-common v16.16.
|
|
1383
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1355
1384
|
/*
|
|
1356
1385
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1357
1386
|
* Licensed under the MIT License.
|
|
@@ -1361,7 +1390,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
1361
1390
|
response.hasOwnProperty("error_description"));
|
|
1362
1391
|
}
|
|
1363
1392
|
|
|
1364
|
-
/*! @azure/msal-common v16.16.
|
|
1393
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1365
1394
|
/*
|
|
1366
1395
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1367
1396
|
* Licensed under the MIT License.
|
|
@@ -1432,7 +1461,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
|
1432
1461
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1433
1462
|
const SetUserData = "setUserData";
|
|
1434
1463
|
|
|
1435
|
-
/*! @azure/msal-common v16.16.
|
|
1464
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1436
1465
|
/*
|
|
1437
1466
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1438
1467
|
* Licensed under the MIT License.
|
|
@@ -1468,7 +1497,8 @@ const invoke = (callback, eventName, logger, telemetryClient, correlationId) =>
|
|
|
1468
1497
|
catch (e) {
|
|
1469
1498
|
logger.trace(`0cfd8i ${eventName}`, correlationId);
|
|
1470
1499
|
try {
|
|
1471
|
-
|
|
1500
|
+
// Prevent numeric error details from being treated as minified log hashes.
|
|
1501
|
+
logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
|
|
1472
1502
|
}
|
|
1473
1503
|
catch (e) {
|
|
1474
1504
|
logger.trace("00dty7", correlationId);
|
|
@@ -1512,7 +1542,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1512
1542
|
.catch((e) => {
|
|
1513
1543
|
logger.trace(`0cfd8i ${eventName}`, correlationId);
|
|
1514
1544
|
try {
|
|
1515
|
-
logger.
|
|
1545
|
+
logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
|
|
1516
1546
|
}
|
|
1517
1547
|
catch (e) {
|
|
1518
1548
|
logger.trace("00dty7", correlationId);
|
|
@@ -1525,12 +1555,26 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1525
1555
|
};
|
|
1526
1556
|
};
|
|
1527
1557
|
|
|
1528
|
-
/*! @azure/msal-common v16.16.
|
|
1558
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1529
1559
|
|
|
1530
1560
|
/*
|
|
1531
1561
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1532
1562
|
* Licensed under the MIT License.
|
|
1533
1563
|
*/
|
|
1564
|
+
// Starts with an ASCII letter; remaining characters are ASCII letters, digits, or hyphens.
|
|
1565
|
+
const REGION_NAME_PATTERN = /^[a-z][a-z0-9-]*$/i;
|
|
1566
|
+
// A region becomes a DNS label, limited to 63 octets by RFC 1035 section 2.3.4.
|
|
1567
|
+
const MAX_REGION_NAME_LENGTH = 63;
|
|
1568
|
+
/**
|
|
1569
|
+
* Whether a region can safely be used as a single DNS label.
|
|
1570
|
+
*/
|
|
1571
|
+
function isValidRegion(region) {
|
|
1572
|
+
return (typeof region === "string" &&
|
|
1573
|
+
region.length <= MAX_REGION_NAME_LENGTH &&
|
|
1574
|
+
REGION_NAME_PATTERN.test(region) &&
|
|
1575
|
+
// Keep the trailing-hyphen rule explicit rather than complicating the pattern.
|
|
1576
|
+
!region.endsWith("-"));
|
|
1577
|
+
}
|
|
1534
1578
|
class RegionDiscovery {
|
|
1535
1579
|
constructor(networkInterface, logger, performanceClient, correlationId) {
|
|
1536
1580
|
this.networkInterface = networkInterface;
|
|
@@ -1590,12 +1634,16 @@ class RegionDiscovery {
|
|
|
1590
1634
|
regionDiscoveryMetadata.region_source =
|
|
1591
1635
|
RegionDiscoverySources.ENVIRONMENT_VARIABLE;
|
|
1592
1636
|
}
|
|
1593
|
-
//
|
|
1594
|
-
if (!autodetectedRegionName) {
|
|
1637
|
+
// Untrusted discovery values must be a single DNS label before becoming a host prefix.
|
|
1638
|
+
if (!autodetectedRegionName || !isValidRegion(autodetectedRegionName)) {
|
|
1639
|
+
if (autodetectedRegionName) {
|
|
1640
|
+
this.logger.warning("0n83q0", this.correlationId);
|
|
1641
|
+
}
|
|
1595
1642
|
regionDiscoveryMetadata.region_source =
|
|
1596
1643
|
RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
1644
|
+
return null;
|
|
1597
1645
|
}
|
|
1598
|
-
return autodetectedRegionName
|
|
1646
|
+
return autodetectedRegionName;
|
|
1599
1647
|
}
|
|
1600
1648
|
/**
|
|
1601
1649
|
* Make the call to the IMDS endpoint
|
|
@@ -1636,7 +1684,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
1636
1684
|
},
|
|
1637
1685
|
};
|
|
1638
1686
|
|
|
1639
|
-
/*! @azure/msal-common v16.16.
|
|
1687
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1640
1688
|
/*
|
|
1641
1689
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1642
1690
|
* Licensed under the MIT License.
|
|
@@ -1701,7 +1749,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1701
1749
|
return cachedAtSec > nowSeconds();
|
|
1702
1750
|
}
|
|
1703
1751
|
|
|
1704
|
-
/*! @azure/msal-common v16.16.
|
|
1752
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1705
1753
|
|
|
1706
1754
|
/*
|
|
1707
1755
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1988,7 +2036,7 @@ function serializeAttributeTokens(attributeTokens) {
|
|
|
1988
2036
|
return [...attributeTokens].sort().join(" ");
|
|
1989
2037
|
}
|
|
1990
2038
|
|
|
1991
|
-
/*! @azure/msal-common v16.16.
|
|
2039
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
1992
2040
|
|
|
1993
2041
|
/*
|
|
1994
2042
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2841,6 +2889,9 @@ class Authority {
|
|
|
2841
2889
|
* @param region string
|
|
2842
2890
|
*/
|
|
2843
2891
|
static buildRegionalAuthorityString(host, region, correlationId, queryString) {
|
|
2892
|
+
if (!isValidRegion(region)) {
|
|
2893
|
+
throw createClientConfigurationError(urlParseError, correlationId);
|
|
2894
|
+
}
|
|
2844
2895
|
// Create and validate a Url string object with the initial authority string
|
|
2845
2896
|
const authorityUrlInstance = new UrlString(host, correlationId);
|
|
2846
2897
|
authorityUrlInstance.validateAsUri();
|
|
@@ -2851,7 +2902,7 @@ class Authority {
|
|
|
2851
2902
|
}
|
|
2852
2903
|
// Include the query string portion of the url
|
|
2853
2904
|
const url = UrlString.constructAuthorityUriFromObject({
|
|
2854
|
-
...
|
|
2905
|
+
...authorityUrlParts,
|
|
2855
2906
|
HostNameAndPort: hostNameAndPort,
|
|
2856
2907
|
}, correlationId).urlString;
|
|
2857
2908
|
// Add the query string if a query string was provided
|
|
@@ -2956,7 +3007,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
2956
3007
|
};
|
|
2957
3008
|
}
|
|
2958
3009
|
|
|
2959
|
-
/*! @azure/msal-common v16.16.
|
|
3010
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
2960
3011
|
|
|
2961
3012
|
/*
|
|
2962
3013
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2990,7 +3041,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
2990
3041
|
}
|
|
2991
3042
|
}
|
|
2992
3043
|
|
|
2993
|
-
/*! @azure/msal-common v16.16.
|
|
3044
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
2994
3045
|
|
|
2995
3046
|
/*
|
|
2996
3047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3186,7 +3237,7 @@ class ScopeSet {
|
|
|
3186
3237
|
}
|
|
3187
3238
|
}
|
|
3188
3239
|
|
|
3189
|
-
/*! @azure/msal-common v16.16.
|
|
3240
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
3190
3241
|
|
|
3191
3242
|
/*
|
|
3192
3243
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3686,7 +3737,7 @@ function addAttributeTokens(parameters, attributeTokens) {
|
|
|
3686
3737
|
}
|
|
3687
3738
|
}
|
|
3688
3739
|
|
|
3689
|
-
/*! @azure/msal-common v16.16.
|
|
3740
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
3690
3741
|
|
|
3691
3742
|
/*
|
|
3692
3743
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3817,7 +3868,7 @@ function validateUrl(url, logger, correlationId) {
|
|
|
3817
3868
|
}
|
|
3818
3869
|
}
|
|
3819
3870
|
|
|
3820
|
-
/*! @azure/msal-common v16.16.
|
|
3871
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
3821
3872
|
|
|
3822
3873
|
/*
|
|
3823
3874
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3865,7 +3916,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3865
3916
|
},
|
|
3866
3917
|
};
|
|
3867
3918
|
|
|
3868
|
-
/*! @azure/msal-common v16.16.
|
|
3919
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
3869
3920
|
|
|
3870
3921
|
/*
|
|
3871
3922
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3888,7 +3939,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
|
|
|
3888
3939
|
},
|
|
3889
3940
|
};
|
|
3890
3941
|
|
|
3891
|
-
/*! @azure/msal-common v16.16.
|
|
3942
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
3892
3943
|
/*
|
|
3893
3944
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3894
3945
|
* Licensed under the MIT License.
|
|
@@ -4163,12 +4214,12 @@ class Logger {
|
|
|
4163
4214
|
}
|
|
4164
4215
|
}
|
|
4165
4216
|
|
|
4166
|
-
/*! @azure/msal-common v16.16.
|
|
4217
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
4167
4218
|
/* eslint-disable header/header */
|
|
4168
4219
|
const name$1 = "@azure/msal-common";
|
|
4169
|
-
const version$1 = "16.16.
|
|
4220
|
+
const version$1 = "16.16.2";
|
|
4170
4221
|
|
|
4171
|
-
/*! @azure/msal-common v16.16.
|
|
4222
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
4172
4223
|
/*
|
|
4173
4224
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4174
4225
|
* Licensed under the MIT License.
|
|
@@ -4176,7 +4227,7 @@ const version$1 = "16.16.0";
|
|
|
4176
4227
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4177
4228
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4178
4229
|
|
|
4179
|
-
/*! @azure/msal-common v16.16.
|
|
4230
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
4180
4231
|
|
|
4181
4232
|
/*
|
|
4182
4233
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4214,7 +4265,7 @@ function createCacheError(e) {
|
|
|
4214
4265
|
}
|
|
4215
4266
|
}
|
|
4216
4267
|
|
|
4217
|
-
/*! @azure/msal-common v16.16.
|
|
4268
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
4218
4269
|
|
|
4219
4270
|
/*
|
|
4220
4271
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4678,19 +4729,25 @@ class CacheManager {
|
|
|
4678
4729
|
* @param account
|
|
4679
4730
|
*/
|
|
4680
4731
|
removeAccount(account, correlationId) {
|
|
4681
|
-
this.removeAccountContext(account, correlationId);
|
|
4682
4732
|
const accountKeys = this.getAccountKeys();
|
|
4683
4733
|
const keyFilter = (key) => {
|
|
4684
4734
|
return (key.includes(account.homeAccountId) &&
|
|
4685
4735
|
key.includes(account.environment));
|
|
4686
4736
|
};
|
|
4737
|
+
this.getTokenKeys()
|
|
4738
|
+
.idToken.filter(keyFilter)
|
|
4739
|
+
.forEach((key) => {
|
|
4740
|
+
this.removeIdToken(key, correlationId);
|
|
4741
|
+
});
|
|
4742
|
+
this.removeAccountContext(account, correlationId);
|
|
4687
4743
|
accountKeys.filter(keyFilter).forEach((key) => {
|
|
4688
4744
|
this.removeItem(key, correlationId);
|
|
4689
4745
|
this.performanceClient.incrementFields({ accountsRemoved: 1 }, correlationId);
|
|
4690
4746
|
});
|
|
4691
4747
|
}
|
|
4692
4748
|
/**
|
|
4693
|
-
* Removes
|
|
4749
|
+
* Removes access and refresh tokens associated with the provided account,
|
|
4750
|
+
* preserving the account and its ID tokens.
|
|
4694
4751
|
* @param account
|
|
4695
4752
|
*/
|
|
4696
4753
|
removeAccountContext(account, correlationId) {
|
|
@@ -4699,9 +4756,6 @@ class CacheManager {
|
|
|
4699
4756
|
return (key.includes(account.homeAccountId) &&
|
|
4700
4757
|
key.includes(account.environment));
|
|
4701
4758
|
};
|
|
4702
|
-
allTokenKeys.idToken.filter(keyFilter).forEach((key) => {
|
|
4703
|
-
this.removeIdToken(key, correlationId);
|
|
4704
|
-
});
|
|
4705
4759
|
allTokenKeys.accessToken.filter(keyFilter).forEach((key) => {
|
|
4706
4760
|
this.removeAccessToken(key, correlationId);
|
|
4707
4761
|
});
|
|
@@ -5438,7 +5492,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5438
5492
|
}
|
|
5439
5493
|
}
|
|
5440
5494
|
|
|
5441
|
-
/*! @azure/msal-common v16.16.
|
|
5495
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5442
5496
|
/*
|
|
5443
5497
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5444
5498
|
* Licensed under the MIT License.
|
|
@@ -5452,7 +5506,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5452
5506
|
const PerformanceEventStatus = {
|
|
5453
5507
|
InProgress: 1};
|
|
5454
5508
|
|
|
5455
|
-
/*! @azure/msal-common v16.16.
|
|
5509
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5456
5510
|
|
|
5457
5511
|
/*
|
|
5458
5512
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5510,7 +5564,7 @@ class StubPerformanceClient {
|
|
|
5510
5564
|
}
|
|
5511
5565
|
}
|
|
5512
5566
|
|
|
5513
|
-
/*! @azure/msal-common v16.16.
|
|
5567
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5514
5568
|
|
|
5515
5569
|
/*
|
|
5516
5570
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5608,7 +5662,7 @@ function isOidcProtocolMode(config) {
|
|
|
5608
5662
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5609
5663
|
}
|
|
5610
5664
|
|
|
5611
|
-
/*! @azure/msal-common v16.16.
|
|
5665
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5612
5666
|
/*
|
|
5613
5667
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5614
5668
|
* Licensed under the MIT License.
|
|
@@ -5635,7 +5689,7 @@ function isOidcProtocolMode(config) {
|
|
|
5635
5689
|
}
|
|
5636
5690
|
}
|
|
5637
5691
|
|
|
5638
|
-
/*! @azure/msal-common v16.16.
|
|
5692
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5639
5693
|
|
|
5640
5694
|
/*
|
|
5641
5695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5656,7 +5710,7 @@ function createJoseHeaderError(code, correlationId) {
|
|
|
5656
5710
|
return new JoseHeaderError(code, correlationId);
|
|
5657
5711
|
}
|
|
5658
5712
|
|
|
5659
|
-
/*! @azure/msal-common v16.16.
|
|
5713
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5660
5714
|
/*
|
|
5661
5715
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5662
5716
|
* Licensed under the MIT License.
|
|
@@ -5681,7 +5735,7 @@ function isPlainObject(value) {
|
|
|
5681
5735
|
return Object.getPrototypeOf(value) === proto;
|
|
5682
5736
|
}
|
|
5683
5737
|
|
|
5684
|
-
/*! @azure/msal-common v16.16.
|
|
5738
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5685
5739
|
/*
|
|
5686
5740
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5687
5741
|
* Licensed under the MIT License.
|
|
@@ -5691,7 +5745,7 @@ const missingAlgError = "missing_alg_error";
|
|
|
5691
5745
|
const missingJwkError = "missing_jwk_error";
|
|
5692
5746
|
const invalidJwkError = "invalid_jwk_error";
|
|
5693
5747
|
|
|
5694
|
-
/*! @azure/msal-common v16.16.
|
|
5748
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5695
5749
|
|
|
5696
5750
|
/*
|
|
5697
5751
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5757,7 +5811,7 @@ class JoseHeader {
|
|
|
5757
5811
|
}
|
|
5758
5812
|
}
|
|
5759
5813
|
|
|
5760
|
-
/*! @azure/msal-common v16.16.
|
|
5814
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5761
5815
|
|
|
5762
5816
|
/*
|
|
5763
5817
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5858,7 +5912,7 @@ class PopTokenGenerator {
|
|
|
5858
5912
|
}
|
|
5859
5913
|
}
|
|
5860
5914
|
|
|
5861
|
-
/*! @azure/msal-common v16.16.
|
|
5915
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
5862
5916
|
|
|
5863
5917
|
/*
|
|
5864
5918
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6013,7 +6067,7 @@ class DpopProofGenerator {
|
|
|
6013
6067
|
}
|
|
6014
6068
|
}
|
|
6015
6069
|
|
|
6016
|
-
/*! @azure/msal-common v16.16.
|
|
6070
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6017
6071
|
/*
|
|
6018
6072
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6019
6073
|
* Licensed under the MIT License.
|
|
@@ -6064,7 +6118,7 @@ const badToken = "bad_token";
|
|
|
6064
6118
|
*/
|
|
6065
6119
|
const interruptedUser = "interrupted_user";
|
|
6066
6120
|
|
|
6067
|
-
/*! @azure/msal-common v16.16.
|
|
6121
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6068
6122
|
|
|
6069
6123
|
/*
|
|
6070
6124
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6131,7 +6185,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
|
|
|
6131
6185
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6132
6186
|
}
|
|
6133
6187
|
|
|
6134
|
-
/*! @azure/msal-common v16.16.
|
|
6188
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6135
6189
|
|
|
6136
6190
|
/*
|
|
6137
6191
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6150,7 +6204,7 @@ class ServerError extends AuthError {
|
|
|
6150
6204
|
}
|
|
6151
6205
|
}
|
|
6152
6206
|
|
|
6153
|
-
/*! @azure/msal-common v16.16.
|
|
6207
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6154
6208
|
|
|
6155
6209
|
/*
|
|
6156
6210
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6221,7 +6275,7 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
6221
6275
|
}
|
|
6222
6276
|
}
|
|
6223
6277
|
|
|
6224
|
-
/*! @azure/msal-common v16.16.
|
|
6278
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6225
6279
|
|
|
6226
6280
|
/*
|
|
6227
6281
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6649,7 +6703,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6649
6703
|
return baseAccount;
|
|
6650
6704
|
}
|
|
6651
6705
|
|
|
6652
|
-
/*! @azure/msal-common v16.16.
|
|
6706
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6653
6707
|
/*
|
|
6654
6708
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6655
6709
|
* Licensed under the MIT License.
|
|
@@ -6659,7 +6713,7 @@ const CcsCredentialType = {
|
|
|
6659
6713
|
UPN: "UPN",
|
|
6660
6714
|
};
|
|
6661
6715
|
|
|
6662
|
-
/*! @azure/msal-common v16.16.
|
|
6716
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6663
6717
|
/*
|
|
6664
6718
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6665
6719
|
* Licensed under the MIT License.
|
|
@@ -6678,7 +6732,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
|
|
|
6678
6732
|
}
|
|
6679
6733
|
}
|
|
6680
6734
|
|
|
6681
|
-
/*! @azure/msal-common v16.16.
|
|
6735
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6682
6736
|
|
|
6683
6737
|
/*
|
|
6684
6738
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6702,7 +6756,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6702
6756
|
};
|
|
6703
6757
|
}
|
|
6704
6758
|
|
|
6705
|
-
/*! @azure/msal-common v16.16.
|
|
6759
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6706
6760
|
|
|
6707
6761
|
/*
|
|
6708
6762
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6792,7 +6846,7 @@ function getRetryAfterHeader(response) {
|
|
|
6792
6846
|
return undefined;
|
|
6793
6847
|
}
|
|
6794
6848
|
|
|
6795
|
-
/*! @azure/msal-common v16.16.
|
|
6849
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6796
6850
|
|
|
6797
6851
|
/*
|
|
6798
6852
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6823,7 +6877,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
|
|
|
6823
6877
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6824
6878
|
}
|
|
6825
6879
|
|
|
6826
|
-
/*! @azure/msal-common v16.16.
|
|
6880
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6827
6881
|
|
|
6828
6882
|
/*
|
|
6829
6883
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6957,7 +7011,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
6957
7011
|
return response;
|
|
6958
7012
|
}
|
|
6959
7013
|
|
|
6960
|
-
/*! @azure/msal-common v16.16.
|
|
7014
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
6961
7015
|
|
|
6962
7016
|
/*
|
|
6963
7017
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7000,7 +7054,8 @@ class AuthorizationCodeClient {
|
|
|
7000
7054
|
throw createClientAuthError(requestCannotBeMade, request.correlationId);
|
|
7001
7055
|
}
|
|
7002
7056
|
// Check for new cloud instance
|
|
7003
|
-
if (
|
|
7057
|
+
if (this.config.authOptions.instanceAware === true &&
|
|
7058
|
+
authCodePayload?.cloud_instance_host_name) {
|
|
7004
7059
|
await invokeAsync(this.updateTokenEndpointAuthority.bind(this), UpdateTokenEndpointAuthority, this.logger, this.performanceClient, request.correlationId)(authCodePayload.cloud_instance_host_name, request.correlationId);
|
|
7005
7060
|
}
|
|
7006
7061
|
const reqTimestamp = nowSeconds();
|
|
@@ -7224,7 +7279,7 @@ class AuthorizationCodeClient {
|
|
|
7224
7279
|
}
|
|
7225
7280
|
}
|
|
7226
7281
|
|
|
7227
|
-
/*! @azure/msal-common v16.16.
|
|
7282
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
7228
7283
|
|
|
7229
7284
|
/*
|
|
7230
7285
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7409,13 +7464,13 @@ function validateAuthorizationResponse(serverResponse, requestState, correlation
|
|
|
7409
7464
|
decodedServerResponseState = decodeURIComponent(serverResponse.state);
|
|
7410
7465
|
}
|
|
7411
7466
|
catch (e) {
|
|
7412
|
-
throw createClientAuthError(invalidState, correlationId
|
|
7467
|
+
throw createClientAuthError(invalidState, correlationId);
|
|
7413
7468
|
}
|
|
7414
7469
|
try {
|
|
7415
7470
|
decodedRequestState = decodeURIComponent(requestState);
|
|
7416
7471
|
}
|
|
7417
7472
|
catch (e) {
|
|
7418
|
-
throw createClientAuthError(invalidState, correlationId
|
|
7473
|
+
throw createClientAuthError(invalidState, correlationId);
|
|
7419
7474
|
}
|
|
7420
7475
|
if (decodedServerResponseState !== decodedRequestState) {
|
|
7421
7476
|
throw createClientAuthError(stateMismatch, correlationId);
|
|
@@ -7454,7 +7509,7 @@ function extractLoginHint(account) {
|
|
|
7454
7509
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7455
7510
|
}
|
|
7456
7511
|
|
|
7457
|
-
/*! @azure/msal-common v16.16.
|
|
7512
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
7458
7513
|
|
|
7459
7514
|
/*
|
|
7460
7515
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7689,7 +7744,7 @@ class RefreshTokenClient {
|
|
|
7689
7744
|
}
|
|
7690
7745
|
}
|
|
7691
7746
|
|
|
7692
|
-
/*! @azure/msal-common v16.16.
|
|
7747
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
7693
7748
|
|
|
7694
7749
|
/*
|
|
7695
7750
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7982,7 +8037,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
|
|
|
7982
8037
|
clearNativeBrokerErrorCode() { }
|
|
7983
8038
|
}
|
|
7984
8039
|
|
|
7985
|
-
/*! @azure/msal-common v16.16.
|
|
8040
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
7986
8041
|
|
|
7987
8042
|
/*
|
|
7988
8043
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8109,7 +8164,7 @@ class SilentFlowClient {
|
|
|
8109
8164
|
}
|
|
8110
8165
|
}
|
|
8111
8166
|
|
|
8112
|
-
/*! @azure/msal-common v16.16.
|
|
8167
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
8113
8168
|
|
|
8114
8169
|
/*
|
|
8115
8170
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8125,7 +8180,7 @@ const StubbedNetworkModule = {
|
|
|
8125
8180
|
},
|
|
8126
8181
|
};
|
|
8127
8182
|
|
|
8128
|
-
/*! @azure/msal-common v16.16.
|
|
8183
|
+
/*! @azure/msal-common v16.16.2 2026-11-12 */
|
|
8129
8184
|
|
|
8130
8185
|
/*
|
|
8131
8186
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8311,6 +8366,7 @@ class InvalidArgumentError extends CustomAuthError {
|
|
|
8311
8366
|
constructor(argName, correlationId) {
|
|
8312
8367
|
const errorDescription = `The argument '${argName}' is invalid.`;
|
|
8313
8368
|
super("invalid_argument", errorDescription, correlationId);
|
|
8369
|
+
this.argName = argName;
|
|
8314
8370
|
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
|
|
8315
8371
|
}
|
|
8316
8372
|
}
|
|
@@ -8346,11 +8402,11 @@ const ACCESS_DENIED = "access_denied";
|
|
|
8346
8402
|
* Licensed under the MIT License.
|
|
8347
8403
|
*/
|
|
8348
8404
|
const PASSWORD_TOO_WEAK$1 = "password_too_weak";
|
|
8349
|
-
const PASSWORD_TOO_SHORT = "password_too_short";
|
|
8350
|
-
const PASSWORD_TOO_LONG = "password_too_long";
|
|
8351
|
-
const PASSWORD_RECENTLY_USED = "password_recently_used";
|
|
8352
|
-
const PASSWORD_BANNED = "password_banned";
|
|
8353
|
-
const PASSWORD_IS_INVALID = "password_is_invalid";
|
|
8405
|
+
const PASSWORD_TOO_SHORT$1 = "password_too_short";
|
|
8406
|
+
const PASSWORD_TOO_LONG$1 = "password_too_long";
|
|
8407
|
+
const PASSWORD_RECENTLY_USED$1 = "password_recently_used";
|
|
8408
|
+
const PASSWORD_BANNED$1 = "password_banned";
|
|
8409
|
+
const PASSWORD_IS_INVALID$1 = "password_is_invalid";
|
|
8354
8410
|
const INVALID_OOB_VALUE = "invalid_oob_value";
|
|
8355
8411
|
const ATTRIBUTE_VALIATION_FAILED = "attribute_validation_failed";
|
|
8356
8412
|
const REGISTRATION_REQUIRED = "registration_required";
|
|
@@ -8408,11 +8464,11 @@ class AuthFlowErrorBase {
|
|
|
8408
8464
|
}
|
|
8409
8465
|
isInvalidNewPasswordError() {
|
|
8410
8466
|
const invalidPasswordSubErrors = new Set([
|
|
8411
|
-
PASSWORD_BANNED,
|
|
8412
|
-
PASSWORD_IS_INVALID,
|
|
8413
|
-
PASSWORD_RECENTLY_USED,
|
|
8414
|
-
PASSWORD_TOO_LONG,
|
|
8415
|
-
PASSWORD_TOO_SHORT,
|
|
8467
|
+
PASSWORD_BANNED$1,
|
|
8468
|
+
PASSWORD_IS_INVALID$1,
|
|
8469
|
+
PASSWORD_RECENTLY_USED$1,
|
|
8470
|
+
PASSWORD_TOO_LONG$1,
|
|
8471
|
+
PASSWORD_TOO_SHORT$1,
|
|
8416
8472
|
PASSWORD_TOO_WEAK$1,
|
|
8417
8473
|
]);
|
|
8418
8474
|
return (this.errorData instanceof CustomAuthApiError &&
|
|
@@ -8557,11 +8613,26 @@ function ensureArgumentIsStringArray(argName, argValue, correlationId) {
|
|
|
8557
8613
|
!argValue.every((value) => typeof value === "string")) {
|
|
8558
8614
|
throw new InvalidArgumentError(argName, correlationId);
|
|
8559
8615
|
}
|
|
8616
|
+
}
|
|
8617
|
+
function filterReservedSignUpAttributesV2(attributes, logger, correlationId) {
|
|
8618
|
+
const reservedSignUpAttributeNames = new Set(["email", "password"]);
|
|
8619
|
+
const reservedSignUpAttributeWarning = "Ignoring app-supplied sign-up attribute because it uses a reserved SDK attribute name.";
|
|
8620
|
+
const filteredAttributes = [];
|
|
8621
|
+
for (const [attributeId, value] of Object.entries(attributes ?? {})) {
|
|
8622
|
+
if (reservedSignUpAttributeNames.has(attributeId.toLowerCase())) {
|
|
8623
|
+
logger.warning(reservedSignUpAttributeWarning, correlationId);
|
|
8624
|
+
continue;
|
|
8625
|
+
}
|
|
8626
|
+
if (value !== undefined) {
|
|
8627
|
+
filteredAttributes.push([attributeId, value]);
|
|
8628
|
+
}
|
|
8629
|
+
}
|
|
8630
|
+
return Object.fromEntries(filteredAttributes);
|
|
8560
8631
|
}
|
|
8561
8632
|
|
|
8562
8633
|
/* eslint-disable header/header */
|
|
8563
8634
|
const name = "@azure/msal-browser";
|
|
8564
|
-
const version = "5.
|
|
8635
|
+
const version = "5.29.1";
|
|
8565
8636
|
|
|
8566
8637
|
/*
|
|
8567
8638
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11485,6 +11556,10 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11485
11556
|
clientId: this.config.auth.clientId,
|
|
11486
11557
|
authority: discoveredAuthority,
|
|
11487
11558
|
clientCapabilities: this.config.auth.clientCapabilities,
|
|
11559
|
+
instanceAware: requestExtraQueryParameters?.instance_aware
|
|
11560
|
+
?.length
|
|
11561
|
+
? requestExtraQueryParameters.instance_aware === "true"
|
|
11562
|
+
: this.config.auth.instanceAware,
|
|
11488
11563
|
redirectUri: this.config.auth.redirectUri,
|
|
11489
11564
|
isMcp: this.config.auth.isMcp,
|
|
11490
11565
|
},
|
|
@@ -11709,6 +11784,7 @@ const SIGN_IN_V2_COMPLETE = 100209;
|
|
|
11709
11784
|
const SIGN_IN_V2_SUBMIT_CODE = 100210;
|
|
11710
11785
|
const SIGN_UP_V2_START = 100211;
|
|
11711
11786
|
const SIGN_UP_V2_CHALLENGE = 100212;
|
|
11787
|
+
const SIGN_UP_V2_SUBMIT_PASSWORD = 100223;
|
|
11712
11788
|
const SIGN_UP_V2_SUBMIT_CODE = 100213;
|
|
11713
11789
|
const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
|
|
11714
11790
|
const SIGN_UP_V2_RESEND_CODE = 100215;
|
|
@@ -12512,12 +12588,7 @@ function readNumberArray(value) {
|
|
|
12512
12588
|
* Licensed under the MIT License.
|
|
12513
12589
|
*/
|
|
12514
12590
|
/*
|
|
12515
|
-
*
|
|
12516
|
-
* relations. Raw-preserving: the body keeps its HAL `_links`/`_embedded` shape so the api-client
|
|
12517
|
-
* navigates typed hrefs directly. Parsing never throws on a non-200 status - every V2 response
|
|
12518
|
-
* (including the entry response) carries a meaningful body, so only a non-object body is a hard
|
|
12519
|
-
* failure; the wire error is normalized onto the envelope (`error`). Required response values use
|
|
12520
|
-
* shared guards after callers read their strongly typed response properties directly.
|
|
12591
|
+
* Parses V2 HTTP responses and validates required response values.
|
|
12521
12592
|
*/
|
|
12522
12593
|
class ResponseHandlerV2 {
|
|
12523
12594
|
constructor(logger) {
|
|
@@ -12535,7 +12606,6 @@ class ResponseHandlerV2 {
|
|
|
12535
12606
|
: undefined);
|
|
12536
12607
|
const error = normalizeServerErrorV2(json);
|
|
12537
12608
|
const isWebFallbackRequired = error?.subError === WEB_REDIRECT_REQUIRED;
|
|
12538
|
-
// Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
|
|
12539
12609
|
json.correlationId = correlationId;
|
|
12540
12610
|
return {
|
|
12541
12611
|
statusCode: response.status,
|
|
@@ -12565,6 +12635,24 @@ class ResponseHandlerV2 {
|
|
|
12565
12635
|
}
|
|
12566
12636
|
return continuationToken;
|
|
12567
12637
|
}
|
|
12638
|
+
resolveSignUpAttributes(attributes, correlationId) {
|
|
12639
|
+
const resolved = attributes === undefined ? [] : attributes;
|
|
12640
|
+
if (!Array.isArray(resolved) ||
|
|
12641
|
+
resolved.some((attribute) => typeof attribute !== "object" ||
|
|
12642
|
+
attribute === null ||
|
|
12643
|
+
typeof attribute.attributeId !== "string" ||
|
|
12644
|
+
!attribute.attributeId.trim())) {
|
|
12645
|
+
const message = "Invalid HAL response: sign-up attributes must be an array of objects with nonempty string attributeId values";
|
|
12646
|
+
this.logger?.error(message, correlationId);
|
|
12647
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
12648
|
+
}
|
|
12649
|
+
if (resolved.some((attribute) => attribute.attributeId.toLowerCase() === "email")) {
|
|
12650
|
+
const message = "Invalid HAL response: email cannot be collected as a sign-up attribute";
|
|
12651
|
+
this.logger?.error(message, correlationId);
|
|
12652
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
12653
|
+
}
|
|
12654
|
+
return resolved;
|
|
12655
|
+
}
|
|
12568
12656
|
// Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
|
|
12569
12657
|
requireMethods(methods, correlationId) {
|
|
12570
12658
|
if (!methods?.length) {
|
|
@@ -12582,7 +12670,6 @@ class ResponseHandlerV2 {
|
|
|
12582
12670
|
this.logger?.error("0fc89v", correlationId);
|
|
12583
12671
|
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, `V2 response body is not valid JSON: '${e}'`, correlationId);
|
|
12584
12672
|
}
|
|
12585
|
-
// response.json() accepts primitives/arrays; every V2 body must be a JSON object.
|
|
12586
12673
|
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
12587
12674
|
this.logger?.error("09w4yw", correlationId);
|
|
12588
12675
|
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "V2 response body is not a JSON object", correlationId);
|
|
@@ -12654,9 +12741,7 @@ function apiPath(path) {
|
|
|
12654
12741
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12655
12742
|
* Licensed under the MIT License.
|
|
12656
12743
|
*/
|
|
12657
|
-
// Content type used by V2 JSON `/api` requests.
|
|
12658
12744
|
const JSON_CONTENT_TYPE = "application/json";
|
|
12659
|
-
// Server action returned after successful credential verification.
|
|
12660
12745
|
const UPDATE_RELATION = "update";
|
|
12661
12746
|
const CHALLENGE_RELATION = "challenge";
|
|
12662
12747
|
const VERIFY_RELATION = "verify";
|
|
@@ -12675,10 +12760,6 @@ const AuthenticationMethodTypeV2 = {
|
|
|
12675
12760
|
const PhoneRegistrationChannelV2 = {
|
|
12676
12761
|
SMS: "sms",
|
|
12677
12762
|
};
|
|
12678
|
-
/*
|
|
12679
|
-
* Known `state` values on a HAL response. Kept open (the body field is typed as string) because
|
|
12680
|
-
* the server may introduce new values; response parsing and flow logic branch on these constants.
|
|
12681
|
-
*/
|
|
12682
12763
|
const ResponseStateV2 = {
|
|
12683
12764
|
CONTINUE: "continue",
|
|
12684
12765
|
};
|
|
@@ -12897,7 +12978,6 @@ const AuthenticationFactorV2 = {
|
|
|
12897
12978
|
* Licensed under the MIT License.
|
|
12898
12979
|
*/
|
|
12899
12980
|
const SignUpSubmitAttributesNextActionV2 = {
|
|
12900
|
-
VERIFY: "verify",
|
|
12901
12981
|
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12902
12982
|
CONTINUE: "continue",
|
|
12903
12983
|
ENROLL: "enroll",
|
|
@@ -12909,7 +12989,6 @@ const SignUpSubmitAttributesNextActionV2 = {
|
|
|
12909
12989
|
*/
|
|
12910
12990
|
/*
|
|
12911
12991
|
* Native Auth V2 network client that follows server-provided HAL links.
|
|
12912
|
-
* Flow-specific entry methods reuse shared challenge, verification, and token operations.
|
|
12913
12992
|
*/
|
|
12914
12993
|
class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
12915
12994
|
/*
|
|
@@ -12930,15 +13009,30 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
12930
13009
|
*/
|
|
12931
13010
|
async signUpStart(signUpHref, request, context) {
|
|
12932
13011
|
const parsedResponse = await this.sendActionRequest(signUpHref, HttpMethod.POST, request, context);
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
13012
|
+
const challengeType = parsedResponse.body.action === VERIFY_RELATION
|
|
13013
|
+
? parsedResponse.body.type
|
|
13014
|
+
: undefined;
|
|
13015
|
+
const isEmailChallenge = typeof challengeType === "string" &&
|
|
13016
|
+
challengeType.toLowerCase() === AuthenticationMethodTypeV2.EMAIL;
|
|
13017
|
+
if (parsedResponse.body.action === VERIFY_RELATION &&
|
|
13018
|
+
isEmailChallenge) {
|
|
13019
|
+
return this.toChallengeVerificationResult(parsedResponse);
|
|
13020
|
+
}
|
|
13021
|
+
if (parsedResponse.body.action === CHALLENGE_RELATION) {
|
|
13022
|
+
return {
|
|
13023
|
+
nextAction: CHALLENGE_RELATION,
|
|
13024
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
13025
|
+
methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, parsedResponse.correlationId), parsedResponse.correlationId),
|
|
13026
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
|
|
13027
|
+
scenario: parsedResponse.body.scenario,
|
|
13028
|
+
};
|
|
13029
|
+
}
|
|
13030
|
+
const message = "Invalid HAL response: sign-up start did not return an email verification or authentication challenge";
|
|
13031
|
+
this.logger?.error(message, parsedResponse.correlationId);
|
|
13032
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, parsedResponse.correlationId);
|
|
12938
13033
|
}
|
|
12939
13034
|
/*
|
|
12940
|
-
* Submits the initial sign-up attributes.
|
|
12941
|
-
* sent the email code and supplies the links needed to verify or resend it.
|
|
13035
|
+
* Submits the initial sign-up attributes.
|
|
12942
13036
|
*/
|
|
12943
13037
|
async submitSignUpAttributes(submitAttributesHref, request, context) {
|
|
12944
13038
|
const parsedResponse = await this.sendActionRequest(submitAttributesHref, HttpMethod.POST, request, context);
|
|
@@ -12954,16 +13048,10 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
12954
13048
|
return {
|
|
12955
13049
|
nextAction: SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES,
|
|
12956
13050
|
continuationToken,
|
|
12957
|
-
attributes: parsedResponse.body.attributes
|
|
13051
|
+
attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
|
|
12958
13052
|
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
12959
13053
|
};
|
|
12960
13054
|
}
|
|
12961
|
-
if (parsedResponse.body.action === VERIFY_RELATION) {
|
|
12962
|
-
return {
|
|
12963
|
-
...this.toChallengeVerificationResult(parsedResponse),
|
|
12964
|
-
attributes: parsedResponse.body.attributes,
|
|
12965
|
-
};
|
|
12966
|
-
}
|
|
12967
13055
|
if (parsedResponse.body.action === ENROLL_RELATION) {
|
|
12968
13056
|
return {
|
|
12969
13057
|
nextAction: ENROLL_RELATION,
|
|
@@ -13056,7 +13144,15 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
13056
13144
|
return {
|
|
13057
13145
|
nextAction,
|
|
13058
13146
|
continuationToken,
|
|
13059
|
-
|
|
13147
|
+
methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
13148
|
+
};
|
|
13149
|
+
}
|
|
13150
|
+
if (nextAction === CHALLENGE_RELATION) {
|
|
13151
|
+
return {
|
|
13152
|
+
nextAction,
|
|
13153
|
+
continuationToken,
|
|
13154
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
|
|
13155
|
+
methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
13060
13156
|
};
|
|
13061
13157
|
}
|
|
13062
13158
|
if (nextAction === POLL_RELATION) {
|
|
@@ -13099,7 +13195,7 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
13099
13195
|
return {
|
|
13100
13196
|
nextAction: COLLECT_ATTRIBUTES_RELATION,
|
|
13101
13197
|
continuationToken,
|
|
13102
|
-
attributes: parsedResponse.body.attributes
|
|
13198
|
+
attributes: this.handler.resolveSignUpAttributes(parsedResponse.body.attributes, correlationId),
|
|
13103
13199
|
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
13104
13200
|
};
|
|
13105
13201
|
}
|
|
@@ -13225,9 +13321,7 @@ class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
13225
13321
|
* Licensed under the MIT License.
|
|
13226
13322
|
*/
|
|
13227
13323
|
/*
|
|
13228
|
-
* Shared base for Native Auth V2 interaction clients.
|
|
13229
|
-
* `StandardInteractionClient` for common browser infrastructure while keeping
|
|
13230
|
-
* V1 and V2 token handling independent.
|
|
13324
|
+
* Shared base for Native Auth V2 interaction clients.
|
|
13231
13325
|
*/
|
|
13232
13326
|
class InteractionClientBaseV2 extends StandardInteractionClient {
|
|
13233
13327
|
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority) {
|
|
@@ -13235,13 +13329,11 @@ class InteractionClientBaseV2 extends StandardInteractionClient {
|
|
|
13235
13329
|
this.customAuthAuthority = customAuthAuthority;
|
|
13236
13330
|
this.tokenResponseHandler = new ResponseHandler(this.config.auth.clientId, this.browserStorage, this.browserCrypto, this.logger, this.performanceClient, null, null);
|
|
13237
13331
|
}
|
|
13238
|
-
// Required by the base contract. After sign-in, use CustomAuthAccountData.getAccessToken().
|
|
13239
13332
|
acquireToken(
|
|
13240
13333
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13241
13334
|
request) {
|
|
13242
13335
|
throw new MethodNotImplementedError("InteractionClientBaseV2.acquireToken");
|
|
13243
13336
|
}
|
|
13244
|
-
// Required by the base contract. After sign-in, use CustomAuthAccountData.signOut().
|
|
13245
13337
|
logout(
|
|
13246
13338
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13247
13339
|
request) {
|
|
@@ -13285,9 +13377,10 @@ class InteractionClientBaseV2 extends StandardInteractionClient {
|
|
|
13285
13377
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13286
13378
|
* Licensed under the MIT License.
|
|
13287
13379
|
*/
|
|
13288
|
-
// Result type discriminators.
|
|
13289
13380
|
const FLOW_METHOD_SELECTION_REQUIRED_V2 = "FlowMethodSelectionRequiredResultV2";
|
|
13290
13381
|
const FLOW_CODE_REQUIRED_V2 = "FlowCodeRequiredResultV2";
|
|
13382
|
+
const FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2 = "FlowExistingAccountCodeRequiredResultV2";
|
|
13383
|
+
const FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2 = "FlowExistingAccountPasswordRequiredResultV2";
|
|
13291
13384
|
const FLOW_PASSWORD_REQUIRED_V2 = "FlowPasswordRequiredResultV2";
|
|
13292
13385
|
const FLOW_SIGN_UP_PASSWORD_REQUIRED_V2 = "FlowSignUpPasswordRequiredResultV2";
|
|
13293
13386
|
const FLOW_MFA_REQUIRED_V2 = "FlowMFARequiredResultV2";
|
|
@@ -13303,6 +13396,12 @@ function createFlowMethodSelectionRequiredResultV2(input) {
|
|
|
13303
13396
|
function createFlowCodeRequiredResultV2(input) {
|
|
13304
13397
|
return { type: FLOW_CODE_REQUIRED_V2, ...input };
|
|
13305
13398
|
}
|
|
13399
|
+
function createFlowExistingAccountCodeRequiredResultV2(input) {
|
|
13400
|
+
return { type: FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2, ...input };
|
|
13401
|
+
}
|
|
13402
|
+
function createFlowExistingAccountPasswordRequiredResultV2(input) {
|
|
13403
|
+
return { type: FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2, ...input };
|
|
13404
|
+
}
|
|
13306
13405
|
function createFlowPasswordRequiredResultV2(input) {
|
|
13307
13406
|
return { type: FLOW_PASSWORD_REQUIRED_V2, ...input };
|
|
13308
13407
|
}
|
|
@@ -13336,10 +13435,8 @@ function createFlowAuthMethodVerificationRequiredResultV2(input) {
|
|
|
13336
13435
|
* Licensed under the MIT License.
|
|
13337
13436
|
*/
|
|
13338
13437
|
/**
|
|
13339
|
-
* The native auth V2 flow that a result or error originates from
|
|
13340
|
-
*
|
|
13341
|
-
* which entry flow produced it; `Unknown` is used when the flow cannot be
|
|
13342
|
-
* determined.
|
|
13438
|
+
* The native auth V2 flow that a result or error originates from.
|
|
13439
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
13343
13440
|
*/
|
|
13344
13441
|
const CustomAuthFlowScenarioV2 = {
|
|
13345
13442
|
SignIn: "signIn",
|
|
@@ -13370,6 +13467,7 @@ const FLOW_STEP_API_IDS_V2 = {
|
|
|
13370
13467
|
[CustomAuthFlowScenarioV2.SignUp]: {
|
|
13371
13468
|
requestChallenge: SIGN_UP_V2_CHALLENGE,
|
|
13372
13469
|
submitCode: SIGN_UP_V2_SUBMIT_CODE,
|
|
13470
|
+
submitPassword: SIGN_UP_V2_SUBMIT_PASSWORD,
|
|
13373
13471
|
resendCode: SIGN_UP_V2_RESEND_CODE,
|
|
13374
13472
|
submitAttributes: SIGN_UP_V2_SUBMIT_ATTRIBUTES,
|
|
13375
13473
|
signInWithContinuation: SIGN_UP_V2_COMPLETE,
|
|
@@ -13380,12 +13478,9 @@ const MFA_STEP_API_IDS_V2 = {
|
|
|
13380
13478
|
submitCode: MFA_V2_SUBMIT_CHALLENGE,
|
|
13381
13479
|
resendCode: MFA_V2_RESEND_CHALLENGE,
|
|
13382
13480
|
};
|
|
13383
|
-
/**
|
|
13384
|
-
* Resolves the telemetry API ID for a flow step. MFA challenge operations use
|
|
13385
|
-
* distinct IDs when the sign-in caller identifies the second factor.
|
|
13386
|
-
*/
|
|
13387
13481
|
function getPublicApiIdV2(scenario, step, authenticationFactor) {
|
|
13388
|
-
if (scenario === CustomAuthFlowScenarioV2.SignIn
|
|
13482
|
+
if ((scenario === CustomAuthFlowScenarioV2.SignIn ||
|
|
13483
|
+
scenario === CustomAuthFlowScenarioV2.PasswordReset) &&
|
|
13389
13484
|
authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
|
|
13390
13485
|
return (MFA_STEP_API_IDS_V2[step] ?? FLOW_STEP_API_IDS_V2[scenario]?.[step]);
|
|
13391
13486
|
}
|
|
@@ -13396,17 +13491,12 @@ function getPublicApiIdV2(scenario, step, authenticationFactor) {
|
|
|
13396
13491
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13397
13492
|
* Licensed under the MIT License.
|
|
13398
13493
|
*/
|
|
13399
|
-
/*
|
|
13400
|
-
* Polls up to five times for password-update completion, waiting 1.5 seconds
|
|
13401
|
-
* between attempts. The first request runs immediately.
|
|
13402
|
-
*/
|
|
13403
13494
|
const POLL_MAX_ATTEMPTS = 5;
|
|
13404
13495
|
// TODO: Replace this fallback with the server-provided polling interval once available.
|
|
13405
13496
|
const POLL_INTERVAL_MS = 1500;
|
|
13406
13497
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
13407
13498
|
/*
|
|
13408
|
-
* Drives server-directed Native Auth V2 flows
|
|
13409
|
-
* and HAL links. Each operation returns only its valid discriminated results.
|
|
13499
|
+
* Drives server-directed Native Auth V2 flows.
|
|
13410
13500
|
*/
|
|
13411
13501
|
class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
13412
13502
|
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority, apiClient) {
|
|
@@ -13414,8 +13504,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13414
13504
|
this.apiClient = apiClient;
|
|
13415
13505
|
}
|
|
13416
13506
|
/*
|
|
13417
|
-
* Starts sign-in
|
|
13418
|
-
* multiple supported methods for user selection.
|
|
13507
|
+
* Starts native auth V2 sign-in.
|
|
13419
13508
|
*/
|
|
13420
13509
|
async signIn(parameters) {
|
|
13421
13510
|
const correlationId = parameters.correlationId;
|
|
@@ -13468,20 +13557,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13468
13557
|
method: selectedMethod,
|
|
13469
13558
|
};
|
|
13470
13559
|
}
|
|
13471
|
-
if (parameters.password) {
|
|
13472
|
-
return this.submitSignInPassword({
|
|
13473
|
-
correlationId,
|
|
13474
|
-
continuationState: challengeResult.continuationState,
|
|
13475
|
-
password: parameters.password,
|
|
13476
|
-
});
|
|
13477
|
-
}
|
|
13478
13560
|
return challengeResult;
|
|
13479
13561
|
}
|
|
13480
13562
|
/*
|
|
13481
|
-
* Starts
|
|
13563
|
+
* Starts native auth V2 sign-up.
|
|
13482
13564
|
*/
|
|
13483
13565
|
async signUp(parameters) {
|
|
13484
13566
|
const correlationId = parameters.correlationId;
|
|
13567
|
+
const pendingProfileAttributes = filterReservedSignUpAttributesV2(parameters.attributes, this.logger, correlationId);
|
|
13485
13568
|
const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
|
|
13486
13569
|
this.logger.verbose("19e1ak", correlationId);
|
|
13487
13570
|
const scopes = this.getScopes(parameters.scopes);
|
|
@@ -13491,38 +13574,82 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13491
13574
|
message: "The authorize-challenge entry response did not include a sign-up link.",
|
|
13492
13575
|
}), {
|
|
13493
13576
|
continuationToken: entryResult.continuationToken,
|
|
13577
|
+
username: parameters.username,
|
|
13494
13578
|
}, context);
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13579
|
+
if (startResult.nextAction === VERIFY_RELATION) {
|
|
13580
|
+
if (startResult.type?.toLowerCase() !==
|
|
13581
|
+
AuthenticationMethodTypeV2.EMAIL) {
|
|
13582
|
+
const message = "New-account sign-up requires an email code challenge.";
|
|
13583
|
+
this.logger.error(message, correlationId);
|
|
13584
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13585
|
+
}
|
|
13586
|
+
return createFlowCodeRequiredResultV2({
|
|
13587
|
+
correlationId,
|
|
13588
|
+
continuationState: {
|
|
13589
|
+
continuationToken: startResult.continuationToken,
|
|
13590
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
13591
|
+
scopes,
|
|
13592
|
+
links: {
|
|
13593
|
+
verify: startResult.verifyHref,
|
|
13594
|
+
resend: startResult.resendHref,
|
|
13595
|
+
},
|
|
13596
|
+
signUp: {
|
|
13597
|
+
purpose: "newAccount",
|
|
13598
|
+
pendingProfileAttributes,
|
|
13599
|
+
submittedAttributeIds: [],
|
|
13600
|
+
},
|
|
13601
|
+
},
|
|
13602
|
+
channel: startResult.type,
|
|
13603
|
+
sentTo: startResult.hint,
|
|
13604
|
+
codeLength: startResult.codeLength,
|
|
13605
|
+
});
|
|
13500
13606
|
}
|
|
13501
|
-
const submitResult = await this.apiClient.submitSignUpAttributes(startResult.submitAttributesHref, {
|
|
13502
|
-
continuationToken: startResult.continuationToken,
|
|
13503
|
-
attributes,
|
|
13504
|
-
}, context);
|
|
13505
13607
|
const continuationState = {
|
|
13506
13608
|
continuationToken: startResult.continuationToken,
|
|
13507
13609
|
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
13508
13610
|
scopes,
|
|
13509
13611
|
links: {},
|
|
13510
13612
|
signUp: {
|
|
13511
|
-
|
|
13613
|
+
purpose: "existingAccount",
|
|
13512
13614
|
},
|
|
13513
13615
|
};
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13616
|
+
this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "existing-account sign-up", correlationId);
|
|
13617
|
+
const supportedMethods = startResult.methods
|
|
13618
|
+
.map((method) => ({
|
|
13619
|
+
id: method.id,
|
|
13620
|
+
type: method.type ?? "",
|
|
13621
|
+
hint: method.hint,
|
|
13622
|
+
challengeHref: method.challengeHref,
|
|
13623
|
+
}))
|
|
13624
|
+
.filter((method) => {
|
|
13625
|
+
const methodType = method.type.toLowerCase();
|
|
13626
|
+
return (methodType === AuthenticationMethodTypeV2.EMAIL ||
|
|
13627
|
+
methodType === AuthenticationMethodTypeV2.PASSWORD);
|
|
13628
|
+
});
|
|
13629
|
+
if (supportedMethods.length === 0) {
|
|
13630
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "The existing-account sign-up response must include an email or password method.", correlationId);
|
|
13520
13631
|
}
|
|
13521
|
-
|
|
13632
|
+
if (supportedMethods.length > 1) {
|
|
13633
|
+
return createFlowMethodSelectionRequiredResultV2({
|
|
13634
|
+
correlationId,
|
|
13635
|
+
continuationState,
|
|
13636
|
+
methods: supportedMethods,
|
|
13637
|
+
});
|
|
13638
|
+
}
|
|
13639
|
+
const selectedMethod = supportedMethods[0];
|
|
13640
|
+
const challengeResult = await this.requestChallenge({
|
|
13641
|
+
correlationId,
|
|
13642
|
+
continuationState: {
|
|
13643
|
+
...continuationState,
|
|
13644
|
+
links: {
|
|
13645
|
+
challenge: selectedMethod.challengeHref,
|
|
13646
|
+
},
|
|
13647
|
+
},
|
|
13648
|
+
});
|
|
13649
|
+
return this.toExistingAccountChallengeResult(challengeResult, selectedMethod, correlationId);
|
|
13522
13650
|
}
|
|
13523
13651
|
/*
|
|
13524
|
-
* Starts
|
|
13525
|
-
* returning multiple methods for selection.
|
|
13652
|
+
* Starts native auth V2 password reset.
|
|
13526
13653
|
*/
|
|
13527
13654
|
async resetPassword(parameters) {
|
|
13528
13655
|
const correlationId = parameters.correlationId;
|
|
@@ -13555,44 +13682,43 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13555
13682
|
this.logger.error(message, correlationId);
|
|
13556
13683
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13557
13684
|
}
|
|
13558
|
-
if (methods.length
|
|
13559
|
-
|
|
13560
|
-
|
|
13685
|
+
if (methods.length > 1) {
|
|
13686
|
+
this.logger.verbose("0k8yah", correlationId);
|
|
13687
|
+
return createFlowMethodSelectionRequiredResultV2({
|
|
13561
13688
|
correlationId,
|
|
13562
|
-
continuationState
|
|
13563
|
-
|
|
13564
|
-
links: {
|
|
13565
|
-
challenge: selectedMethod.challengeHref,
|
|
13566
|
-
},
|
|
13567
|
-
},
|
|
13689
|
+
continuationState,
|
|
13690
|
+
methods,
|
|
13568
13691
|
});
|
|
13569
|
-
if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
13570
|
-
(challengeResult.channel?.toLowerCase() ===
|
|
13571
|
-
AuthenticationMethodTypeV2.EMAIL ||
|
|
13572
|
-
challengeResult.channel?.toLowerCase() ===
|
|
13573
|
-
AuthenticationMethodTypeV2.SMS)) {
|
|
13574
|
-
return {
|
|
13575
|
-
...challengeResult,
|
|
13576
|
-
method: selectedMethod,
|
|
13577
|
-
};
|
|
13578
|
-
}
|
|
13579
|
-
const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
|
|
13580
|
-
? challengeResult.channel
|
|
13581
|
-
: AuthenticationMethodTypeV2.PASSWORD;
|
|
13582
|
-
const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
|
|
13583
|
-
this.logger.error(message, correlationId);
|
|
13584
|
-
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13585
13692
|
}
|
|
13586
|
-
|
|
13587
|
-
|
|
13693
|
+
const selectedMethod = methods[0];
|
|
13694
|
+
const challengeResult = await this.requestChallenge({
|
|
13588
13695
|
correlationId,
|
|
13589
|
-
continuationState
|
|
13590
|
-
|
|
13696
|
+
continuationState: {
|
|
13697
|
+
...continuationState,
|
|
13698
|
+
links: {
|
|
13699
|
+
challenge: selectedMethod.challengeHref,
|
|
13700
|
+
},
|
|
13701
|
+
},
|
|
13591
13702
|
});
|
|
13703
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
13704
|
+
(challengeResult.channel?.toLowerCase() ===
|
|
13705
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
13706
|
+
challengeResult.channel?.toLowerCase() ===
|
|
13707
|
+
AuthenticationMethodTypeV2.SMS)) {
|
|
13708
|
+
return {
|
|
13709
|
+
...challengeResult,
|
|
13710
|
+
method: selectedMethod,
|
|
13711
|
+
};
|
|
13712
|
+
}
|
|
13713
|
+
const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
|
|
13714
|
+
? challengeResult.channel
|
|
13715
|
+
: AuthenticationMethodTypeV2.PASSWORD;
|
|
13716
|
+
const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
|
|
13717
|
+
this.logger.error(message, correlationId);
|
|
13718
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13592
13719
|
}
|
|
13593
13720
|
/*
|
|
13594
|
-
* Requests a
|
|
13595
|
-
* the continuation state and code metadata needed for verification.
|
|
13721
|
+
* Requests a challenge for the selected authentication method.
|
|
13596
13722
|
*/
|
|
13597
13723
|
async requestChallenge(parameters) {
|
|
13598
13724
|
const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
|
|
@@ -13622,7 +13748,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13622
13748
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
|
|
13623
13749
|
}
|
|
13624
13750
|
/*
|
|
13625
|
-
* Registers the selected
|
|
13751
|
+
* Registers the selected authentication method.
|
|
13626
13752
|
*/
|
|
13627
13753
|
async registerAuthMethod(parameters) {
|
|
13628
13754
|
const { continuationState, correlationId } = parameters;
|
|
@@ -13636,8 +13762,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13636
13762
|
return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
|
|
13637
13763
|
}
|
|
13638
13764
|
/*
|
|
13639
|
-
* Activates the registered method
|
|
13640
|
-
* for tokens.
|
|
13765
|
+
* Activates the registered authentication method.
|
|
13641
13766
|
*/
|
|
13642
13767
|
async verifyAuthMethodRegistration(parameters) {
|
|
13643
13768
|
const { continuationState, correlationId } = parameters;
|
|
@@ -13647,11 +13772,22 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13647
13772
|
continuationToken: continuationState.continuationToken,
|
|
13648
13773
|
otp: parameters.code,
|
|
13649
13774
|
}, context);
|
|
13775
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp ||
|
|
13776
|
+
continuationState.scenario ===
|
|
13777
|
+
CustomAuthFlowScenarioV2.PasswordReset) {
|
|
13778
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13779
|
+
correlationId,
|
|
13780
|
+
continuationState: {
|
|
13781
|
+
...continuationState,
|
|
13782
|
+
continuationToken: result.continuationToken,
|
|
13783
|
+
links: {},
|
|
13784
|
+
},
|
|
13785
|
+
});
|
|
13786
|
+
}
|
|
13650
13787
|
return this.completeSignInAfterVerification(continuationState, result.continuationToken, correlationId);
|
|
13651
13788
|
}
|
|
13652
13789
|
/*
|
|
13653
|
-
* Requests a replacement activation challenge
|
|
13654
|
-
* resend link using the latest continuation token.
|
|
13790
|
+
* Requests a replacement authentication-method activation challenge.
|
|
13655
13791
|
*/
|
|
13656
13792
|
async resendAuthMethodRegistrationChallenge(parameters) {
|
|
13657
13793
|
const { continuationState, correlationId } = parameters;
|
|
@@ -13663,8 +13799,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13663
13799
|
return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
|
|
13664
13800
|
}
|
|
13665
13801
|
/*
|
|
13666
|
-
* Verifies the submitted one-time code
|
|
13667
|
-
* response determines the next required action.
|
|
13802
|
+
* Verifies the submitted one-time code.
|
|
13668
13803
|
*/
|
|
13669
13804
|
async submitCode(parameters) {
|
|
13670
13805
|
const continuationState = parameters.continuationState;
|
|
@@ -13679,6 +13814,22 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13679
13814
|
const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
|
|
13680
13815
|
if (continuationState.scenario ===
|
|
13681
13816
|
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
13817
|
+
parameters.authenticationFactor ===
|
|
13818
|
+
AuthenticationFactorV2.MULTI_FACTOR &&
|
|
13819
|
+
verifyResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
13820
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13821
|
+
correlationId,
|
|
13822
|
+
continuationState: {
|
|
13823
|
+
...continuationState,
|
|
13824
|
+
continuationToken: verifyResult.continuationToken,
|
|
13825
|
+
links: {},
|
|
13826
|
+
},
|
|
13827
|
+
});
|
|
13828
|
+
}
|
|
13829
|
+
if (continuationState.scenario ===
|
|
13830
|
+
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
13831
|
+
parameters.authenticationFactor !==
|
|
13832
|
+
AuthenticationFactorV2.MULTI_FACTOR &&
|
|
13682
13833
|
verifyResult.nextAction === UPDATE_RELATION) {
|
|
13683
13834
|
return createFlowNewPasswordRequiredResultV2({
|
|
13684
13835
|
correlationId,
|
|
@@ -13693,6 +13844,10 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13693
13844
|
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
13694
13845
|
return this.handleSignInVerification(continuationState, verifyResult, correlationId);
|
|
13695
13846
|
}
|
|
13847
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13848
|
+
continuationState.signUp?.purpose === "existingAccount") {
|
|
13849
|
+
return this.handleSignInVerification(continuationState, verifyResult, correlationId);
|
|
13850
|
+
}
|
|
13696
13851
|
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
|
|
13697
13852
|
return this.handleSignUpVerification(continuationState, verifyResult, correlationId);
|
|
13698
13853
|
}
|
|
@@ -13701,11 +13856,17 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13701
13856
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13702
13857
|
}
|
|
13703
13858
|
/*
|
|
13704
|
-
* Requests a
|
|
13705
|
-
* Returns refreshed continuation state and code metadata.
|
|
13859
|
+
* Requests a replacement one-time code.
|
|
13706
13860
|
*/
|
|
13707
13861
|
async resendCode(parameters) {
|
|
13708
13862
|
const challengeResult = await this.sendMethodChallenge(parameters, "resendCode");
|
|
13863
|
+
const challengeType = challengeResult.type?.toLowerCase();
|
|
13864
|
+
if (challengeType !== AuthenticationMethodTypeV2.EMAIL &&
|
|
13865
|
+
challengeType !== AuthenticationMethodTypeV2.SMS) {
|
|
13866
|
+
const message = "A replacement code requires an email or SMS code challenge.";
|
|
13867
|
+
this.logger.error(message, parameters.correlationId);
|
|
13868
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
|
|
13869
|
+
}
|
|
13709
13870
|
return createFlowCodeRequiredResultV2({
|
|
13710
13871
|
correlationId: parameters.correlationId,
|
|
13711
13872
|
continuationState: this.createChallengeContinuationState(parameters.continuationState, challengeResult),
|
|
@@ -13715,24 +13876,31 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13715
13876
|
});
|
|
13716
13877
|
}
|
|
13717
13878
|
async submitSignUpAttributes(parameters) {
|
|
13718
|
-
const { continuationState, correlationId, attributes } = parameters;
|
|
13879
|
+
const { continuationState, correlationId, attributes: submittedAttributes, } = parameters;
|
|
13719
13880
|
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitAttributes", correlationId), correlationId);
|
|
13720
13881
|
this.logger.verbose("0js2ub", correlationId);
|
|
13882
|
+
const submittedAttributeIds = Object.keys(submittedAttributes);
|
|
13721
13883
|
const submitResult = await this.apiClient.submitSignUpAttributes(this.requireLink(correlationId, continuationState.links.submitAttributes), {
|
|
13722
13884
|
continuationToken: continuationState.continuationToken,
|
|
13723
|
-
attributes,
|
|
13885
|
+
attributes: submittedAttributes,
|
|
13724
13886
|
}, context);
|
|
13725
|
-
return this.
|
|
13887
|
+
return this.toSignUpSubmitAttributesResult(submitResult, {
|
|
13726
13888
|
...continuationState,
|
|
13727
13889
|
signUp: {
|
|
13728
|
-
|
|
13729
|
-
|
|
13890
|
+
purpose: "newAccount",
|
|
13891
|
+
submittedAttributeIds: [
|
|
13892
|
+
...new Set([
|
|
13893
|
+
...(continuationState.signUp
|
|
13894
|
+
?.submittedAttributeIds ?? []),
|
|
13895
|
+
...submittedAttributeIds,
|
|
13896
|
+
]),
|
|
13897
|
+
],
|
|
13730
13898
|
},
|
|
13731
13899
|
}, correlationId);
|
|
13732
13900
|
}
|
|
13733
13901
|
/*
|
|
13734
|
-
* Submits the new password and polls
|
|
13735
|
-
*
|
|
13902
|
+
* Submits the new password and polls for the next action: method registration,
|
|
13903
|
+
* MFA, or a continuation for explicit sign-in.
|
|
13736
13904
|
*/
|
|
13737
13905
|
async submitNewPassword(parameters) {
|
|
13738
13906
|
const continuationState = parameters.continuationState;
|
|
@@ -13750,7 +13918,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13750
13918
|
for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
|
|
13751
13919
|
pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
|
|
13752
13920
|
isPolling = pollResult.nextAction === POLL_RELATION;
|
|
13753
|
-
if (
|
|
13921
|
+
if (pollResult.nextAction !== POLL_RELATION) {
|
|
13754
13922
|
break;
|
|
13755
13923
|
}
|
|
13756
13924
|
pollToken = pollResult.continuationToken;
|
|
@@ -13764,8 +13932,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13764
13932
|
this.logger.error(message, correlationId);
|
|
13765
13933
|
throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
|
|
13766
13934
|
}
|
|
13767
|
-
if (pollResult.nextAction === ENROLL_RELATION &&
|
|
13768
|
-
pollResult.enrollmentMethods) {
|
|
13935
|
+
if (pollResult.nextAction === ENROLL_RELATION && pollResult.methods) {
|
|
13769
13936
|
return this.createAuthMethodRegistrationRequiredResult({
|
|
13770
13937
|
correlationId,
|
|
13771
13938
|
continuationState: {
|
|
@@ -13773,7 +13940,30 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13773
13940
|
continuationToken: pollResult.continuationToken,
|
|
13774
13941
|
links: {},
|
|
13775
13942
|
},
|
|
13776
|
-
methods: pollResult.
|
|
13943
|
+
methods: pollResult.methods,
|
|
13944
|
+
});
|
|
13945
|
+
}
|
|
13946
|
+
if (pollResult.nextAction === CHALLENGE_RELATION) {
|
|
13947
|
+
if (!pollResult.authenticationFactor) {
|
|
13948
|
+
const message = "Password-reset MFA challenge is missing its authentication factor.";
|
|
13949
|
+
this.logger.error(message, correlationId);
|
|
13950
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13951
|
+
}
|
|
13952
|
+
this.ensureAuthenticationFactor(pollResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after password reset", correlationId);
|
|
13953
|
+
return createFlowMFARequiredResultV2({
|
|
13954
|
+
correlationId,
|
|
13955
|
+
continuationState: {
|
|
13956
|
+
continuationToken: pollResult.continuationToken,
|
|
13957
|
+
scenario: continuationState.scenario,
|
|
13958
|
+
scopes: continuationState.scopes,
|
|
13959
|
+
links: {},
|
|
13960
|
+
},
|
|
13961
|
+
methods: pollResult.methods.map((method) => ({
|
|
13962
|
+
id: method.id,
|
|
13963
|
+
type: method.type ?? "",
|
|
13964
|
+
hint: method.hint,
|
|
13965
|
+
challengeHref: method.challengeHref,
|
|
13966
|
+
})),
|
|
13777
13967
|
});
|
|
13778
13968
|
}
|
|
13779
13969
|
if (pollResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
@@ -13793,15 +13983,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13793
13983
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13794
13984
|
}
|
|
13795
13985
|
/*
|
|
13796
|
-
* Verifies
|
|
13986
|
+
* Verifies the sign-in password.
|
|
13797
13987
|
*/
|
|
13798
13988
|
async submitSignInPassword(parameters) {
|
|
13799
13989
|
const verifyResult = await this.verifySignInPassword(parameters);
|
|
13800
13990
|
return this.handleSignInVerification(parameters.continuationState, verifyResult, parameters.correlationId);
|
|
13801
13991
|
}
|
|
13802
13992
|
/*
|
|
13803
|
-
*
|
|
13804
|
-
* authentication result after validating and caching the response.
|
|
13993
|
+
* Signs the user in from a completed flow.
|
|
13805
13994
|
*/
|
|
13806
13995
|
async signInWithContinuation(parameters) {
|
|
13807
13996
|
const continuationState = parameters.continuationState;
|
|
@@ -13832,13 +14021,12 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13832
14021
|
});
|
|
13833
14022
|
}
|
|
13834
14023
|
if (verifyResult.nextAction === CHALLENGE_RELATION) {
|
|
13835
|
-
this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after
|
|
14024
|
+
this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after authentication verification", correlationId);
|
|
13836
14025
|
return createFlowMFARequiredResultV2({
|
|
13837
14026
|
correlationId,
|
|
13838
14027
|
continuationState: {
|
|
14028
|
+
...continuationState,
|
|
13839
14029
|
continuationToken: verifyResult.continuationToken,
|
|
13840
|
-
scenario: continuationState.scenario,
|
|
13841
|
-
scopes: continuationState.scopes,
|
|
13842
14030
|
links: {},
|
|
13843
14031
|
},
|
|
13844
14032
|
methods: verifyResult.methods.map((method) => ({
|
|
@@ -13852,37 +14040,41 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13852
14040
|
if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
13853
14041
|
return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
|
|
13854
14042
|
}
|
|
13855
|
-
const message = `Verification next action '${verifyResult.nextAction}' is not supported for
|
|
14043
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for authentication.`;
|
|
13856
14044
|
this.logger.error(message, correlationId);
|
|
13857
14045
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13858
14046
|
}
|
|
13859
|
-
handleSignUpVerification(continuationState, verifyResult, correlationId) {
|
|
14047
|
+
async handleSignUpVerification(continuationState, verifyResult, correlationId) {
|
|
13860
14048
|
if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
|
|
13861
|
-
const
|
|
13862
|
-
|
|
14049
|
+
const requestedAttributes = verifyResult.attributes;
|
|
14050
|
+
const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
|
|
13863
14051
|
const nextContinuationState = {
|
|
14052
|
+
...continuationState,
|
|
13864
14053
|
continuationToken: verifyResult.continuationToken,
|
|
13865
|
-
scenario: continuationState.scenario,
|
|
13866
|
-
scopes: continuationState.scopes,
|
|
13867
14054
|
links: {
|
|
13868
14055
|
submitAttributes: verifyResult.submitAttributesHref,
|
|
13869
14056
|
},
|
|
13870
|
-
signUp: continuationState.signUp,
|
|
13871
14057
|
};
|
|
13872
|
-
const
|
|
13873
|
-
if (
|
|
13874
|
-
|
|
14058
|
+
const pendingProfileAttributes = continuationState.signUp?.pendingProfileAttributes;
|
|
14059
|
+
if (pendingProfileAttributes &&
|
|
14060
|
+
Object.keys(pendingProfileAttributes).length > 0) {
|
|
14061
|
+
return this.submitSignUpAttributes({
|
|
14062
|
+
correlationId,
|
|
14063
|
+
continuationState: nextContinuationState,
|
|
14064
|
+
attributes: pendingProfileAttributes,
|
|
14065
|
+
});
|
|
14066
|
+
}
|
|
14067
|
+
if (requestedPasswordAttribute) {
|
|
13875
14068
|
return createFlowSignUpPasswordRequiredResultV2({
|
|
13876
14069
|
correlationId,
|
|
13877
14070
|
continuationState: nextContinuationState,
|
|
13878
|
-
|
|
13879
|
-
requiredPasswordAttribute,
|
|
14071
|
+
requestedPasswordAttribute,
|
|
13880
14072
|
});
|
|
13881
14073
|
}
|
|
13882
14074
|
return createFlowAttributesRequiredResultV2({
|
|
13883
14075
|
correlationId,
|
|
13884
14076
|
continuationState: nextContinuationState,
|
|
13885
|
-
attributes,
|
|
14077
|
+
attributes: requestedAttributes,
|
|
13886
14078
|
});
|
|
13887
14079
|
}
|
|
13888
14080
|
if (verifyResult.nextAction === ENROLL_RELATION) {
|
|
@@ -13900,9 +14092,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13900
14092
|
return createFlowSignInContinuationRequiredResultV2({
|
|
13901
14093
|
correlationId,
|
|
13902
14094
|
continuationState: {
|
|
14095
|
+
...continuationState,
|
|
13903
14096
|
continuationToken: verifyResult.continuationToken,
|
|
13904
|
-
scenario: continuationState.scenario,
|
|
13905
|
-
scopes: continuationState.scopes,
|
|
13906
14097
|
links: {},
|
|
13907
14098
|
},
|
|
13908
14099
|
});
|
|
@@ -13998,26 +14189,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
13998
14189
|
codeLength: result.codeLength,
|
|
13999
14190
|
});
|
|
14000
14191
|
}
|
|
14001
|
-
|
|
14192
|
+
toSignUpSubmitAttributesResult(result, continuationState, correlationId) {
|
|
14002
14193
|
const nextAction = result.nextAction;
|
|
14003
|
-
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
14004
|
-
return createFlowCodeRequiredResultV2({
|
|
14005
|
-
correlationId,
|
|
14006
|
-
continuationState: {
|
|
14007
|
-
continuationToken: result.continuationToken,
|
|
14008
|
-
scenario: continuationState.scenario,
|
|
14009
|
-
scopes: continuationState.scopes,
|
|
14010
|
-
links: {
|
|
14011
|
-
verify: result.verifyHref,
|
|
14012
|
-
resend: result.resendHref,
|
|
14013
|
-
},
|
|
14014
|
-
signUp: continuationState.signUp,
|
|
14015
|
-
},
|
|
14016
|
-
channel: result.type,
|
|
14017
|
-
sentTo: result.hint,
|
|
14018
|
-
codeLength: result.codeLength,
|
|
14019
|
-
});
|
|
14020
|
-
}
|
|
14021
14194
|
if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
|
|
14022
14195
|
return this.createAuthMethodRegistrationRequiredResult({
|
|
14023
14196
|
correlationId,
|
|
@@ -14031,40 +14204,35 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14031
14204
|
}
|
|
14032
14205
|
if (result.nextAction ===
|
|
14033
14206
|
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
|
|
14034
|
-
const
|
|
14035
|
-
|
|
14207
|
+
const requestedAttributes = result.attributes;
|
|
14208
|
+
this.ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId);
|
|
14036
14209
|
const nextContinuationState = {
|
|
14210
|
+
...continuationState,
|
|
14037
14211
|
continuationToken: result.continuationToken,
|
|
14038
|
-
scenario: continuationState.scenario,
|
|
14039
|
-
scopes: continuationState.scopes,
|
|
14040
14212
|
links: {
|
|
14041
14213
|
submitAttributes: result.submitAttributesHref,
|
|
14042
14214
|
},
|
|
14043
|
-
signUp: continuationState.signUp,
|
|
14044
14215
|
};
|
|
14045
|
-
const
|
|
14046
|
-
if (
|
|
14047
|
-
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
14216
|
+
const requestedPasswordAttribute = requestedAttributes.find((attribute) => attribute.attributeId.toLowerCase() === "password");
|
|
14217
|
+
if (requestedPasswordAttribute) {
|
|
14048
14218
|
return createFlowSignUpPasswordRequiredResultV2({
|
|
14049
14219
|
correlationId,
|
|
14050
14220
|
continuationState: nextContinuationState,
|
|
14051
|
-
|
|
14052
|
-
requiredPasswordAttribute,
|
|
14221
|
+
requestedPasswordAttribute,
|
|
14053
14222
|
});
|
|
14054
14223
|
}
|
|
14055
14224
|
return createFlowAttributesRequiredResultV2({
|
|
14056
14225
|
correlationId,
|
|
14057
14226
|
continuationState: nextContinuationState,
|
|
14058
|
-
attributes,
|
|
14227
|
+
attributes: requestedAttributes,
|
|
14059
14228
|
});
|
|
14060
14229
|
}
|
|
14061
14230
|
if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
|
|
14062
14231
|
return createFlowSignInContinuationRequiredResultV2({
|
|
14063
14232
|
correlationId,
|
|
14064
14233
|
continuationState: {
|
|
14234
|
+
...continuationState,
|
|
14065
14235
|
continuationToken: result.continuationToken,
|
|
14066
|
-
scenario: continuationState.scenario,
|
|
14067
|
-
scopes: continuationState.scopes,
|
|
14068
14236
|
links: {},
|
|
14069
14237
|
},
|
|
14070
14238
|
});
|
|
@@ -14073,6 +14241,20 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14073
14241
|
this.logger.error(message, correlationId);
|
|
14074
14242
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
14075
14243
|
}
|
|
14244
|
+
ensureValidSignUpAttributeCollectionAfterSubmission(requestedAttributes, continuationState, correlationId) {
|
|
14245
|
+
const submittedAttributeIds = continuationState.signUp?.submittedAttributeIds ?? [];
|
|
14246
|
+
const hasSubmittedPassword = submittedAttributeIds.some((attributeId) => attributeId.toLowerCase() === "password");
|
|
14247
|
+
const invalidAttribute = requestedAttributes.find((requestedAttribute) => requestedAttribute.attributeId.toLowerCase() === "password"
|
|
14248
|
+
? hasSubmittedPassword
|
|
14249
|
+
: submittedAttributeIds.includes(requestedAttribute.attributeId));
|
|
14250
|
+
if (invalidAttribute) {
|
|
14251
|
+
const message = invalidAttribute.attributeId.toLowerCase() === "password"
|
|
14252
|
+
? "The sign-up API cannot request password collection after attribute submission."
|
|
14253
|
+
: "The sign-up API requested an attribute that was already successfully submitted.";
|
|
14254
|
+
this.logger.error(message, correlationId);
|
|
14255
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
14256
|
+
}
|
|
14257
|
+
}
|
|
14076
14258
|
ensureAuthenticationFactor(authenticationFactor, expectedFactor, transition, correlationId) {
|
|
14077
14259
|
if (authenticationFactor === expectedFactor) {
|
|
14078
14260
|
return;
|
|
@@ -14081,10 +14263,33 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14081
14263
|
this.logger.error(message, correlationId);
|
|
14082
14264
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
14083
14265
|
}
|
|
14266
|
+
toExistingAccountChallengeResult(challengeResult, method, correlationId) {
|
|
14267
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
14268
|
+
challengeResult.channel?.toLowerCase() ===
|
|
14269
|
+
AuthenticationMethodTypeV2.EMAIL) {
|
|
14270
|
+
return createFlowExistingAccountCodeRequiredResultV2({
|
|
14271
|
+
correlationId,
|
|
14272
|
+
continuationState: challengeResult.continuationState,
|
|
14273
|
+
method,
|
|
14274
|
+
channel: challengeResult.channel,
|
|
14275
|
+
sentTo: challengeResult.sentTo,
|
|
14276
|
+
codeLength: challengeResult.codeLength,
|
|
14277
|
+
});
|
|
14278
|
+
}
|
|
14279
|
+
if (challengeResult.type === FLOW_PASSWORD_REQUIRED_V2) {
|
|
14280
|
+
return createFlowExistingAccountPasswordRequiredResultV2({
|
|
14281
|
+
correlationId,
|
|
14282
|
+
continuationState: challengeResult.continuationState,
|
|
14283
|
+
});
|
|
14284
|
+
}
|
|
14285
|
+
const message = "Existing-account sign-up requires an email code challenge or a password challenge.";
|
|
14286
|
+
this.logger.error(message, correlationId);
|
|
14287
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
14288
|
+
}
|
|
14084
14289
|
async verifySignInPassword(parameters) {
|
|
14085
14290
|
const { continuationState, correlationId } = parameters;
|
|
14086
14291
|
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitPassword", correlationId), correlationId);
|
|
14087
|
-
this.logger.verbose("
|
|
14292
|
+
this.logger.verbose("13uf3o", correlationId);
|
|
14088
14293
|
return this.apiClient.verifyChallenge(this.requireLink(correlationId, continuationState.links.verify), {
|
|
14089
14294
|
continuationToken: continuationState.continuationToken,
|
|
14090
14295
|
password: parameters.password,
|
|
@@ -14094,9 +14299,8 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14094
14299
|
return this.signInWithContinuation({
|
|
14095
14300
|
correlationId,
|
|
14096
14301
|
continuationState: {
|
|
14302
|
+
...continuationState,
|
|
14097
14303
|
continuationToken,
|
|
14098
|
-
scenario: continuationState.scenario,
|
|
14099
|
-
scopes: continuationState.scopes,
|
|
14100
14304
|
links: {},
|
|
14101
14305
|
},
|
|
14102
14306
|
});
|
|
@@ -14125,18 +14329,14 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14125
14329
|
}
|
|
14126
14330
|
createChallengeContinuationState(continuationState, challengeResult) {
|
|
14127
14331
|
return {
|
|
14332
|
+
...continuationState,
|
|
14128
14333
|
continuationToken: challengeResult.continuationToken,
|
|
14129
|
-
scenario: continuationState.scenario,
|
|
14130
|
-
scopes: continuationState.scopes,
|
|
14131
14334
|
links: {
|
|
14132
14335
|
challenge: continuationState.links.challenge,
|
|
14133
14336
|
verify: challengeResult.verifyHref,
|
|
14134
14337
|
resend: challengeResult.resendHref ??
|
|
14135
14338
|
continuationState.links.resend,
|
|
14136
14339
|
},
|
|
14137
|
-
...(continuationState.signUp && {
|
|
14138
|
-
signUp: continuationState.signUp,
|
|
14139
|
-
}),
|
|
14140
14340
|
};
|
|
14141
14341
|
}
|
|
14142
14342
|
resolveStepApiId(scenario, step, correlationId, authenticationFactor) {
|
|
@@ -14166,8 +14366,7 @@ class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
|
14166
14366
|
*/
|
|
14167
14367
|
/**
|
|
14168
14368
|
* Terminal state indicating the operation failed.
|
|
14169
|
-
*
|
|
14170
|
-
* The error is carried by the result's `error` payload, not by this state.
|
|
14369
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14171
14370
|
*/
|
|
14172
14371
|
class FailedStateV2 extends AuthFlowStateBase {
|
|
14173
14372
|
constructor() {
|
|
@@ -14180,8 +14379,14 @@ class FailedStateV2 extends AuthFlowStateBase {
|
|
|
14180
14379
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14181
14380
|
* Licensed under the MIT License.
|
|
14182
14381
|
*/
|
|
14382
|
+
const ATTRIBUTE_VALIDATION_ERROR = "attributeValidationError";
|
|
14183
14383
|
const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
|
|
14184
14384
|
const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
|
|
14385
|
+
const PASSWORD_BANNED = "passwordBanned";
|
|
14386
|
+
const PASSWORD_IS_INVALID = "passwordIsInvalid";
|
|
14387
|
+
const PASSWORD_RECENTLY_USED = "passwordRecentlyUsed";
|
|
14388
|
+
const PASSWORD_TOO_LONG = "passwordTooLong";
|
|
14389
|
+
const PASSWORD_TOO_SHORT = "passwordTooShort";
|
|
14185
14390
|
const PASSWORD_TOO_WEAK = "passwordTooWeak";
|
|
14186
14391
|
const USER_NOT_FOUND = "userNotFound";
|
|
14187
14392
|
|
|
@@ -14190,12 +14395,13 @@ const USER_NOT_FOUND = "userNotFound";
|
|
|
14190
14395
|
* Licensed under the MIT License.
|
|
14191
14396
|
*/
|
|
14192
14397
|
/**
|
|
14193
|
-
* Error returned by a native authentication V2 operation.
|
|
14194
|
-
*
|
|
14398
|
+
* Error returned by a native authentication V2 operation.
|
|
14399
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14195
14400
|
*/
|
|
14196
14401
|
class AuthFlowErrorV2 {
|
|
14197
|
-
constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
14402
|
+
constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown, errorContext = "default") {
|
|
14198
14403
|
this.errorData = errorData;
|
|
14404
|
+
this.errorContext = errorContext;
|
|
14199
14405
|
this.scenario = scenario;
|
|
14200
14406
|
}
|
|
14201
14407
|
get correlationId() {
|
|
@@ -14212,123 +14418,111 @@ class AuthFlowErrorV2 {
|
|
|
14212
14418
|
? this.errorData.innerErrorCode
|
|
14213
14419
|
: undefined;
|
|
14214
14420
|
}
|
|
14215
|
-
/**
|
|
14216
|
-
* Gets the attribute ids that the service reports as required.
|
|
14217
|
-
*/
|
|
14218
14421
|
get requiredAttributes() {
|
|
14219
14422
|
return this.getAttributeIdsByCode("attributeRequired");
|
|
14220
14423
|
}
|
|
14221
|
-
/**
|
|
14222
|
-
* Gets the attribute ids whose submitted values failed validation.
|
|
14223
|
-
*/
|
|
14224
14424
|
get invalidAttributes() {
|
|
14225
14425
|
return this.getAttributeIdsByCode("attributeValidationFailed");
|
|
14226
14426
|
}
|
|
14227
14427
|
/**
|
|
14228
|
-
* Checks
|
|
14229
|
-
* server surfaces this as the `web_redirect_required` OAuth suberror, so a
|
|
14230
|
-
* browser hand-off arrives as a `FailedStateV2` on which this detector
|
|
14231
|
-
* returns true.
|
|
14428
|
+
* Checks whether the flow must continue in the browser.
|
|
14232
14429
|
* @returns True if the browser is required, false otherwise.
|
|
14233
14430
|
*/
|
|
14234
14431
|
isBrowserRequired() {
|
|
14235
|
-
return this.errorData.
|
|
14432
|
+
return (this.errorData.error === "invalid_grant" &&
|
|
14433
|
+
this.errorData.subError === WEB_REDIRECT_REQUIRED);
|
|
14236
14434
|
}
|
|
14237
14435
|
/**
|
|
14238
|
-
* Checks
|
|
14239
|
-
* client-side validation before the request was issued (for example an empty
|
|
14240
|
-
* username, code, or password, or an unknown method id). Use it to prompt the
|
|
14241
|
-
* user to correct the input rather than treating it as a server failure.
|
|
14436
|
+
* Checks whether a caller-supplied argument failed client-side validation.
|
|
14242
14437
|
* @returns True if the input was invalid, false otherwise.
|
|
14243
14438
|
*/
|
|
14244
14439
|
isInvalidInput() {
|
|
14245
14440
|
return this.errorData instanceof InvalidArgumentError;
|
|
14246
14441
|
}
|
|
14247
14442
|
/**
|
|
14248
|
-
* Checks whether the
|
|
14249
|
-
*
|
|
14250
|
-
* @returns True when the username is invalid, otherwise false.
|
|
14443
|
+
* Checks whether the supplied username failed local validation.
|
|
14444
|
+
* @returns True when local username validation failed.
|
|
14251
14445
|
*/
|
|
14252
14446
|
isInvalidUsername() {
|
|
14253
|
-
return this.
|
|
14447
|
+
return (this.errorData instanceof InvalidArgumentError &&
|
|
14448
|
+
this.errorData.argName === "inputs.username");
|
|
14254
14449
|
}
|
|
14255
14450
|
/**
|
|
14256
|
-
* Checks whether the supplied username does not identify an account.
|
|
14257
|
-
* to distinguish a missing account from other request failures.
|
|
14451
|
+
* Checks whether the supplied username does not identify an account.
|
|
14258
14452
|
* @returns True when the service reports that the user was not found.
|
|
14259
14453
|
*/
|
|
14260
14454
|
isUserNotFound() {
|
|
14261
14455
|
return this.isUserNotFoundError();
|
|
14262
14456
|
}
|
|
14263
14457
|
/**
|
|
14264
|
-
* Checks whether the service rejected
|
|
14265
|
-
* classifier does not identify new-password policy failures.
|
|
14266
|
-
* @returns True when the username or password is incorrect.
|
|
14267
|
-
*/
|
|
14268
|
-
isInvalidCredentials() {
|
|
14269
|
-
return this.isPasswordIncorrectError();
|
|
14270
|
-
}
|
|
14271
|
-
/**
|
|
14272
|
-
* Checks whether the service rejected a one-time code. Use it to prompt the
|
|
14273
|
-
* user to re-enter the code or request a new one.
|
|
14458
|
+
* Checks whether the service rejected a one-time code.
|
|
14274
14459
|
* @returns True when the one-time code is invalid, otherwise false.
|
|
14275
14460
|
*/
|
|
14276
14461
|
isInvalidCode() {
|
|
14277
|
-
return this.isInvalidCodeError();
|
|
14462
|
+
return this.errorContext === "default" && this.isInvalidCodeError();
|
|
14278
14463
|
}
|
|
14279
14464
|
/**
|
|
14280
|
-
* Checks whether
|
|
14281
|
-
*
|
|
14282
|
-
* @returns True when the new password is invalid, otherwise false.
|
|
14465
|
+
* Checks whether the service rejected an MFA or registration challenge.
|
|
14466
|
+
* @returns True when the verification challenge is invalid.
|
|
14283
14467
|
*/
|
|
14284
|
-
|
|
14285
|
-
return (this.
|
|
14286
|
-
this.
|
|
14468
|
+
isInvalidChallenge() {
|
|
14469
|
+
return ((this.errorContext === "mfaVerification" ||
|
|
14470
|
+
this.errorContext === "authMethodRegistration") &&
|
|
14471
|
+
this.isInvalidCodeError());
|
|
14287
14472
|
}
|
|
14288
14473
|
/**
|
|
14289
|
-
* Checks whether
|
|
14290
|
-
*
|
|
14291
|
-
* @returns True
|
|
14474
|
+
* Checks whether the service rejected non-password attributes.
|
|
14475
|
+
* Password-targeted validation is reported only by isInvalidPassword().
|
|
14476
|
+
* @returns True when at least one non-password attribute is invalid.
|
|
14292
14477
|
*/
|
|
14293
|
-
|
|
14294
|
-
|
|
14478
|
+
isInvalidAttributes() {
|
|
14479
|
+
if (!this.isAttributeValidationError() ||
|
|
14480
|
+
this.isPasswordAttributeValidationError()) {
|
|
14481
|
+
return false;
|
|
14482
|
+
}
|
|
14483
|
+
const attributeIds = this.getAttributeValidationDetails()
|
|
14484
|
+
.flatMap((detail) => Array.isArray(detail.attributeIds) ? detail.attributeIds : [])
|
|
14485
|
+
.filter((attributeId) => typeof attributeId === "string");
|
|
14486
|
+
return attributeIds.some((attributeId) => attributeId.length > 0);
|
|
14295
14487
|
}
|
|
14296
14488
|
/**
|
|
14297
|
-
* Checks whether the service
|
|
14298
|
-
*
|
|
14299
|
-
* @returns True when required attributes are missing, otherwise false.
|
|
14489
|
+
* Checks whether the service rejected a supplied password.
|
|
14490
|
+
* @returns True when the supplied password is invalid, otherwise false.
|
|
14300
14491
|
*/
|
|
14301
|
-
|
|
14302
|
-
return this.
|
|
14492
|
+
isInvalidPassword() {
|
|
14493
|
+
return (this.isPasswordIncorrectError() ||
|
|
14494
|
+
this.isInvalidPasswordError() ||
|
|
14495
|
+
this.isPasswordAttributeValidationError());
|
|
14303
14496
|
}
|
|
14304
|
-
|
|
14497
|
+
isAttributeValidationError() {
|
|
14305
14498
|
return (this.errorData.error === "invalidRequest" &&
|
|
14306
|
-
|
|
14307
|
-
this.errorData.errorDescription?.includes("AADSTS50034") ===
|
|
14308
|
-
true));
|
|
14499
|
+
this.innerErrorCode === ATTRIBUTE_VALIDATION_ERROR);
|
|
14309
14500
|
}
|
|
14310
|
-
|
|
14501
|
+
isUserNotFoundError() {
|
|
14311
14502
|
return (this.errorData.error === "invalidRequest" &&
|
|
14312
|
-
this.
|
|
14313
|
-
this.errorData.errorDescription
|
|
14314
|
-
.toLowerCase()
|
|
14315
|
-
.includes("username parameter"));
|
|
14503
|
+
this.innerErrorCode === USER_NOT_FOUND);
|
|
14316
14504
|
}
|
|
14317
14505
|
isInvalidCodeError() {
|
|
14318
14506
|
return (this.errorData.error === "invalidGrant" &&
|
|
14319
14507
|
this.innerErrorCode === INVALID_ONE_TIME_CODE);
|
|
14320
14508
|
}
|
|
14321
14509
|
isInvalidPasswordError() {
|
|
14510
|
+
const innerErrorCode = this.innerErrorCode;
|
|
14322
14511
|
return (this.errorData.error === "invalidRequest" &&
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
|
|
14512
|
+
(innerErrorCode === PASSWORD_TOO_WEAK ||
|
|
14513
|
+
innerErrorCode === PASSWORD_TOO_SHORT ||
|
|
14514
|
+
innerErrorCode === PASSWORD_TOO_LONG ||
|
|
14515
|
+
innerErrorCode === PASSWORD_IS_INVALID ||
|
|
14516
|
+
innerErrorCode === PASSWORD_RECENTLY_USED ||
|
|
14517
|
+
innerErrorCode === PASSWORD_BANNED));
|
|
14518
|
+
}
|
|
14519
|
+
isPasswordAttributeValidationError() {
|
|
14520
|
+
if (!this.isAttributeValidationError()) {
|
|
14521
|
+
return false;
|
|
14522
|
+
}
|
|
14523
|
+
return this.getAttributeValidationDetails().some((detail) => {
|
|
14327
14524
|
const attributeIds = detail.attributeIds;
|
|
14328
|
-
return (
|
|
14329
|
-
Array.isArray(attributeIds) &&
|
|
14330
|
-
attributeIds.some((attributeId) => typeof attributeId === "string" &&
|
|
14331
|
-
attributeId.toLowerCase() === "password"));
|
|
14525
|
+
return (Array.isArray(attributeIds) && attributeIds.includes("password"));
|
|
14332
14526
|
});
|
|
14333
14527
|
}
|
|
14334
14528
|
isPasswordIncorrectError() {
|
|
@@ -14354,8 +14548,8 @@ class AuthFlowErrorV2 {
|
|
|
14354
14548
|
* Licensed under the MIT License.
|
|
14355
14549
|
*/
|
|
14356
14550
|
/**
|
|
14357
|
-
* Result of a native auth V2 operation.
|
|
14358
|
-
*
|
|
14551
|
+
* Result of a native auth V2 operation.
|
|
14552
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14359
14553
|
*/
|
|
14360
14554
|
class CustomAuthResultV2 {
|
|
14361
14555
|
constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
@@ -14364,8 +14558,7 @@ class CustomAuthResultV2 {
|
|
|
14364
14558
|
this.scenario = scenario;
|
|
14365
14559
|
}
|
|
14366
14560
|
/**
|
|
14367
|
-
*
|
|
14368
|
-
* A successful match makes the state's properties available without a cast.
|
|
14561
|
+
* Checks whether the result matches a state type and narrows its state.
|
|
14369
14562
|
* @param stateType - The state type to test for.
|
|
14370
14563
|
* @returns True (and narrows `state`) when the current state matches `stateType`.
|
|
14371
14564
|
*/
|
|
@@ -14373,25 +14566,32 @@ class CustomAuthResultV2 {
|
|
|
14373
14566
|
return this.state.stateType === stateType;
|
|
14374
14567
|
}
|
|
14375
14568
|
/**
|
|
14376
|
-
* Checks whether the
|
|
14377
|
-
* contains the unified V2 flow error.
|
|
14569
|
+
* Checks whether the operation failed.
|
|
14378
14570
|
* @returns True (and narrows `state`) when the operation failed.
|
|
14379
14571
|
*/
|
|
14380
14572
|
isFailed() {
|
|
14381
14573
|
return this.state.stateType === "failed";
|
|
14382
14574
|
}
|
|
14383
14575
|
/**
|
|
14384
|
-
*
|
|
14385
|
-
*
|
|
14576
|
+
* Checks whether the current state requires a password.
|
|
14577
|
+
* @returns True (and narrows `state`) when a password is required.
|
|
14578
|
+
*/
|
|
14579
|
+
isPasswordRequired() {
|
|
14580
|
+
return this.state.stateType === "passwordRequired";
|
|
14581
|
+
}
|
|
14582
|
+
/**
|
|
14583
|
+
* Creates a failed result from the supplied error.
|
|
14584
|
+
* Optional error context identifies MFA verification or authentication-method registration.
|
|
14386
14585
|
* @param error - The error that occurred.
|
|
14387
14586
|
* @param options - The flow-error context.
|
|
14388
14587
|
* @returns A failed result carrying the unified V2 flow error.
|
|
14389
14588
|
*/
|
|
14390
14589
|
static createWithError(error, options) {
|
|
14391
|
-
const {
|
|
14392
|
-
const
|
|
14393
|
-
|
|
14394
|
-
|
|
14590
|
+
const { correlationId } = options;
|
|
14591
|
+
const flowError = error instanceof AuthFlowErrorV2
|
|
14592
|
+
? error
|
|
14593
|
+
: new AuthFlowErrorV2(CustomAuthResultV2.createErrorData(error, correlationId), options.scenario ?? CustomAuthFlowScenarioV2.Unknown, options.errorContext);
|
|
14594
|
+
const result = new CustomAuthResultV2(new FailedStateV2(), undefined, flowError.scenario);
|
|
14395
14595
|
result.error = flowError;
|
|
14396
14596
|
return result;
|
|
14397
14597
|
}
|
|
@@ -14424,9 +14624,7 @@ class CustomAuthResultV2 {
|
|
|
14424
14624
|
*/
|
|
14425
14625
|
/**
|
|
14426
14626
|
* Terminal state indicating the operation completed successfully.
|
|
14427
|
-
*
|
|
14428
|
-
* Completion data (for example the signed-in account) is carried by the
|
|
14429
|
-
* result's `data` payload, not by this state.
|
|
14627
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14430
14628
|
*/
|
|
14431
14629
|
class CompletedStateV2 extends AuthFlowStateBase {
|
|
14432
14630
|
constructor() {
|
|
@@ -14435,6 +14633,74 @@ class CompletedStateV2 extends AuthFlowStateBase {
|
|
|
14435
14633
|
}
|
|
14436
14634
|
}
|
|
14437
14635
|
|
|
14636
|
+
/*
|
|
14637
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14638
|
+
* Licensed under the MIT License.
|
|
14639
|
+
*/
|
|
14640
|
+
/**
|
|
14641
|
+
* State returned when a completed V2 flow can sign the user in.
|
|
14642
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14643
|
+
*/
|
|
14644
|
+
class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14645
|
+
constructor() {
|
|
14646
|
+
super(...arguments);
|
|
14647
|
+
this.stateType = "signInContinuation";
|
|
14648
|
+
}
|
|
14649
|
+
/**
|
|
14650
|
+
* Signs the user in after completing the V2 flow.
|
|
14651
|
+
* @returns The result of completing the continuation sign-in.
|
|
14652
|
+
*/
|
|
14653
|
+
async signIn() {
|
|
14654
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14655
|
+
try {
|
|
14656
|
+
logger.verbose("09mk3f", correlationId);
|
|
14657
|
+
const result = await flowClient.signInWithContinuation({
|
|
14658
|
+
correlationId,
|
|
14659
|
+
continuationState,
|
|
14660
|
+
});
|
|
14661
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14662
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14663
|
+
}
|
|
14664
|
+
catch (error) {
|
|
14665
|
+
logger.errorPii(`0zoo5u ${error}`, correlationId);
|
|
14666
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14667
|
+
scenario: continuationState.scenario,
|
|
14668
|
+
correlationId,
|
|
14669
|
+
});
|
|
14670
|
+
}
|
|
14671
|
+
}
|
|
14672
|
+
}
|
|
14673
|
+
|
|
14674
|
+
/*
|
|
14675
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14676
|
+
* Licensed under the MIT License.
|
|
14677
|
+
*/
|
|
14678
|
+
class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14679
|
+
constructor(stateParameters) {
|
|
14680
|
+
super(stateParameters);
|
|
14681
|
+
this.method = stateParameters.method;
|
|
14682
|
+
this.sentTo = stateParameters.sentTo;
|
|
14683
|
+
this.channel = stateParameters.channel;
|
|
14684
|
+
this.codeLength = stateParameters.codeLength;
|
|
14685
|
+
}
|
|
14686
|
+
async submitCodeCore(code, authenticationFactor) {
|
|
14687
|
+
ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
|
|
14688
|
+
return this.stateParameters.flowClient.submitCode({
|
|
14689
|
+
correlationId: this.stateParameters.correlationId,
|
|
14690
|
+
continuationState: this.stateParameters.continuationState,
|
|
14691
|
+
authenticationFactor,
|
|
14692
|
+
code,
|
|
14693
|
+
});
|
|
14694
|
+
}
|
|
14695
|
+
async resendCodeCore(authenticationFactor) {
|
|
14696
|
+
return this.stateParameters.flowClient.resendCode({
|
|
14697
|
+
correlationId: this.stateParameters.correlationId,
|
|
14698
|
+
continuationState: this.stateParameters.continuationState,
|
|
14699
|
+
authenticationFactor,
|
|
14700
|
+
});
|
|
14701
|
+
}
|
|
14702
|
+
}
|
|
14703
|
+
|
|
14438
14704
|
/*
|
|
14439
14705
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14440
14706
|
* Licensed under the MIT License.
|
|
@@ -14442,6 +14708,7 @@ class CompletedStateV2 extends AuthFlowStateBase {
|
|
|
14442
14708
|
/**
|
|
14443
14709
|
* State returned when a newly registered authentication method must be
|
|
14444
14710
|
* activated with the challenge sent by the service.
|
|
14711
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14445
14712
|
*/
|
|
14446
14713
|
class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14447
14714
|
constructor(stateParameters) {
|
|
@@ -14454,7 +14721,7 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
|
|
|
14454
14721
|
/**
|
|
14455
14722
|
* Submits the activation challenge for the registered method.
|
|
14456
14723
|
* @param challenge - The activation challenge to submit.
|
|
14457
|
-
* @returns
|
|
14724
|
+
* @returns A sign-in continuation, completed authentication result, or failed state.
|
|
14458
14725
|
*/
|
|
14459
14726
|
async submitChallenge(challenge) {
|
|
14460
14727
|
const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
|
|
@@ -14466,6 +14733,16 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
|
|
|
14466
14733
|
continuationState,
|
|
14467
14734
|
code: challenge,
|
|
14468
14735
|
});
|
|
14736
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14737
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14738
|
+
correlationId: result.correlationId,
|
|
14739
|
+
logger,
|
|
14740
|
+
config: this.stateParameters.config,
|
|
14741
|
+
flowClient,
|
|
14742
|
+
continuationState: result.continuationState,
|
|
14743
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14744
|
+
}), undefined, result.continuationState.scenario);
|
|
14745
|
+
}
|
|
14469
14746
|
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14470
14747
|
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14471
14748
|
}
|
|
@@ -14474,12 +14751,12 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
|
|
|
14474
14751
|
return CustomAuthResultV2.createWithError(error, {
|
|
14475
14752
|
scenario: continuationState.scenario,
|
|
14476
14753
|
correlationId,
|
|
14754
|
+
errorContext: "authMethodRegistration",
|
|
14477
14755
|
});
|
|
14478
14756
|
}
|
|
14479
14757
|
}
|
|
14480
14758
|
/**
|
|
14481
|
-
* Requests a replacement activation challenge
|
|
14482
|
-
* resend link.
|
|
14759
|
+
* Requests a replacement activation challenge for the registered method.
|
|
14483
14760
|
* @returns Refreshed activation metadata or a failed state.
|
|
14484
14761
|
*/
|
|
14485
14762
|
async resendChallenge() {
|
|
@@ -14517,8 +14794,8 @@ class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateB
|
|
|
14517
14794
|
* Licensed under the MIT License.
|
|
14518
14795
|
*/
|
|
14519
14796
|
/**
|
|
14520
|
-
* State returned when an authentication method must be registered.
|
|
14521
|
-
*
|
|
14797
|
+
* State returned when an authentication method must be registered.
|
|
14798
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14522
14799
|
*/
|
|
14523
14800
|
class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14524
14801
|
constructor(stateParameters) {
|
|
@@ -14575,143 +14852,8 @@ class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateB
|
|
|
14575
14852
|
* Licensed under the MIT License.
|
|
14576
14853
|
*/
|
|
14577
14854
|
/**
|
|
14578
|
-
*
|
|
14579
|
-
*
|
|
14580
|
-
* state without duplicating the token-acquisition behavior.
|
|
14581
|
-
*/
|
|
14582
|
-
class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14583
|
-
constructor() {
|
|
14584
|
-
super(...arguments);
|
|
14585
|
-
this.stateType = "signInContinuation";
|
|
14586
|
-
}
|
|
14587
|
-
/**
|
|
14588
|
-
* Signs the user in using the continuation established by the completed V2
|
|
14589
|
-
* flow. The result either reaches the completed state with the signed-in
|
|
14590
|
-
* account data or reports why the follow-up sign-in could not complete.
|
|
14591
|
-
* @returns The result of completing the continuation sign-in.
|
|
14592
|
-
*/
|
|
14593
|
-
async signIn() {
|
|
14594
|
-
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14595
|
-
try {
|
|
14596
|
-
logger.verbose("09mk3f", correlationId);
|
|
14597
|
-
const result = await flowClient.signInWithContinuation({
|
|
14598
|
-
correlationId,
|
|
14599
|
-
continuationState,
|
|
14600
|
-
});
|
|
14601
|
-
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14602
|
-
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14603
|
-
}
|
|
14604
|
-
catch (error) {
|
|
14605
|
-
logger.errorPii(`0zoo5u ${error}`, correlationId);
|
|
14606
|
-
return CustomAuthResultV2.createWithError(error, {
|
|
14607
|
-
scenario: continuationState.scenario,
|
|
14608
|
-
correlationId,
|
|
14609
|
-
});
|
|
14610
|
-
}
|
|
14611
|
-
}
|
|
14612
|
-
}
|
|
14613
|
-
|
|
14614
|
-
/*
|
|
14615
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14616
|
-
* Licensed under the MIT License.
|
|
14617
|
-
*/
|
|
14618
|
-
/**
|
|
14619
|
-
* State returned when the user must supply a new password to complete the flow.
|
|
14620
|
-
* A successful submission can require registration or return a continuation
|
|
14621
|
-
* for sign-in.
|
|
14622
|
-
*/
|
|
14623
|
-
class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14624
|
-
constructor() {
|
|
14625
|
-
super(...arguments);
|
|
14626
|
-
this.stateType = "newPasswordRequired";
|
|
14627
|
-
}
|
|
14628
|
-
/**
|
|
14629
|
-
* Submits the new password to complete the reset. Enrollment may be
|
|
14630
|
-
* required before sign-in; a rejected password returns an error.
|
|
14631
|
-
* @param password - The new password to set.
|
|
14632
|
-
* @returns The result of submitting the new password.
|
|
14633
|
-
*/
|
|
14634
|
-
async submitNewPassword(password) {
|
|
14635
|
-
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14636
|
-
try {
|
|
14637
|
-
this.ensurePasswordIsNotEmpty(password);
|
|
14638
|
-
logger.verbose("0ie1qa", correlationId);
|
|
14639
|
-
const result = await flowClient.submitNewPassword({
|
|
14640
|
-
correlationId,
|
|
14641
|
-
continuationState,
|
|
14642
|
-
newPassword: password,
|
|
14643
|
-
});
|
|
14644
|
-
const resultType = result.type;
|
|
14645
|
-
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
14646
|
-
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
14647
|
-
correlationId: result.correlationId,
|
|
14648
|
-
logger,
|
|
14649
|
-
config: this.stateParameters.config,
|
|
14650
|
-
flowClient,
|
|
14651
|
-
continuationState: result.continuationState,
|
|
14652
|
-
cacheClient: this.stateParameters.cacheClient,
|
|
14653
|
-
methods: result.methods,
|
|
14654
|
-
}), undefined, result.continuationState.scenario);
|
|
14655
|
-
}
|
|
14656
|
-
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14657
|
-
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14658
|
-
correlationId: result.correlationId,
|
|
14659
|
-
logger,
|
|
14660
|
-
config: this.stateParameters.config,
|
|
14661
|
-
flowClient,
|
|
14662
|
-
continuationState: result.continuationState,
|
|
14663
|
-
cacheClient: this.stateParameters.cacheClient,
|
|
14664
|
-
}), undefined, result.continuationState.scenario);
|
|
14665
|
-
}
|
|
14666
|
-
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
|
|
14667
|
-
}
|
|
14668
|
-
catch (error) {
|
|
14669
|
-
logger.errorPii(`03m081 ${error}`, correlationId);
|
|
14670
|
-
return CustomAuthResultV2.createWithError(error, {
|
|
14671
|
-
scenario: continuationState.scenario,
|
|
14672
|
-
correlationId,
|
|
14673
|
-
});
|
|
14674
|
-
}
|
|
14675
|
-
}
|
|
14676
|
-
}
|
|
14677
|
-
|
|
14678
|
-
/*
|
|
14679
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14680
|
-
* Licensed under the MIT License.
|
|
14681
|
-
*/
|
|
14682
|
-
class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14683
|
-
constructor(stateParameters) {
|
|
14684
|
-
super(stateParameters);
|
|
14685
|
-
this.method = stateParameters.method;
|
|
14686
|
-
this.sentTo = stateParameters.sentTo;
|
|
14687
|
-
this.channel = stateParameters.channel;
|
|
14688
|
-
this.codeLength = stateParameters.codeLength;
|
|
14689
|
-
}
|
|
14690
|
-
async submitCodeCore(code, authenticationFactor) {
|
|
14691
|
-
ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
|
|
14692
|
-
return this.stateParameters.flowClient.submitCode({
|
|
14693
|
-
correlationId: this.stateParameters.correlationId,
|
|
14694
|
-
continuationState: this.stateParameters.continuationState,
|
|
14695
|
-
authenticationFactor,
|
|
14696
|
-
code,
|
|
14697
|
-
});
|
|
14698
|
-
}
|
|
14699
|
-
async resendCodeCore(authenticationFactor) {
|
|
14700
|
-
return this.stateParameters.flowClient.resendCode({
|
|
14701
|
-
correlationId: this.stateParameters.correlationId,
|
|
14702
|
-
continuationState: this.stateParameters.continuationState,
|
|
14703
|
-
authenticationFactor,
|
|
14704
|
-
});
|
|
14705
|
-
}
|
|
14706
|
-
}
|
|
14707
|
-
|
|
14708
|
-
/*
|
|
14709
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14710
|
-
* Licensed under the MIT License.
|
|
14711
|
-
*/
|
|
14712
|
-
/**
|
|
14713
|
-
* State returned when first-factor email authentication requires a one-time
|
|
14714
|
-
* code. It allows the app to submit the code or request a replacement.
|
|
14855
|
+
* State returned when first-factor authentication requires a one-time code.
|
|
14856
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14715
14857
|
*/
|
|
14716
14858
|
class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
14717
14859
|
constructor() {
|
|
@@ -14719,8 +14861,7 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14719
14861
|
this.stateType = "codeRequired";
|
|
14720
14862
|
}
|
|
14721
14863
|
/**
|
|
14722
|
-
* Submits the first-factor
|
|
14723
|
-
* result may complete the operation or require another flow-specific step.
|
|
14864
|
+
* Submits the first-factor code.
|
|
14724
14865
|
* @param code - The code to submit.
|
|
14725
14866
|
* @returns The result of submitting the first-factor code.
|
|
14726
14867
|
*/
|
|
@@ -14731,14 +14872,11 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14731
14872
|
const result = await this.submitCodeCore(code);
|
|
14732
14873
|
const resultType = result.type;
|
|
14733
14874
|
if (result.type === FLOW_NEW_PASSWORD_REQUIRED_V2) {
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
continuationState: result.continuationState,
|
|
14740
|
-
cacheClient: this.stateParameters.cacheClient,
|
|
14741
|
-
}), undefined, result.continuationState.scenario);
|
|
14875
|
+
const resetPasswordStateTransitionHandler = this.stateParameters.resetPasswordStateTransitionHandler;
|
|
14876
|
+
if (!resetPasswordStateTransitionHandler) {
|
|
14877
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Password-reset state transition handler is missing.", correlationId);
|
|
14878
|
+
}
|
|
14879
|
+
return resetPasswordStateTransitionHandler.handleNewPasswordRequired(result, this.stateParameters);
|
|
14742
14880
|
}
|
|
14743
14881
|
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2 ||
|
|
14744
14882
|
result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
@@ -14746,10 +14884,10 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14746
14884
|
if (!signUpStateTransitionHandler) {
|
|
14747
14885
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-up state transition handler is missing.", correlationId);
|
|
14748
14886
|
}
|
|
14749
|
-
return signUpStateTransitionHandler.
|
|
14887
|
+
return signUpStateTransitionHandler.handleAttributeSubmission(result, {
|
|
14750
14888
|
...this.stateParameters,
|
|
14751
14889
|
signUpStateTransitionHandler,
|
|
14752
|
-
});
|
|
14890
|
+
}, "attribute");
|
|
14753
14891
|
}
|
|
14754
14892
|
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14755
14893
|
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
@@ -14794,8 +14932,7 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14794
14932
|
}
|
|
14795
14933
|
}
|
|
14796
14934
|
/**
|
|
14797
|
-
* Requests a replacement first-factor
|
|
14798
|
-
* contains the refreshed challenge metadata.
|
|
14935
|
+
* Requests a replacement first-factor code.
|
|
14799
14936
|
* @returns The result of requesting a replacement code.
|
|
14800
14937
|
*/
|
|
14801
14938
|
async resendCode() {
|
|
@@ -14812,6 +14949,8 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14812
14949
|
cacheClient: this.stateParameters.cacheClient,
|
|
14813
14950
|
signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
|
|
14814
14951
|
signInStateTransitionHandler: this.stateParameters.signInStateTransitionHandler,
|
|
14952
|
+
resetPasswordStateTransitionHandler: this.stateParameters
|
|
14953
|
+
.resetPasswordStateTransitionHandler,
|
|
14815
14954
|
method: this.method,
|
|
14816
14955
|
sentTo: result.sentTo,
|
|
14817
14956
|
channel: result.channel,
|
|
@@ -14833,8 +14972,9 @@ class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14833
14972
|
* Licensed under the MIT License.
|
|
14834
14973
|
*/
|
|
14835
14974
|
/**
|
|
14836
|
-
* State returned when
|
|
14975
|
+
* State returned when authentication requires verification of an email or SMS MFA
|
|
14837
14976
|
* challenge. It allows the app to submit the challenge or request a replacement.
|
|
14977
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14838
14978
|
*/
|
|
14839
14979
|
class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
14840
14980
|
constructor() {
|
|
@@ -14843,7 +14983,6 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14843
14983
|
}
|
|
14844
14984
|
/**
|
|
14845
14985
|
* Submits the email or SMS challenge as the second authentication factor.
|
|
14846
|
-
* Successful verification completes sign-in.
|
|
14847
14986
|
* @param challenge - The challenge value to submit.
|
|
14848
14987
|
* @returns The result of submitting the MFA challenge.
|
|
14849
14988
|
*/
|
|
@@ -14852,6 +14991,16 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14852
14991
|
try {
|
|
14853
14992
|
logger.verbose("10k0lc", correlationId);
|
|
14854
14993
|
const result = await this.submitCodeCore(challenge, AuthenticationFactorV2.MULTI_FACTOR);
|
|
14994
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14995
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14996
|
+
correlationId: result.correlationId,
|
|
14997
|
+
logger,
|
|
14998
|
+
config: this.stateParameters.config,
|
|
14999
|
+
flowClient: this.stateParameters.flowClient,
|
|
15000
|
+
continuationState: result.continuationState,
|
|
15001
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
15002
|
+
}), undefined, result.continuationState.scenario);
|
|
15003
|
+
}
|
|
14855
15004
|
if (result.type !== FLOW_COMPLETED_V2) {
|
|
14856
15005
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
|
|
14857
15006
|
}
|
|
@@ -14863,12 +15012,12 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14863
15012
|
return CustomAuthResultV2.createWithError(error, {
|
|
14864
15013
|
scenario: continuationState.scenario,
|
|
14865
15014
|
correlationId,
|
|
15015
|
+
errorContext: "mfaVerification",
|
|
14866
15016
|
});
|
|
14867
15017
|
}
|
|
14868
15018
|
}
|
|
14869
15019
|
/**
|
|
14870
|
-
* Requests a replacement challenge for the selected MFA method.
|
|
14871
|
-
* returned state contains the refreshed email or SMS challenge metadata.
|
|
15020
|
+
* Requests a replacement challenge for the selected MFA method.
|
|
14872
15021
|
* @returns The result of requesting a replacement MFA challenge.
|
|
14873
15022
|
*/
|
|
14874
15023
|
async resendChallenge() {
|
|
@@ -14899,15 +15048,157 @@ class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
|
14899
15048
|
}
|
|
14900
15049
|
}
|
|
14901
15050
|
|
|
15051
|
+
/*
|
|
15052
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15053
|
+
* Licensed under the MIT License.
|
|
15054
|
+
*/
|
|
15055
|
+
function handleExistingAccountVerificationResultV2(result, stateParameters) {
|
|
15056
|
+
const commonStateParameters = {
|
|
15057
|
+
correlationId: result.correlationId,
|
|
15058
|
+
logger: stateParameters.logger,
|
|
15059
|
+
config: stateParameters.config,
|
|
15060
|
+
flowClient: stateParameters.flowClient,
|
|
15061
|
+
continuationState: "continuationState" in result
|
|
15062
|
+
? result.continuationState
|
|
15063
|
+
: stateParameters.continuationState,
|
|
15064
|
+
cacheClient: stateParameters.cacheClient,
|
|
15065
|
+
};
|
|
15066
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
15067
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, stateParameters.config, stateParameters.cacheClient, stateParameters.logger, result.correlationId);
|
|
15068
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, stateParameters.continuationState.scenario);
|
|
15069
|
+
}
|
|
15070
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
15071
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
15072
|
+
...commonStateParameters,
|
|
15073
|
+
continuationState: result.continuationState,
|
|
15074
|
+
methods: result.methods,
|
|
15075
|
+
}), undefined, result.continuationState.scenario);
|
|
15076
|
+
}
|
|
15077
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
15078
|
+
const signInStateTransitionHandler = stateParameters.signInStateTransitionHandler;
|
|
15079
|
+
if (!signInStateTransitionHandler) {
|
|
15080
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-in state transition handler is missing.", stateParameters.correlationId);
|
|
15081
|
+
}
|
|
15082
|
+
return signInStateTransitionHandler.handleMfaRequired(result, stateParameters);
|
|
15083
|
+
}
|
|
15084
|
+
const resultType = result.type;
|
|
15085
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account verification result type '${resultType}' is not supported.`, stateParameters.correlationId);
|
|
15086
|
+
}
|
|
15087
|
+
|
|
15088
|
+
/*
|
|
15089
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15090
|
+
* Licensed under the MIT License.
|
|
15091
|
+
*/
|
|
15092
|
+
/**
|
|
15093
|
+
* State returned when sign-up discovers an existing account that requires an
|
|
15094
|
+
* email code. Submitting or resending the code preserves existing-account authentication.
|
|
15095
|
+
*/
|
|
15096
|
+
class ExistingAccountCodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
15097
|
+
constructor() {
|
|
15098
|
+
super(...arguments);
|
|
15099
|
+
this.stateType = "existingAccountCodeRequired";
|
|
15100
|
+
}
|
|
15101
|
+
/**
|
|
15102
|
+
* Submits the existing account's email code and continues authentication.
|
|
15103
|
+
* The result can complete authentication or require enrollment or MFA.
|
|
15104
|
+
* @param code - The email code to verify.
|
|
15105
|
+
* @returns The next existing-account authentication result.
|
|
15106
|
+
*/
|
|
15107
|
+
async submitCode(code) {
|
|
15108
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
15109
|
+
try {
|
|
15110
|
+
const result = await this.submitCodeCore(code);
|
|
15111
|
+
if (result.type === FLOW_COMPLETED_V2 ||
|
|
15112
|
+
result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 ||
|
|
15113
|
+
result.type === FLOW_MFA_REQUIRED_V2) {
|
|
15114
|
+
return handleExistingAccountVerificationResultV2(result, this.stateParameters);
|
|
15115
|
+
}
|
|
15116
|
+
const resultType = result.type;
|
|
15117
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Existing-account code submission result type '${resultType}' is not supported.`, correlationId);
|
|
15118
|
+
}
|
|
15119
|
+
catch (error) {
|
|
15120
|
+
logger.errorPii(`18e4gg ${error}`, correlationId);
|
|
15121
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
15122
|
+
scenario: continuationState.scenario,
|
|
15123
|
+
correlationId,
|
|
15124
|
+
});
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
/**
|
|
15128
|
+
* Requests a replacement email code for the existing account. The returned
|
|
15129
|
+
* state contains the fresh continuation token and challenge metadata.
|
|
15130
|
+
* @returns The refreshed existing-account code state or an error.
|
|
15131
|
+
*/
|
|
15132
|
+
async resendCode() {
|
|
15133
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
15134
|
+
try {
|
|
15135
|
+
const result = await this.resendCodeCore();
|
|
15136
|
+
return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
|
|
15137
|
+
...this.stateParameters,
|
|
15138
|
+
correlationId: result.correlationId,
|
|
15139
|
+
continuationState: result.continuationState,
|
|
15140
|
+
sentTo: result.sentTo,
|
|
15141
|
+
channel: result.channel,
|
|
15142
|
+
codeLength: result.codeLength,
|
|
15143
|
+
}), undefined, result.continuationState.scenario);
|
|
15144
|
+
}
|
|
15145
|
+
catch (error) {
|
|
15146
|
+
logger.errorPii(`011v0m ${error}`, correlationId);
|
|
15147
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
15148
|
+
scenario: continuationState.scenario,
|
|
15149
|
+
correlationId,
|
|
15150
|
+
});
|
|
15151
|
+
}
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
15154
|
+
|
|
15155
|
+
/*
|
|
15156
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15157
|
+
* Licensed under the MIT License.
|
|
15158
|
+
*/
|
|
15159
|
+
/**
|
|
15160
|
+
* State returned when sign-up discovers an existing account that requires its
|
|
15161
|
+
* current password. The password is verified as an authentication credential.
|
|
15162
|
+
*/
|
|
15163
|
+
class ExistingAccountPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
15164
|
+
constructor() {
|
|
15165
|
+
super(...arguments);
|
|
15166
|
+
this.stateType = "existingAccountPasswordRequired";
|
|
15167
|
+
}
|
|
15168
|
+
/**
|
|
15169
|
+
* Verifies the existing account's current password and continues authentication.
|
|
15170
|
+
* The result can complete authentication or require enrollment or MFA.
|
|
15171
|
+
* @param password - The existing account password.
|
|
15172
|
+
* @returns The next existing-account authentication result.
|
|
15173
|
+
*/
|
|
15174
|
+
async submitPassword(password) {
|
|
15175
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
15176
|
+
try {
|
|
15177
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
15178
|
+
const result = await flowClient.submitSignInPassword({
|
|
15179
|
+
correlationId,
|
|
15180
|
+
continuationState,
|
|
15181
|
+
password,
|
|
15182
|
+
});
|
|
15183
|
+
return handleExistingAccountVerificationResultV2(result, this.stateParameters);
|
|
15184
|
+
}
|
|
15185
|
+
catch (error) {
|
|
15186
|
+
logger.errorPii(`1glycw ${error}`, correlationId);
|
|
15187
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
15188
|
+
scenario: continuationState.scenario,
|
|
15189
|
+
correlationId,
|
|
15190
|
+
});
|
|
15191
|
+
}
|
|
15192
|
+
}
|
|
15193
|
+
}
|
|
15194
|
+
|
|
14902
15195
|
/*
|
|
14903
15196
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14904
15197
|
* Licensed under the MIT License.
|
|
14905
15198
|
*/
|
|
14906
15199
|
/**
|
|
14907
|
-
* State returned when the user must select
|
|
14908
|
-
*
|
|
14909
|
-
* methods and lets the app request a challenge for the chosen one. The flow
|
|
14910
|
-
* stays on this state until a challenge is successfully requested.
|
|
15200
|
+
* State returned when the user must select an authentication method.
|
|
15201
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
14911
15202
|
*/
|
|
14912
15203
|
class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14913
15204
|
constructor(stateParameters) {
|
|
@@ -14916,13 +15207,12 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
|
|
|
14916
15207
|
this.methods = stateParameters.methods;
|
|
14917
15208
|
}
|
|
14918
15209
|
/**
|
|
14919
|
-
* Selects an authentication method and requests its challenge.
|
|
14920
|
-
* state identifies the credential the application must collect.
|
|
15210
|
+
* Selects an authentication method and requests its challenge.
|
|
14921
15211
|
* @param method - The method to select, from {@link methods}.
|
|
14922
15212
|
* @returns The result of selecting the method and requesting its challenge.
|
|
14923
15213
|
*/
|
|
14924
15214
|
async selectAuthMethod(method) {
|
|
14925
|
-
const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, } = this.stateParameters;
|
|
15215
|
+
const { authenticationFactor, correlationId, logger, continuationState, flowClient, signInStateTransitionHandler, resetPasswordStateTransitionHandler, } = this.stateParameters;
|
|
14926
15216
|
try {
|
|
14927
15217
|
logger.verbose("1r2ypl", correlationId);
|
|
14928
15218
|
const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
|
|
@@ -14933,22 +15223,45 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
|
|
|
14933
15223
|
flowClient,
|
|
14934
15224
|
continuationState: result.continuationState,
|
|
14935
15225
|
cacheClient: this.stateParameters.cacheClient,
|
|
15226
|
+
signInStateTransitionHandler,
|
|
14936
15227
|
};
|
|
14937
|
-
|
|
15228
|
+
const isExistingAccountSignUp = continuationState.scenario ===
|
|
15229
|
+
CustomAuthFlowScenarioV2.SignUp &&
|
|
15230
|
+
continuationState.signUp?.purpose === "existingAccount";
|
|
15231
|
+
const channel = result.type === FLOW_CODE_REQUIRED_V2
|
|
15232
|
+
? result.channel?.toLowerCase()
|
|
15233
|
+
: undefined;
|
|
15234
|
+
if (isExistingAccountSignUp &&
|
|
15235
|
+
authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
|
|
14938
15236
|
result.type === FLOW_CODE_REQUIRED_V2 &&
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
15237
|
+
channel === AuthenticationMethodTypeV2.EMAIL) {
|
|
15238
|
+
return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
|
|
15239
|
+
...commonStateParameters,
|
|
15240
|
+
method: selectedMethod,
|
|
15241
|
+
sentTo: result.sentTo,
|
|
15242
|
+
channel: result.channel,
|
|
15243
|
+
codeLength: result.codeLength,
|
|
15244
|
+
}), undefined, result.continuationState.scenario);
|
|
15245
|
+
}
|
|
15246
|
+
if (!isExistingAccountSignUp &&
|
|
15247
|
+
authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
|
|
15248
|
+
result.type === FLOW_CODE_REQUIRED_V2 &&
|
|
15249
|
+
(channel === AuthenticationMethodTypeV2.EMAIL ||
|
|
15250
|
+
channel === AuthenticationMethodTypeV2.SMS)) {
|
|
14943
15251
|
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14944
15252
|
...commonStateParameters,
|
|
14945
|
-
|
|
15253
|
+
resetPasswordStateTransitionHandler,
|
|
14946
15254
|
method: selectedMethod,
|
|
14947
15255
|
sentTo: result.sentTo,
|
|
14948
15256
|
channel: result.channel,
|
|
14949
15257
|
codeLength: result.codeLength,
|
|
14950
15258
|
}), undefined, result.continuationState.scenario);
|
|
14951
15259
|
}
|
|
15260
|
+
if (isExistingAccountSignUp &&
|
|
15261
|
+
authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
|
|
15262
|
+
result.type === FLOW_PASSWORD_REQUIRED_V2) {
|
|
15263
|
+
return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2(commonStateParameters), undefined, result.continuationState.scenario);
|
|
15264
|
+
}
|
|
14952
15265
|
if (continuationState.scenario ===
|
|
14953
15266
|
CustomAuthFlowScenarioV2.SignIn &&
|
|
14954
15267
|
authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR &&
|
|
@@ -14968,12 +15281,17 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
|
|
|
14968
15281
|
codeLength: result.codeLength,
|
|
14969
15282
|
}), undefined, result.continuationState.scenario);
|
|
14970
15283
|
}
|
|
14971
|
-
|
|
15284
|
+
let expectedChallenge = authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR
|
|
14972
15285
|
? continuationState.scenario ===
|
|
14973
15286
|
CustomAuthFlowScenarioV2.SignIn
|
|
14974
15287
|
? "an email or SMS code challenge or a password challenge for single-factor sign-in"
|
|
14975
15288
|
: "an email or SMS code challenge for single-factor authentication"
|
|
14976
15289
|
: "a code challenge for multi-factor authentication";
|
|
15290
|
+
if (isExistingAccountSignUp &&
|
|
15291
|
+
authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR) {
|
|
15292
|
+
expectedChallenge =
|
|
15293
|
+
"an email code challenge or a password challenge for existing-account sign-up";
|
|
15294
|
+
}
|
|
14977
15295
|
const returnedChallenge = result.type === FLOW_CODE_REQUIRED_V2
|
|
14978
15296
|
? result.channel
|
|
14979
15297
|
? `a '${result.channel}' code challenge`
|
|
@@ -14989,24 +15307,143 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
|
|
|
14989
15307
|
});
|
|
14990
15308
|
}
|
|
14991
15309
|
}
|
|
14992
|
-
async requestSelectedMethodChallenge(method) {
|
|
14993
|
-
const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
|
|
14994
|
-
const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
|
|
14995
|
-
if (!selectedMethod) {
|
|
14996
|
-
throw new InvalidArgumentError("method", correlationId);
|
|
14997
|
-
}
|
|
14998
|
-
const result = await flowClient.requestChallenge({
|
|
14999
|
-
correlationId,
|
|
15000
|
-
authenticationFactor,
|
|
15001
|
-
continuationState: {
|
|
15002
|
-
...continuationState,
|
|
15003
|
-
links: {
|
|
15004
|
-
...continuationState.links,
|
|
15005
|
-
challenge: selectedMethod.challengeHref,
|
|
15006
|
-
},
|
|
15007
|
-
},
|
|
15008
|
-
});
|
|
15009
|
-
return { result, selectedMethod };
|
|
15310
|
+
async requestSelectedMethodChallenge(method) {
|
|
15311
|
+
const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
|
|
15312
|
+
const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
|
|
15313
|
+
if (!selectedMethod) {
|
|
15314
|
+
throw new InvalidArgumentError("method", correlationId);
|
|
15315
|
+
}
|
|
15316
|
+
const result = await flowClient.requestChallenge({
|
|
15317
|
+
correlationId,
|
|
15318
|
+
authenticationFactor,
|
|
15319
|
+
continuationState: {
|
|
15320
|
+
...continuationState,
|
|
15321
|
+
links: {
|
|
15322
|
+
...continuationState.links,
|
|
15323
|
+
challenge: selectedMethod.challengeHref,
|
|
15324
|
+
},
|
|
15325
|
+
},
|
|
15326
|
+
});
|
|
15327
|
+
return { result, selectedMethod };
|
|
15328
|
+
}
|
|
15329
|
+
}
|
|
15330
|
+
|
|
15331
|
+
/*
|
|
15332
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15333
|
+
* Licensed under the MIT License.
|
|
15334
|
+
*/
|
|
15335
|
+
/**
|
|
15336
|
+
* State returned when sign-in or sign-up requires a password.
|
|
15337
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
15338
|
+
*/
|
|
15339
|
+
class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
15340
|
+
constructor(stateParameters) {
|
|
15341
|
+
super(stateParameters);
|
|
15342
|
+
this.stateType = "passwordRequired";
|
|
15343
|
+
this.requestedPasswordAttribute =
|
|
15344
|
+
stateParameters.requestedPasswordAttribute;
|
|
15345
|
+
}
|
|
15346
|
+
/**
|
|
15347
|
+
* Submits the password and advances the active flow. Use the returned result
|
|
15348
|
+
* to continue the flow.
|
|
15349
|
+
* @param password - The account password.
|
|
15350
|
+
* @returns The result containing the next state or an error.
|
|
15351
|
+
*/
|
|
15352
|
+
async submitPassword(password) {
|
|
15353
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
15354
|
+
try {
|
|
15355
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
15356
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
|
|
15357
|
+
return await this.submitSignUpPassword(password);
|
|
15358
|
+
}
|
|
15359
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
15360
|
+
return await this.submitSignInPassword(password);
|
|
15361
|
+
}
|
|
15362
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission is not supported for the '${continuationState.scenario}' flow.`, correlationId);
|
|
15363
|
+
}
|
|
15364
|
+
catch (error) {
|
|
15365
|
+
logger.errorPii(`1n12c0 ${error}`, correlationId);
|
|
15366
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
15367
|
+
scenario: continuationState.scenario,
|
|
15368
|
+
correlationId,
|
|
15369
|
+
});
|
|
15370
|
+
}
|
|
15371
|
+
}
|
|
15372
|
+
async submitSignUpPassword(password) {
|
|
15373
|
+
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
15374
|
+
const signUpStateTransitionHandler = this.stateParameters.signUpStateTransitionHandler;
|
|
15375
|
+
if (!signUpStateTransitionHandler) {
|
|
15376
|
+
throw new UnexpectedError("Sign-up state transition handler is missing.", correlationId);
|
|
15377
|
+
}
|
|
15378
|
+
const result = await flowClient.submitSignUpAttributes({
|
|
15379
|
+
correlationId,
|
|
15380
|
+
continuationState,
|
|
15381
|
+
attributes: { password },
|
|
15382
|
+
});
|
|
15383
|
+
return signUpStateTransitionHandler.handleAttributeSubmission(result, { ...this.stateParameters, signUpStateTransitionHandler }, "password");
|
|
15384
|
+
}
|
|
15385
|
+
async submitSignInPassword(password) {
|
|
15386
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
15387
|
+
const result = await flowClient.submitSignInPassword({
|
|
15388
|
+
correlationId,
|
|
15389
|
+
continuationState,
|
|
15390
|
+
password,
|
|
15391
|
+
});
|
|
15392
|
+
const resultType = result.type;
|
|
15393
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
15394
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
15395
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
15396
|
+
}
|
|
15397
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
15398
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
15399
|
+
correlationId: result.correlationId,
|
|
15400
|
+
logger,
|
|
15401
|
+
config: this.stateParameters.config,
|
|
15402
|
+
flowClient,
|
|
15403
|
+
continuationState: result.continuationState,
|
|
15404
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
15405
|
+
methods: result.methods,
|
|
15406
|
+
}), undefined, result.continuationState.scenario);
|
|
15407
|
+
}
|
|
15408
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
15409
|
+
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
15410
|
+
correlationId: result.correlationId,
|
|
15411
|
+
logger,
|
|
15412
|
+
config: this.stateParameters.config,
|
|
15413
|
+
flowClient,
|
|
15414
|
+
continuationState: result.continuationState,
|
|
15415
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
15416
|
+
methods: result.methods,
|
|
15417
|
+
authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
|
|
15418
|
+
}), undefined, result.continuationState.scenario);
|
|
15419
|
+
}
|
|
15420
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
|
|
15421
|
+
}
|
|
15422
|
+
}
|
|
15423
|
+
|
|
15424
|
+
/*
|
|
15425
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15426
|
+
* Licensed under the MIT License.
|
|
15427
|
+
*/
|
|
15428
|
+
class SignInStateTransitionHandlerV2 {
|
|
15429
|
+
handlePasswordRequired(result, stateParameters) {
|
|
15430
|
+
return new CustomAuthResultV2(new PasswordRequiredStateV2({
|
|
15431
|
+
...stateParameters,
|
|
15432
|
+
correlationId: result.correlationId,
|
|
15433
|
+
continuationState: result.continuationState,
|
|
15434
|
+
}), undefined, result.continuationState.scenario);
|
|
15435
|
+
}
|
|
15436
|
+
handleMfaRequired(result, stateParameters) {
|
|
15437
|
+
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
15438
|
+
correlationId: result.correlationId,
|
|
15439
|
+
logger: stateParameters.logger,
|
|
15440
|
+
config: stateParameters.config,
|
|
15441
|
+
flowClient: stateParameters.flowClient,
|
|
15442
|
+
continuationState: result.continuationState,
|
|
15443
|
+
cacheClient: stateParameters.cacheClient,
|
|
15444
|
+
methods: result.methods,
|
|
15445
|
+
authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
|
|
15446
|
+
}), undefined, result.continuationState.scenario);
|
|
15010
15447
|
}
|
|
15011
15448
|
}
|
|
15012
15449
|
|
|
@@ -15015,33 +15452,34 @@ class AuthMethodSelectionRequiredStateV2 extends AuthFlowActionRequiredStateBase
|
|
|
15015
15452
|
* Licensed under the MIT License.
|
|
15016
15453
|
*/
|
|
15017
15454
|
/**
|
|
15018
|
-
* State returned when the
|
|
15019
|
-
*
|
|
15455
|
+
* State returned when the user must supply a new password. Submission can
|
|
15456
|
+
* require method registration or MFA, and the flow is not complete until any
|
|
15457
|
+
* subsequent required actions finish.
|
|
15458
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
15020
15459
|
*/
|
|
15021
|
-
class
|
|
15460
|
+
class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
15022
15461
|
constructor() {
|
|
15023
15462
|
super(...arguments);
|
|
15024
|
-
this.stateType = "
|
|
15463
|
+
this.stateType = "newPasswordRequired";
|
|
15025
15464
|
}
|
|
15026
15465
|
/**
|
|
15027
|
-
* Submits the password
|
|
15028
|
-
*
|
|
15029
|
-
*
|
|
15466
|
+
* Submits the new password. The result can require method registration or
|
|
15467
|
+
* MFA, and completion is not final until any subsequent required actions
|
|
15468
|
+
* finish.
|
|
15469
|
+
* @param password - The new password to set.
|
|
15470
|
+
* @returns The result of submitting the new password.
|
|
15030
15471
|
*/
|
|
15031
|
-
async
|
|
15472
|
+
async submitNewPassword(password) {
|
|
15032
15473
|
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
15033
15474
|
try {
|
|
15034
15475
|
this.ensurePasswordIsNotEmpty(password);
|
|
15035
|
-
|
|
15476
|
+
logger.verbose("0ie1qa", correlationId);
|
|
15477
|
+
const result = await flowClient.submitNewPassword({
|
|
15036
15478
|
correlationId,
|
|
15037
15479
|
continuationState,
|
|
15038
|
-
password,
|
|
15480
|
+
newPassword: password,
|
|
15039
15481
|
});
|
|
15040
15482
|
const resultType = result.type;
|
|
15041
|
-
if (result.type === FLOW_COMPLETED_V2) {
|
|
15042
|
-
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
15043
|
-
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
15044
|
-
}
|
|
15045
15483
|
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
15046
15484
|
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
15047
15485
|
correlationId: result.correlationId,
|
|
@@ -15065,10 +15503,20 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
|
15065
15503
|
authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
|
|
15066
15504
|
}), undefined, result.continuationState.scenario);
|
|
15067
15505
|
}
|
|
15068
|
-
|
|
15506
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
15507
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
15508
|
+
correlationId: result.correlationId,
|
|
15509
|
+
logger,
|
|
15510
|
+
config: this.stateParameters.config,
|
|
15511
|
+
flowClient,
|
|
15512
|
+
continuationState: result.continuationState,
|
|
15513
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
15514
|
+
}), undefined, result.continuationState.scenario);
|
|
15515
|
+
}
|
|
15516
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
|
|
15069
15517
|
}
|
|
15070
15518
|
catch (error) {
|
|
15071
|
-
logger.errorPii(`
|
|
15519
|
+
logger.errorPii(`03m081 ${error}`, correlationId);
|
|
15072
15520
|
return CustomAuthResultV2.createWithError(error, {
|
|
15073
15521
|
scenario: continuationState.scenario,
|
|
15074
15522
|
correlationId,
|
|
@@ -15081,66 +15529,46 @@ class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
|
15081
15529
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15082
15530
|
* Licensed under the MIT License.
|
|
15083
15531
|
*/
|
|
15084
|
-
class
|
|
15085
|
-
|
|
15086
|
-
return new CustomAuthResultV2(new
|
|
15087
|
-
...stateParameters,
|
|
15088
|
-
correlationId: result.correlationId,
|
|
15089
|
-
continuationState: result.continuationState,
|
|
15090
|
-
}), undefined, result.continuationState.scenario);
|
|
15091
|
-
}
|
|
15092
|
-
handleMfaRequired(result, stateParameters) {
|
|
15093
|
-
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
15532
|
+
class ResetPasswordStateTransitionHandlerV2 {
|
|
15533
|
+
handleNewPasswordRequired(result, stateParameters) {
|
|
15534
|
+
return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
|
|
15094
15535
|
correlationId: result.correlationId,
|
|
15095
15536
|
logger: stateParameters.logger,
|
|
15096
15537
|
config: stateParameters.config,
|
|
15097
15538
|
flowClient: stateParameters.flowClient,
|
|
15098
15539
|
continuationState: result.continuationState,
|
|
15099
15540
|
cacheClient: stateParameters.cacheClient,
|
|
15100
|
-
methods: result.methods,
|
|
15101
|
-
authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
|
|
15102
15541
|
}), undefined, result.continuationState.scenario);
|
|
15103
15542
|
}
|
|
15104
15543
|
}
|
|
15105
15544
|
|
|
15106
|
-
/*
|
|
15107
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15108
|
-
* Licensed under the MIT License.
|
|
15109
|
-
*/
|
|
15110
|
-
class SignUpAttributesRequiredStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
15111
|
-
constructor(stateParameters) {
|
|
15112
|
-
super(stateParameters);
|
|
15113
|
-
this.attributes = stateParameters.attributes;
|
|
15114
|
-
}
|
|
15115
|
-
async submitAttributesAction(attributes) {
|
|
15116
|
-
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
15117
|
-
return flowClient.submitSignUpAttributes({
|
|
15118
|
-
correlationId,
|
|
15119
|
-
continuationState,
|
|
15120
|
-
attributes,
|
|
15121
|
-
});
|
|
15122
|
-
}
|
|
15123
|
-
}
|
|
15124
|
-
|
|
15125
15545
|
/*
|
|
15126
15546
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15127
15547
|
* Licensed under the MIT License.
|
|
15128
15548
|
*/
|
|
15129
15549
|
/**
|
|
15130
15550
|
* State returned when sign-up requires profile or custom attributes.
|
|
15551
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
15131
15552
|
*/
|
|
15132
|
-
class AttributesRequiredStateV2 extends
|
|
15133
|
-
constructor() {
|
|
15134
|
-
super(
|
|
15553
|
+
class AttributesRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
15554
|
+
constructor(stateParameters) {
|
|
15555
|
+
super(stateParameters);
|
|
15135
15556
|
this.stateType = "attributesRequired";
|
|
15557
|
+
this.attributes = stateParameters.attributes;
|
|
15136
15558
|
}
|
|
15137
15559
|
/**
|
|
15138
|
-
* Submits the attributes
|
|
15560
|
+
* Submits the supplied attributes, including an empty object, to the service.
|
|
15561
|
+
* The returned result identifies the next step or a submission failure.
|
|
15139
15562
|
*/
|
|
15140
15563
|
async submitAttributes(attributes) {
|
|
15141
|
-
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
15564
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
15142
15565
|
try {
|
|
15143
|
-
const
|
|
15566
|
+
const filteredAttributes = filterReservedSignUpAttributesV2(attributes, logger, correlationId);
|
|
15567
|
+
const result = await flowClient.submitSignUpAttributes({
|
|
15568
|
+
correlationId,
|
|
15569
|
+
continuationState,
|
|
15570
|
+
attributes: filteredAttributes,
|
|
15571
|
+
});
|
|
15144
15572
|
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "attribute");
|
|
15145
15573
|
}
|
|
15146
15574
|
catch (error) {
|
|
@@ -15157,53 +15585,23 @@ class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
|
15157
15585
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15158
15586
|
* Licensed under the MIT License.
|
|
15159
15587
|
*/
|
|
15160
|
-
|
|
15161
|
-
* State returned when sign-up requires a password that was not submitted with
|
|
15162
|
-
* an earlier attribute request.
|
|
15163
|
-
*/
|
|
15164
|
-
class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
15165
|
-
constructor(stateParameters) {
|
|
15166
|
-
super(stateParameters);
|
|
15167
|
-
this.stateType = "passwordRequired";
|
|
15168
|
-
this.requiredPasswordAttribute =
|
|
15169
|
-
stateParameters.requiredPasswordAttribute;
|
|
15170
|
-
}
|
|
15588
|
+
class SignUpStateTransitionHandlerV2 {
|
|
15171
15589
|
/**
|
|
15172
|
-
*
|
|
15590
|
+
* Maps new-account verification and attribute-submission outcomes to public states.
|
|
15173
15591
|
*/
|
|
15174
|
-
async submitPassword(password, attributes = {}) {
|
|
15175
|
-
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
15176
|
-
try {
|
|
15177
|
-
this.ensurePasswordIsNotEmpty(password);
|
|
15178
|
-
const result = await this.submitAttributesAction({
|
|
15179
|
-
...attributes,
|
|
15180
|
-
password,
|
|
15181
|
-
});
|
|
15182
|
-
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "password");
|
|
15183
|
-
}
|
|
15184
|
-
catch (error) {
|
|
15185
|
-
logger.errorPii(`07t30r ${error}`, correlationId);
|
|
15186
|
-
return CustomAuthResultV2.createWithError(error, {
|
|
15187
|
-
scenario: continuationState.scenario,
|
|
15188
|
-
correlationId,
|
|
15189
|
-
});
|
|
15190
|
-
}
|
|
15191
|
-
}
|
|
15192
|
-
}
|
|
15193
|
-
|
|
15194
|
-
/*
|
|
15195
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15196
|
-
* Licensed under the MIT License.
|
|
15197
|
-
*/
|
|
15198
|
-
class SignUpStateTransitionHandlerV2 {
|
|
15199
15592
|
handleAttributeSubmission(result, stateParameters, submission) {
|
|
15593
|
+
const resultType = result.type;
|
|
15200
15594
|
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
15201
|
-
if (result.type ===
|
|
15202
|
-
return new CustomAuthResultV2(new
|
|
15595
|
+
if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
15596
|
+
return new CustomAuthResultV2(new PasswordRequiredStateV2({
|
|
15203
15597
|
...commonStateParameters,
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15598
|
+
requestedPasswordAttribute: result.requestedPasswordAttribute,
|
|
15599
|
+
}), undefined, result.continuationState.scenario);
|
|
15600
|
+
}
|
|
15601
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
15602
|
+
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
15603
|
+
...commonStateParameters,
|
|
15604
|
+
attributes: result.attributes,
|
|
15207
15605
|
}), undefined, result.continuationState.scenario);
|
|
15208
15606
|
}
|
|
15209
15607
|
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
@@ -15215,21 +15613,7 @@ class SignUpStateTransitionHandlerV2 {
|
|
|
15215
15613
|
methods: result.methods,
|
|
15216
15614
|
}), undefined, result.continuationState.scenario);
|
|
15217
15615
|
}
|
|
15218
|
-
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${
|
|
15219
|
-
}
|
|
15220
|
-
handleVerification(result, stateParameters) {
|
|
15221
|
-
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
15222
|
-
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
15223
|
-
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
15224
|
-
...commonStateParameters,
|
|
15225
|
-
attributes: result.attributes,
|
|
15226
|
-
}), undefined, result.continuationState.scenario);
|
|
15227
|
-
}
|
|
15228
|
-
return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
|
|
15229
|
-
...commonStateParameters,
|
|
15230
|
-
attributes: result.attributes,
|
|
15231
|
-
requiredPasswordAttribute: result.requiredPasswordAttribute,
|
|
15232
|
-
}), undefined, result.continuationState.scenario);
|
|
15616
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${resultType}' is not supported.`, stateParameters.correlationId);
|
|
15233
15617
|
}
|
|
15234
15618
|
createCommonStateParameters(result, stateParameters) {
|
|
15235
15619
|
return {
|
|
@@ -21353,37 +21737,38 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
21353
21737
|
}, e);
|
|
21354
21738
|
throw e;
|
|
21355
21739
|
}
|
|
21356
|
-
|
|
21357
|
-
|
|
21358
|
-
|
|
21359
|
-
|
|
21360
|
-
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21740
|
+
if (this.apiId === ApiId.acquireTokenSilent_silentFlow) {
|
|
21741
|
+
let cachedResult;
|
|
21742
|
+
try {
|
|
21743
|
+
cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest, cacheLookupPolicy);
|
|
21744
|
+
}
|
|
21745
|
+
catch (e) {
|
|
21746
|
+
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
21747
|
+
this.logger.info("0eitbc", this.correlationId);
|
|
21748
|
+
nativeATMeasurement.add({
|
|
21749
|
+
isNativeBroker: false,
|
|
21750
|
+
});
|
|
21751
|
+
nativeATMeasurement.end({
|
|
21752
|
+
success: false,
|
|
21753
|
+
});
|
|
21754
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
21755
|
+
throw e;
|
|
21756
|
+
}
|
|
21757
|
+
// continue with a native call for any and all errors
|
|
21758
|
+
this.logger.info("0957j1", this.correlationId);
|
|
21759
|
+
}
|
|
21760
|
+
if (cachedResult) {
|
|
21761
|
+
// Served from the native internal cache; token did not come directly from the broker
|
|
21364
21762
|
nativeATMeasurement.add({
|
|
21365
21763
|
isNativeBroker: false,
|
|
21366
21764
|
});
|
|
21367
21765
|
nativeATMeasurement.end({
|
|
21368
|
-
success:
|
|
21766
|
+
success: true,
|
|
21767
|
+
fromCache: true,
|
|
21369
21768
|
});
|
|
21370
|
-
await this.
|
|
21371
|
-
|
|
21769
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
21770
|
+
return cachedResult;
|
|
21372
21771
|
}
|
|
21373
|
-
// continue with a native call for any and all errors
|
|
21374
|
-
this.logger.info("0957j1", this.correlationId);
|
|
21375
|
-
}
|
|
21376
|
-
if (cachedResult) {
|
|
21377
|
-
// Served from the native internal cache; token did not come directly from the broker
|
|
21378
|
-
nativeATMeasurement.add({
|
|
21379
|
-
isNativeBroker: false,
|
|
21380
|
-
});
|
|
21381
|
-
nativeATMeasurement.end({
|
|
21382
|
-
success: true,
|
|
21383
|
-
fromCache: true,
|
|
21384
|
-
});
|
|
21385
|
-
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
21386
|
-
return cachedResult;
|
|
21387
21772
|
}
|
|
21388
21773
|
// dispatch the request to the broker
|
|
21389
21774
|
try {
|
|
@@ -21474,12 +21859,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
21474
21859
|
};
|
|
21475
21860
|
}
|
|
21476
21861
|
/**
|
|
21477
|
-
* Fetches
|
|
21862
|
+
* Fetches unexpired tokens when allowed by cache policy.
|
|
21478
21863
|
* @param nativeAccountId
|
|
21479
21864
|
* @param request
|
|
21480
|
-
* @
|
|
21865
|
+
* @param cacheLookupPolicy
|
|
21866
|
+
* @returns Cached result, or undefined when cache policy bypasses lookup.
|
|
21481
21867
|
*/
|
|
21482
|
-
async acquireTokensFromCache(nativeAccountId, request) {
|
|
21868
|
+
async acquireTokensFromCache(nativeAccountId, request, cacheLookupPolicy = CacheLookupPolicy.Default) {
|
|
21869
|
+
if (cacheLookupPolicy === CacheLookupPolicy.RefreshTokenAndNetwork ||
|
|
21870
|
+
cacheLookupPolicy === CacheLookupPolicy.Skip) {
|
|
21871
|
+
this.logger.verbose("03uwyk", this.correlationId);
|
|
21872
|
+
return undefined;
|
|
21873
|
+
}
|
|
21483
21874
|
if (!nativeAccountId) {
|
|
21484
21875
|
this.logger.warning("1ndf3e", this.correlationId);
|
|
21485
21876
|
throw createClientAuthError(noAccountFound, this.correlationId);
|
|
@@ -21829,7 +22220,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
21829
22220
|
async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
|
|
21830
22221
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
21831
22222
|
await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
|
|
21832
|
-
// Remove
|
|
22223
|
+
// Remove cached web access and refresh tokens, preserving ID tokens.
|
|
21833
22224
|
if (clearExistingTokens) {
|
|
21834
22225
|
this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
|
|
21835
22226
|
}
|
|
@@ -24760,7 +25151,11 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
24760
25151
|
const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, request.correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
|
|
24761
25152
|
return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
24762
25153
|
}
|
|
24763
|
-
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
|
25154
|
+
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
|
25155
|
+
serverTelemetryManager,
|
|
25156
|
+
requestAuthority: request.authority,
|
|
25157
|
+
requestExtraQueryParameters: request.extraQueryParameters,
|
|
25158
|
+
});
|
|
24764
25159
|
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
24765
25160
|
}
|
|
24766
25161
|
/**
|
|
@@ -27114,6 +27509,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27114
27509
|
super(operatingContext);
|
|
27115
27510
|
this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
|
|
27116
27511
|
this.signInStateTransitionHandlerV2 = new SignInStateTransitionHandlerV2();
|
|
27512
|
+
this.resetPasswordStateTransitionHandlerV2 = new ResetPasswordStateTransitionHandlerV2();
|
|
27117
27513
|
if (!this.isBrowserEnvironment) {
|
|
27118
27514
|
this.logger.verbose("1f7i3q", "");
|
|
27119
27515
|
throw new UnsupportedEnvironmentError();
|
|
@@ -27390,7 +27786,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27390
27786
|
const correlationId = this.getCorrelationId(inputs);
|
|
27391
27787
|
try {
|
|
27392
27788
|
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
27393
|
-
|
|
27789
|
+
this.ensureUsernameIsValidV2(inputs.username, correlationId);
|
|
27394
27790
|
if (inputs.scopes !== undefined && inputs.scopes !== null) {
|
|
27395
27791
|
ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
|
|
27396
27792
|
}
|
|
@@ -27414,6 +27810,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27414
27810
|
flowClient: this.flowClientV2,
|
|
27415
27811
|
continuationState: result.continuationState,
|
|
27416
27812
|
cacheClient: this.cacheClient,
|
|
27813
|
+
resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
|
|
27417
27814
|
method: result.method,
|
|
27418
27815
|
sentTo: result.sentTo,
|
|
27419
27816
|
channel: result.channel,
|
|
@@ -27429,6 +27826,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27429
27826
|
cacheClient: this.cacheClient,
|
|
27430
27827
|
methods: result.methods,
|
|
27431
27828
|
authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
|
|
27829
|
+
resetPasswordStateTransitionHandler: this.resetPasswordStateTransitionHandlerV2,
|
|
27432
27830
|
}), undefined, result.continuationState.scenario);
|
|
27433
27831
|
}
|
|
27434
27832
|
catch (error) {
|
|
@@ -27443,7 +27841,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27443
27841
|
const correlationId = this.getCorrelationId(inputs);
|
|
27444
27842
|
try {
|
|
27445
27843
|
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
27446
|
-
|
|
27844
|
+
this.ensureUsernameIsValidV2(inputs.username, correlationId);
|
|
27447
27845
|
if (inputs.scopes !== undefined && inputs.scopes !== null) {
|
|
27448
27846
|
ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
|
|
27449
27847
|
}
|
|
@@ -27455,13 +27853,9 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27455
27853
|
const result = await this.flowClientV2.signIn({
|
|
27456
27854
|
correlationId,
|
|
27457
27855
|
username: inputs.username,
|
|
27458
|
-
password: inputs.password,
|
|
27459
27856
|
scopes: inputs.scopes,
|
|
27460
27857
|
claims: inputs.claims,
|
|
27461
27858
|
});
|
|
27462
|
-
if (result.type === FLOW_COMPLETED_V2) {
|
|
27463
|
-
return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
|
|
27464
|
-
}
|
|
27465
27859
|
if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
|
|
27466
27860
|
return new CustomAuthResultV2(new PasswordRequiredStateV2({
|
|
27467
27861
|
correlationId: result.correlationId,
|
|
@@ -27472,17 +27866,6 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27472
27866
|
cacheClient: this.cacheClient,
|
|
27473
27867
|
}), undefined, result.continuationState.scenario);
|
|
27474
27868
|
}
|
|
27475
|
-
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
27476
|
-
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
27477
|
-
correlationId: result.correlationId,
|
|
27478
|
-
logger: this.logger,
|
|
27479
|
-
config: this.customAuthConfig,
|
|
27480
|
-
flowClient: this.flowClientV2,
|
|
27481
|
-
continuationState: result.continuationState,
|
|
27482
|
-
cacheClient: this.cacheClient,
|
|
27483
|
-
methods: result.methods,
|
|
27484
|
-
}), undefined, result.continuationState.scenario);
|
|
27485
|
-
}
|
|
27486
27869
|
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
27487
27870
|
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
27488
27871
|
correlationId: result.correlationId,
|
|
@@ -27511,18 +27894,6 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27511
27894
|
signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
|
|
27512
27895
|
}), undefined, result.continuationState.scenario);
|
|
27513
27896
|
}
|
|
27514
|
-
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
27515
|
-
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
27516
|
-
correlationId: result.correlationId,
|
|
27517
|
-
logger: this.logger,
|
|
27518
|
-
config: this.customAuthConfig,
|
|
27519
|
-
flowClient: this.flowClientV2,
|
|
27520
|
-
continuationState: result.continuationState,
|
|
27521
|
-
cacheClient: this.cacheClient,
|
|
27522
|
-
methods: result.methods,
|
|
27523
|
-
authenticationFactor: AuthenticationFactorV2.MULTI_FACTOR,
|
|
27524
|
-
}), undefined, result.continuationState.scenario);
|
|
27525
|
-
}
|
|
27526
27897
|
throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
|
|
27527
27898
|
}
|
|
27528
27899
|
catch (error) {
|
|
@@ -27537,11 +27908,7 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27537
27908
|
const correlationId = this.getCorrelationId(inputs);
|
|
27538
27909
|
try {
|
|
27539
27910
|
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
27540
|
-
|
|
27541
|
-
if (Object.prototype.hasOwnProperty.call(inputs, "password")) {
|
|
27542
|
-
ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
|
|
27543
|
-
ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
|
|
27544
|
-
}
|
|
27911
|
+
this.ensureUsernameIsValidV2(inputs.username, correlationId);
|
|
27545
27912
|
if (inputs.scopes !== undefined && inputs.scopes !== null) {
|
|
27546
27913
|
ensureArgumentIsStringArray("inputs.scopes", inputs.scopes, correlationId);
|
|
27547
27914
|
}
|
|
@@ -27553,39 +27920,61 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27553
27920
|
const result = await this.flowClientV2.signUp({
|
|
27554
27921
|
correlationId,
|
|
27555
27922
|
username: inputs.username,
|
|
27556
|
-
password: inputs.password,
|
|
27557
|
-
attributes: inputs.attributes,
|
|
27558
27923
|
scopes: inputs.scopes,
|
|
27559
27924
|
claims: inputs.claims,
|
|
27925
|
+
attributes: inputs.attributes,
|
|
27560
27926
|
});
|
|
27561
|
-
const commonStateParameters = {
|
|
27562
|
-
correlationId: result.correlationId,
|
|
27563
|
-
logger: this.logger,
|
|
27564
|
-
config: this.customAuthConfig,
|
|
27565
|
-
flowClient: this.flowClientV2,
|
|
27566
|
-
continuationState: result.continuationState,
|
|
27567
|
-
cacheClient: this.cacheClient,
|
|
27568
|
-
signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
|
|
27569
|
-
};
|
|
27570
27927
|
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
27571
27928
|
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
27572
|
-
|
|
27929
|
+
correlationId: result.correlationId,
|
|
27930
|
+
logger: this.logger,
|
|
27931
|
+
config: this.customAuthConfig,
|
|
27932
|
+
flowClient: this.flowClientV2,
|
|
27933
|
+
continuationState: result.continuationState,
|
|
27934
|
+
cacheClient: this.cacheClient,
|
|
27935
|
+
signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
|
|
27573
27936
|
sentTo: result.sentTo,
|
|
27574
27937
|
channel: result.channel,
|
|
27575
27938
|
codeLength: result.codeLength,
|
|
27576
27939
|
}), undefined, result.continuationState.scenario);
|
|
27577
27940
|
}
|
|
27578
|
-
if (result.type ===
|
|
27579
|
-
return new CustomAuthResultV2(new
|
|
27580
|
-
|
|
27581
|
-
|
|
27582
|
-
|
|
27941
|
+
if (result.type === FLOW_EXISTING_ACCOUNT_CODE_REQUIRED_V2) {
|
|
27942
|
+
return new CustomAuthResultV2(new ExistingAccountCodeRequiredStateV2({
|
|
27943
|
+
correlationId: result.correlationId,
|
|
27944
|
+
logger: this.logger,
|
|
27945
|
+
config: this.customAuthConfig,
|
|
27946
|
+
flowClient: this.flowClientV2,
|
|
27947
|
+
continuationState: result.continuationState,
|
|
27948
|
+
cacheClient: this.cacheClient,
|
|
27949
|
+
signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
|
|
27950
|
+
method: result.method,
|
|
27951
|
+
sentTo: result.sentTo,
|
|
27952
|
+
channel: result.channel,
|
|
27953
|
+
codeLength: result.codeLength,
|
|
27583
27954
|
}), undefined, result.continuationState.scenario);
|
|
27584
27955
|
}
|
|
27585
|
-
if (result.type ===
|
|
27586
|
-
return new CustomAuthResultV2(new
|
|
27587
|
-
|
|
27588
|
-
|
|
27956
|
+
if (result.type === FLOW_EXISTING_ACCOUNT_PASSWORD_REQUIRED_V2) {
|
|
27957
|
+
return new CustomAuthResultV2(new ExistingAccountPasswordRequiredStateV2({
|
|
27958
|
+
correlationId: result.correlationId,
|
|
27959
|
+
logger: this.logger,
|
|
27960
|
+
config: this.customAuthConfig,
|
|
27961
|
+
flowClient: this.flowClientV2,
|
|
27962
|
+
continuationState: result.continuationState,
|
|
27963
|
+
cacheClient: this.cacheClient,
|
|
27964
|
+
signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
|
|
27965
|
+
}), undefined, result.continuationState.scenario);
|
|
27966
|
+
}
|
|
27967
|
+
if (result.type === FLOW_METHOD_SELECTION_REQUIRED_V2) {
|
|
27968
|
+
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
27969
|
+
correlationId: result.correlationId,
|
|
27970
|
+
logger: this.logger,
|
|
27971
|
+
config: this.customAuthConfig,
|
|
27972
|
+
flowClient: this.flowClientV2,
|
|
27973
|
+
continuationState: result.continuationState,
|
|
27974
|
+
cacheClient: this.cacheClient,
|
|
27975
|
+
methods: result.methods,
|
|
27976
|
+
authenticationFactor: AuthenticationFactorV2.SINGLE_FACTOR,
|
|
27977
|
+
signInStateTransitionHandler: this.signInStateTransitionHandlerV2,
|
|
27589
27978
|
}), undefined, result.continuationState.scenario);
|
|
27590
27979
|
}
|
|
27591
27980
|
throw new UnexpectedError("Unsupported native auth V2 sign-up result type.", correlationId);
|
|
@@ -27598,6 +27987,9 @@ class CustomAuthStandardController extends StandardController {
|
|
|
27598
27987
|
});
|
|
27599
27988
|
}
|
|
27600
27989
|
}
|
|
27990
|
+
ensureUsernameIsValidV2(username, correlationId) {
|
|
27991
|
+
ensureArgumentIsNotEmptyString("inputs.username", username, correlationId);
|
|
27992
|
+
}
|
|
27601
27993
|
getCorrelationId(actionInputs) {
|
|
27602
27994
|
return (actionInputs?.correlationId || this.browserCrypto.createNewGuid());
|
|
27603
27995
|
}
|
|
@@ -28571,8 +28963,8 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
|
|
|
28571
28963
|
return this.customAuthController.resetPassword(resetPasswordInputs);
|
|
28572
28964
|
}
|
|
28573
28965
|
/**
|
|
28574
|
-
* Starts native auth V2 sign-in
|
|
28575
|
-
*
|
|
28966
|
+
* Starts native auth V2 sign-in.
|
|
28967
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
28576
28968
|
* @param inputs - Inputs for the sign-in V2 flow.
|
|
28577
28969
|
* @returns A promise that resolves to the sign-in start result.
|
|
28578
28970
|
*/
|
|
@@ -28581,6 +28973,7 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
|
|
|
28581
28973
|
}
|
|
28582
28974
|
/**
|
|
28583
28975
|
* Starts native auth V2 sign-up.
|
|
28976
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
28584
28977
|
* @param inputs - Inputs for the sign-up V2 flow.
|
|
28585
28978
|
* @returns A promise that resolves to the sign-up start result.
|
|
28586
28979
|
*/
|
|
@@ -28588,7 +28981,8 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
|
|
|
28588
28981
|
return this.customAuthController.signUpV2(inputs);
|
|
28589
28982
|
}
|
|
28590
28983
|
/**
|
|
28591
|
-
*
|
|
28984
|
+
* Starts native auth V2 self-service password reset.
|
|
28985
|
+
* @warning This API is experimental. It may be changed in the future without notice. Do not use in production applications.
|
|
28592
28986
|
* @param {ResetPasswordInputsV2} inputs - Inputs for the reset-password V2 flow
|
|
28593
28987
|
* @returns {Promise<ResetPasswordStartResultV2>} - A promise that resolves to ResetPasswordStartResultV2
|
|
28594
28988
|
*/
|
|
@@ -28657,6 +29051,8 @@ exports.CustomAuthError = CustomAuthError;
|
|
|
28657
29051
|
exports.CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2;
|
|
28658
29052
|
exports.CustomAuthPublicClientApplication = CustomAuthPublicClientApplication;
|
|
28659
29053
|
exports.CustomAuthResultV2 = CustomAuthResultV2;
|
|
29054
|
+
exports.ExistingAccountCodeRequiredStateV2 = ExistingAccountCodeRequiredStateV2;
|
|
29055
|
+
exports.ExistingAccountPasswordRequiredStateV2 = ExistingAccountPasswordRequiredStateV2;
|
|
28660
29056
|
exports.FailedStateV2 = FailedStateV2;
|
|
28661
29057
|
exports.GetAccessTokenResult = GetAccessTokenResult;
|
|
28662
29058
|
exports.GetAccountError = GetAccountError;
|
|
@@ -28716,7 +29112,6 @@ exports.SignUpCompletedState = SignUpCompletedState;
|
|
|
28716
29112
|
exports.SignUpError = SignUpError;
|
|
28717
29113
|
exports.SignUpFailedState = SignUpFailedState;
|
|
28718
29114
|
exports.SignUpPasswordRequiredState = SignUpPasswordRequiredState;
|
|
28719
|
-
exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
|
|
28720
29115
|
exports.SignUpResendCodeError = SignUpResendCodeError;
|
|
28721
29116
|
exports.SignUpResendCodeResult = SignUpResendCodeResult;
|
|
28722
29117
|
exports.SignUpResult = SignUpResult;
|