@azure/msal-browser 5.21.0 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +23 -3
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +5 -2
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +49 -0
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -0
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.mjs +1 -1
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/CacheKeys.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/EncryptedData.mjs +1 -1
- package/dist/cache/LocalStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +27 -2
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs.map +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +192 -2
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
- package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +21 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +80 -0
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs +102 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +12 -0
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs +20 -0
- package/dist/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs +29 -0
- package/dist/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +76 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +36 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +134 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +23 -0
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +22 -0
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs +61 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +87 -0
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +3 -2
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs.map +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +602 -0
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +67 -0
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs.map +1 -0
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +46 -0
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +3 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +30 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +193 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +236 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +26 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +66 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +97 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +56 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +23 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +14 -0
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -0
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +3 -2
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs.map +1 -1
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +38 -0
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -0
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +20 -3
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
- package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
- package/dist/custom_auth/index.mjs +23 -1
- package/dist/custom_auth/index.mjs.map +1 -1
- package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs +29 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.mjs.map +1 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +59 -0
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs +18 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs +37 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs +23 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +70 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +61 -0
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs +25 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs +33 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +40 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +25 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +47 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +60 -0
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -0
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +8 -2
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +11 -8
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +189 -5
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/popup_relay/constants.mjs +1 -1
- package/dist/popup_relay/index.mjs +1 -1
- package/dist/popup_relay/relayClient.mjs +1 -1
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
- package/dist/webBrokerBridge/PerfEventNames.mjs +38 -0
- package/dist/webBrokerBridge/PerfEventNames.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
- package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +139 -0
- package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs.map +1 -0
- package/dist/webBrokerBridge/index.mjs +8 -0
- package/dist/webBrokerBridge/index.mjs.map +1 -0
- package/lib/custom-auth-path/log-strings-mapping.json +195 -11
- package/lib/custom-auth-path/msal-custom-auth.cjs +2996 -204
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +2996 -204
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +2 -2
- package/lib/msal-browser.cjs +176 -87
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +176 -87
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
- package/lib/popup-relay/msal-popup-relay.js +2 -2
- package/lib/popup-relay/msal-popup-relay.js.map +1 -1
- package/lib/popup-relay/msal-popup-relay.min.js +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
- package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +353 -0
- package/lib/web-broker-bridge/msal-web-broker-bridge.cjs.map +1 -0
- package/package.json +19 -2
- package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +40 -2
- package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +4 -1
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +118 -6
- package/src/broker/nativeBroker/PlatformAuthResponse.ts +14 -1
- package/src/custom_auth/CustomAuthActionInputs.ts +11 -0
- package/src/custom_auth/CustomAuthPublicClientApplication.ts +40 -4
- package/src/custom_auth/ICustomAuthPublicClientApplicationV2.ts +44 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +360 -1
- package/src/custom_auth/controller/ICustomAuthStandardController.ts +14 -0
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.ts +20 -0
- package/src/custom_auth/core/auth_flow/v2/CustomAuthResultV2.ts +133 -0
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.ts +146 -0
- package/src/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.ts +8 -0
- package/src/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.ts +33 -0
- package/src/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.ts +25 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +25 -0
- package/src/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.ts +30 -0
- package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +40 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +100 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.ts +59 -0
- package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +53 -0
- package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +196 -0
- package/src/custom_auth/core/auth_flow/v2/state/CompletedStateV2.ts +16 -0
- package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +44 -0
- package/src/custom_auth/core/auth_flow/v2/state/FailedStateV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.ts +76 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +119 -0
- package/src/custom_auth/core/error/CustomAuthApiError.ts +3 -1
- package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +35 -0
- package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +1145 -0
- package/src/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.ts +150 -0
- package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +66 -0
- package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +185 -0
- package/src/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.ts +1 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +30 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.ts +423 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +553 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.ts +24 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.ts +81 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +177 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +129 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.ts +68 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.ts +50 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.ts +20 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +202 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +111 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +26 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +44 -0
- package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +64 -0
- package/src/custom_auth/core/telemetry/PublicApiId.ts +18 -0
- package/src/custom_auth/index.ts +96 -0
- package/src/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.ts +25 -0
- package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +33 -0
- package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +69 -0
- package/src/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.ts +9 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.ts +13 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.ts +35 -0
- package/src/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.ts +19 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.ts +31 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +32 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +22 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +96 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.ts +83 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.ts +12 -0
- package/src/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.ts +21 -0
- package/src/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.ts +32 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.ts +28 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +20 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.ts +48 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.ts +34 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.ts +63 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.ts +24 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +112 -0
- package/src/index.ts +0 -2
- package/src/interaction_client/PlatformAuthInteractionClient.ts +23 -2
- package/src/interaction_client/RedirectClient.ts +15 -5
- package/src/packageMetadata.ts +1 -1
- package/src/webBrokerBridge/PerfEventNames.ts +43 -0
- package/src/webBrokerBridge/index.ts +28 -6
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts +1 -0
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +68 -5
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +12 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthActionInputs.d.ts +7 -0
- package/types/custom_auth/CustomAuthActionInputs.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/custom_auth/CustomAuthPublicClientApplication.d.ts +27 -5
- package/types/custom_auth/CustomAuthPublicClientApplication.d.ts.map +1 -1
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts +30 -0
- package/types/custom_auth/ICustomAuthPublicClientApplicationV2.d.ts.map +1 -0
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts +11 -2
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/controller/ICustomAuthStandardController.d.ts +7 -1
- package/types/custom_auth/controller/ICustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts +53 -0
- package/types/custom_auth/core/auth_flow/v2/CustomAuthResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts +40 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts +4 -0
- package/types/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/error/RequestChallengeErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts +23 -0
- package/types/custom_auth/core/auth_flow/v2/error/ResetPasswordStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/error/VerifyChallengeErrorV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts +7 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFARequestChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts +15 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFAResendChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts +16 -0
- package/types/custom_auth/core/auth_flow/v2/result/MFASubmitChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +16 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/result/ResetPasswordStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +23 -0
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts +21 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts +17 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthenticationMethodSelectionStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts +25 -0
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/state/CompletedStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +28 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts +10 -0
- package/types/custom_auth/core/auth_flow/v2/state/FailedStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts +18 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFARequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts +25 -0
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/error/CustomAuthApiError.d.ts +3 -1
- package/types/custom_auth/core/error/CustomAuthApiError.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +21 -0
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +35 -0
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts +26 -0
- package/types/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +43 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -0
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +80 -0
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +17 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts +31 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +23 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts +19 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts +2 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +15 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +52 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts +3 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts +37 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorResponsesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts +12 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/HalResource.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +133 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +70 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +10 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +33 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -0
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +4 -0
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts +16 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
- package/types/custom_auth/index.d.ts +37 -0
- package/types/custom_auth/index.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts +18 -0
- package/types/custom_auth/reset_password/auth_flow/v2/error_type/SubmitNewPasswordErrorV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +22 -0
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +19 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts +3 -0
- package/types/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts +9 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInContinuationErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts +22 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SignInStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts +12 -0
- package/types/custom_auth/sign_in/auth_flow/v2/error_type/SubmitPasswordErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts +21 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInContinuationResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +17 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +9 -0
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts +17 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts +24 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts +4 -0
- package/types/custom_auth/sign_in/auth_flow/v2/state/SignInStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts +14 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SignUpStartErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts +20 -0
- package/types/custom_auth/sign_up/auth_flow/v2/error_type/SubmitAttributesErrorV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts +15 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SignUpStartResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +8 -0
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts +15 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts +11 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts +19 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts +14 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateParametersV2.d.ts.map +1 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts +10 -0
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -0
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/webBrokerBridge/PerfEventNames.d.ts +30 -0
- package/types/webBrokerBridge/PerfEventNames.d.ts.map +1 -0
- package/types/webBrokerBridge/index.d.cts +1 -0
- package/types/webBrokerBridge/index.d.ts +3 -5
- package/types/webBrokerBridge/index.d.ts.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.23.0 2026-09-23 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v16.14.
|
|
5
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -56,7 +56,7 @@ const RESOURCE = "resource";
|
|
|
56
56
|
const CLI_DATA = "clidata";
|
|
57
57
|
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
58
58
|
|
|
59
|
-
/*! @azure/msal-common v16.14.
|
|
59
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
60
60
|
/*
|
|
61
61
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
62
62
|
* Licensed under the MIT License.
|
|
@@ -290,7 +290,7 @@ const JsonWebTokenTypes = {
|
|
|
290
290
|
// Token renewal offset default in seconds
|
|
291
291
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
292
292
|
|
|
293
|
-
/*! @azure/msal-common v16.14.
|
|
293
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
294
294
|
/*
|
|
295
295
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
296
296
|
* Licensed under the MIT License.
|
|
@@ -319,7 +319,7 @@ function createAuthError(code, correlationId, additionalMessage) {
|
|
|
319
319
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
/*! @azure/msal-common v16.14.
|
|
322
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
323
323
|
|
|
324
324
|
/*
|
|
325
325
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -342,7 +342,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
|
|
|
342
342
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
/*! @azure/msal-common v16.14.
|
|
345
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
346
346
|
/*
|
|
347
347
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
348
348
|
* Licensed under the MIT License.
|
|
@@ -380,7 +380,7 @@ const methodNotImplemented = "method_not_implemented";
|
|
|
380
380
|
const resourceParameterRequired = "resource_parameter_required";
|
|
381
381
|
const misplacedResourceParam = "misplaced_resource_parameter";
|
|
382
382
|
|
|
383
|
-
/*! @azure/msal-common v16.14.
|
|
383
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
384
384
|
|
|
385
385
|
/*
|
|
386
386
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -418,7 +418,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
/*! @azure/msal-common v16.14.
|
|
421
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
422
422
|
|
|
423
423
|
/*
|
|
424
424
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -484,7 +484,7 @@ function getJWSPayload(authToken, correlationId) {
|
|
|
484
484
|
return matches[2];
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
-
/*! @azure/msal-common v16.14.
|
|
487
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
488
488
|
|
|
489
489
|
/*
|
|
490
490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -572,7 +572,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
572
572
|
return updatedAccountInfo;
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
-
/*! @azure/msal-common v16.14.
|
|
575
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
576
576
|
/*
|
|
577
577
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
578
578
|
* Licensed under the MIT License.
|
|
@@ -586,7 +586,7 @@ const AuthorityType = {
|
|
|
586
586
|
Ciam: 3,
|
|
587
587
|
};
|
|
588
588
|
|
|
589
|
-
/*! @azure/msal-common v16.14.
|
|
589
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
590
590
|
/*
|
|
591
591
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
592
592
|
* Licensed under the MIT License.
|
|
@@ -608,7 +608,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
608
608
|
return null;
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
/*! @azure/msal-common v16.14.
|
|
611
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
612
612
|
/*
|
|
613
613
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
614
614
|
* Licensed under the MIT License.
|
|
@@ -632,7 +632,7 @@ const ProtocolMode = {
|
|
|
632
632
|
EAR: "EAR",
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
-
/*! @azure/msal-common v16.14.
|
|
635
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
636
636
|
/**
|
|
637
637
|
* Returns the AccountInfo interface for this account.
|
|
638
638
|
* @internal
|
|
@@ -821,7 +821,7 @@ function isAccountEntity(entity) {
|
|
|
821
821
|
entity.hasOwnProperty("authorityType"));
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
-
/*! @azure/msal-common v16.14.
|
|
824
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
825
825
|
/*
|
|
826
826
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
827
827
|
* Licensed under the MIT License.
|
|
@@ -831,7 +831,7 @@ function isAccountEntity(entity) {
|
|
|
831
831
|
*/
|
|
832
832
|
const unexpectedError = "unexpected_error";
|
|
833
833
|
|
|
834
|
-
/*! @azure/msal-common v16.14.
|
|
834
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
835
835
|
|
|
836
836
|
/*
|
|
837
837
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -851,7 +851,7 @@ function createClientConfigurationError(errorCode, correlationId) {
|
|
|
851
851
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
852
852
|
}
|
|
853
853
|
|
|
854
|
-
/*! @azure/msal-common v16.14.
|
|
854
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
855
855
|
/*
|
|
856
856
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
857
857
|
* Licensed under the MIT License.
|
|
@@ -882,7 +882,7 @@ const invalidDpopHtu = "invalid_dpop_htu";
|
|
|
882
882
|
const invalidDpopNonce = "invalid_dpop_nonce";
|
|
883
883
|
const dpopMissingResourceContext = "dpop_missing_resource_context";
|
|
884
884
|
|
|
885
|
-
/*! @azure/msal-common v16.14.
|
|
885
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
886
886
|
/*
|
|
887
887
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
888
888
|
* Licensed under the MIT License.
|
|
@@ -894,7 +894,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
894
894
|
response.hasOwnProperty("jwks_uri"));
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
/*! @azure/msal-common v16.14.
|
|
897
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
898
898
|
/*
|
|
899
899
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
900
900
|
* Licensed under the MIT License.
|
|
@@ -974,7 +974,7 @@ class StringUtils {
|
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
976
|
|
|
977
|
-
/*! @azure/msal-common v16.14.
|
|
977
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
978
978
|
|
|
979
979
|
/*
|
|
980
980
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1132,7 +1132,7 @@ class UrlString {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
|
-
/*! @azure/msal-common v16.14.
|
|
1135
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1136
1136
|
|
|
1137
1137
|
/*
|
|
1138
1138
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1286,7 +1286,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
1286
1286
|
return null;
|
|
1287
1287
|
}
|
|
1288
1288
|
|
|
1289
|
-
/*! @azure/msal-common v16.14.
|
|
1289
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1290
1290
|
/*
|
|
1291
1291
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1292
1292
|
* Licensed under the MIT License.
|
|
@@ -1295,7 +1295,7 @@ const AzureCloudInstance = {
|
|
|
1295
1295
|
// AzureCloudInstance is not specified.
|
|
1296
1296
|
None: "none"};
|
|
1297
1297
|
|
|
1298
|
-
/*! @azure/msal-common v16.14.
|
|
1298
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1299
1299
|
/*
|
|
1300
1300
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1301
1301
|
* Licensed under the MIT License.
|
|
@@ -1305,7 +1305,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
1305
1305
|
response.hasOwnProperty("metadata"));
|
|
1306
1306
|
}
|
|
1307
1307
|
|
|
1308
|
-
/*! @azure/msal-common v16.14.
|
|
1308
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1309
1309
|
/*
|
|
1310
1310
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1311
1311
|
* Licensed under the MIT License.
|
|
@@ -1315,7 +1315,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
1315
1315
|
response.hasOwnProperty("error_description"));
|
|
1316
1316
|
}
|
|
1317
1317
|
|
|
1318
|
-
/*! @azure/msal-common v16.14.
|
|
1318
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1319
1319
|
/*
|
|
1320
1320
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1321
1321
|
* Licensed under the MIT License.
|
|
@@ -1386,7 +1386,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
|
1386
1386
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1387
1387
|
const SetUserData = "setUserData";
|
|
1388
1388
|
|
|
1389
|
-
/*! @azure/msal-common v16.14.
|
|
1389
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1390
1390
|
/*
|
|
1391
1391
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1392
1392
|
* Licensed under the MIT License.
|
|
@@ -1479,7 +1479,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1479
1479
|
};
|
|
1480
1480
|
};
|
|
1481
1481
|
|
|
1482
|
-
/*! @azure/msal-common v16.14.
|
|
1482
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1483
1483
|
|
|
1484
1484
|
/*
|
|
1485
1485
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1590,7 +1590,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
1590
1590
|
},
|
|
1591
1591
|
};
|
|
1592
1592
|
|
|
1593
|
-
/*! @azure/msal-common v16.14.
|
|
1593
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1594
1594
|
/*
|
|
1595
1595
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1596
1596
|
* Licensed under the MIT License.
|
|
@@ -1655,7 +1655,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1655
1655
|
return cachedAtSec > nowSeconds();
|
|
1656
1656
|
}
|
|
1657
1657
|
|
|
1658
|
-
/*! @azure/msal-common v16.14.
|
|
1658
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1659
1659
|
|
|
1660
1660
|
/*
|
|
1661
1661
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1942,7 +1942,7 @@ function serializeAttributeTokens(attributeTokens) {
|
|
|
1942
1942
|
return [...attributeTokens].sort().join(" ");
|
|
1943
1943
|
}
|
|
1944
1944
|
|
|
1945
|
-
/*! @azure/msal-common v16.14.
|
|
1945
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
1946
1946
|
|
|
1947
1947
|
/*
|
|
1948
1948
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2910,7 +2910,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
2910
2910
|
};
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
|
-
/*! @azure/msal-common v16.14.
|
|
2913
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
2914
2914
|
|
|
2915
2915
|
/*
|
|
2916
2916
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2944,7 +2944,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
2944
2944
|
}
|
|
2945
2945
|
}
|
|
2946
2946
|
|
|
2947
|
-
/*! @azure/msal-common v16.14.
|
|
2947
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
2948
2948
|
|
|
2949
2949
|
/*
|
|
2950
2950
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3140,7 +3140,7 @@ class ScopeSet {
|
|
|
3140
3140
|
}
|
|
3141
3141
|
}
|
|
3142
3142
|
|
|
3143
|
-
/*! @azure/msal-common v16.14.
|
|
3143
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3144
3144
|
|
|
3145
3145
|
/*
|
|
3146
3146
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3626,7 +3626,7 @@ function addAttributeTokens(parameters, attributeTokens) {
|
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
3628
|
|
|
3629
|
-
/*! @azure/msal-common v16.14.
|
|
3629
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3630
3630
|
|
|
3631
3631
|
/*
|
|
3632
3632
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3748,7 +3748,7 @@ function validateUrl(url, logger, correlationId) {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
}
|
|
3750
3750
|
|
|
3751
|
-
/*! @azure/msal-common v16.14.
|
|
3751
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3752
3752
|
|
|
3753
3753
|
/*
|
|
3754
3754
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3796,7 +3796,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3796
3796
|
},
|
|
3797
3797
|
};
|
|
3798
3798
|
|
|
3799
|
-
/*! @azure/msal-common v16.14.
|
|
3799
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3800
3800
|
|
|
3801
3801
|
/*
|
|
3802
3802
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3819,7 +3819,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
|
|
|
3819
3819
|
},
|
|
3820
3820
|
};
|
|
3821
3821
|
|
|
3822
|
-
/*! @azure/msal-common v16.14.
|
|
3822
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
3823
3823
|
/*
|
|
3824
3824
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3825
3825
|
* Licensed under the MIT License.
|
|
@@ -4094,12 +4094,12 @@ class Logger {
|
|
|
4094
4094
|
}
|
|
4095
4095
|
}
|
|
4096
4096
|
|
|
4097
|
-
/*! @azure/msal-common v16.14.
|
|
4097
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4098
4098
|
/* eslint-disable header/header */
|
|
4099
4099
|
const name$1 = "@azure/msal-common";
|
|
4100
|
-
const version$1 = "16.14.
|
|
4100
|
+
const version$1 = "16.14.1";
|
|
4101
4101
|
|
|
4102
|
-
/*! @azure/msal-common v16.14.
|
|
4102
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4103
4103
|
/*
|
|
4104
4104
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4105
4105
|
* Licensed under the MIT License.
|
|
@@ -4107,7 +4107,7 @@ const version$1 = "16.14.0";
|
|
|
4107
4107
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4108
4108
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4109
4109
|
|
|
4110
|
-
/*! @azure/msal-common v16.14.
|
|
4110
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4111
4111
|
|
|
4112
4112
|
/*
|
|
4113
4113
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4145,7 +4145,7 @@ function createCacheError(e) {
|
|
|
4145
4145
|
}
|
|
4146
4146
|
}
|
|
4147
4147
|
|
|
4148
|
-
/*! @azure/msal-common v16.14.
|
|
4148
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
4149
4149
|
|
|
4150
4150
|
/*
|
|
4151
4151
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5332,7 +5332,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5332
5332
|
}
|
|
5333
5333
|
}
|
|
5334
5334
|
|
|
5335
|
-
/*! @azure/msal-common v16.14.
|
|
5335
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5336
5336
|
/*
|
|
5337
5337
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5338
5338
|
* Licensed under the MIT License.
|
|
@@ -5346,7 +5346,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5346
5346
|
const PerformanceEventStatus = {
|
|
5347
5347
|
InProgress: 1};
|
|
5348
5348
|
|
|
5349
|
-
/*! @azure/msal-common v16.14.
|
|
5349
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5350
5350
|
|
|
5351
5351
|
/*
|
|
5352
5352
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5404,7 +5404,7 @@ class StubPerformanceClient {
|
|
|
5404
5404
|
}
|
|
5405
5405
|
}
|
|
5406
5406
|
|
|
5407
|
-
/*! @azure/msal-common v16.14.
|
|
5407
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5408
5408
|
|
|
5409
5409
|
/*
|
|
5410
5410
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5502,7 +5502,7 @@ function isOidcProtocolMode(config) {
|
|
|
5502
5502
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5503
5503
|
}
|
|
5504
5504
|
|
|
5505
|
-
/*! @azure/msal-common v16.14.
|
|
5505
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5506
5506
|
/*
|
|
5507
5507
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5508
5508
|
* Licensed under the MIT License.
|
|
@@ -5529,7 +5529,7 @@ function isOidcProtocolMode(config) {
|
|
|
5529
5529
|
}
|
|
5530
5530
|
}
|
|
5531
5531
|
|
|
5532
|
-
/*! @azure/msal-common v16.14.
|
|
5532
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5533
5533
|
|
|
5534
5534
|
/*
|
|
5535
5535
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5550,7 +5550,7 @@ function createJoseHeaderError(code, correlationId) {
|
|
|
5550
5550
|
return new JoseHeaderError(code, correlationId);
|
|
5551
5551
|
}
|
|
5552
5552
|
|
|
5553
|
-
/*! @azure/msal-common v16.14.
|
|
5553
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5554
5554
|
/*
|
|
5555
5555
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5556
5556
|
* Licensed under the MIT License.
|
|
@@ -5575,7 +5575,7 @@ function isPlainObject(value) {
|
|
|
5575
5575
|
return Object.getPrototypeOf(value) === proto;
|
|
5576
5576
|
}
|
|
5577
5577
|
|
|
5578
|
-
/*! @azure/msal-common v16.14.
|
|
5578
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5579
5579
|
/*
|
|
5580
5580
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5581
5581
|
* Licensed under the MIT License.
|
|
@@ -5585,7 +5585,7 @@ const missingAlgError = "missing_alg_error";
|
|
|
5585
5585
|
const missingJwkError = "missing_jwk_error";
|
|
5586
5586
|
const invalidJwkError = "invalid_jwk_error";
|
|
5587
5587
|
|
|
5588
|
-
/*! @azure/msal-common v16.14.
|
|
5588
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5589
5589
|
|
|
5590
5590
|
/*
|
|
5591
5591
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5651,7 +5651,7 @@ class JoseHeader {
|
|
|
5651
5651
|
}
|
|
5652
5652
|
}
|
|
5653
5653
|
|
|
5654
|
-
/*! @azure/msal-common v16.14.
|
|
5654
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5655
5655
|
|
|
5656
5656
|
/*
|
|
5657
5657
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5752,7 +5752,7 @@ class PopTokenGenerator {
|
|
|
5752
5752
|
}
|
|
5753
5753
|
}
|
|
5754
5754
|
|
|
5755
|
-
/*! @azure/msal-common v16.14.
|
|
5755
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5756
5756
|
|
|
5757
5757
|
/*
|
|
5758
5758
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5897,7 +5897,7 @@ class DpopProofGenerator {
|
|
|
5897
5897
|
}
|
|
5898
5898
|
}
|
|
5899
5899
|
|
|
5900
|
-
/*! @azure/msal-common v16.14.
|
|
5900
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5901
5901
|
/*
|
|
5902
5902
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5903
5903
|
* Licensed under the MIT License.
|
|
@@ -5948,7 +5948,7 @@ const badToken = "bad_token";
|
|
|
5948
5948
|
*/
|
|
5949
5949
|
const interruptedUser = "interrupted_user";
|
|
5950
5950
|
|
|
5951
|
-
/*! @azure/msal-common v16.14.
|
|
5951
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
5952
5952
|
|
|
5953
5953
|
/*
|
|
5954
5954
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6015,7 +6015,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
|
|
|
6015
6015
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6016
6016
|
}
|
|
6017
6017
|
|
|
6018
|
-
/*! @azure/msal-common v16.14.
|
|
6018
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6019
6019
|
|
|
6020
6020
|
/*
|
|
6021
6021
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6034,7 +6034,7 @@ class ServerError extends AuthError {
|
|
|
6034
6034
|
}
|
|
6035
6035
|
}
|
|
6036
6036
|
|
|
6037
|
-
/*! @azure/msal-common v16.14.
|
|
6037
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6038
6038
|
|
|
6039
6039
|
/*
|
|
6040
6040
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6105,7 +6105,7 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
6105
6105
|
}
|
|
6106
6106
|
}
|
|
6107
6107
|
|
|
6108
|
-
/*! @azure/msal-common v16.14.
|
|
6108
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6109
6109
|
|
|
6110
6110
|
/*
|
|
6111
6111
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6178,11 +6178,26 @@ class ResponseHandler {
|
|
|
6178
6178
|
let idTokenClaims;
|
|
6179
6179
|
if (serverTokenResponse.id_token) {
|
|
6180
6180
|
idTokenClaims = extractTokenClaims(serverTokenResponse.id_token || "", this.cryptoObj.base64Decode, request.correlationId);
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6181
|
+
}
|
|
6182
|
+
/*
|
|
6183
|
+
* Callers opt in to strict nonce-presence validation by including
|
|
6184
|
+
* the nonce property, even when its value is undefined.
|
|
6185
|
+
*/
|
|
6186
|
+
if (authCodePayload &&
|
|
6187
|
+
Object.prototype.hasOwnProperty.call(authCodePayload, "nonce")) {
|
|
6188
|
+
const expectedNonce = authCodePayload.nonce;
|
|
6189
|
+
const tokenNonce = idTokenClaims?.nonce;
|
|
6190
|
+
// Warn when the ID Token nonce cannot be bound to the request.
|
|
6191
|
+
if (tokenNonce !== undefined && expectedNonce === undefined) {
|
|
6192
|
+
this.logger.warning("0thba9", request.correlationId);
|
|
6193
|
+
throw createClientAuthError(nonceMismatch, request.correlationId);
|
|
6194
|
+
}
|
|
6195
|
+
// If the request supplies a nonce, the ID Token value must be a matching string.
|
|
6196
|
+
if (expectedNonce !== undefined &&
|
|
6197
|
+
(typeof expectedNonce !== "string" ||
|
|
6198
|
+
typeof tokenNonce !== "string" ||
|
|
6199
|
+
expectedNonce !== tokenNonce)) {
|
|
6200
|
+
throw createClientAuthError(nonceMismatch, request.correlationId);
|
|
6186
6201
|
}
|
|
6187
6202
|
}
|
|
6188
6203
|
// generate homeAccountId
|
|
@@ -6518,7 +6533,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6518
6533
|
return baseAccount;
|
|
6519
6534
|
}
|
|
6520
6535
|
|
|
6521
|
-
/*! @azure/msal-common v16.14.
|
|
6536
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6522
6537
|
/*
|
|
6523
6538
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6524
6539
|
* Licensed under the MIT License.
|
|
@@ -6528,7 +6543,7 @@ const CcsCredentialType = {
|
|
|
6528
6543
|
UPN: "UPN",
|
|
6529
6544
|
};
|
|
6530
6545
|
|
|
6531
|
-
/*! @azure/msal-common v16.14.
|
|
6546
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6532
6547
|
/*
|
|
6533
6548
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6534
6549
|
* Licensed under the MIT License.
|
|
@@ -6547,7 +6562,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
|
|
|
6547
6562
|
}
|
|
6548
6563
|
}
|
|
6549
6564
|
|
|
6550
|
-
/*! @azure/msal-common v16.14.
|
|
6565
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6551
6566
|
|
|
6552
6567
|
/*
|
|
6553
6568
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6571,7 +6586,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6571
6586
|
};
|
|
6572
6587
|
}
|
|
6573
6588
|
|
|
6574
|
-
/*! @azure/msal-common v16.14.
|
|
6589
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6575
6590
|
|
|
6576
6591
|
/*
|
|
6577
6592
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6657,7 +6672,7 @@ class ThrottlingUtils {
|
|
|
6657
6672
|
}
|
|
6658
6673
|
}
|
|
6659
6674
|
|
|
6660
|
-
/*! @azure/msal-common v16.14.
|
|
6675
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6661
6676
|
|
|
6662
6677
|
/*
|
|
6663
6678
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6688,7 +6703,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
|
|
|
6688
6703
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6689
6704
|
}
|
|
6690
6705
|
|
|
6691
|
-
/*! @azure/msal-common v16.14.
|
|
6706
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6692
6707
|
|
|
6693
6708
|
/*
|
|
6694
6709
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6821,7 +6836,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
6821
6836
|
return response;
|
|
6822
6837
|
}
|
|
6823
6838
|
|
|
6824
|
-
/*! @azure/msal-common v16.14.
|
|
6839
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
6825
6840
|
|
|
6826
6841
|
/*
|
|
6827
6842
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7085,7 +7100,7 @@ class AuthorizationCodeClient {
|
|
|
7085
7100
|
}
|
|
7086
7101
|
}
|
|
7087
7102
|
|
|
7088
|
-
/*! @azure/msal-common v16.14.
|
|
7103
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7089
7104
|
|
|
7090
7105
|
/*
|
|
7091
7106
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7312,7 +7327,7 @@ function extractLoginHint(account) {
|
|
|
7312
7327
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7313
7328
|
}
|
|
7314
7329
|
|
|
7315
|
-
/*! @azure/msal-common v16.14.
|
|
7330
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7316
7331
|
|
|
7317
7332
|
/*
|
|
7318
7333
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7546,7 +7561,7 @@ class RefreshTokenClient {
|
|
|
7546
7561
|
}
|
|
7547
7562
|
}
|
|
7548
7563
|
|
|
7549
|
-
/*! @azure/msal-common v16.14.
|
|
7564
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7550
7565
|
|
|
7551
7566
|
/*
|
|
7552
7567
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7839,7 +7854,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
|
|
|
7839
7854
|
clearNativeBrokerErrorCode() { }
|
|
7840
7855
|
}
|
|
7841
7856
|
|
|
7842
|
-
/*! @azure/msal-common v16.14.
|
|
7857
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7843
7858
|
|
|
7844
7859
|
/*
|
|
7845
7860
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7966,7 +7981,7 @@ class SilentFlowClient {
|
|
|
7966
7981
|
}
|
|
7967
7982
|
}
|
|
7968
7983
|
|
|
7969
|
-
/*! @azure/msal-common v16.14.
|
|
7984
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7970
7985
|
|
|
7971
7986
|
/*
|
|
7972
7987
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7982,7 +7997,7 @@ const StubbedNetworkModule = {
|
|
|
7982
7997
|
},
|
|
7983
7998
|
};
|
|
7984
7999
|
|
|
7985
|
-
/*! @azure/msal-common v16.14.
|
|
8000
|
+
/*! @azure/msal-common v16.14.1 2026-09-23 */
|
|
7986
8001
|
|
|
7987
8002
|
/*
|
|
7988
8003
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8137,12 +8152,13 @@ class RedirectError extends CustomAuthError {
|
|
|
8137
8152
|
* Custom Auth API error.
|
|
8138
8153
|
*/
|
|
8139
8154
|
class CustomAuthApiError extends CustomAuthError {
|
|
8140
|
-
constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp) {
|
|
8155
|
+
constructor(error, errorDescription, correlationId, errorCodes, subError, attributes, continuationToken, traceId, timestamp, attributeValidationDetails) {
|
|
8141
8156
|
super(error, errorDescription, correlationId, errorCodes, subError);
|
|
8142
8157
|
this.attributes = attributes;
|
|
8143
8158
|
this.continuationToken = continuationToken;
|
|
8144
8159
|
this.traceId = traceId;
|
|
8145
8160
|
this.timestamp = timestamp;
|
|
8161
|
+
this.attributeValidationDetails = attributeValidationDetails;
|
|
8146
8162
|
Object.setPrototypeOf(this, CustomAuthApiError.prototype);
|
|
8147
8163
|
}
|
|
8148
8164
|
}
|
|
@@ -8174,15 +8190,15 @@ class InvalidArgumentError extends CustomAuthError {
|
|
|
8174
8190
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8175
8191
|
* Licensed under the MIT License.
|
|
8176
8192
|
*/
|
|
8177
|
-
const CONTINUATION_TOKEN_MISSING = "continuation_token_missing";
|
|
8178
|
-
const INVALID_RESPONSE_BODY = "invalid_response_body";
|
|
8193
|
+
const CONTINUATION_TOKEN_MISSING$1 = "continuation_token_missing";
|
|
8194
|
+
const INVALID_RESPONSE_BODY$1 = "invalid_response_body";
|
|
8179
8195
|
const UNSUPPORTED_CHALLENGE_TYPE = "unsupported_challenge_type";
|
|
8180
8196
|
const ACCESS_TOKEN_MISSING = "access_token_missing";
|
|
8181
8197
|
const ID_TOKEN_MISSING = "id_token_missing";
|
|
8182
8198
|
const REFRESH_TOKEN_MISSING = "refresh_token_missing";
|
|
8183
8199
|
const INVALID_EXPIRES_IN = "invalid_expires_in";
|
|
8184
8200
|
const INVALID_TOKEN_TYPE = "invalid_token_type";
|
|
8185
|
-
const HTTP_REQUEST_FAILED = "http_request_failed";
|
|
8201
|
+
const HTTP_REQUEST_FAILED$1 = "http_request_failed";
|
|
8186
8202
|
const INVALID_REQUEST = "invalid_request";
|
|
8187
8203
|
const USER_NOT_FOUND = "user_not_found";
|
|
8188
8204
|
const INVALID_GRANT = "invalid_grant";
|
|
@@ -8200,7 +8216,7 @@ const ACCESS_DENIED = "access_denied";
|
|
|
8200
8216
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8201
8217
|
* Licensed under the MIT License.
|
|
8202
8218
|
*/
|
|
8203
|
-
const PASSWORD_TOO_WEAK = "password_too_weak";
|
|
8219
|
+
const PASSWORD_TOO_WEAK$1 = "password_too_weak";
|
|
8204
8220
|
const PASSWORD_TOO_SHORT = "password_too_short";
|
|
8205
8221
|
const PASSWORD_TOO_LONG = "password_too_long";
|
|
8206
8222
|
const PASSWORD_RECENTLY_USED = "password_recently_used";
|
|
@@ -8268,7 +8284,7 @@ class AuthFlowErrorBase {
|
|
|
8268
8284
|
PASSWORD_RECENTLY_USED,
|
|
8269
8285
|
PASSWORD_TOO_LONG,
|
|
8270
8286
|
PASSWORD_TOO_SHORT,
|
|
8271
|
-
PASSWORD_TOO_WEAK,
|
|
8287
|
+
PASSWORD_TOO_WEAK$1,
|
|
8272
8288
|
]);
|
|
8273
8289
|
return (this.errorData instanceof CustomAuthApiError &&
|
|
8274
8290
|
this.errorData.error === INVALID_GRANT &&
|
|
@@ -8410,7 +8426,7 @@ function ensureArgumentIsJSONString(argName, argValue, correlationId) {
|
|
|
8410
8426
|
|
|
8411
8427
|
/* eslint-disable header/header */
|
|
8412
8428
|
const name = "@azure/msal-browser";
|
|
8413
|
-
const version = "5.
|
|
8429
|
+
const version = "5.23.0";
|
|
8414
8430
|
|
|
8415
8431
|
/*
|
|
8416
8432
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11376,7 +11392,24 @@ const JIT_CHALLENGE_AUTH_METHOD = 100081;
|
|
|
11376
11392
|
const JIT_SUBMIT_CHALLENGE = 100082;
|
|
11377
11393
|
// MFA
|
|
11378
11394
|
const MFA_REQUEST_CHALLENGE = 100101;
|
|
11379
|
-
const MFA_SUBMIT_CHALLENGE = 100102;
|
|
11395
|
+
const MFA_SUBMIT_CHALLENGE = 100102;
|
|
11396
|
+
// Native Auth V2 (server-driven HAL flows) API Ids
|
|
11397
|
+
const RESET_PASSWORD_V2_START = 100201;
|
|
11398
|
+
const RESET_PASSWORD_V2_SUBMIT_CODE = 100202;
|
|
11399
|
+
const RESET_PASSWORD_V2_RESEND_CODE = 100203;
|
|
11400
|
+
const RESET_PASSWORD_V2_SUBMIT = 100204;
|
|
11401
|
+
const RESET_PASSWORD_V2_CHALLENGE = 100205;
|
|
11402
|
+
const SIGN_IN_V2_START = 100206;
|
|
11403
|
+
const SIGN_IN_V2_CHALLENGE = 100207;
|
|
11404
|
+
const SIGN_IN_V2_SUBMIT_PASSWORD = 100208;
|
|
11405
|
+
const SIGN_IN_V2_COMPLETE = 100209;
|
|
11406
|
+
const SIGN_IN_V2_SUBMIT_CODE = 100210;
|
|
11407
|
+
const SIGN_UP_V2_START = 100211;
|
|
11408
|
+
const SIGN_UP_V2_CHALLENGE = 100212;
|
|
11409
|
+
const SIGN_UP_V2_SUBMIT_CODE = 100213;
|
|
11410
|
+
const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
|
|
11411
|
+
const SIGN_UP_V2_RESEND_CODE = 100215;
|
|
11412
|
+
const SIGN_UP_V2_COMPLETE = 100216;
|
|
11380
11413
|
|
|
11381
11414
|
/*
|
|
11382
11415
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11973,16 +12006,2468 @@ class ResetPasswordStartResult extends AuthFlowResultBase {
|
|
|
11973
12006
|
return result;
|
|
11974
12007
|
}
|
|
11975
12008
|
/**
|
|
11976
|
-
* Checks if the result is in a failed state.
|
|
12009
|
+
* Checks if the result is in a failed state.
|
|
12010
|
+
*/
|
|
12011
|
+
isFailed() {
|
|
12012
|
+
return this.state.stateType === RESET_PASSWORD_FAILED_STATE_TYPE;
|
|
12013
|
+
}
|
|
12014
|
+
/**
|
|
12015
|
+
* Checks if the result is in a code required state.
|
|
12016
|
+
*/
|
|
12017
|
+
isCodeRequired() {
|
|
12018
|
+
return this.state.stateType === RESET_PASSWORD_CODE_REQUIRED_STATE_TYPE;
|
|
12019
|
+
}
|
|
12020
|
+
}
|
|
12021
|
+
|
|
12022
|
+
/*
|
|
12023
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12024
|
+
* Licensed under the MIT License.
|
|
12025
|
+
*/
|
|
12026
|
+
/**
|
|
12027
|
+
* Represents an HTTP method type.
|
|
12028
|
+
*/
|
|
12029
|
+
const HttpMethod = {
|
|
12030
|
+
GET: "GET",
|
|
12031
|
+
POST: "POST",
|
|
12032
|
+
PUT: "PUT"};
|
|
12033
|
+
|
|
12034
|
+
/*
|
|
12035
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12036
|
+
* Licensed under the MIT License.
|
|
12037
|
+
*/
|
|
12038
|
+
class ParsedUrlError extends CustomAuthError {
|
|
12039
|
+
constructor(error, message, correlationId) {
|
|
12040
|
+
super(error, message, correlationId);
|
|
12041
|
+
Object.setPrototypeOf(this, ParsedUrlError.prototype);
|
|
12042
|
+
}
|
|
12043
|
+
}
|
|
12044
|
+
|
|
12045
|
+
/*
|
|
12046
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12047
|
+
* Licensed under the MIT License.
|
|
12048
|
+
*/
|
|
12049
|
+
const InvalidUrl = "invalid_url";
|
|
12050
|
+
|
|
12051
|
+
/*
|
|
12052
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12053
|
+
* Licensed under the MIT License.
|
|
12054
|
+
*/
|
|
12055
|
+
function parseUrl(url) {
|
|
12056
|
+
try {
|
|
12057
|
+
return new URL(url);
|
|
12058
|
+
}
|
|
12059
|
+
catch (e) {
|
|
12060
|
+
throw new ParsedUrlError(InvalidUrl, `The URL "${url}" is invalid: ${e}`);
|
|
12061
|
+
}
|
|
12062
|
+
}
|
|
12063
|
+
function buildUrl(baseUrl, path, queryParams) {
|
|
12064
|
+
const newBaseUrl = !baseUrl.endsWith("/") ? `${baseUrl}/` : baseUrl;
|
|
12065
|
+
const newPath = path.startsWith("/") ? path.slice(1) : path;
|
|
12066
|
+
const url = new URL(newPath, newBaseUrl);
|
|
12067
|
+
// Add query parameters if provided
|
|
12068
|
+
if (queryParams) {
|
|
12069
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
12070
|
+
if (value !== undefined && value !== null) {
|
|
12071
|
+
url.searchParams.set(key, String(value));
|
|
12072
|
+
}
|
|
12073
|
+
});
|
|
12074
|
+
}
|
|
12075
|
+
return url;
|
|
12076
|
+
}
|
|
12077
|
+
|
|
12078
|
+
/*
|
|
12079
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12080
|
+
* Licensed under the MIT License.
|
|
12081
|
+
*/
|
|
12082
|
+
/**
|
|
12083
|
+
* Filters the headers returned by a {@link CustomAuthRequestInterceptor},
|
|
12084
|
+
* keeping only those that conform to the custom-auth header naming rules.
|
|
12085
|
+
*
|
|
12086
|
+
* Rules (mirrors the iOS / Android native auth implementations):
|
|
12087
|
+
* - Header names must start with `x-` (case-insensitive); others are dropped.
|
|
12088
|
+
* - Header names that start with any reserved prefix (`x-client-`, `x-ms-`,
|
|
12089
|
+
* `x-broker-`, `x-app-`) are dropped.
|
|
12090
|
+
* - Headers with empty/whitespace-only names or null/undefined values are dropped.
|
|
12091
|
+
*
|
|
12092
|
+
* Dropped headers are logged as warnings (PII-safe) when a logger is provided.
|
|
12093
|
+
*
|
|
12094
|
+
* @param headers - Raw headers returned by the interceptor.
|
|
12095
|
+
* @param logger - Optional logger used to emit warnings for dropped headers.
|
|
12096
|
+
* @param correlationId - Optional correlation id forwarded to the logger.
|
|
12097
|
+
* @returns A new record containing only the headers that pass the filter,
|
|
12098
|
+
* preserving the original casing of header names.
|
|
12099
|
+
*/
|
|
12100
|
+
function filterCustomHeaders(headers, logger, correlationId) {
|
|
12101
|
+
const filtered = {};
|
|
12102
|
+
if (!headers) {
|
|
12103
|
+
return filtered;
|
|
12104
|
+
}
|
|
12105
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
12106
|
+
if (!name || value === undefined || value === null) {
|
|
12107
|
+
continue;
|
|
12108
|
+
}
|
|
12109
|
+
const trimmedName = name.trim();
|
|
12110
|
+
if (!trimmedName) {
|
|
12111
|
+
continue;
|
|
12112
|
+
}
|
|
12113
|
+
const lowerName = trimmedName.toLowerCase();
|
|
12114
|
+
if (!lowerName.startsWith(CustomHeaderConstants.REQUIRED_PREFIX)) {
|
|
12115
|
+
logger?.warningPii(`0vzpop ${trimmedName} ${CustomHeaderConstants.REQUIRED_PREFIX}`, correlationId ?? "");
|
|
12116
|
+
continue;
|
|
12117
|
+
}
|
|
12118
|
+
const reservedPrefix = CustomHeaderConstants.RESERVED_PREFIXES.find((prefix) => lowerName.startsWith(prefix));
|
|
12119
|
+
if (reservedPrefix) {
|
|
12120
|
+
logger?.warningPii(`1m3lhk ${trimmedName} ${reservedPrefix}`, correlationId ?? "");
|
|
12121
|
+
continue;
|
|
12122
|
+
}
|
|
12123
|
+
filtered[trimmedName] = value;
|
|
12124
|
+
}
|
|
12125
|
+
return filtered;
|
|
12126
|
+
}
|
|
12127
|
+
|
|
12128
|
+
/*
|
|
12129
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12130
|
+
* Licensed under the MIT License.
|
|
12131
|
+
*/
|
|
12132
|
+
const HTTP_REQUEST_FAILED = "http_request_failed";
|
|
12133
|
+
const REDIRECT_TO_WEB = "redirect_to_web";
|
|
12134
|
+
const UNEXPECTED_ERROR = "unexpected_error";
|
|
12135
|
+
const AUTH_CODE_MISSING = "authorization_code_missing";
|
|
12136
|
+
const INVALID_TOKEN_RESPONSE = "invalid_token_response";
|
|
12137
|
+
const INVALID_RESPONSE_BODY = "invalid_response_body";
|
|
12138
|
+
const CONTINUATION_TOKEN_MISSING = "continuation_token_missing";
|
|
12139
|
+
const INVALID_HAL_RESPONSE = "invalid_hal_response";
|
|
12140
|
+
const RESET_PASSWORD_UNSUPPORTED = "reset_password_unsupported";
|
|
12141
|
+
const SIGN_IN_UNSUPPORTED = "sign_in_unsupported";
|
|
12142
|
+
const SIGN_UP_UNSUPPORTED = "sign_up_unsupported";
|
|
12143
|
+
const CONTINUATION_LINK_MISSING = "continuation_link_missing";
|
|
12144
|
+
const RESET_PASSWORD_TIMEOUT = "reset_password_timeout";
|
|
12145
|
+
const UNSUPPORTED_FLOW_STEP = "unsupported_flow_step";
|
|
12146
|
+
const UNSUPPORTED_FLOW_TRANSITION = "unsupported_flow_transition";
|
|
12147
|
+
const NO_AUTHENTICATION_METHODS = "no_authentication_methods";
|
|
12148
|
+
const UNEXPECTED_AUTHENTICATION_FACTOR = "unexpected_authentication_factor";
|
|
12149
|
+
|
|
12150
|
+
/*
|
|
12151
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12152
|
+
* Licensed under the MIT License.
|
|
12153
|
+
*/
|
|
12154
|
+
/*
|
|
12155
|
+
* Normalizes nested HAL and flat OAuth error bodies into a `ServerErrorV2`.
|
|
12156
|
+
* Returns `undefined` when the response contains no recognized error.
|
|
12157
|
+
*/
|
|
12158
|
+
function normalizeServerErrorV2(body) {
|
|
12159
|
+
const error = body.error;
|
|
12160
|
+
if (error && typeof error === "object") {
|
|
12161
|
+
return normalizeHalError(body);
|
|
12162
|
+
}
|
|
12163
|
+
if (typeof error === "string") {
|
|
12164
|
+
return normalizeOAuthError(body);
|
|
12165
|
+
}
|
|
12166
|
+
return undefined;
|
|
12167
|
+
}
|
|
12168
|
+
function normalizeHalError(response) {
|
|
12169
|
+
const error = response.error ?? {};
|
|
12170
|
+
return {
|
|
12171
|
+
code: readString(error.code) ?? UNEXPECTED_ERROR,
|
|
12172
|
+
message: readString(error.message),
|
|
12173
|
+
innerErrorCode: readString(error.innerError?.code),
|
|
12174
|
+
attributeValidationDetails: error.innerError?.details,
|
|
12175
|
+
correlationId: readString(error.correlationId),
|
|
12176
|
+
traceId: readString(error.traceId),
|
|
12177
|
+
timestamp: readString(error.timestamp),
|
|
12178
|
+
};
|
|
12179
|
+
}
|
|
12180
|
+
function normalizeOAuthError(response) {
|
|
12181
|
+
return {
|
|
12182
|
+
code: readString(response.error) ?? UNEXPECTED_ERROR,
|
|
12183
|
+
message: readString(response.error_description),
|
|
12184
|
+
errorCodes: readNumberArray(response.error_codes),
|
|
12185
|
+
correlationId: readString(response.correlation_id),
|
|
12186
|
+
traceId: readString(response.trace_id),
|
|
12187
|
+
timestamp: readString(response.timestamp),
|
|
12188
|
+
};
|
|
12189
|
+
}
|
|
12190
|
+
function readString(value) {
|
|
12191
|
+
return typeof value === "string" ? value : undefined;
|
|
12192
|
+
}
|
|
12193
|
+
function readNumberArray(value) {
|
|
12194
|
+
if (Array.isArray(value) && value.every((v) => typeof v === "number")) {
|
|
12195
|
+
return value;
|
|
12196
|
+
}
|
|
12197
|
+
return undefined;
|
|
12198
|
+
}
|
|
12199
|
+
|
|
12200
|
+
/*
|
|
12201
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12202
|
+
* Licensed under the MIT License.
|
|
12203
|
+
*/
|
|
12204
|
+
// Content type used by V2 JSON `/api` requests.
|
|
12205
|
+
const JSON_CONTENT_TYPE = "application/json";
|
|
12206
|
+
// Server action returned after successful credential verification.
|
|
12207
|
+
const UPDATE_RELATION = "update";
|
|
12208
|
+
const CHALLENGE_RELATION = "challenge";
|
|
12209
|
+
const VERIFY_RELATION = "verify";
|
|
12210
|
+
const RISK_VERIFY_RELATION = "riskverify";
|
|
12211
|
+
const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
|
|
12212
|
+
const AuthenticationMethodTypeV2 = {
|
|
12213
|
+
EMAIL: "email",
|
|
12214
|
+
PASSWORD: "password",
|
|
12215
|
+
SMS: "sms",
|
|
12216
|
+
};
|
|
12217
|
+
/*
|
|
12218
|
+
* Known `state` values on a HAL response. Kept open (the body field is typed as string) because
|
|
12219
|
+
* the server may introduce new values; response parsing and flow logic branch on these constants.
|
|
12220
|
+
*/
|
|
12221
|
+
const ResponseStateV2 = {
|
|
12222
|
+
CONTINUE: "continue",
|
|
12223
|
+
WEB_FALLBACK_REQUIRED: "webFallbackRequired",
|
|
12224
|
+
};
|
|
12225
|
+
|
|
12226
|
+
/*
|
|
12227
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12228
|
+
* Licensed under the MIT License.
|
|
12229
|
+
*/
|
|
12230
|
+
/*
|
|
12231
|
+
* Turns a raw HTTP response from a V2 endpoint into a typed, checked envelope, and validates HAL
|
|
12232
|
+
* relations. Raw-preserving: the body keeps its HAL `_links`/`_embedded` shape so the api-client
|
|
12233
|
+
* navigates typed hrefs directly. Parsing never throws on a non-200 status - every V2 response
|
|
12234
|
+
* (including the entry response) carries a meaningful body, so only a non-object body is a hard
|
|
12235
|
+
* failure; the wire error is normalized onto the envelope (`error`). Required response values use
|
|
12236
|
+
* shared guards after callers read their strongly typed response properties directly.
|
|
12237
|
+
*/
|
|
12238
|
+
class ResponseHandlerV2 {
|
|
12239
|
+
constructor(logger) {
|
|
12240
|
+
this.logger = logger;
|
|
12241
|
+
}
|
|
12242
|
+
async parseResponse(response, requestCorrelationId) {
|
|
12243
|
+
const correlationId = response.headers.get(HttpHeaderKeys.X_MS_REQUEST_ID) ??
|
|
12244
|
+
requestCorrelationId;
|
|
12245
|
+
const json = await this.parseBody(response, correlationId);
|
|
12246
|
+
const state = typeof json.state === "string" ? json.state : undefined;
|
|
12247
|
+
const continuationToken = (typeof json.continuationToken === "string"
|
|
12248
|
+
? json.continuationToken
|
|
12249
|
+
: undefined) ??
|
|
12250
|
+
(typeof json.continuation_token === "string"
|
|
12251
|
+
? json.continuation_token
|
|
12252
|
+
: undefined);
|
|
12253
|
+
const flatError = typeof json.error === "string" ? json.error : undefined;
|
|
12254
|
+
const isWebFallbackRequired = flatError === REDIRECT_TO_WEB ||
|
|
12255
|
+
state === ResponseStateV2.WEB_FALLBACK_REQUIRED;
|
|
12256
|
+
const error = normalizeServerErrorV2(json);
|
|
12257
|
+
// Surface the header correlation id on the body (HalResponseBaseV2.correlationId).
|
|
12258
|
+
json.correlationId = correlationId;
|
|
12259
|
+
return {
|
|
12260
|
+
statusCode: response.status,
|
|
12261
|
+
correlationId,
|
|
12262
|
+
continuationToken,
|
|
12263
|
+
isWebFallbackRequired,
|
|
12264
|
+
error,
|
|
12265
|
+
body: json,
|
|
12266
|
+
};
|
|
12267
|
+
}
|
|
12268
|
+
// Required href; throws when it is absent.
|
|
12269
|
+
requireHref(href, relation, correlationId, missingHrefError) {
|
|
12270
|
+
if (!href) {
|
|
12271
|
+
const errorCode = missingHrefError?.code ?? INVALID_HAL_RESPONSE;
|
|
12272
|
+
const errorMessage = missingHrefError?.message ??
|
|
12273
|
+
`Invalid HAL response: missing '${relation}' link`;
|
|
12274
|
+
this.logger?.error(errorMessage, correlationId);
|
|
12275
|
+
throw new CustomAuthApiError(errorCode, errorMessage, correlationId);
|
|
12276
|
+
}
|
|
12277
|
+
return href;
|
|
12278
|
+
}
|
|
12279
|
+
// Required continuation token to advance the flow; throws when absent.
|
|
12280
|
+
requireContinuationToken(continuationToken, correlationId) {
|
|
12281
|
+
if (!continuationToken) {
|
|
12282
|
+
this.logger?.error("0a3z6v", correlationId);
|
|
12283
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response", correlationId);
|
|
12284
|
+
}
|
|
12285
|
+
return continuationToken;
|
|
12286
|
+
}
|
|
12287
|
+
// Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
|
|
12288
|
+
requireMethods(methods, correlationId) {
|
|
12289
|
+
if (!methods?.length) {
|
|
12290
|
+
this.logger?.error("0u0cak", correlationId);
|
|
12291
|
+
throw new CustomAuthApiError(NO_AUTHENTICATION_METHODS, "Invalid HAL response: no embedded authentication methods", correlationId);
|
|
12292
|
+
}
|
|
12293
|
+
return methods;
|
|
12294
|
+
}
|
|
12295
|
+
async parseBody(response, correlationId) {
|
|
12296
|
+
let json;
|
|
12297
|
+
try {
|
|
12298
|
+
json = await response.json();
|
|
12299
|
+
}
|
|
12300
|
+
catch (e) {
|
|
12301
|
+
this.logger?.error("0fc89v", correlationId);
|
|
12302
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, `V2 response body is not valid JSON: '${e}'`, correlationId);
|
|
12303
|
+
}
|
|
12304
|
+
// response.json() accepts primitives/arrays; every V2 body must be a JSON object.
|
|
12305
|
+
if (typeof json !== "object" || json === null || Array.isArray(json)) {
|
|
12306
|
+
this.logger?.error("09w4yw", correlationId);
|
|
12307
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "V2 response body is not a JSON object", correlationId);
|
|
12308
|
+
}
|
|
12309
|
+
return json;
|
|
12310
|
+
}
|
|
12311
|
+
}
|
|
12312
|
+
|
|
12313
|
+
/*
|
|
12314
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12315
|
+
* Licensed under the MIT License.
|
|
12316
|
+
*/
|
|
12317
|
+
const API_MARKERS = ["/api/", "/oauth2/"];
|
|
12318
|
+
/*
|
|
12319
|
+
* Resolves a HAL href against the configured authority. Absolute HTTP(S) URLs
|
|
12320
|
+
* pass through; relative URLs retain their API path and query while using the
|
|
12321
|
+
* configured tenant path.
|
|
12322
|
+
*
|
|
12323
|
+
* TODO: Remove tenant-path rewriting once the service consistently returns links that can be
|
|
12324
|
+
* resolved directly against the configured authority.
|
|
12325
|
+
*/
|
|
12326
|
+
function resolveHrefV2(base, href) {
|
|
12327
|
+
const trimmed = href.trim();
|
|
12328
|
+
if (!trimmed) {
|
|
12329
|
+
throw new ParsedUrlError(InvalidUrl, "The HAL href cannot be empty");
|
|
12330
|
+
}
|
|
12331
|
+
const absolute = tryParseAbsolute(trimmed);
|
|
12332
|
+
if (absolute) {
|
|
12333
|
+
return absolute;
|
|
12334
|
+
}
|
|
12335
|
+
let resolved;
|
|
12336
|
+
try {
|
|
12337
|
+
resolved = new URL(trimmed, base.origin);
|
|
12338
|
+
}
|
|
12339
|
+
catch (e) {
|
|
12340
|
+
throw new ParsedUrlError(InvalidUrl, `The HAL href "${href}" could not be resolved: ${e}`);
|
|
12341
|
+
}
|
|
12342
|
+
if (resolved.protocol !== "http:" && resolved.protocol !== "https:") {
|
|
12343
|
+
throw new ParsedUrlError(InvalidUrl, `The HAL href "${href}" must use the HTTP or HTTPS protocol`);
|
|
12344
|
+
}
|
|
12345
|
+
const tenantPath = base.pathname.endsWith("/")
|
|
12346
|
+
? base.pathname.slice(0, -1)
|
|
12347
|
+
: base.pathname;
|
|
12348
|
+
resolved.pathname = tenantPath + apiPath(resolved.pathname);
|
|
12349
|
+
return resolved;
|
|
12350
|
+
}
|
|
12351
|
+
function tryParseAbsolute(href) {
|
|
12352
|
+
try {
|
|
12353
|
+
const url = new URL(href);
|
|
12354
|
+
return url.protocol === "http:" || url.protocol === "https:"
|
|
12355
|
+
? url
|
|
12356
|
+
: undefined;
|
|
12357
|
+
}
|
|
12358
|
+
catch {
|
|
12359
|
+
return undefined;
|
|
12360
|
+
}
|
|
12361
|
+
}
|
|
12362
|
+
function apiPath(path) {
|
|
12363
|
+
for (const marker of API_MARKERS) {
|
|
12364
|
+
const index = path.indexOf(marker);
|
|
12365
|
+
if (index >= 0) {
|
|
12366
|
+
return path.slice(index);
|
|
12367
|
+
}
|
|
12368
|
+
}
|
|
12369
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
12370
|
+
}
|
|
12371
|
+
|
|
12372
|
+
/*
|
|
12373
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12374
|
+
* Licensed under the MIT License.
|
|
12375
|
+
*/
|
|
12376
|
+
const SIGNIN_INITIATE = "/oauth2/v2.0/initiate";
|
|
12377
|
+
const SIGNIN_CHALLENGE = "/oauth2/v2.0/challenge";
|
|
12378
|
+
const SIGNIN_TOKEN = "/oauth2/v2.0/token";
|
|
12379
|
+
const SIGNIN_INTROSPECT = "/oauth2/v2.0/introspect";
|
|
12380
|
+
const AUTHORIZE_CHALLENGE = "/oauth2/v2.0/authorize-challenge";
|
|
12381
|
+
const SIGNUP_START = "/signup/v1.0/start";
|
|
12382
|
+
const SIGNUP_CHALLENGE = "/signup/v1.0/challenge";
|
|
12383
|
+
const SIGNUP_CONTINUE = "/signup/v1.0/continue";
|
|
12384
|
+
const RESET_PWD_START = "/resetpassword/v1.0/start";
|
|
12385
|
+
const RESET_PWD_CHALLENGE = "/resetpassword/v1.0/challenge";
|
|
12386
|
+
const RESET_PWD_CONTINUE = "/resetpassword/v1.0/continue";
|
|
12387
|
+
const RESET_PWD_SUBMIT = "/resetpassword/v1.0/submit";
|
|
12388
|
+
const RESET_PWD_POLL = "/resetpassword/v1.0/poll_completion";
|
|
12389
|
+
const REGISTER_INTROSPECT = "/register/v1.0/introspect";
|
|
12390
|
+
const REGISTER_CHALLENGE = "/register/v1.0/challenge";
|
|
12391
|
+
const REGISTER_CONTINUE = "/register/v1.0/continue";
|
|
12392
|
+
|
|
12393
|
+
/*
|
|
12394
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12395
|
+
* Licensed under the MIT License.
|
|
12396
|
+
*/
|
|
12397
|
+
/*
|
|
12398
|
+
* Shared Native Auth V2 network client for OAuth and HAL requests.
|
|
12399
|
+
* Handles serialization, headers, error normalization, and server-provided links.
|
|
12400
|
+
*/
|
|
12401
|
+
class BaseApiClientV2 {
|
|
12402
|
+
constructor(baseUrl, clientId, httpClient, customAuthApiQueryParams, requestInterceptor, logger) {
|
|
12403
|
+
this.clientId = clientId;
|
|
12404
|
+
this.httpClient = httpClient;
|
|
12405
|
+
this.customAuthApiQueryParams = customAuthApiQueryParams;
|
|
12406
|
+
this.requestInterceptor = requestInterceptor;
|
|
12407
|
+
this.logger = logger;
|
|
12408
|
+
this.baseRequestUrl = parseUrl(!baseUrl.endsWith("/") ? `${baseUrl}/` : baseUrl);
|
|
12409
|
+
this.handler = new ResponseHandlerV2(logger);
|
|
12410
|
+
}
|
|
12411
|
+
/*
|
|
12412
|
+
* Starts authorization and returns the initial continuation token and flow links.
|
|
12413
|
+
*/
|
|
12414
|
+
async authorizeChallengeStart(context, scopes) {
|
|
12415
|
+
const request = {
|
|
12416
|
+
client_id: this.clientId,
|
|
12417
|
+
};
|
|
12418
|
+
if (scopes?.length) {
|
|
12419
|
+
request.scope = scopes.join(" ");
|
|
12420
|
+
}
|
|
12421
|
+
const parsedResponse = await this.postOAuthForm(AUTHORIZE_CHALLENGE, request, context);
|
|
12422
|
+
const { continuationToken, correlationId, error, body } = parsedResponse;
|
|
12423
|
+
/*
|
|
12424
|
+
* No token means a genuine server error: surface the normalized server error directly. The
|
|
12425
|
+
* fallback code/message only applies to a malformed response that carries neither a token
|
|
12426
|
+
* nor an error.
|
|
12427
|
+
*/
|
|
12428
|
+
if (!continuationToken) {
|
|
12429
|
+
const apiError = error
|
|
12430
|
+
? this.toApiError(error, correlationId)
|
|
12431
|
+
: new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response", correlationId);
|
|
12432
|
+
this.logger?.error(`15sfif ${apiError.error}`, correlationId);
|
|
12433
|
+
throw apiError;
|
|
12434
|
+
}
|
|
12435
|
+
return {
|
|
12436
|
+
continuationToken,
|
|
12437
|
+
resetPasswordHref: body.reset_password,
|
|
12438
|
+
signInHref: body.sign_in,
|
|
12439
|
+
signUpHref: body.sign_up,
|
|
12440
|
+
};
|
|
12441
|
+
}
|
|
12442
|
+
/*
|
|
12443
|
+
* Redeems a continuation token for an authorization code and then tokens.
|
|
12444
|
+
*/
|
|
12445
|
+
async completeWithTokens(request, context) {
|
|
12446
|
+
const code = await this.authorizeChallengeContinue(request.continuationToken, context);
|
|
12447
|
+
return this.token(code, request.scopes, context);
|
|
12448
|
+
}
|
|
12449
|
+
/*
|
|
12450
|
+
* Redeems a continuation token for an authorization code.
|
|
12451
|
+
*/
|
|
12452
|
+
async authorizeChallengeContinue(continuationToken, context) {
|
|
12453
|
+
const request = {
|
|
12454
|
+
continuation_token: continuationToken,
|
|
12455
|
+
};
|
|
12456
|
+
const parsedResponse = await this.postOAuthForm(AUTHORIZE_CHALLENGE, request, context);
|
|
12457
|
+
this.throwOnApiError(parsedResponse);
|
|
12458
|
+
const code = parsedResponse.body.code;
|
|
12459
|
+
if (!code) {
|
|
12460
|
+
this.logger?.error("0hzeol", parsedResponse.correlationId);
|
|
12461
|
+
throw new CustomAuthApiError(AUTH_CODE_MISSING, "Authorization code is missing in the response body", parsedResponse.correlationId);
|
|
12462
|
+
}
|
|
12463
|
+
return code;
|
|
12464
|
+
}
|
|
12465
|
+
/*
|
|
12466
|
+
* Exchanges an authorization code for tokens.
|
|
12467
|
+
*/
|
|
12468
|
+
async token(code, scopes, context) {
|
|
12469
|
+
const request = {
|
|
12470
|
+
client_id: this.clientId,
|
|
12471
|
+
grant_type: GrantType$1.AUTHORIZATION_CODE_GRANT,
|
|
12472
|
+
code,
|
|
12473
|
+
// Required so the server returns the client_info blob MSAL uses to build the home account id.
|
|
12474
|
+
client_info: "1",
|
|
12475
|
+
};
|
|
12476
|
+
if (scopes.length > 0) {
|
|
12477
|
+
request.scope = scopes.join(" ");
|
|
12478
|
+
}
|
|
12479
|
+
const parsedResponse = await this.postOAuthForm(SIGNIN_TOKEN, request, context);
|
|
12480
|
+
this.throwOnApiError(parsedResponse);
|
|
12481
|
+
this.ensureTokenResponseIsValid(parsedResponse.body, parsedResponse.correlationId);
|
|
12482
|
+
return parsedResponse.body;
|
|
12483
|
+
}
|
|
12484
|
+
/*
|
|
12485
|
+
* Sends a JSON action request to a server-provided link.
|
|
12486
|
+
*/
|
|
12487
|
+
async sendActionRequest(href, method, body, context) {
|
|
12488
|
+
if (!body.continuationToken) {
|
|
12489
|
+
this.logger?.error("1wtzk1", context.correlationId);
|
|
12490
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "The HAL request body did not include a continuation token, so the server-driven reset flow cannot advance", context.correlationId);
|
|
12491
|
+
}
|
|
12492
|
+
const url = resolveHrefV2(this.baseRequestUrl, href);
|
|
12493
|
+
const response = await this.sendRequest(url, method, JSON.stringify(body), JSON_CONTENT_TYPE, context);
|
|
12494
|
+
const parsedResponse = await this.handler.parseResponse(response, context.correlationId);
|
|
12495
|
+
this.throwOnWebFallback(parsedResponse);
|
|
12496
|
+
this.throwOnApiError(parsedResponse);
|
|
12497
|
+
return parsedResponse;
|
|
12498
|
+
}
|
|
12499
|
+
throwOnApiError(parsedResponse) {
|
|
12500
|
+
if (parsedResponse.error) {
|
|
12501
|
+
const apiError = this.toApiError(parsedResponse.error, parsedResponse.correlationId);
|
|
12502
|
+
this.logger?.error(`0u4c13 ${apiError.error}`, parsedResponse.correlationId);
|
|
12503
|
+
throw apiError;
|
|
12504
|
+
}
|
|
12505
|
+
}
|
|
12506
|
+
async postOAuthForm(endpoint, data, context) {
|
|
12507
|
+
const formData = new URLSearchParams(Object.entries(data));
|
|
12508
|
+
const url = buildUrl(this.baseRequestUrl.href, endpoint, this.customAuthApiQueryParams);
|
|
12509
|
+
const response = await this.sendRequest(url, HttpMethod.POST, formData, URL_FORM_CONTENT_TYPE, context);
|
|
12510
|
+
const parsedResponse = await this.handler.parseResponse(response, context.correlationId);
|
|
12511
|
+
this.throwOnWebFallback(parsedResponse);
|
|
12512
|
+
return parsedResponse;
|
|
12513
|
+
}
|
|
12514
|
+
async sendRequest(url, method, body, contentType, context) {
|
|
12515
|
+
const headers = {
|
|
12516
|
+
...this.getCommonHeaders(context.correlationId, context.telemetryManager, contentType),
|
|
12517
|
+
...(await this.getAdditionalHeaders(url, context.correlationId)),
|
|
12518
|
+
};
|
|
12519
|
+
try {
|
|
12520
|
+
return await this.httpClient.sendAsync(url, {
|
|
12521
|
+
method,
|
|
12522
|
+
body,
|
|
12523
|
+
headers,
|
|
12524
|
+
});
|
|
12525
|
+
}
|
|
12526
|
+
catch (e) {
|
|
12527
|
+
throw new CustomAuthApiError(HTTP_REQUEST_FAILED, `Failed to send request to '${url}': '${e}'`, context.correlationId);
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12530
|
+
toApiError(serverError, correlationId) {
|
|
12531
|
+
return new CustomAuthApiError(serverError.code, serverError.message ?? "", serverError.correlationId ?? correlationId, serverError.errorCodes, serverError.innerErrorCode, undefined, undefined, serverError.traceId, serverError.timestamp, serverError.attributeValidationDetails);
|
|
12532
|
+
}
|
|
12533
|
+
throwOnWebFallback(parsedResponse) {
|
|
12534
|
+
if (parsedResponse.isWebFallbackRequired) {
|
|
12535
|
+
throw new CustomAuthApiError(REDIRECT_TO_WEB, "The server requires the flow to continue in a web browser", parsedResponse.correlationId);
|
|
12536
|
+
}
|
|
12537
|
+
}
|
|
12538
|
+
ensureTokenResponseIsValid(tokenResponse, correlationId) {
|
|
12539
|
+
if (!tokenResponse.access_token) {
|
|
12540
|
+
throw new CustomAuthApiError(INVALID_TOKEN_RESPONSE, "Access token is missing in the response body", correlationId);
|
|
12541
|
+
}
|
|
12542
|
+
}
|
|
12543
|
+
getCommonHeaders(correlationId, telemetryManager, contentType) {
|
|
12544
|
+
return {
|
|
12545
|
+
[HttpHeaderKeys.CONTENT_TYPE]: contentType,
|
|
12546
|
+
[X_CLIENT_SKU]: DefaultPackageInfo.SKU,
|
|
12547
|
+
[X_CLIENT_VER]: DefaultPackageInfo.VERSION,
|
|
12548
|
+
[X_CLIENT_OS]: DefaultPackageInfo.OS,
|
|
12549
|
+
[X_CLIENT_CPU]: DefaultPackageInfo.CPU,
|
|
12550
|
+
[X_CLIENT_CURR_TELEM]: telemetryManager.generateCurrentRequestHeaderValue(),
|
|
12551
|
+
[X_CLIENT_LAST_TELEM]: telemetryManager.generateLastRequestHeaderValue(),
|
|
12552
|
+
[CLIENT_REQUEST_ID]: correlationId,
|
|
12553
|
+
};
|
|
12554
|
+
}
|
|
12555
|
+
async getAdditionalHeaders(url, correlationId) {
|
|
12556
|
+
if (!this.requestInterceptor) {
|
|
12557
|
+
return {};
|
|
12558
|
+
}
|
|
12559
|
+
try {
|
|
12560
|
+
const result = await Promise.resolve(this.requestInterceptor.addAdditionalHeaderFields(url));
|
|
12561
|
+
return filterCustomHeaders(result, this.logger, correlationId);
|
|
12562
|
+
}
|
|
12563
|
+
catch (e) {
|
|
12564
|
+
this.logger?.warningPii(`1x9eyr ${e}`, correlationId);
|
|
12565
|
+
return {};
|
|
12566
|
+
}
|
|
12567
|
+
}
|
|
12568
|
+
}
|
|
12569
|
+
|
|
12570
|
+
/*
|
|
12571
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12572
|
+
* Licensed under the MIT License.
|
|
12573
|
+
*/
|
|
12574
|
+
const AuthenticationFactorV2 = {
|
|
12575
|
+
SINGLE_FACTOR: "singleFactor",
|
|
12576
|
+
MULTI_FACTOR: "multiFactor",
|
|
12577
|
+
};
|
|
12578
|
+
const ChallengeNextActionV2 = {
|
|
12579
|
+
VERIFY: "verify",
|
|
12580
|
+
RISK_VERIFY: "riskVerify",
|
|
12581
|
+
};
|
|
12582
|
+
const VerifyNextActionV2 = {
|
|
12583
|
+
UPDATE: "update",
|
|
12584
|
+
CONTINUE: "continue",
|
|
12585
|
+
CHALLENGE: "challenge",
|
|
12586
|
+
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12587
|
+
};
|
|
12588
|
+
|
|
12589
|
+
/*
|
|
12590
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12591
|
+
* Licensed under the MIT License.
|
|
12592
|
+
*/
|
|
12593
|
+
const SignUpSubmitAttributesNextActionV2 = {
|
|
12594
|
+
VERIFY: "verify",
|
|
12595
|
+
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12596
|
+
CONTINUE: "continue",
|
|
12597
|
+
};
|
|
12598
|
+
|
|
12599
|
+
/*
|
|
12600
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12601
|
+
* Licensed under the MIT License.
|
|
12602
|
+
*/
|
|
12603
|
+
/*
|
|
12604
|
+
* Native Auth V2 network client that follows server-provided HAL links.
|
|
12605
|
+
* Flow-specific entry methods reuse shared challenge, verification, and token operations.
|
|
12606
|
+
*/
|
|
12607
|
+
class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
12608
|
+
/*
|
|
12609
|
+
* Starts the reset-password flow using a server-provided link.
|
|
12610
|
+
*/
|
|
12611
|
+
async resetPasswordStart(resetPasswordHref, request, context) {
|
|
12612
|
+
return this.sendStartRequest(resetPasswordHref, request, context);
|
|
12613
|
+
}
|
|
12614
|
+
/*
|
|
12615
|
+
* Starts sign-in using a server-provided link.
|
|
12616
|
+
*/
|
|
12617
|
+
async signInStart(signInHref, request, context) {
|
|
12618
|
+
const result = await this.sendStartRequest(signInHref, request, context);
|
|
12619
|
+
return result;
|
|
12620
|
+
}
|
|
12621
|
+
/*
|
|
12622
|
+
* Starts sign-up using a server-provided link.
|
|
12623
|
+
*/
|
|
12624
|
+
async signUpStart(signUpHref, request, context) {
|
|
12625
|
+
const parsedResponse = await this.sendActionRequest(signUpHref, HttpMethod.POST, request, context);
|
|
12626
|
+
return {
|
|
12627
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
12628
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", parsedResponse.correlationId),
|
|
12629
|
+
attributes: parsedResponse.body.attributes,
|
|
12630
|
+
};
|
|
12631
|
+
}
|
|
12632
|
+
/*
|
|
12633
|
+
* Submits the initial sign-up attributes. A successful response has already
|
|
12634
|
+
* sent the email code and supplies the links needed to verify or resend it.
|
|
12635
|
+
*/
|
|
12636
|
+
async submitSignUpAttributes(submitAttributesHref, request, context) {
|
|
12637
|
+
const parsedResponse = await this.sendActionRequest(submitAttributesHref, HttpMethod.POST, request, context);
|
|
12638
|
+
const correlationId = parsedResponse.correlationId;
|
|
12639
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
12640
|
+
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
12641
|
+
return {
|
|
12642
|
+
nextAction: SignUpSubmitAttributesNextActionV2.CONTINUE,
|
|
12643
|
+
continuationToken,
|
|
12644
|
+
};
|
|
12645
|
+
}
|
|
12646
|
+
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
12647
|
+
return {
|
|
12648
|
+
nextAction: SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES,
|
|
12649
|
+
continuationToken,
|
|
12650
|
+
attributes: parsedResponse.body.attributes ?? [],
|
|
12651
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
12652
|
+
};
|
|
12653
|
+
}
|
|
12654
|
+
if (parsedResponse.body.action === VERIFY_RELATION) {
|
|
12655
|
+
return {
|
|
12656
|
+
...this.toChallengeVerificationResult(parsedResponse),
|
|
12657
|
+
attributes: parsedResponse.body.attributes,
|
|
12658
|
+
};
|
|
12659
|
+
}
|
|
12660
|
+
const message = "Invalid HAL response: sign-up attribute submission returned no known next action";
|
|
12661
|
+
this.logger?.error(message, correlationId);
|
|
12662
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
12663
|
+
}
|
|
12664
|
+
/*
|
|
12665
|
+
* Requests the selected method's challenge and returns the data needed for verification.
|
|
12666
|
+
*/
|
|
12667
|
+
async requestChallenge(challengeHref, request, context) {
|
|
12668
|
+
const parsedResponse = await this.sendActionRequest(challengeHref, HttpMethod.POST, request, context);
|
|
12669
|
+
return this.toChallengeResult(parsedResponse);
|
|
12670
|
+
}
|
|
12671
|
+
async verifyRisk(riskVerifyHref, request, context) {
|
|
12672
|
+
const parsedResponse = await this.sendActionRequest(riskVerifyHref, HttpMethod.POST, request, context);
|
|
12673
|
+
if (parsedResponse.body.action !== VERIFY_RELATION) {
|
|
12674
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: SMS risk verification returned no known next action", parsedResponse.correlationId);
|
|
12675
|
+
}
|
|
12676
|
+
if (parsedResponse.body.type?.toLowerCase() !==
|
|
12677
|
+
AuthenticationMethodTypeV2.SMS) {
|
|
12678
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: SMS risk verification returned a non-SMS challenge", parsedResponse.correlationId);
|
|
12679
|
+
}
|
|
12680
|
+
return this.toChallengeVerificationResult(parsedResponse);
|
|
12681
|
+
}
|
|
12682
|
+
/*
|
|
12683
|
+
* Verifies the submitted credential and returns the server-directed next action.
|
|
12684
|
+
*/
|
|
12685
|
+
async verifyChallenge(verifyHref, request, context) {
|
|
12686
|
+
const parsedResponse = await this.sendActionRequest(verifyHref, HttpMethod.POST, request, context);
|
|
12687
|
+
return this.toVerifyResult(parsedResponse);
|
|
12688
|
+
}
|
|
12689
|
+
/*
|
|
12690
|
+
* Submits the new password and returns the link used to poll for completion.
|
|
12691
|
+
*/
|
|
12692
|
+
async submitNewPassword(updateHref, request, context) {
|
|
12693
|
+
const parsedResponse = await this.sendActionRequest(updateHref, HttpMethod.PUT, request, context);
|
|
12694
|
+
const nextContinuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12695
|
+
return {
|
|
12696
|
+
continuationToken: nextContinuationToken,
|
|
12697
|
+
pollHref: this.handler.requireHref(parsedResponse.body._links?.poll?.href, "poll", parsedResponse.correlationId),
|
|
12698
|
+
};
|
|
12699
|
+
}
|
|
12700
|
+
/*
|
|
12701
|
+
* Polls once for reset completion and returns the next server-provided link.
|
|
12702
|
+
*/
|
|
12703
|
+
async poll(pollHref, request, context) {
|
|
12704
|
+
const parsedResponse = await this.sendActionRequest(pollHref, HttpMethod.POST, request, context);
|
|
12705
|
+
const isCompleted = parsedResponse.body.state === ResponseStateV2.CONTINUE;
|
|
12706
|
+
return {
|
|
12707
|
+
continuationToken: parsedResponse.continuationToken ?? request.continuationToken,
|
|
12708
|
+
isCompleted,
|
|
12709
|
+
pollHref: isCompleted
|
|
12710
|
+
? undefined
|
|
12711
|
+
: this.handler.requireHref(parsedResponse.body._links?.poll?.href, "poll", parsedResponse.correlationId),
|
|
12712
|
+
};
|
|
12713
|
+
}
|
|
12714
|
+
async sendStartRequest(startHref, request, context) {
|
|
12715
|
+
const parsedResponse = await this.sendActionRequest(startHref, HttpMethod.POST, request, context);
|
|
12716
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12717
|
+
return {
|
|
12718
|
+
continuationToken,
|
|
12719
|
+
methods: this.resolveMethods(parsedResponse.body, parsedResponse.correlationId),
|
|
12720
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
|
|
12721
|
+
scenario: parsedResponse.body.scenario,
|
|
12722
|
+
};
|
|
12723
|
+
}
|
|
12724
|
+
toVerifyResult(parsedResponse) {
|
|
12725
|
+
const correlationId = parsedResponse.correlationId;
|
|
12726
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
12727
|
+
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
12728
|
+
return {
|
|
12729
|
+
nextAction: VerifyNextActionV2.CONTINUE,
|
|
12730
|
+
continuationToken,
|
|
12731
|
+
};
|
|
12732
|
+
}
|
|
12733
|
+
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
12734
|
+
return {
|
|
12735
|
+
nextAction: VerifyNextActionV2.COLLECT_ATTRIBUTES,
|
|
12736
|
+
continuationToken,
|
|
12737
|
+
attributes: parsedResponse.body.attributes ?? [],
|
|
12738
|
+
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
12739
|
+
};
|
|
12740
|
+
}
|
|
12741
|
+
if (parsedResponse.body.action === UPDATE_RELATION) {
|
|
12742
|
+
return {
|
|
12743
|
+
nextAction: VerifyNextActionV2.UPDATE,
|
|
12744
|
+
continuationToken,
|
|
12745
|
+
updateHref: this.handler.requireHref(parsedResponse.body._links?.update?.href, "update", correlationId),
|
|
12746
|
+
};
|
|
12747
|
+
}
|
|
12748
|
+
if (parsedResponse.body.action === CHALLENGE_RELATION) {
|
|
12749
|
+
return {
|
|
12750
|
+
nextAction: VerifyNextActionV2.CHALLENGE,
|
|
12751
|
+
continuationToken,
|
|
12752
|
+
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
|
|
12753
|
+
methods: this.resolveMethods(parsedResponse.body, correlationId),
|
|
12754
|
+
};
|
|
12755
|
+
}
|
|
12756
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: verify returned no known next action", correlationId);
|
|
12757
|
+
}
|
|
12758
|
+
resolveAuthenticationFactor(authenticationFactor, correlationId) {
|
|
12759
|
+
if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR ||
|
|
12760
|
+
authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
|
|
12761
|
+
return authenticationFactor;
|
|
12762
|
+
}
|
|
12763
|
+
const message = authenticationFactor
|
|
12764
|
+
? `Unexpected authentication factor '${authenticationFactor}'.`
|
|
12765
|
+
: "The response did not include an authentication factor.";
|
|
12766
|
+
this.logger?.error(message, correlationId);
|
|
12767
|
+
throw new CustomAuthApiError(UNEXPECTED_AUTHENTICATION_FACTOR, message, correlationId);
|
|
12768
|
+
}
|
|
12769
|
+
toChallengeResult(parsedResponse) {
|
|
12770
|
+
if (parsedResponse.body.action === RISK_VERIFY_RELATION) {
|
|
12771
|
+
const riskResponse = parsedResponse.body;
|
|
12772
|
+
return {
|
|
12773
|
+
nextAction: ChallengeNextActionV2.RISK_VERIFY,
|
|
12774
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
12775
|
+
riskVerifyHref: this.handler.requireHref(riskResponse._links?.riskverify?.href, RISK_VERIFY_RELATION, parsedResponse.correlationId),
|
|
12776
|
+
};
|
|
12777
|
+
}
|
|
12778
|
+
if (parsedResponse.body.action === VERIFY_RELATION) {
|
|
12779
|
+
return this.toChallengeVerificationResult(parsedResponse);
|
|
12780
|
+
}
|
|
12781
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: challenge returned no known next action", parsedResponse.correlationId);
|
|
12782
|
+
}
|
|
12783
|
+
toChallengeVerificationResult(parsedResponse) {
|
|
12784
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12785
|
+
const links = parsedResponse.body._links;
|
|
12786
|
+
const codeMetadata = "hint" in parsedResponse.body ||
|
|
12787
|
+
"codeLength" in parsedResponse.body ||
|
|
12788
|
+
"payload" in parsedResponse.body
|
|
12789
|
+
? parsedResponse.body
|
|
12790
|
+
: undefined;
|
|
12791
|
+
return {
|
|
12792
|
+
nextAction: ChallengeNextActionV2.VERIFY,
|
|
12793
|
+
continuationToken,
|
|
12794
|
+
verifyHref: this.handler.requireHref(links?.verify?.href, "verify", parsedResponse.correlationId),
|
|
12795
|
+
resendHref: links && "resend" in links ? links.resend?.href : undefined,
|
|
12796
|
+
codeLength: codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength,
|
|
12797
|
+
hint: codeMetadata?.hint,
|
|
12798
|
+
type: parsedResponse.body.type,
|
|
12799
|
+
};
|
|
12800
|
+
}
|
|
12801
|
+
resolveMethods(body, correlationId) {
|
|
12802
|
+
const methods = this.handler.requireMethods(body._embedded?.methods, correlationId);
|
|
12803
|
+
const resolved = [];
|
|
12804
|
+
methods.forEach((method, index) => {
|
|
12805
|
+
const href = method._links?.challenge?.href;
|
|
12806
|
+
if (href) {
|
|
12807
|
+
resolved.push({
|
|
12808
|
+
id: method.id ?? method.type ?? `method-${index}`,
|
|
12809
|
+
type: method.type,
|
|
12810
|
+
hint: method.hint,
|
|
12811
|
+
challengeHref: href,
|
|
12812
|
+
});
|
|
12813
|
+
}
|
|
12814
|
+
});
|
|
12815
|
+
if (resolved.length === 0) {
|
|
12816
|
+
this.logger?.error("1poo9g", correlationId);
|
|
12817
|
+
throw new CustomAuthApiError(NO_AUTHENTICATION_METHODS, "The flow-start response contains no authentication method with a challenge link", correlationId);
|
|
12818
|
+
}
|
|
12819
|
+
return resolved;
|
|
12820
|
+
}
|
|
12821
|
+
}
|
|
12822
|
+
|
|
12823
|
+
/*
|
|
12824
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12825
|
+
* Licensed under the MIT License.
|
|
12826
|
+
*/
|
|
12827
|
+
/*
|
|
12828
|
+
* Shared base for Native Auth V2 interaction clients. It extends
|
|
12829
|
+
* `StandardInteractionClient` for common browser infrastructure while keeping
|
|
12830
|
+
* V1 and V2 token handling independent.
|
|
12831
|
+
*/
|
|
12832
|
+
class InteractionClientBaseV2 extends StandardInteractionClient {
|
|
12833
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority) {
|
|
12834
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, "");
|
|
12835
|
+
this.customAuthAuthority = customAuthAuthority;
|
|
12836
|
+
this.tokenResponseHandler = new ResponseHandler(this.config.auth.clientId, this.browserStorage, this.browserCrypto, this.logger, this.performanceClient, null, null);
|
|
12837
|
+
}
|
|
12838
|
+
// Required by the base contract. After sign-in, use CustomAuthAccountData.getAccessToken().
|
|
12839
|
+
acquireToken(
|
|
12840
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12841
|
+
request) {
|
|
12842
|
+
throw new MethodNotImplementedError("InteractionClientBaseV2.acquireToken");
|
|
12843
|
+
}
|
|
12844
|
+
// Required by the base contract. After sign-in, use CustomAuthAccountData.signOut().
|
|
12845
|
+
logout(
|
|
12846
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12847
|
+
request) {
|
|
12848
|
+
throw new MethodNotImplementedError("InteractionClientBaseV2.logout");
|
|
12849
|
+
}
|
|
12850
|
+
getScopes(scopes) {
|
|
12851
|
+
const requestedScopes = scopes?.filter((scope) => !!scope) ?? [];
|
|
12852
|
+
const seenScopes = new Set(requestedScopes.map((scope) => scope.toLowerCase()));
|
|
12853
|
+
const defaultScopes = [
|
|
12854
|
+
OPENID_SCOPE,
|
|
12855
|
+
PROFILE_SCOPE,
|
|
12856
|
+
OFFLINE_ACCESS_SCOPE,
|
|
12857
|
+
];
|
|
12858
|
+
return [
|
|
12859
|
+
...requestedScopes,
|
|
12860
|
+
...defaultScopes.filter((scope) => !seenScopes.has(scope.toLowerCase())),
|
|
12861
|
+
];
|
|
12862
|
+
}
|
|
12863
|
+
async handleTokenResponse(tokenResponse, requestScopes, correlationId, apiId) {
|
|
12864
|
+
this.logger.verbose("1aahxi", correlationId);
|
|
12865
|
+
const requestTimestamp = Math.round(new Date().getTime() / 1000.0);
|
|
12866
|
+
const result = await this.tokenResponseHandler.handleServerTokenResponse(tokenResponse, this.customAuthAuthority, requestTimestamp, {
|
|
12867
|
+
authority: this.customAuthAuthority.canonicalAuthority,
|
|
12868
|
+
correlationId,
|
|
12869
|
+
scopes: requestScopes,
|
|
12870
|
+
}, apiId);
|
|
12871
|
+
return result;
|
|
12872
|
+
}
|
|
12873
|
+
createRequestContext(apiId, correlationId) {
|
|
12874
|
+
return {
|
|
12875
|
+
correlationId,
|
|
12876
|
+
telemetryManager: initializeServerTelemetryManager(apiId, this.config.auth.clientId, correlationId, this.browserStorage, this.logger),
|
|
12877
|
+
};
|
|
12878
|
+
}
|
|
12879
|
+
}
|
|
12880
|
+
|
|
12881
|
+
/*
|
|
12882
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12883
|
+
* Licensed under the MIT License.
|
|
12884
|
+
*/
|
|
12885
|
+
// Result type discriminators.
|
|
12886
|
+
const FLOW_METHOD_SELECTION_REQUIRED_V2 = "FlowMethodSelectionRequiredResultV2";
|
|
12887
|
+
const FLOW_CODE_REQUIRED_V2 = "FlowCodeRequiredResultV2";
|
|
12888
|
+
const FLOW_PASSWORD_REQUIRED_V2 = "FlowPasswordRequiredResultV2";
|
|
12889
|
+
const FLOW_SIGN_UP_PASSWORD_REQUIRED_V2 = "FlowSignUpPasswordRequiredResultV2";
|
|
12890
|
+
const FLOW_MFA_REQUIRED_V2 = "FlowMFARequiredResultV2";
|
|
12891
|
+
const FLOW_NEW_PASSWORD_REQUIRED_V2 = "FlowNewPasswordRequiredResultV2";
|
|
12892
|
+
const FLOW_ATTRIBUTES_REQUIRED_V2 = "FlowAttributesRequiredResultV2";
|
|
12893
|
+
const FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 = "FlowSignInContinuationRequiredResultV2";
|
|
12894
|
+
const FLOW_COMPLETED_V2 = "FlowCompletedResultV2";
|
|
12895
|
+
function createFlowMethodSelectionRequiredResultV2(input) {
|
|
12896
|
+
return { type: FLOW_METHOD_SELECTION_REQUIRED_V2, ...input };
|
|
12897
|
+
}
|
|
12898
|
+
function createFlowCodeRequiredResultV2(input) {
|
|
12899
|
+
return { type: FLOW_CODE_REQUIRED_V2, ...input };
|
|
12900
|
+
}
|
|
12901
|
+
function createFlowPasswordRequiredResultV2(input) {
|
|
12902
|
+
return { type: FLOW_PASSWORD_REQUIRED_V2, ...input };
|
|
12903
|
+
}
|
|
12904
|
+
function createFlowSignUpPasswordRequiredResultV2(input) {
|
|
12905
|
+
return { type: FLOW_SIGN_UP_PASSWORD_REQUIRED_V2, ...input };
|
|
12906
|
+
}
|
|
12907
|
+
function createFlowMFARequiredResultV2(input) {
|
|
12908
|
+
return { type: FLOW_MFA_REQUIRED_V2, ...input };
|
|
12909
|
+
}
|
|
12910
|
+
function createFlowNewPasswordRequiredResultV2(input) {
|
|
12911
|
+
return { type: FLOW_NEW_PASSWORD_REQUIRED_V2, ...input };
|
|
12912
|
+
}
|
|
12913
|
+
function createFlowAttributesRequiredResultV2(input) {
|
|
12914
|
+
return { type: FLOW_ATTRIBUTES_REQUIRED_V2, ...input };
|
|
12915
|
+
}
|
|
12916
|
+
function createFlowSignInContinuationRequiredResultV2(input) {
|
|
12917
|
+
return { type: FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2, ...input };
|
|
12918
|
+
}
|
|
12919
|
+
function createFlowCompletedResultV2(input) {
|
|
12920
|
+
return { type: FLOW_COMPLETED_V2, ...input };
|
|
12921
|
+
}
|
|
12922
|
+
|
|
12923
|
+
/*
|
|
12924
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12925
|
+
* Licensed under the MIT License.
|
|
12926
|
+
*/
|
|
12927
|
+
/**
|
|
12928
|
+
* The native auth V2 flow that a result or error originates from (sign-in,
|
|
12929
|
+
* sign-up, or password reset). It lets a shared result or error type report
|
|
12930
|
+
* which entry flow produced it; `Unknown` is used when the flow cannot be
|
|
12931
|
+
* determined.
|
|
12932
|
+
*/
|
|
12933
|
+
const CustomAuthFlowScenarioV2 = {
|
|
12934
|
+
SignIn: "signIn",
|
|
12935
|
+
SignUp: "signUp",
|
|
12936
|
+
PasswordReset: "passwordReset",
|
|
12937
|
+
Unknown: "unknown",
|
|
12938
|
+
};
|
|
12939
|
+
|
|
12940
|
+
/*
|
|
12941
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12942
|
+
* Licensed under the MIT License.
|
|
12943
|
+
*/
|
|
12944
|
+
const FLOW_STEP_API_IDS_V2 = {
|
|
12945
|
+
[CustomAuthFlowScenarioV2.PasswordReset]: {
|
|
12946
|
+
requestChallenge: RESET_PASSWORD_V2_CHALLENGE,
|
|
12947
|
+
submitCode: RESET_PASSWORD_V2_SUBMIT_CODE,
|
|
12948
|
+
resendCode: RESET_PASSWORD_V2_RESEND_CODE,
|
|
12949
|
+
submitNewPassword: RESET_PASSWORD_V2_SUBMIT,
|
|
12950
|
+
signInWithContinuation: SIGN_IN_AFTER_PASSWORD_RESET,
|
|
12951
|
+
},
|
|
12952
|
+
[CustomAuthFlowScenarioV2.SignIn]: {
|
|
12953
|
+
requestChallenge: SIGN_IN_V2_CHALLENGE,
|
|
12954
|
+
submitCode: SIGN_IN_V2_SUBMIT_CODE,
|
|
12955
|
+
resendCode: SIGN_IN_V2_CHALLENGE,
|
|
12956
|
+
submitPassword: SIGN_IN_V2_SUBMIT_PASSWORD,
|
|
12957
|
+
signInWithContinuation: SIGN_IN_V2_COMPLETE,
|
|
12958
|
+
},
|
|
12959
|
+
[CustomAuthFlowScenarioV2.SignUp]: {
|
|
12960
|
+
requestChallenge: SIGN_UP_V2_CHALLENGE,
|
|
12961
|
+
submitCode: SIGN_UP_V2_SUBMIT_CODE,
|
|
12962
|
+
resendCode: SIGN_UP_V2_RESEND_CODE,
|
|
12963
|
+
submitAttributes: SIGN_UP_V2_SUBMIT_ATTRIBUTES,
|
|
12964
|
+
signInWithContinuation: SIGN_UP_V2_COMPLETE,
|
|
12965
|
+
},
|
|
12966
|
+
};
|
|
12967
|
+
function getPublicApiIdV2(scenario, step) {
|
|
12968
|
+
return FLOW_STEP_API_IDS_V2[scenario]?.[step];
|
|
12969
|
+
}
|
|
12970
|
+
|
|
12971
|
+
/*
|
|
12972
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12973
|
+
* Licensed under the MIT License.
|
|
12974
|
+
*/
|
|
12975
|
+
/*
|
|
12976
|
+
* Polls up to five times for password-update completion, waiting 1.5 seconds
|
|
12977
|
+
* between attempts. The first request runs immediately.
|
|
12978
|
+
*/
|
|
12979
|
+
const POLL_MAX_ATTEMPTS = 5;
|
|
12980
|
+
// TODO: Replace this fallback with the server-provided polling interval once available.
|
|
12981
|
+
const POLL_INTERVAL_MS = 1500;
|
|
12982
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
12983
|
+
/*
|
|
12984
|
+
* Drives server-directed Native Auth V2 flows using opaque continuation state
|
|
12985
|
+
* and HAL links. Each operation returns only its valid discriminated results.
|
|
12986
|
+
*/
|
|
12987
|
+
class FlowInteractionClientV2 extends InteractionClientBaseV2 {
|
|
12988
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority, apiClient) {
|
|
12989
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, customAuthAuthority);
|
|
12990
|
+
this.apiClient = apiClient;
|
|
12991
|
+
}
|
|
12992
|
+
/*
|
|
12993
|
+
* Starts sign-in using the preferred supported method offered by the server.
|
|
12994
|
+
*/
|
|
12995
|
+
async signIn(parameters) {
|
|
12996
|
+
const correlationId = parameters.correlationId;
|
|
12997
|
+
const context = this.createRequestContext(SIGN_IN_V2_START, correlationId);
|
|
12998
|
+
this.logger.verbose("1jeyrn", correlationId);
|
|
12999
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context);
|
|
13000
|
+
const startResult = await this.apiClient.signInStart(this.requireLink(correlationId, entryResult.signInHref, {
|
|
13001
|
+
code: SIGN_IN_UNSUPPORTED,
|
|
13002
|
+
message: "The authorize-challenge entry response did not include a sign-in link.",
|
|
13003
|
+
}), {
|
|
13004
|
+
continuationToken: entryResult.continuationToken,
|
|
13005
|
+
username: parameters.username,
|
|
13006
|
+
}, context);
|
|
13007
|
+
this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "sign-in start", correlationId);
|
|
13008
|
+
const continuationState = {
|
|
13009
|
+
continuationToken: startResult.continuationToken,
|
|
13010
|
+
scenario: CustomAuthFlowScenarioV2.SignIn,
|
|
13011
|
+
links: {},
|
|
13012
|
+
tokenRequest: {
|
|
13013
|
+
scopes: parameters.scopes,
|
|
13014
|
+
},
|
|
13015
|
+
};
|
|
13016
|
+
const methods = startResult.methods.map((method) => ({
|
|
13017
|
+
id: method.id,
|
|
13018
|
+
type: method.type ?? "",
|
|
13019
|
+
hint: method.hint,
|
|
13020
|
+
challengeHref: method.challengeHref,
|
|
13021
|
+
}));
|
|
13022
|
+
const selectedMethod = this.selectSignInMethod(methods, parameters.password !== undefined, correlationId);
|
|
13023
|
+
const challengeResult = await this.requestChallenge({
|
|
13024
|
+
correlationId,
|
|
13025
|
+
continuationState: {
|
|
13026
|
+
...continuationState,
|
|
13027
|
+
links: {
|
|
13028
|
+
...continuationState.links,
|
|
13029
|
+
challenge: selectedMethod.challengeHref,
|
|
13030
|
+
},
|
|
13031
|
+
},
|
|
13032
|
+
});
|
|
13033
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2) {
|
|
13034
|
+
return {
|
|
13035
|
+
...challengeResult,
|
|
13036
|
+
method: selectedMethod,
|
|
13037
|
+
};
|
|
13038
|
+
}
|
|
13039
|
+
if (parameters.password) {
|
|
13040
|
+
return this.submitSignInPassword({
|
|
13041
|
+
correlationId,
|
|
13042
|
+
continuationState: challengeResult.continuationState,
|
|
13043
|
+
password: parameters.password,
|
|
13044
|
+
});
|
|
13045
|
+
}
|
|
13046
|
+
return challengeResult;
|
|
13047
|
+
}
|
|
13048
|
+
/*
|
|
13049
|
+
* Starts sign-up and resolves the server-provided attribute-submission transition.
|
|
13050
|
+
*/
|
|
13051
|
+
async signUp(parameters) {
|
|
13052
|
+
const correlationId = parameters.correlationId;
|
|
13053
|
+
const context = this.createRequestContext(SIGN_UP_V2_START, correlationId);
|
|
13054
|
+
this.logger.verbose("19e1ak", correlationId);
|
|
13055
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context, parameters.scopes);
|
|
13056
|
+
const startResult = await this.apiClient.signUpStart(this.requireLink(correlationId, entryResult.signUpHref, {
|
|
13057
|
+
code: SIGN_UP_UNSUPPORTED,
|
|
13058
|
+
message: "The authorize-challenge entry response did not include a sign-up link.",
|
|
13059
|
+
}), {
|
|
13060
|
+
continuationToken: entryResult.continuationToken,
|
|
13061
|
+
}, context);
|
|
13062
|
+
const attributes = Object.fromEntries(Object.entries(parameters.attributes ?? {}).filter(([name]) => name.toLowerCase() !== "email" &&
|
|
13063
|
+
name.toLowerCase() !== "password"));
|
|
13064
|
+
attributes.email = parameters.username;
|
|
13065
|
+
if (parameters.password !== undefined) {
|
|
13066
|
+
attributes.password = parameters.password;
|
|
13067
|
+
}
|
|
13068
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(startResult.submitAttributesHref, {
|
|
13069
|
+
continuationToken: startResult.continuationToken,
|
|
13070
|
+
attributes,
|
|
13071
|
+
}, context);
|
|
13072
|
+
const continuationState = {
|
|
13073
|
+
continuationToken: startResult.continuationToken,
|
|
13074
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
13075
|
+
links: {},
|
|
13076
|
+
tokenRequest: {
|
|
13077
|
+
scopes: parameters.scopes,
|
|
13078
|
+
},
|
|
13079
|
+
signUp: {
|
|
13080
|
+
passwordWasSupplied: attributes.password !== undefined,
|
|
13081
|
+
},
|
|
13082
|
+
};
|
|
13083
|
+
const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
|
|
13084
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
13085
|
+
const message = "Initial sign-up attribute submission cannot complete without code verification or additional attributes.";
|
|
13086
|
+
this.logger.error(message, correlationId);
|
|
13087
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13088
|
+
}
|
|
13089
|
+
return result;
|
|
13090
|
+
}
|
|
13091
|
+
/*
|
|
13092
|
+
* Starts password reset, automatically challenging a sole method or
|
|
13093
|
+
* returning multiple methods for selection.
|
|
13094
|
+
*/
|
|
13095
|
+
async resetPassword(parameters) {
|
|
13096
|
+
const correlationId = parameters.correlationId;
|
|
13097
|
+
const context = this.createRequestContext(RESET_PASSWORD_V2_START, correlationId);
|
|
13098
|
+
this.logger.verbose("1en88i", correlationId);
|
|
13099
|
+
const entryResult = await this.apiClient.authorizeChallengeStart(context);
|
|
13100
|
+
const startResult = await this.apiClient.resetPasswordStart(this.requireLink(correlationId, entryResult.resetPasswordHref, {
|
|
13101
|
+
code: RESET_PASSWORD_UNSUPPORTED,
|
|
13102
|
+
message: "The authorize-challenge entry response did not include a reset-password link.",
|
|
13103
|
+
}), {
|
|
13104
|
+
username: parameters.username,
|
|
13105
|
+
continuationToken: entryResult.continuationToken,
|
|
13106
|
+
}, context);
|
|
13107
|
+
this.ensureAuthenticationFactor(startResult.authenticationFactor, AuthenticationFactorV2.SINGLE_FACTOR, "password-reset start", correlationId);
|
|
13108
|
+
const continuationState = {
|
|
13109
|
+
continuationToken: startResult.continuationToken,
|
|
13110
|
+
scenario: CustomAuthFlowScenarioV2.PasswordReset,
|
|
13111
|
+
links: {},
|
|
13112
|
+
};
|
|
13113
|
+
const methods = startResult.methods.map((method) => ({
|
|
13114
|
+
id: method.id,
|
|
13115
|
+
type: method.type ?? "",
|
|
13116
|
+
hint: method.hint,
|
|
13117
|
+
challengeHref: method.challengeHref,
|
|
13118
|
+
}));
|
|
13119
|
+
if (methods.length === 0) {
|
|
13120
|
+
const message = "The password-reset start response did not include an authentication method.";
|
|
13121
|
+
this.logger.error(message, correlationId);
|
|
13122
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13123
|
+
}
|
|
13124
|
+
if (methods.length === 1) {
|
|
13125
|
+
const selectedMethod = methods[0];
|
|
13126
|
+
const challengeResult = await this.requestChallenge({
|
|
13127
|
+
correlationId,
|
|
13128
|
+
continuationState: {
|
|
13129
|
+
...continuationState,
|
|
13130
|
+
links: {
|
|
13131
|
+
challenge: selectedMethod.challengeHref,
|
|
13132
|
+
},
|
|
13133
|
+
},
|
|
13134
|
+
});
|
|
13135
|
+
if (challengeResult.type === FLOW_CODE_REQUIRED_V2 &&
|
|
13136
|
+
(challengeResult.channel?.toLowerCase() ===
|
|
13137
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
13138
|
+
challengeResult.channel?.toLowerCase() ===
|
|
13139
|
+
AuthenticationMethodTypeV2.SMS)) {
|
|
13140
|
+
return {
|
|
13141
|
+
...challengeResult,
|
|
13142
|
+
method: selectedMethod,
|
|
13143
|
+
};
|
|
13144
|
+
}
|
|
13145
|
+
const channel = challengeResult.type === FLOW_CODE_REQUIRED_V2
|
|
13146
|
+
? challengeResult.channel
|
|
13147
|
+
: AuthenticationMethodTypeV2.PASSWORD;
|
|
13148
|
+
const message = `Challenge type '${challengeResult.type}' with channel '${channel}' is not supported for password reset.`;
|
|
13149
|
+
this.logger.error(message, correlationId);
|
|
13150
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13151
|
+
}
|
|
13152
|
+
this.logger.verbose("0k8yah", correlationId);
|
|
13153
|
+
return createFlowMethodSelectionRequiredResultV2({
|
|
13154
|
+
correlationId,
|
|
13155
|
+
continuationState,
|
|
13156
|
+
methods,
|
|
13157
|
+
});
|
|
13158
|
+
}
|
|
13159
|
+
/*
|
|
13160
|
+
* Requests a one-time code for the selected authentication method. Returns
|
|
13161
|
+
* the continuation state and code metadata needed for verification.
|
|
13162
|
+
*/
|
|
13163
|
+
async requestChallenge(parameters) {
|
|
13164
|
+
const challengeResult = await this.sendMethodChallenge(parameters, "requestChallenge");
|
|
13165
|
+
const challengeType = challengeResult.type ?? AuthenticationMethodTypeV2.EMAIL;
|
|
13166
|
+
const continuationState = this.createChallengeContinuationState(parameters.continuationState, challengeResult);
|
|
13167
|
+
if (challengeType.toLowerCase() === AuthenticationMethodTypeV2.PASSWORD) {
|
|
13168
|
+
return createFlowPasswordRequiredResultV2({
|
|
13169
|
+
correlationId: parameters.correlationId,
|
|
13170
|
+
continuationState,
|
|
13171
|
+
});
|
|
13172
|
+
}
|
|
13173
|
+
return createFlowCodeRequiredResultV2({
|
|
13174
|
+
correlationId: parameters.correlationId,
|
|
13175
|
+
continuationState,
|
|
13176
|
+
channel: challengeType,
|
|
13177
|
+
sentTo: challengeResult.hint,
|
|
13178
|
+
codeLength: challengeResult.codeLength,
|
|
13179
|
+
});
|
|
13180
|
+
}
|
|
13181
|
+
/*
|
|
13182
|
+
* Verifies the submitted one-time code using the server-provided link. The
|
|
13183
|
+
* response determines the next required action.
|
|
13184
|
+
*/
|
|
13185
|
+
async submitCode(parameters) {
|
|
13186
|
+
const continuationState = parameters.continuationState;
|
|
13187
|
+
const correlationId = parameters.correlationId;
|
|
13188
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId), correlationId);
|
|
13189
|
+
this.logger.verbose("16ks6n", correlationId);
|
|
13190
|
+
const verifyHref = this.requireLink(correlationId, continuationState.links.verify);
|
|
13191
|
+
const verifyRequest = {
|
|
13192
|
+
continuationToken: continuationState.continuationToken,
|
|
13193
|
+
otp: parameters.code,
|
|
13194
|
+
};
|
|
13195
|
+
const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
|
|
13196
|
+
if (continuationState.scenario ===
|
|
13197
|
+
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
13198
|
+
verifyResult.nextAction === VerifyNextActionV2.UPDATE) {
|
|
13199
|
+
return createFlowNewPasswordRequiredResultV2({
|
|
13200
|
+
correlationId,
|
|
13201
|
+
continuationState: {
|
|
13202
|
+
continuationToken: verifyResult.continuationToken,
|
|
13203
|
+
scenario: continuationState.scenario,
|
|
13204
|
+
links: { update: verifyResult.updateHref },
|
|
13205
|
+
},
|
|
13206
|
+
});
|
|
13207
|
+
}
|
|
13208
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
13209
|
+
return this.handleSignInVerification(continuationState, verifyResult, correlationId);
|
|
13210
|
+
}
|
|
13211
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13212
|
+
verifyResult.nextAction === VerifyNextActionV2.COLLECT_ATTRIBUTES) {
|
|
13213
|
+
const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13214
|
+
attribute.required === true);
|
|
13215
|
+
const nextContinuationState = {
|
|
13216
|
+
continuationToken: verifyResult.continuationToken,
|
|
13217
|
+
scenario: continuationState.scenario,
|
|
13218
|
+
links: {
|
|
13219
|
+
submitAttributes: verifyResult.submitAttributesHref,
|
|
13220
|
+
},
|
|
13221
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13222
|
+
signUp: continuationState.signUp,
|
|
13223
|
+
};
|
|
13224
|
+
const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13225
|
+
if (requiredPasswordAttribute &&
|
|
13226
|
+
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13227
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
13228
|
+
correlationId,
|
|
13229
|
+
continuationState: nextContinuationState,
|
|
13230
|
+
attributes,
|
|
13231
|
+
requiredPasswordAttribute,
|
|
13232
|
+
});
|
|
13233
|
+
}
|
|
13234
|
+
return createFlowAttributesRequiredResultV2({
|
|
13235
|
+
correlationId,
|
|
13236
|
+
continuationState: nextContinuationState,
|
|
13237
|
+
attributes,
|
|
13238
|
+
});
|
|
13239
|
+
}
|
|
13240
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13241
|
+
verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
13242
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13243
|
+
correlationId,
|
|
13244
|
+
continuationState: {
|
|
13245
|
+
continuationToken: verifyResult.continuationToken,
|
|
13246
|
+
scenario: continuationState.scenario,
|
|
13247
|
+
links: {},
|
|
13248
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13249
|
+
},
|
|
13250
|
+
});
|
|
13251
|
+
}
|
|
13252
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
|
|
13253
|
+
this.logger.error(message, correlationId);
|
|
13254
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13255
|
+
}
|
|
13256
|
+
/*
|
|
13257
|
+
* Requests a new one-time code using the server-provided resend link.
|
|
13258
|
+
* Returns refreshed continuation state and code metadata.
|
|
13259
|
+
*/
|
|
13260
|
+
async resendCode(parameters) {
|
|
13261
|
+
const challengeResult = await this.sendMethodChallenge(parameters, "resendCode");
|
|
13262
|
+
return createFlowCodeRequiredResultV2({
|
|
13263
|
+
correlationId: parameters.correlationId,
|
|
13264
|
+
continuationState: this.createChallengeContinuationState(parameters.continuationState, challengeResult),
|
|
13265
|
+
channel: challengeResult.type,
|
|
13266
|
+
sentTo: challengeResult.hint,
|
|
13267
|
+
codeLength: challengeResult.codeLength,
|
|
13268
|
+
});
|
|
13269
|
+
}
|
|
13270
|
+
async submitSignUpAttributes(parameters) {
|
|
13271
|
+
const { continuationState, correlationId, attributes } = parameters;
|
|
13272
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitAttributes", correlationId), correlationId);
|
|
13273
|
+
this.logger.verbose("0js2ub", correlationId);
|
|
13274
|
+
const submitResult = await this.apiClient.submitSignUpAttributes(this.requireLink(correlationId, continuationState.links.submitAttributes), {
|
|
13275
|
+
continuationToken: continuationState.continuationToken,
|
|
13276
|
+
attributes,
|
|
13277
|
+
}, context);
|
|
13278
|
+
return this.toSignUpActionResult(submitResult, {
|
|
13279
|
+
...continuationState,
|
|
13280
|
+
signUp: {
|
|
13281
|
+
passwordWasSupplied: continuationState.signUp?.passwordWasSupplied ===
|
|
13282
|
+
true || attributes.password !== undefined,
|
|
13283
|
+
},
|
|
13284
|
+
}, correlationId);
|
|
13285
|
+
}
|
|
13286
|
+
/*
|
|
13287
|
+
* Submits the new password and polls until the reset completes. The result
|
|
13288
|
+
* contains the continuation state required for explicit sign-in.
|
|
13289
|
+
*/
|
|
13290
|
+
async submitNewPassword(parameters) {
|
|
13291
|
+
const continuationState = parameters.continuationState;
|
|
13292
|
+
const correlationId = parameters.correlationId;
|
|
13293
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitNewPassword", correlationId), correlationId);
|
|
13294
|
+
this.logger.verbose("0ie1qa", correlationId);
|
|
13295
|
+
const updateResult = await this.apiClient.submitNewPassword(this.requireLink(correlationId, continuationState.links.update), {
|
|
13296
|
+
continuationToken: continuationState.continuationToken,
|
|
13297
|
+
newPassword: parameters.newPassword,
|
|
13298
|
+
}, context);
|
|
13299
|
+
let pollToken = updateResult.continuationToken;
|
|
13300
|
+
let pollHref = updateResult.pollHref;
|
|
13301
|
+
let completionToken;
|
|
13302
|
+
for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
|
|
13303
|
+
const pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
|
|
13304
|
+
if (pollResult.isCompleted) {
|
|
13305
|
+
completionToken = pollResult.continuationToken;
|
|
13306
|
+
break;
|
|
13307
|
+
}
|
|
13308
|
+
pollToken = pollResult.continuationToken;
|
|
13309
|
+
pollHref = pollResult.pollHref ?? pollHref;
|
|
13310
|
+
if (attempt < POLL_MAX_ATTEMPTS) {
|
|
13311
|
+
await delay(POLL_INTERVAL_MS);
|
|
13312
|
+
}
|
|
13313
|
+
}
|
|
13314
|
+
if (!completionToken) {
|
|
13315
|
+
const message = "The password reset did not complete within the allotted number of polling attempts.";
|
|
13316
|
+
this.logger.error(message, correlationId);
|
|
13317
|
+
throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
|
|
13318
|
+
}
|
|
13319
|
+
this.logger.verbose("0hrwdj", correlationId);
|
|
13320
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13321
|
+
correlationId,
|
|
13322
|
+
continuationState: {
|
|
13323
|
+
continuationToken: completionToken,
|
|
13324
|
+
scenario: continuationState.scenario,
|
|
13325
|
+
links: {},
|
|
13326
|
+
},
|
|
13327
|
+
});
|
|
13328
|
+
}
|
|
13329
|
+
/*
|
|
13330
|
+
* Verifies a sign-in password and returns the next sign-in action.
|
|
13331
|
+
*/
|
|
13332
|
+
async submitSignInPassword(parameters) {
|
|
13333
|
+
const verifyResult = await this.verifySignInPassword(parameters);
|
|
13334
|
+
return this.handleSignInVerification(parameters.continuationState, verifyResult, parameters.correlationId);
|
|
13335
|
+
}
|
|
13336
|
+
/*
|
|
13337
|
+
* Redeems the completed flow continuation for tokens. Returns the
|
|
13338
|
+
* authentication result after validating and caching the response.
|
|
13339
|
+
*/
|
|
13340
|
+
async signInWithContinuation(parameters) {
|
|
13341
|
+
const continuationState = parameters.continuationState;
|
|
13342
|
+
const correlationId = parameters.correlationId;
|
|
13343
|
+
const apiId = this.resolveStepApiId(continuationState.scenario, "signInWithContinuation", correlationId);
|
|
13344
|
+
const context = this.createRequestContext(apiId, correlationId);
|
|
13345
|
+
this.logger.verbose("09mk3f", correlationId);
|
|
13346
|
+
const scopes = this.getScopes(parameters.scopes);
|
|
13347
|
+
const tokenResponse = await this.apiClient.completeWithTokens({
|
|
13348
|
+
continuationToken: continuationState.continuationToken,
|
|
13349
|
+
scopes,
|
|
13350
|
+
}, context);
|
|
13351
|
+
const authenticationResult = await this.handleTokenResponse(tokenResponse, scopes, correlationId, apiId);
|
|
13352
|
+
this.logger.verbose("15nu4j", correlationId);
|
|
13353
|
+
return createFlowCompletedResultV2({
|
|
13354
|
+
correlationId,
|
|
13355
|
+
authenticationResult,
|
|
13356
|
+
});
|
|
13357
|
+
}
|
|
13358
|
+
async handleSignInVerification(continuationState, verifyResult, correlationId) {
|
|
13359
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CHALLENGE) {
|
|
13360
|
+
this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
|
|
13361
|
+
return createFlowMFARequiredResultV2({
|
|
13362
|
+
correlationId,
|
|
13363
|
+
continuationState: {
|
|
13364
|
+
continuationToken: verifyResult.continuationToken,
|
|
13365
|
+
scenario: continuationState.scenario,
|
|
13366
|
+
links: {},
|
|
13367
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13368
|
+
},
|
|
13369
|
+
methods: verifyResult.methods.map((method) => ({
|
|
13370
|
+
id: method.id,
|
|
13371
|
+
type: method.type ?? "",
|
|
13372
|
+
hint: method.hint,
|
|
13373
|
+
challengeHref: method.challengeHref,
|
|
13374
|
+
})),
|
|
13375
|
+
});
|
|
13376
|
+
}
|
|
13377
|
+
if (verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
13378
|
+
return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
|
|
13379
|
+
}
|
|
13380
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
|
|
13381
|
+
this.logger.error(message, correlationId);
|
|
13382
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13383
|
+
}
|
|
13384
|
+
selectSignInMethod(methods, passwordProvided, correlationId) {
|
|
13385
|
+
const passwordMethod = methods.find((method) => method.type.toLowerCase() ===
|
|
13386
|
+
AuthenticationMethodTypeV2.PASSWORD);
|
|
13387
|
+
const emailMethod = methods.find((method) => method.type.toLowerCase() === AuthenticationMethodTypeV2.EMAIL);
|
|
13388
|
+
if (passwordProvided) {
|
|
13389
|
+
if (passwordMethod) {
|
|
13390
|
+
return passwordMethod;
|
|
13391
|
+
}
|
|
13392
|
+
const message = "A password was supplied, but the sign-in response did not include a password method.";
|
|
13393
|
+
this.logger.error(message, correlationId);
|
|
13394
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13395
|
+
}
|
|
13396
|
+
const selectedMethod = emailMethod ?? passwordMethod;
|
|
13397
|
+
if (selectedMethod) {
|
|
13398
|
+
return selectedMethod;
|
|
13399
|
+
}
|
|
13400
|
+
const message = "The sign-in start response did not include a supported email or password method.";
|
|
13401
|
+
this.logger.error(message, correlationId);
|
|
13402
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13403
|
+
}
|
|
13404
|
+
toSignUpActionResult(result, continuationState, correlationId) {
|
|
13405
|
+
const nextAction = result.nextAction;
|
|
13406
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
13407
|
+
return createFlowCodeRequiredResultV2({
|
|
13408
|
+
correlationId,
|
|
13409
|
+
continuationState: {
|
|
13410
|
+
continuationToken: result.continuationToken,
|
|
13411
|
+
scenario: continuationState.scenario,
|
|
13412
|
+
links: {
|
|
13413
|
+
verify: result.verifyHref,
|
|
13414
|
+
resend: result.resendHref,
|
|
13415
|
+
},
|
|
13416
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13417
|
+
signUp: continuationState.signUp,
|
|
13418
|
+
},
|
|
13419
|
+
channel: result.type,
|
|
13420
|
+
sentTo: result.hint,
|
|
13421
|
+
codeLength: result.codeLength,
|
|
13422
|
+
});
|
|
13423
|
+
}
|
|
13424
|
+
if (result.nextAction ===
|
|
13425
|
+
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
|
|
13426
|
+
const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13427
|
+
attribute.required === true);
|
|
13428
|
+
const nextContinuationState = {
|
|
13429
|
+
continuationToken: result.continuationToken,
|
|
13430
|
+
scenario: continuationState.scenario,
|
|
13431
|
+
links: {
|
|
13432
|
+
submitAttributes: result.submitAttributesHref,
|
|
13433
|
+
},
|
|
13434
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13435
|
+
signUp: continuationState.signUp,
|
|
13436
|
+
};
|
|
13437
|
+
const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13438
|
+
if (requiredPasswordAttribute &&
|
|
13439
|
+
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13440
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
13441
|
+
correlationId,
|
|
13442
|
+
continuationState: nextContinuationState,
|
|
13443
|
+
attributes,
|
|
13444
|
+
requiredPasswordAttribute,
|
|
13445
|
+
});
|
|
13446
|
+
}
|
|
13447
|
+
return createFlowAttributesRequiredResultV2({
|
|
13448
|
+
correlationId,
|
|
13449
|
+
continuationState: nextContinuationState,
|
|
13450
|
+
attributes,
|
|
13451
|
+
});
|
|
13452
|
+
}
|
|
13453
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
|
|
13454
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13455
|
+
correlationId,
|
|
13456
|
+
continuationState: {
|
|
13457
|
+
continuationToken: result.continuationToken,
|
|
13458
|
+
scenario: continuationState.scenario,
|
|
13459
|
+
links: {},
|
|
13460
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13461
|
+
},
|
|
13462
|
+
});
|
|
13463
|
+
}
|
|
13464
|
+
const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
|
|
13465
|
+
this.logger.error(message, correlationId);
|
|
13466
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13467
|
+
}
|
|
13468
|
+
ensureAuthenticationFactor(authenticationFactor, expectedFactor, transition, correlationId) {
|
|
13469
|
+
if (authenticationFactor === expectedFactor) {
|
|
13470
|
+
return;
|
|
13471
|
+
}
|
|
13472
|
+
const message = `Authentication factor '${authenticationFactor}' is not supported for ${transition}.`;
|
|
13473
|
+
this.logger.error(message, correlationId);
|
|
13474
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13475
|
+
}
|
|
13476
|
+
async verifySignInPassword(parameters) {
|
|
13477
|
+
const { continuationState, correlationId } = parameters;
|
|
13478
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitPassword", correlationId), correlationId);
|
|
13479
|
+
this.logger.verbose("1bi1xn", correlationId);
|
|
13480
|
+
return this.apiClient.verifyChallenge(this.requireLink(correlationId, continuationState.links.verify), {
|
|
13481
|
+
continuationToken: continuationState.continuationToken,
|
|
13482
|
+
password: parameters.password,
|
|
13483
|
+
}, context);
|
|
13484
|
+
}
|
|
13485
|
+
completeSignInAfterVerification(continuationState, continuationToken, correlationId) {
|
|
13486
|
+
return this.signInWithContinuation({
|
|
13487
|
+
correlationId,
|
|
13488
|
+
continuationState: {
|
|
13489
|
+
continuationToken,
|
|
13490
|
+
scenario: continuationState.scenario,
|
|
13491
|
+
links: {},
|
|
13492
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13493
|
+
},
|
|
13494
|
+
scopes: continuationState.tokenRequest?.scopes,
|
|
13495
|
+
});
|
|
13496
|
+
}
|
|
13497
|
+
async sendMethodChallenge(parameters, step) {
|
|
13498
|
+
const continuationState = parameters.continuationState;
|
|
13499
|
+
const correlationId = parameters.correlationId;
|
|
13500
|
+
const challengeHref = step === "resendCode"
|
|
13501
|
+
? continuationState.links.resend
|
|
13502
|
+
: continuationState.links.challenge;
|
|
13503
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId), correlationId);
|
|
13504
|
+
this.logger.verbose(step === "0d2mys"
|
|
13505
|
+
? "Resending V2 one-time code."
|
|
13506
|
+
: "Requesting V2 challenge.", correlationId);
|
|
13507
|
+
const challengeResult = await this.apiClient.requestChallenge(this.requireLink(correlationId, challengeHref), { continuationToken: continuationState.continuationToken }, context);
|
|
13508
|
+
const nextAction = challengeResult.nextAction;
|
|
13509
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.VERIFY) {
|
|
13510
|
+
return challengeResult;
|
|
13511
|
+
}
|
|
13512
|
+
if (challengeResult.nextAction === ChallengeNextActionV2.RISK_VERIFY) {
|
|
13513
|
+
return this.apiClient.verifyRisk(challengeResult.riskVerifyHref, { continuationToken: challengeResult.continuationToken }, context);
|
|
13514
|
+
}
|
|
13515
|
+
const message = `Challenge next action '${nextAction}' is not supported.`;
|
|
13516
|
+
this.logger.error(message, correlationId);
|
|
13517
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13518
|
+
}
|
|
13519
|
+
createChallengeContinuationState(continuationState, challengeResult) {
|
|
13520
|
+
return {
|
|
13521
|
+
continuationToken: challengeResult.continuationToken,
|
|
13522
|
+
scenario: continuationState.scenario,
|
|
13523
|
+
links: {
|
|
13524
|
+
challenge: continuationState.links.challenge,
|
|
13525
|
+
verify: challengeResult.verifyHref,
|
|
13526
|
+
resend: challengeResult.resendHref ??
|
|
13527
|
+
continuationState.links.resend,
|
|
13528
|
+
},
|
|
13529
|
+
...(continuationState.tokenRequest && {
|
|
13530
|
+
tokenRequest: continuationState.tokenRequest,
|
|
13531
|
+
}),
|
|
13532
|
+
...(continuationState.signUp && {
|
|
13533
|
+
signUp: continuationState.signUp,
|
|
13534
|
+
}),
|
|
13535
|
+
};
|
|
13536
|
+
}
|
|
13537
|
+
resolveStepApiId(scenario, step, correlationId) {
|
|
13538
|
+
const apiId = getPublicApiIdV2(scenario, step);
|
|
13539
|
+
if (apiId === undefined) {
|
|
13540
|
+
const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
|
|
13541
|
+
this.logger.error(message, correlationId);
|
|
13542
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_STEP, message, correlationId);
|
|
13543
|
+
}
|
|
13544
|
+
return apiId;
|
|
13545
|
+
}
|
|
13546
|
+
requireLink(correlationId, href, missingLinkError) {
|
|
13547
|
+
if (!href) {
|
|
13548
|
+
const errorCode = missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
|
|
13549
|
+
const message = missingLinkError?.message ??
|
|
13550
|
+
"The continuation state is missing a link required to advance the flow.";
|
|
13551
|
+
this.logger.error(message, correlationId);
|
|
13552
|
+
throw new CustomAuthError(errorCode, message, correlationId);
|
|
13553
|
+
}
|
|
13554
|
+
return href;
|
|
13555
|
+
}
|
|
13556
|
+
}
|
|
13557
|
+
|
|
13558
|
+
/*
|
|
13559
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13560
|
+
* Licensed under the MIT License.
|
|
13561
|
+
*/
|
|
13562
|
+
/**
|
|
13563
|
+
* Terminal state indicating the operation failed.
|
|
13564
|
+
*
|
|
13565
|
+
* The error is carried by the result's `error` payload, not by this state.
|
|
13566
|
+
*/
|
|
13567
|
+
class FailedStateV2 extends AuthFlowStateBase {
|
|
13568
|
+
constructor() {
|
|
13569
|
+
super(...arguments);
|
|
13570
|
+
this.stateType = "failed";
|
|
13571
|
+
}
|
|
13572
|
+
}
|
|
13573
|
+
|
|
13574
|
+
/*
|
|
13575
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13576
|
+
* Licensed under the MIT License.
|
|
13577
|
+
*/
|
|
13578
|
+
/**
|
|
13579
|
+
* Result of a native auth V2 operation. Use {@link CustomAuthResultV2.isState}
|
|
13580
|
+
* to narrow the state before accessing its members.
|
|
13581
|
+
*/
|
|
13582
|
+
class CustomAuthResultV2 {
|
|
13583
|
+
constructor(state, data, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
13584
|
+
this.state = state;
|
|
13585
|
+
this.data = data;
|
|
13586
|
+
this.scenario = scenario;
|
|
13587
|
+
}
|
|
13588
|
+
/**
|
|
13589
|
+
* Narrows the result to a specific state by its `stateType` discriminator.
|
|
13590
|
+
* A successful match makes the state's properties available without a cast.
|
|
13591
|
+
* @param stateType - The state type to test for.
|
|
13592
|
+
* @returns True (and narrows `state`) when the current state matches `stateType`.
|
|
13593
|
+
*/
|
|
13594
|
+
isState(stateType) {
|
|
13595
|
+
return this.state.stateType === stateType;
|
|
13596
|
+
}
|
|
13597
|
+
/**
|
|
13598
|
+
* Checks whether the result is in the terminal failed state. A failed result
|
|
13599
|
+
* contains the flow-specific error.
|
|
13600
|
+
* @returns True (and narrows `state`) when the operation failed.
|
|
13601
|
+
*/
|
|
13602
|
+
isFailed() {
|
|
13603
|
+
return this.state.stateType === "failed";
|
|
13604
|
+
}
|
|
13605
|
+
/**
|
|
13606
|
+
* Creates a failed result from the supplied error. The result uses the
|
|
13607
|
+
* shared {@link FailedStateV2} terminal state.
|
|
13608
|
+
* @param error - The error that occurred.
|
|
13609
|
+
* @param options - The flow-error type and error context.
|
|
13610
|
+
* @returns A failed result carrying the flow-specific error.
|
|
13611
|
+
*/
|
|
13612
|
+
static createWithError(error, options) {
|
|
13613
|
+
const { errorType: ErrorType, scenario = CustomAuthFlowScenarioV2.Unknown, correlationId, } = options;
|
|
13614
|
+
const errorData = CustomAuthResultV2.createErrorData(error, correlationId);
|
|
13615
|
+
const flowError = new ErrorType(errorData, scenario);
|
|
13616
|
+
const result = new CustomAuthResultV2(new FailedStateV2(), undefined, scenario);
|
|
13617
|
+
result.error = flowError;
|
|
13618
|
+
return result;
|
|
13619
|
+
}
|
|
13620
|
+
static createErrorData(error, correlationId) {
|
|
13621
|
+
if (error instanceof CustomAuthError) {
|
|
13622
|
+
return error;
|
|
13623
|
+
}
|
|
13624
|
+
if (error instanceof AuthError) {
|
|
13625
|
+
const errorCodes = [];
|
|
13626
|
+
if ("errorNo" in error) {
|
|
13627
|
+
if (typeof error.errorNo === "string") {
|
|
13628
|
+
const code = Number(error.errorNo);
|
|
13629
|
+
if (!isNaN(code)) {
|
|
13630
|
+
errorCodes.push(code);
|
|
13631
|
+
}
|
|
13632
|
+
}
|
|
13633
|
+
else if (typeof error.errorNo === "number") {
|
|
13634
|
+
errorCodes.push(error.errorNo);
|
|
13635
|
+
}
|
|
13636
|
+
}
|
|
13637
|
+
return new MsalCustomAuthError(error.errorCode, error.errorMessage, error.subError, errorCodes, error.correlationId);
|
|
13638
|
+
}
|
|
13639
|
+
return new UnexpectedError(error, correlationId);
|
|
13640
|
+
}
|
|
13641
|
+
}
|
|
13642
|
+
|
|
13643
|
+
/*
|
|
13644
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13645
|
+
* Licensed under the MIT License.
|
|
13646
|
+
*/
|
|
13647
|
+
const INVALID_ONE_TIME_CODE = "invalidOneTimeCode";
|
|
13648
|
+
const INVALID_USERNAME_OR_PASSWORD = "invalidUserNameOrPassword";
|
|
13649
|
+
const PASSWORD_TOO_WEAK = "passwordTooWeak";
|
|
13650
|
+
|
|
13651
|
+
/*
|
|
13652
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13653
|
+
* Licensed under the MIT License.
|
|
13654
|
+
*/
|
|
13655
|
+
/*
|
|
13656
|
+
* Standalone V2 error base; intentionally does NOT extend the V1 AuthFlowErrorBase.
|
|
13657
|
+
* Provides the detectors common to every V2 flow; each per-action subclass adds only
|
|
13658
|
+
* the detectors relevant to its own action.
|
|
13659
|
+
*/
|
|
13660
|
+
class AuthFlowErrorBaseV2 {
|
|
13661
|
+
constructor(errorData, scenario = CustomAuthFlowScenarioV2.Unknown) {
|
|
13662
|
+
this.errorData = errorData;
|
|
13663
|
+
this.scenario = scenario;
|
|
13664
|
+
}
|
|
13665
|
+
get correlationId() {
|
|
13666
|
+
return this.errorData.correlationId;
|
|
13667
|
+
}
|
|
13668
|
+
get errorCodes() {
|
|
13669
|
+
return this.errorData.errorCodes;
|
|
13670
|
+
}
|
|
13671
|
+
get errorDescription() {
|
|
13672
|
+
return this.errorData.errorDescription;
|
|
13673
|
+
}
|
|
13674
|
+
/**
|
|
13675
|
+
* Checks if the error requires the flow to continue in the browser. The
|
|
13676
|
+
* server surfaces this as a `redirect_to_web` failure, so a browser hand-off
|
|
13677
|
+
* always arrives as a `FailedStateV2` on which this detector returns true.
|
|
13678
|
+
* @returns True if the browser is required, false otherwise.
|
|
13679
|
+
*/
|
|
13680
|
+
isBrowserRequired() {
|
|
13681
|
+
return this.errorData.error === REDIRECT_TO_WEB;
|
|
13682
|
+
}
|
|
13683
|
+
/**
|
|
13684
|
+
* Checks if the error is due to a caller-supplied argument failing
|
|
13685
|
+
* client-side validation before the request was issued (for example an empty
|
|
13686
|
+
* username, code, or password, or an unknown method id). Use it to prompt the
|
|
13687
|
+
* user to correct the input rather than treating it as a server failure.
|
|
13688
|
+
* @returns True if the input was invalid, false otherwise.
|
|
13689
|
+
*/
|
|
13690
|
+
isInvalidInput() {
|
|
13691
|
+
return this.errorData instanceof InvalidArgumentError;
|
|
13692
|
+
}
|
|
13693
|
+
/**
|
|
13694
|
+
* Checks whether an account already exists for the supplied identifier.
|
|
13695
|
+
* This can occur at different stages while completing sign-up.
|
|
13696
|
+
* @returns True if the account already exists, otherwise false.
|
|
13697
|
+
*/
|
|
13698
|
+
isUserAlreadyExists() {
|
|
13699
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "userAlreadyExists");
|
|
13700
|
+
}
|
|
13701
|
+
/*
|
|
13702
|
+
* User-not-found arrives as AADSTS50034. The nested `/api` error carries no
|
|
13703
|
+
* innerError and no error_codes array, so the AADSTS marker in the message is
|
|
13704
|
+
* the only signal.
|
|
13705
|
+
*/
|
|
13706
|
+
// TODO: Use the service-provided suberror when it becomes available.
|
|
13707
|
+
isUserNotFoundError() {
|
|
13708
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13709
|
+
this.errorData.errorDescription?.includes("AADSTS50034") === true);
|
|
13710
|
+
}
|
|
13711
|
+
isUserInvalidError() {
|
|
13712
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13713
|
+
this.errorData.errorDescription?.includes("AADSTS90100") === true &&
|
|
13714
|
+
this.errorData.errorDescription
|
|
13715
|
+
.toLowerCase()
|
|
13716
|
+
.includes("username parameter"));
|
|
13717
|
+
}
|
|
13718
|
+
// The verification endpoint uses this outer/inner code pair for an invalid one-time code.
|
|
13719
|
+
isInvalidCodeError() {
|
|
13720
|
+
return (this.errorData.error === "invalidGrant" &&
|
|
13721
|
+
this.errorData.subError === INVALID_ONE_TIME_CODE);
|
|
13722
|
+
}
|
|
13723
|
+
// New password rejected by policy: inner `passwordTooWeak` (AADSTS120002).
|
|
13724
|
+
isInvalidPasswordError() {
|
|
13725
|
+
return (this.errorData.error === "invalidRequest" &&
|
|
13726
|
+
this.errorData.subError === PASSWORD_TOO_WEAK);
|
|
13727
|
+
}
|
|
13728
|
+
isPasswordPolicyViolationError() {
|
|
13729
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "passwordPolicyViolation" &&
|
|
13730
|
+
detail.attributeIds?.some((attributeId) => attributeId.toLowerCase() === "password") === true);
|
|
13731
|
+
}
|
|
13732
|
+
isPasswordIncorrectError() {
|
|
13733
|
+
return (this.errorData.error === "invalidGrant" &&
|
|
13734
|
+
this.errorData.subError === INVALID_USERNAME_OR_PASSWORD);
|
|
13735
|
+
}
|
|
13736
|
+
getAttributeValidationDetails() {
|
|
13737
|
+
const details = this.errorData.attributeValidationDetails;
|
|
13738
|
+
return Array.isArray(details)
|
|
13739
|
+
? details.filter((detail) => typeof detail === "object" && detail !== null)
|
|
13740
|
+
: [];
|
|
13741
|
+
}
|
|
13742
|
+
}
|
|
13743
|
+
|
|
13744
|
+
/*
|
|
13745
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13746
|
+
* Licensed under the MIT License.
|
|
13747
|
+
*/
|
|
13748
|
+
/**
|
|
13749
|
+
* Error raised when requesting (or resending) a challenge for a selected
|
|
13750
|
+
* authentication method. It is a shared action error bound to the shared
|
|
13751
|
+
* `RequestChallengeResultV2` and returned regardless of which entry flow reached
|
|
13752
|
+
* it. It currently exposes no action-specific detectors — only the inherited
|
|
13753
|
+
* `isBrowserRequired()`.
|
|
13754
|
+
*/
|
|
13755
|
+
class RequestChallengeErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13756
|
+
}
|
|
13757
|
+
|
|
13758
|
+
/*
|
|
13759
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13760
|
+
* Licensed under the MIT License.
|
|
13761
|
+
*/
|
|
13762
|
+
/**
|
|
13763
|
+
* Error raised when verifying a challenge (submitting a one-time code). It
|
|
13764
|
+
* exposes the detectors relevant to code verification so the app can respond to
|
|
13765
|
+
* a rejected code specifically. Unrecognised failures carry no specific
|
|
13766
|
+
* detector; inspect the error code (`unexpected_error` when the server gives
|
|
13767
|
+
* none) and `errorDescription`.
|
|
13768
|
+
*/
|
|
13769
|
+
class VerifyChallengeErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13770
|
+
/**
|
|
13771
|
+
* Checks if the error is due to the provided code being invalid or expired.
|
|
13772
|
+
* Use it to prompt the user to re-enter the code or request a new one, rather
|
|
13773
|
+
* than restarting the whole flow.
|
|
13774
|
+
* @returns True if the code is invalid, false otherwise.
|
|
13775
|
+
*/
|
|
13776
|
+
isInvalidCode() {
|
|
13777
|
+
return this.isInvalidCodeError();
|
|
13778
|
+
}
|
|
13779
|
+
}
|
|
13780
|
+
|
|
13781
|
+
/*
|
|
13782
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13783
|
+
* Licensed under the MIT License.
|
|
13784
|
+
*/
|
|
13785
|
+
/**
|
|
13786
|
+
* Terminal state indicating the operation completed successfully.
|
|
13787
|
+
*
|
|
13788
|
+
* Completion data (for example the signed-in account) is carried by the
|
|
13789
|
+
* result's `data` payload, not by this state.
|
|
13790
|
+
*/
|
|
13791
|
+
class CompletedStateV2 extends AuthFlowStateBase {
|
|
13792
|
+
constructor() {
|
|
13793
|
+
super(...arguments);
|
|
13794
|
+
this.stateType = "completed";
|
|
13795
|
+
}
|
|
13796
|
+
}
|
|
13797
|
+
|
|
13798
|
+
/*
|
|
13799
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13800
|
+
* Licensed under the MIT License.
|
|
13801
|
+
*/
|
|
13802
|
+
/**
|
|
13803
|
+
* Error raised when redeeming a completed V2 flow's continuation for tokens.
|
|
13804
|
+
* It adds no action-specific detectors beyond the inherited
|
|
13805
|
+
* `isBrowserRequired()`; the app typically retries or starts sign-in explicitly.
|
|
13806
|
+
*/
|
|
13807
|
+
class SignInContinuationErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13808
|
+
}
|
|
13809
|
+
|
|
13810
|
+
/*
|
|
13811
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13812
|
+
* Licensed under the MIT License.
|
|
13813
|
+
*/
|
|
13814
|
+
/**
|
|
13815
|
+
* Shared state returned when a completed V2 flow can sign the user in by
|
|
13816
|
+
* redeeming its continuation. Password reset and sign-up can both surface this
|
|
13817
|
+
* state without duplicating the token-acquisition behavior.
|
|
13818
|
+
*/
|
|
13819
|
+
class SignInContinuationStateV2 extends AuthFlowActionRequiredStateBase {
|
|
13820
|
+
constructor() {
|
|
13821
|
+
super(...arguments);
|
|
13822
|
+
this.stateType = "signInContinuation";
|
|
13823
|
+
}
|
|
13824
|
+
/**
|
|
13825
|
+
* Signs the user in using the continuation established by the completed V2
|
|
13826
|
+
* flow. On success the returned result reaches the completed state
|
|
13827
|
+
* carrying the signed-in account data; on failure the result's error reports
|
|
13828
|
+
* why the follow-up sign-in could not complete.
|
|
13829
|
+
* @param inputs - Optional scopes requested for the issued token. Claims
|
|
13830
|
+
* are accepted for API alignment but are not sent until the V2 service
|
|
13831
|
+
* supports them on authorize-challenge.
|
|
13832
|
+
* @returns The result of signing in after the password reset.
|
|
13833
|
+
*/
|
|
13834
|
+
async signIn(inputs) {
|
|
13835
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
13836
|
+
try {
|
|
13837
|
+
if (inputs?.claims) {
|
|
13838
|
+
ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
|
|
13839
|
+
}
|
|
13840
|
+
logger.verbose("09mk3f", correlationId);
|
|
13841
|
+
const result = await flowClient.signInWithContinuation({
|
|
13842
|
+
correlationId,
|
|
13843
|
+
continuationState,
|
|
13844
|
+
scopes: inputs?.scopes,
|
|
13845
|
+
});
|
|
13846
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
13847
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
13848
|
+
}
|
|
13849
|
+
catch (error) {
|
|
13850
|
+
logger.errorPii(`0zoo5u ${error}`, correlationId);
|
|
13851
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
13852
|
+
errorType: SignInContinuationErrorV2,
|
|
13853
|
+
scenario: continuationState.scenario,
|
|
13854
|
+
correlationId,
|
|
13855
|
+
});
|
|
13856
|
+
}
|
|
13857
|
+
}
|
|
13858
|
+
}
|
|
13859
|
+
|
|
13860
|
+
/*
|
|
13861
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13862
|
+
* Licensed under the MIT License.
|
|
13863
|
+
*/
|
|
13864
|
+
/**
|
|
13865
|
+
* Error raised when submitting a new password. It exposes the detectors relevant
|
|
13866
|
+
* to password submission so the app can react to a rejected password
|
|
13867
|
+
* specifically. Unrecognised failures carry no specific detector; inspect the
|
|
13868
|
+
* error code (`unexpected_error` when the server gives none) and
|
|
13869
|
+
* `errorDescription`.
|
|
13870
|
+
*/
|
|
13871
|
+
class SubmitNewPasswordErrorV2 extends AuthFlowErrorBaseV2 {
|
|
13872
|
+
/**
|
|
13873
|
+
* Checks if the error is due to the new password being invalid, for example
|
|
13874
|
+
* because it fails the tenant's complexity policy. Use it to prompt the user
|
|
13875
|
+
* for a stronger password rather than restarting the reset flow.
|
|
13876
|
+
* @returns True if the new password is invalid, false otherwise.
|
|
13877
|
+
*/
|
|
13878
|
+
isInvalidPassword() {
|
|
13879
|
+
return this.isInvalidPasswordError();
|
|
13880
|
+
}
|
|
13881
|
+
}
|
|
13882
|
+
|
|
13883
|
+
/*
|
|
13884
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13885
|
+
* Licensed under the MIT License.
|
|
13886
|
+
*/
|
|
13887
|
+
/**
|
|
13888
|
+
* State returned when the user must supply a new password to complete the flow.
|
|
13889
|
+
* A successful submission returns `SignInContinuationStateV2` so the app can
|
|
13890
|
+
* sign the user in.
|
|
13891
|
+
*/
|
|
13892
|
+
class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
13893
|
+
constructor() {
|
|
13894
|
+
super(...arguments);
|
|
13895
|
+
this.stateType = "newPasswordRequired";
|
|
13896
|
+
}
|
|
13897
|
+
/**
|
|
13898
|
+
* Submits the new password to complete the reset. The result either allows
|
|
13899
|
+
* sign-in or reports that the password was rejected.
|
|
13900
|
+
* @param password - The new password to set.
|
|
13901
|
+
* @returns The result of submitting the new password.
|
|
13902
|
+
*/
|
|
13903
|
+
async submitNewPassword(password) {
|
|
13904
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
13905
|
+
try {
|
|
13906
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
13907
|
+
logger.verbose("0ie1qa", correlationId);
|
|
13908
|
+
const result = await flowClient.submitNewPassword({
|
|
13909
|
+
correlationId,
|
|
13910
|
+
continuationState,
|
|
13911
|
+
newPassword: password,
|
|
13912
|
+
});
|
|
13913
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
13914
|
+
correlationId: result.correlationId,
|
|
13915
|
+
logger,
|
|
13916
|
+
config: this.stateParameters.config,
|
|
13917
|
+
flowClient,
|
|
13918
|
+
continuationState: result.continuationState,
|
|
13919
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
13920
|
+
}), undefined, result.continuationState.scenario);
|
|
13921
|
+
}
|
|
13922
|
+
catch (error) {
|
|
13923
|
+
logger.errorPii(`03m081 ${error}`, correlationId);
|
|
13924
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
13925
|
+
errorType: SubmitNewPasswordErrorV2,
|
|
13926
|
+
scenario: continuationState.scenario,
|
|
13927
|
+
correlationId,
|
|
13928
|
+
});
|
|
13929
|
+
}
|
|
13930
|
+
}
|
|
13931
|
+
}
|
|
13932
|
+
|
|
13933
|
+
/*
|
|
13934
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13935
|
+
* Licensed under the MIT License.
|
|
13936
|
+
*/
|
|
13937
|
+
class ChallengeVerificationStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
13938
|
+
constructor(stateParameters) {
|
|
13939
|
+
super(stateParameters);
|
|
13940
|
+
this.method = stateParameters.method;
|
|
13941
|
+
this.sentTo = stateParameters.sentTo;
|
|
13942
|
+
this.channel = stateParameters.channel;
|
|
13943
|
+
this.codeLength = stateParameters.codeLength;
|
|
13944
|
+
}
|
|
13945
|
+
async submitCodeCore(code) {
|
|
13946
|
+
if (this.codeLength) {
|
|
13947
|
+
this.ensureCodeIsValid(code, this.codeLength);
|
|
13948
|
+
}
|
|
13949
|
+
return this.stateParameters.flowClient.submitCode({
|
|
13950
|
+
correlationId: this.stateParameters.correlationId,
|
|
13951
|
+
continuationState: this.stateParameters.continuationState,
|
|
13952
|
+
code,
|
|
13953
|
+
});
|
|
13954
|
+
}
|
|
13955
|
+
async resendCodeCore() {
|
|
13956
|
+
return this.stateParameters.flowClient.resendCode({
|
|
13957
|
+
correlationId: this.stateParameters.correlationId,
|
|
13958
|
+
continuationState: this.stateParameters.continuationState,
|
|
13959
|
+
});
|
|
13960
|
+
}
|
|
13961
|
+
}
|
|
13962
|
+
|
|
13963
|
+
/*
|
|
13964
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13965
|
+
* Licensed under the MIT License.
|
|
13966
|
+
*/
|
|
13967
|
+
/**
|
|
13968
|
+
* State returned when sign-in requires verification of an email or SMS MFA
|
|
13969
|
+
* challenge. It allows the app to submit the challenge or request a replacement.
|
|
13970
|
+
*/
|
|
13971
|
+
class MFAVerificationRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
13972
|
+
constructor() {
|
|
13973
|
+
super(...arguments);
|
|
13974
|
+
this.stateType = "mfaVerificationRequired";
|
|
13975
|
+
}
|
|
13976
|
+
/**
|
|
13977
|
+
* Submits the email or SMS challenge as the second authentication factor.
|
|
13978
|
+
* Successful verification completes sign-in.
|
|
13979
|
+
* @param challenge - The challenge value to submit.
|
|
13980
|
+
* @returns The result of submitting the MFA challenge.
|
|
13981
|
+
*/
|
|
13982
|
+
async submitChallenge(challenge) {
|
|
13983
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
13984
|
+
try {
|
|
13985
|
+
logger.verbose("10k0lc", correlationId);
|
|
13986
|
+
const result = await this.submitCodeCore(challenge);
|
|
13987
|
+
if (result.type !== FLOW_COMPLETED_V2) {
|
|
13988
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
|
|
13989
|
+
}
|
|
13990
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
13991
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
13992
|
+
}
|
|
13993
|
+
catch (error) {
|
|
13994
|
+
logger.errorPii(`178w0g ${error}`, correlationId);
|
|
13995
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
13996
|
+
errorType: VerifyChallengeErrorV2,
|
|
13997
|
+
scenario: continuationState.scenario,
|
|
13998
|
+
correlationId,
|
|
13999
|
+
});
|
|
14000
|
+
}
|
|
14001
|
+
}
|
|
14002
|
+
/**
|
|
14003
|
+
* Requests a replacement challenge for the selected MFA method. The
|
|
14004
|
+
* returned state contains the refreshed email or SMS challenge metadata.
|
|
14005
|
+
* @returns The result of requesting a replacement MFA challenge.
|
|
14006
|
+
*/
|
|
14007
|
+
async resendChallenge() {
|
|
14008
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14009
|
+
try {
|
|
14010
|
+
logger.verbose("13st9u", correlationId);
|
|
14011
|
+
const result = await this.resendCodeCore();
|
|
14012
|
+
return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
|
|
14013
|
+
correlationId: result.correlationId,
|
|
14014
|
+
logger,
|
|
14015
|
+
config: this.stateParameters.config,
|
|
14016
|
+
flowClient: this.stateParameters.flowClient,
|
|
14017
|
+
continuationState: result.continuationState,
|
|
14018
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14019
|
+
method: this.method,
|
|
14020
|
+
sentTo: result.sentTo,
|
|
14021
|
+
channel: result.channel,
|
|
14022
|
+
codeLength: result.codeLength,
|
|
14023
|
+
}), undefined, result.continuationState.scenario);
|
|
14024
|
+
}
|
|
14025
|
+
catch (error) {
|
|
14026
|
+
logger.errorPii(`1qw1ey ${error}`, correlationId);
|
|
14027
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14028
|
+
errorType: RequestChallengeErrorV2,
|
|
14029
|
+
scenario: continuationState.scenario,
|
|
14030
|
+
correlationId,
|
|
14031
|
+
});
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
}
|
|
14035
|
+
|
|
14036
|
+
/*
|
|
14037
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14038
|
+
* Licensed under the MIT License.
|
|
14039
|
+
*/
|
|
14040
|
+
class AuthenticationMethodSelectionStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14041
|
+
constructor(stateParameters) {
|
|
14042
|
+
super(stateParameters);
|
|
14043
|
+
this.methods = stateParameters.methods;
|
|
14044
|
+
}
|
|
14045
|
+
async requestSelectedMethodChallenge(method) {
|
|
14046
|
+
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
14047
|
+
const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
|
|
14048
|
+
if (!selectedMethod) {
|
|
14049
|
+
throw new InvalidArgumentError("method", correlationId);
|
|
14050
|
+
}
|
|
14051
|
+
const result = await flowClient.requestChallenge({
|
|
14052
|
+
correlationId,
|
|
14053
|
+
continuationState: {
|
|
14054
|
+
...continuationState,
|
|
14055
|
+
links: {
|
|
14056
|
+
...continuationState.links,
|
|
14057
|
+
challenge: selectedMethod.challengeHref,
|
|
14058
|
+
},
|
|
14059
|
+
},
|
|
14060
|
+
});
|
|
14061
|
+
return { result, selectedMethod };
|
|
14062
|
+
}
|
|
14063
|
+
}
|
|
14064
|
+
|
|
14065
|
+
/*
|
|
14066
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14067
|
+
* Licensed under the MIT License.
|
|
14068
|
+
*/
|
|
14069
|
+
/**
|
|
14070
|
+
* State returned when sign-in requires a registered multi-factor
|
|
14071
|
+
* authentication method.
|
|
14072
|
+
*/
|
|
14073
|
+
class MFARequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
|
|
14074
|
+
constructor() {
|
|
14075
|
+
super(...arguments);
|
|
14076
|
+
this.stateType = "mfaRequired";
|
|
14077
|
+
}
|
|
14078
|
+
/**
|
|
14079
|
+
* Requests a challenge for a registered MFA method.
|
|
14080
|
+
* @param method - A method from {@link methods}.
|
|
14081
|
+
* @returns A result requiring challenge verification or describing failure.
|
|
14082
|
+
*/
|
|
14083
|
+
async requestChallenge(method) {
|
|
14084
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14085
|
+
try {
|
|
14086
|
+
const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
|
|
14087
|
+
if (result.type !== FLOW_CODE_REQUIRED_V2) {
|
|
14088
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA method selection expected a code challenge but received '${result.type}'.`, correlationId);
|
|
14089
|
+
}
|
|
14090
|
+
return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
|
|
14091
|
+
correlationId: result.correlationId,
|
|
14092
|
+
logger,
|
|
14093
|
+
config: this.stateParameters.config,
|
|
14094
|
+
flowClient,
|
|
14095
|
+
continuationState: result.continuationState,
|
|
14096
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14097
|
+
method: selectedMethod,
|
|
14098
|
+
sentTo: result.sentTo,
|
|
14099
|
+
channel: result.channel,
|
|
14100
|
+
codeLength: result.codeLength,
|
|
14101
|
+
}), undefined, result.continuationState.scenario);
|
|
14102
|
+
}
|
|
14103
|
+
catch (error) {
|
|
14104
|
+
logger.errorPii(`0ax1kt ${error}`, correlationId);
|
|
14105
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14106
|
+
errorType: RequestChallengeErrorV2,
|
|
14107
|
+
scenario: continuationState.scenario,
|
|
14108
|
+
correlationId,
|
|
14109
|
+
});
|
|
14110
|
+
}
|
|
14111
|
+
}
|
|
14112
|
+
}
|
|
14113
|
+
|
|
14114
|
+
/*
|
|
14115
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14116
|
+
* Licensed under the MIT License.
|
|
14117
|
+
*/
|
|
14118
|
+
/**
|
|
14119
|
+
* State returned when first-factor email authentication requires a one-time
|
|
14120
|
+
* code. It allows the app to submit the code or request a replacement.
|
|
14121
|
+
*/
|
|
14122
|
+
class CodeRequiredStateV2 extends ChallengeVerificationStateBaseV2 {
|
|
14123
|
+
constructor() {
|
|
14124
|
+
super(...arguments);
|
|
14125
|
+
this.stateType = "codeRequired";
|
|
14126
|
+
}
|
|
14127
|
+
/**
|
|
14128
|
+
* Submits the first-factor email code and advances the active flow. The
|
|
14129
|
+
* result may complete the operation or require another flow-specific step.
|
|
14130
|
+
* @param code - The code to submit.
|
|
14131
|
+
* @returns The result of submitting the first-factor code.
|
|
14132
|
+
*/
|
|
14133
|
+
async submitCode(code) {
|
|
14134
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14135
|
+
try {
|
|
14136
|
+
logger.verbose("1x3xae", correlationId);
|
|
14137
|
+
const result = await this.submitCodeCore(code);
|
|
14138
|
+
const resultType = result.type;
|
|
14139
|
+
if (result.type === FLOW_NEW_PASSWORD_REQUIRED_V2) {
|
|
14140
|
+
return new CustomAuthResultV2(new NewPasswordRequiredStateV2({
|
|
14141
|
+
correlationId: result.correlationId,
|
|
14142
|
+
logger,
|
|
14143
|
+
config: this.stateParameters.config,
|
|
14144
|
+
flowClient: this.stateParameters.flowClient,
|
|
14145
|
+
continuationState: result.continuationState,
|
|
14146
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14147
|
+
}), undefined, result.continuationState.scenario);
|
|
14148
|
+
}
|
|
14149
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2 ||
|
|
14150
|
+
result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
14151
|
+
const signUpStateTransitionHandler = this.stateParameters.signUpStateTransitionHandler;
|
|
14152
|
+
if (!signUpStateTransitionHandler) {
|
|
14153
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "Sign-up state transition handler is missing.", correlationId);
|
|
14154
|
+
}
|
|
14155
|
+
return signUpStateTransitionHandler.handleVerification(result, {
|
|
14156
|
+
...this.stateParameters,
|
|
14157
|
+
signUpStateTransitionHandler,
|
|
14158
|
+
});
|
|
14159
|
+
}
|
|
14160
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14161
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14162
|
+
correlationId: result.correlationId,
|
|
14163
|
+
logger,
|
|
14164
|
+
config: this.stateParameters.config,
|
|
14165
|
+
flowClient: this.stateParameters.flowClient,
|
|
14166
|
+
continuationState: result.continuationState,
|
|
14167
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14168
|
+
}), undefined, result.continuationState.scenario);
|
|
14169
|
+
}
|
|
14170
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14171
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
14172
|
+
correlationId: result.correlationId,
|
|
14173
|
+
logger,
|
|
14174
|
+
config: this.stateParameters.config,
|
|
14175
|
+
flowClient: this.stateParameters.flowClient,
|
|
14176
|
+
continuationState: result.continuationState,
|
|
14177
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14178
|
+
methods: result.methods,
|
|
14179
|
+
}), undefined, result.continuationState.scenario);
|
|
14180
|
+
}
|
|
14181
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
14182
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14183
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14184
|
+
}
|
|
14185
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Code submission result type '${resultType}' is not supported.`, correlationId);
|
|
14186
|
+
}
|
|
14187
|
+
catch (error) {
|
|
14188
|
+
logger.errorPii(`0br9qy ${error}`, correlationId);
|
|
14189
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14190
|
+
errorType: VerifyChallengeErrorV2,
|
|
14191
|
+
scenario: continuationState.scenario,
|
|
14192
|
+
correlationId,
|
|
14193
|
+
});
|
|
14194
|
+
}
|
|
14195
|
+
}
|
|
14196
|
+
/**
|
|
14197
|
+
* Requests a replacement first-factor email code. The returned state
|
|
14198
|
+
* contains the refreshed challenge metadata.
|
|
14199
|
+
* @returns The result of requesting a replacement code.
|
|
14200
|
+
*/
|
|
14201
|
+
async resendCode() {
|
|
14202
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14203
|
+
try {
|
|
14204
|
+
logger.verbose("1xub2c", correlationId);
|
|
14205
|
+
const result = await this.resendCodeCore();
|
|
14206
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14207
|
+
correlationId: result.correlationId,
|
|
14208
|
+
logger,
|
|
14209
|
+
config: this.stateParameters.config,
|
|
14210
|
+
flowClient: this.stateParameters.flowClient,
|
|
14211
|
+
continuationState: result.continuationState,
|
|
14212
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14213
|
+
signUpStateTransitionHandler: this.stateParameters.signUpStateTransitionHandler,
|
|
14214
|
+
method: this.method,
|
|
14215
|
+
sentTo: result.sentTo,
|
|
14216
|
+
channel: result.channel,
|
|
14217
|
+
codeLength: result.codeLength,
|
|
14218
|
+
}), undefined, result.continuationState.scenario);
|
|
14219
|
+
}
|
|
14220
|
+
catch (error) {
|
|
14221
|
+
logger.errorPii(`0eq23q ${error}`, correlationId);
|
|
14222
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14223
|
+
errorType: RequestChallengeErrorV2,
|
|
14224
|
+
scenario: continuationState.scenario,
|
|
14225
|
+
correlationId,
|
|
14226
|
+
});
|
|
14227
|
+
}
|
|
14228
|
+
}
|
|
14229
|
+
}
|
|
14230
|
+
|
|
14231
|
+
/*
|
|
14232
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14233
|
+
* Licensed under the MIT License.
|
|
14234
|
+
*/
|
|
14235
|
+
/**
|
|
14236
|
+
* State returned when the user must select one of several authentication
|
|
14237
|
+
* methods before a challenge can be issued. It exposes the list of offered
|
|
14238
|
+
* methods and lets the app request a challenge for the chosen one. The flow
|
|
14239
|
+
* stays on this state until a challenge is successfully requested.
|
|
14240
|
+
*/
|
|
14241
|
+
class AuthMethodSelectionRequiredStateV2 extends AuthenticationMethodSelectionStateBaseV2 {
|
|
14242
|
+
constructor() {
|
|
14243
|
+
super(...arguments);
|
|
14244
|
+
this.stateType = "authMethodSelectionRequired";
|
|
14245
|
+
}
|
|
14246
|
+
/**
|
|
14247
|
+
* Requests a challenge for the selected authentication method. The returned
|
|
14248
|
+
* state identifies the credential the application must collect.
|
|
14249
|
+
* @param method - The method to challenge, from {@link methods}.
|
|
14250
|
+
* @returns The result of requesting the challenge.
|
|
14251
|
+
*/
|
|
14252
|
+
async requestChallenge(method) {
|
|
14253
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14254
|
+
try {
|
|
14255
|
+
logger.verbose("1r2ypl", correlationId);
|
|
14256
|
+
const { result, selectedMethod } = await this.requestSelectedMethodChallenge(method);
|
|
14257
|
+
const resultType = result.type;
|
|
14258
|
+
const commonStateParameters = {
|
|
14259
|
+
correlationId: result.correlationId,
|
|
14260
|
+
logger,
|
|
14261
|
+
config: this.stateParameters.config,
|
|
14262
|
+
flowClient,
|
|
14263
|
+
continuationState: result.continuationState,
|
|
14264
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14265
|
+
};
|
|
14266
|
+
if (result.type === FLOW_CODE_REQUIRED_V2 &&
|
|
14267
|
+
(result.channel?.toLowerCase() ===
|
|
14268
|
+
AuthenticationMethodTypeV2.EMAIL ||
|
|
14269
|
+
result.channel?.toLowerCase() ===
|
|
14270
|
+
AuthenticationMethodTypeV2.SMS)) {
|
|
14271
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14272
|
+
...commonStateParameters,
|
|
14273
|
+
method: selectedMethod,
|
|
14274
|
+
sentTo: result.sentTo,
|
|
14275
|
+
channel: result.channel,
|
|
14276
|
+
codeLength: result.codeLength,
|
|
14277
|
+
}), undefined, result.continuationState.scenario);
|
|
14278
|
+
}
|
|
14279
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Challenge type '${resultType}' with channel '${result.type === FLOW_CODE_REQUIRED_V2
|
|
14280
|
+
? result.channel
|
|
14281
|
+
: AuthenticationMethodTypeV2.PASSWORD}' is not supported for password reset.`, correlationId);
|
|
14282
|
+
}
|
|
14283
|
+
catch (error) {
|
|
14284
|
+
logger.errorPii(`0z5x7r ${error}`, correlationId);
|
|
14285
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14286
|
+
errorType: RequestChallengeErrorV2,
|
|
14287
|
+
scenario: continuationState.scenario,
|
|
14288
|
+
correlationId,
|
|
14289
|
+
});
|
|
14290
|
+
}
|
|
14291
|
+
}
|
|
14292
|
+
}
|
|
14293
|
+
|
|
14294
|
+
/*
|
|
14295
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14296
|
+
* Licensed under the MIT License.
|
|
14297
|
+
*/
|
|
14298
|
+
/**
|
|
14299
|
+
* Error raised by the first call of the native auth V2 reset-password flow
|
|
14300
|
+
* (`resetPasswordV2`). It surfaces only the detectors relevant to starting a
|
|
14301
|
+
* password reset, so an app inspecting `result.error` sees a small, focused set.
|
|
14302
|
+
* Any unrecognised failure carries no specific detector; inspect the error code
|
|
14303
|
+
* (`unexpected_error` when the server gives none) and `errorDescription`.
|
|
14304
|
+
*/
|
|
14305
|
+
class ResetPasswordStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14306
|
+
/**
|
|
14307
|
+
* Checks if the supplied username is empty or invalid.
|
|
14308
|
+
* @returns True if the username is invalid, false otherwise.
|
|
14309
|
+
*/
|
|
14310
|
+
isInvalidUsername() {
|
|
14311
|
+
return this.isUserInvalidError();
|
|
14312
|
+
}
|
|
14313
|
+
/**
|
|
14314
|
+
* Checks if the error is due to the user not being found. Use it to tell the
|
|
14315
|
+
* user no account matches the supplied username, rather than exposing a
|
|
14316
|
+
* generic failure that hides the real cause.
|
|
14317
|
+
* @returns True if the user was not found, false otherwise.
|
|
14318
|
+
*/
|
|
14319
|
+
isUserNotFound() {
|
|
14320
|
+
return this.isUserNotFoundError();
|
|
14321
|
+
}
|
|
14322
|
+
}
|
|
14323
|
+
|
|
14324
|
+
/*
|
|
14325
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14326
|
+
* Licensed under the MIT License.
|
|
14327
|
+
*/
|
|
14328
|
+
/**
|
|
14329
|
+
* Error returned when native auth V2 sign-in cannot start.
|
|
14330
|
+
*/
|
|
14331
|
+
class SignInStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14332
|
+
/**
|
|
14333
|
+
* Checks whether the service rejected the username parameter.
|
|
14334
|
+
* @returns True when the username was empty or invalid.
|
|
14335
|
+
*/
|
|
14336
|
+
isInvalidUsername() {
|
|
14337
|
+
return this.isUserInvalidError();
|
|
14338
|
+
}
|
|
14339
|
+
/**
|
|
14340
|
+
* Checks whether the supplied username does not identify an account.
|
|
14341
|
+
* @returns True when the service reports that the user was not found.
|
|
14342
|
+
*/
|
|
14343
|
+
isUserNotFound() {
|
|
14344
|
+
return this.isUserNotFoundError();
|
|
14345
|
+
}
|
|
14346
|
+
/**
|
|
14347
|
+
* Checks whether an automatically submitted password was rejected.
|
|
14348
|
+
* @returns True when the password is incorrect.
|
|
14349
|
+
*/
|
|
14350
|
+
isInvalidPassword() {
|
|
14351
|
+
return this.isPasswordIncorrectError();
|
|
14352
|
+
}
|
|
14353
|
+
}
|
|
14354
|
+
|
|
14355
|
+
/*
|
|
14356
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14357
|
+
* Licensed under the MIT License.
|
|
14358
|
+
*/
|
|
14359
|
+
/**
|
|
14360
|
+
* Error returned when native auth V2 sign-up cannot start. It exposes
|
|
14361
|
+
* detectors for failures that an app can correct without restarting the flow.
|
|
14362
|
+
*/
|
|
14363
|
+
class SignUpStartErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14364
|
+
/**
|
|
14365
|
+
* Checks whether an upfront password violates the tenant's password policy.
|
|
14366
|
+
* Use it to prompt the user for a stronger password.
|
|
14367
|
+
* @returns True when the password violates policy, otherwise false.
|
|
14368
|
+
*/
|
|
14369
|
+
isInvalidPassword() {
|
|
14370
|
+
return this.isPasswordPolicyViolationError();
|
|
14371
|
+
}
|
|
14372
|
+
}
|
|
14373
|
+
|
|
14374
|
+
/*
|
|
14375
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14376
|
+
* Licensed under the MIT License.
|
|
14377
|
+
*/
|
|
14378
|
+
/**
|
|
14379
|
+
* Error returned when a password cannot be submitted for V2 sign-in.
|
|
14380
|
+
*/
|
|
14381
|
+
class SubmitPasswordErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14382
|
+
/**
|
|
14383
|
+
* Checks whether the supplied password was rejected.
|
|
14384
|
+
* @returns True when the password is incorrect.
|
|
14385
|
+
*/
|
|
14386
|
+
isInvalidPassword() {
|
|
14387
|
+
return this.isPasswordIncorrectError();
|
|
14388
|
+
}
|
|
14389
|
+
}
|
|
14390
|
+
|
|
14391
|
+
/*
|
|
14392
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14393
|
+
* Licensed under the MIT License.
|
|
14394
|
+
*/
|
|
14395
|
+
/**
|
|
14396
|
+
* State returned when the selected sign-in method requires the user's
|
|
14397
|
+
* password.
|
|
14398
|
+
*/
|
|
14399
|
+
class PasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14400
|
+
constructor() {
|
|
14401
|
+
super(...arguments);
|
|
14402
|
+
this.stateType = "passwordRequired";
|
|
14403
|
+
}
|
|
14404
|
+
/**
|
|
14405
|
+
* Submits the password and advances sign-in.
|
|
14406
|
+
* @param password - The account password.
|
|
14407
|
+
* @returns A completed sign-in, MFA selection, or password submission error.
|
|
14408
|
+
*/
|
|
14409
|
+
async submitPassword(password) {
|
|
14410
|
+
const { correlationId, logger, continuationState, flowClient } = this.stateParameters;
|
|
14411
|
+
try {
|
|
14412
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
14413
|
+
const result = await flowClient.submitSignInPassword({
|
|
14414
|
+
correlationId,
|
|
14415
|
+
continuationState,
|
|
14416
|
+
password,
|
|
14417
|
+
});
|
|
14418
|
+
const resultType = result.type;
|
|
14419
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
14420
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14421
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14422
|
+
}
|
|
14423
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14424
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
14425
|
+
correlationId: result.correlationId,
|
|
14426
|
+
logger,
|
|
14427
|
+
config: this.stateParameters.config,
|
|
14428
|
+
flowClient,
|
|
14429
|
+
continuationState: result.continuationState,
|
|
14430
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14431
|
+
methods: result.methods,
|
|
14432
|
+
}), undefined, result.continuationState.scenario);
|
|
14433
|
+
}
|
|
14434
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password verification result type '${resultType}' is not supported.`, correlationId);
|
|
14435
|
+
}
|
|
14436
|
+
catch (error) {
|
|
14437
|
+
logger.errorPii(`0qvjzk ${error}`, correlationId);
|
|
14438
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14439
|
+
errorType: SubmitPasswordErrorV2,
|
|
14440
|
+
scenario: continuationState.scenario,
|
|
14441
|
+
correlationId,
|
|
14442
|
+
});
|
|
14443
|
+
}
|
|
14444
|
+
}
|
|
14445
|
+
}
|
|
14446
|
+
|
|
14447
|
+
/*
|
|
14448
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14449
|
+
* Licensed under the MIT License.
|
|
14450
|
+
*/
|
|
14451
|
+
/**
|
|
14452
|
+
* Error returned when additional V2 sign-up attributes cannot be submitted. It
|
|
14453
|
+
* identifies attribute failures that an app can correct and resubmit.
|
|
14454
|
+
*/
|
|
14455
|
+
class SubmitAttributesErrorV2 extends AuthFlowErrorBaseV2 {
|
|
14456
|
+
/**
|
|
14457
|
+
* Checks whether the service requires attributes omitted from the request.
|
|
14458
|
+
* Use it to collect the required attributes before resubmitting.
|
|
14459
|
+
* @returns True when required attributes are missing, otherwise false.
|
|
11977
14460
|
*/
|
|
11978
|
-
|
|
11979
|
-
return this.
|
|
14461
|
+
isMissingRequiredAttributes() {
|
|
14462
|
+
return this.getAttributeValidationDetails().some((detail) => detail.code === "attributeRequired");
|
|
11980
14463
|
}
|
|
11981
14464
|
/**
|
|
11982
|
-
* Checks
|
|
14465
|
+
* Checks whether a submitted password violates the tenant's password policy.
|
|
14466
|
+
* Use it to prompt the user for a stronger password.
|
|
14467
|
+
* @returns True when the password violates policy, otherwise false.
|
|
11983
14468
|
*/
|
|
11984
|
-
|
|
11985
|
-
return this.
|
|
14469
|
+
isInvalidPassword() {
|
|
14470
|
+
return this.isPasswordPolicyViolationError();
|
|
11986
14471
|
}
|
|
11987
14472
|
}
|
|
11988
14473
|
|
|
@@ -11990,30 +14475,50 @@ class ResetPasswordStartResult extends AuthFlowResultBase {
|
|
|
11990
14475
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11991
14476
|
* Licensed under the MIT License.
|
|
11992
14477
|
*/
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
const
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
const REGISTER_CONTINUE = "/register/v1.0/continue";
|
|
14478
|
+
class SignUpAttributesRequiredStateBaseV2 extends AuthFlowActionRequiredStateBase {
|
|
14479
|
+
constructor(stateParameters) {
|
|
14480
|
+
super(stateParameters);
|
|
14481
|
+
this.attributes = stateParameters.attributes;
|
|
14482
|
+
}
|
|
14483
|
+
async submitAttributesAction(attributes) {
|
|
14484
|
+
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
14485
|
+
return flowClient.submitSignUpAttributes({
|
|
14486
|
+
correlationId,
|
|
14487
|
+
continuationState,
|
|
14488
|
+
attributes,
|
|
14489
|
+
});
|
|
14490
|
+
}
|
|
14491
|
+
}
|
|
12008
14492
|
|
|
12009
14493
|
/*
|
|
12010
14494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12011
14495
|
* Licensed under the MIT License.
|
|
12012
14496
|
*/
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
14497
|
+
/**
|
|
14498
|
+
* State returned when sign-up requires profile or custom attributes.
|
|
14499
|
+
*/
|
|
14500
|
+
class AttributesRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
14501
|
+
constructor() {
|
|
14502
|
+
super(...arguments);
|
|
14503
|
+
this.stateType = "attributesRequired";
|
|
14504
|
+
}
|
|
14505
|
+
/**
|
|
14506
|
+
* Submits the attributes requested by the latest server response.
|
|
14507
|
+
*/
|
|
14508
|
+
async submitAttributes(attributes) {
|
|
14509
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14510
|
+
try {
|
|
14511
|
+
const result = await this.submitAttributesAction(attributes);
|
|
14512
|
+
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "attribute");
|
|
14513
|
+
}
|
|
14514
|
+
catch (error) {
|
|
14515
|
+
logger.errorPii(`0l4w01 ${error}`, correlationId);
|
|
14516
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14517
|
+
errorType: SubmitAttributesErrorV2,
|
|
14518
|
+
scenario: continuationState.scenario,
|
|
14519
|
+
correlationId,
|
|
14520
|
+
});
|
|
14521
|
+
}
|
|
12017
14522
|
}
|
|
12018
14523
|
}
|
|
12019
14524
|
|
|
@@ -12021,33 +14526,86 @@ class ParsedUrlError extends CustomAuthError {
|
|
|
12021
14526
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12022
14527
|
* Licensed under the MIT License.
|
|
12023
14528
|
*/
|
|
12024
|
-
|
|
14529
|
+
/**
|
|
14530
|
+
* State returned when sign-up requires a password that was not submitted with
|
|
14531
|
+
* an earlier attribute request.
|
|
14532
|
+
*/
|
|
14533
|
+
class SignUpPasswordRequiredStateV2 extends SignUpAttributesRequiredStateBaseV2 {
|
|
14534
|
+
constructor(stateParameters) {
|
|
14535
|
+
super(stateParameters);
|
|
14536
|
+
this.stateType = "passwordRequired";
|
|
14537
|
+
this.requiredPasswordAttribute =
|
|
14538
|
+
stateParameters.requiredPasswordAttribute;
|
|
14539
|
+
}
|
|
14540
|
+
/**
|
|
14541
|
+
* Submits the password and any profile attributes requested alongside it.
|
|
14542
|
+
*/
|
|
14543
|
+
async submitPassword(password, attributes = {}) {
|
|
14544
|
+
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14545
|
+
try {
|
|
14546
|
+
this.ensurePasswordIsNotEmpty(password);
|
|
14547
|
+
const result = await this.submitAttributesAction({
|
|
14548
|
+
...attributes,
|
|
14549
|
+
password,
|
|
14550
|
+
});
|
|
14551
|
+
return this.stateParameters.signUpStateTransitionHandler.handleAttributeSubmission(result, this.stateParameters, "password");
|
|
14552
|
+
}
|
|
14553
|
+
catch (error) {
|
|
14554
|
+
logger.errorPii(`07t30r ${error}`, correlationId);
|
|
14555
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14556
|
+
errorType: SubmitAttributesErrorV2,
|
|
14557
|
+
scenario: continuationState.scenario,
|
|
14558
|
+
correlationId,
|
|
14559
|
+
});
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
}
|
|
12025
14563
|
|
|
12026
14564
|
/*
|
|
12027
14565
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12028
14566
|
* Licensed under the MIT License.
|
|
12029
14567
|
*/
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
14568
|
+
class SignUpStateTransitionHandlerV2 {
|
|
14569
|
+
handleAttributeSubmission(result, stateParameters, submission) {
|
|
14570
|
+
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
14571
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
14572
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
14573
|
+
...commonStateParameters,
|
|
14574
|
+
sentTo: result.sentTo,
|
|
14575
|
+
channel: result.channel,
|
|
14576
|
+
codeLength: result.codeLength,
|
|
14577
|
+
}), undefined, result.continuationState.scenario);
|
|
14578
|
+
}
|
|
14579
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14580
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario);
|
|
14581
|
+
}
|
|
14582
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
|
|
12033
14583
|
}
|
|
12034
|
-
|
|
12035
|
-
|
|
14584
|
+
handleVerification(result, stateParameters) {
|
|
14585
|
+
const commonStateParameters = this.createCommonStateParameters(result, stateParameters);
|
|
14586
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
14587
|
+
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
14588
|
+
...commonStateParameters,
|
|
14589
|
+
attributes: result.attributes,
|
|
14590
|
+
}), undefined, result.continuationState.scenario);
|
|
14591
|
+
}
|
|
14592
|
+
return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
|
|
14593
|
+
...commonStateParameters,
|
|
14594
|
+
attributes: result.attributes,
|
|
14595
|
+
requiredPasswordAttribute: result.requiredPasswordAttribute,
|
|
14596
|
+
}), undefined, result.continuationState.scenario);
|
|
12036
14597
|
}
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
}
|
|
12048
|
-
});
|
|
14598
|
+
createCommonStateParameters(result, stateParameters) {
|
|
14599
|
+
return {
|
|
14600
|
+
correlationId: result.correlationId,
|
|
14601
|
+
logger: stateParameters.logger,
|
|
14602
|
+
config: stateParameters.config,
|
|
14603
|
+
flowClient: stateParameters.flowClient,
|
|
14604
|
+
continuationState: result.continuationState,
|
|
14605
|
+
cacheClient: stateParameters.cacheClient,
|
|
14606
|
+
signUpStateTransitionHandler: stateParameters.signUpStateTransitionHandler,
|
|
14607
|
+
};
|
|
12049
14608
|
}
|
|
12050
|
-
return url;
|
|
12051
14609
|
}
|
|
12052
14610
|
|
|
12053
14611
|
/*
|
|
@@ -12377,7 +14935,7 @@ class SignUpClient extends CustomAuthInteractionClientBase {
|
|
|
12377
14935
|
if (responseError.error === ATTRIBUTES_REQUIRED) {
|
|
12378
14936
|
if (!responseError.attributes ||
|
|
12379
14937
|
responseError.attributes.length === 0) {
|
|
12380
|
-
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "Attributes are required but required_attributes field is missing in the response body.", correlationId);
|
|
14938
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY$1, "Attributes are required but required_attributes field is missing in the response body.", correlationId);
|
|
12381
14939
|
}
|
|
12382
14940
|
return true;
|
|
12383
14941
|
}
|
|
@@ -12385,7 +14943,7 @@ class SignUpClient extends CustomAuthInteractionClientBase {
|
|
|
12385
14943
|
}
|
|
12386
14944
|
readContinuationTokenFromResponeError(responseError, correlationId) {
|
|
12387
14945
|
if (!responseError.continuationToken) {
|
|
12388
|
-
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response body", correlationId);
|
|
14946
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING$1, "Continuation token is missing in the response body", correlationId);
|
|
12389
14947
|
}
|
|
12390
14948
|
return responseError.continuationToken;
|
|
12391
14949
|
}
|
|
@@ -12413,56 +14971,6 @@ class CustomAuthInterationClientFactory {
|
|
|
12413
14971
|
}
|
|
12414
14972
|
}
|
|
12415
14973
|
|
|
12416
|
-
/*
|
|
12417
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12418
|
-
* Licensed under the MIT License.
|
|
12419
|
-
*/
|
|
12420
|
-
/**
|
|
12421
|
-
* Filters the headers returned by a {@link CustomAuthRequestInterceptor},
|
|
12422
|
-
* keeping only those that conform to the custom-auth header naming rules.
|
|
12423
|
-
*
|
|
12424
|
-
* Rules (mirrors the iOS / Android native auth implementations):
|
|
12425
|
-
* - Header names must start with `x-` (case-insensitive); others are dropped.
|
|
12426
|
-
* - Header names that start with any reserved prefix (`x-client-`, `x-ms-`,
|
|
12427
|
-
* `x-broker-`, `x-app-`) are dropped.
|
|
12428
|
-
* - Headers with empty/whitespace-only names or null/undefined values are dropped.
|
|
12429
|
-
*
|
|
12430
|
-
* Dropped headers are logged as warnings (PII-safe) when a logger is provided.
|
|
12431
|
-
*
|
|
12432
|
-
* @param headers - Raw headers returned by the interceptor.
|
|
12433
|
-
* @param logger - Optional logger used to emit warnings for dropped headers.
|
|
12434
|
-
* @param correlationId - Optional correlation id forwarded to the logger.
|
|
12435
|
-
* @returns A new record containing only the headers that pass the filter,
|
|
12436
|
-
* preserving the original casing of header names.
|
|
12437
|
-
*/
|
|
12438
|
-
function filterCustomHeaders(headers, logger, correlationId) {
|
|
12439
|
-
const filtered = {};
|
|
12440
|
-
if (!headers) {
|
|
12441
|
-
return filtered;
|
|
12442
|
-
}
|
|
12443
|
-
for (const [name, value] of Object.entries(headers)) {
|
|
12444
|
-
if (!name || value === undefined || value === null) {
|
|
12445
|
-
continue;
|
|
12446
|
-
}
|
|
12447
|
-
const trimmedName = name.trim();
|
|
12448
|
-
if (!trimmedName) {
|
|
12449
|
-
continue;
|
|
12450
|
-
}
|
|
12451
|
-
const lowerName = trimmedName.toLowerCase();
|
|
12452
|
-
if (!lowerName.startsWith(CustomHeaderConstants.REQUIRED_PREFIX)) {
|
|
12453
|
-
logger?.warningPii(`0vzpop ${trimmedName} ${CustomHeaderConstants.REQUIRED_PREFIX}`, correlationId ?? "");
|
|
12454
|
-
continue;
|
|
12455
|
-
}
|
|
12456
|
-
const reservedPrefix = CustomHeaderConstants.RESERVED_PREFIXES.find((prefix) => lowerName.startsWith(prefix));
|
|
12457
|
-
if (reservedPrefix) {
|
|
12458
|
-
logger?.warningPii(`1m3lhk ${trimmedName} ${reservedPrefix}`, correlationId ?? "");
|
|
12459
|
-
continue;
|
|
12460
|
-
}
|
|
12461
|
-
filtered[trimmedName] = value;
|
|
12462
|
-
}
|
|
12463
|
-
return filtered;
|
|
12464
|
-
}
|
|
12465
|
-
|
|
12466
14974
|
/*
|
|
12467
14975
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12468
14976
|
* Licensed under the MIT License.
|
|
@@ -12490,13 +14998,13 @@ class BaseApiClient {
|
|
|
12490
14998
|
response = await this.httpClient.post(url, formData, headers);
|
|
12491
14999
|
}
|
|
12492
15000
|
catch (e) {
|
|
12493
|
-
throw new CustomAuthApiError(HTTP_REQUEST_FAILED, `Failed to perform '${endpoint}' request: ${e}`, correlationId);
|
|
15001
|
+
throw new CustomAuthApiError(HTTP_REQUEST_FAILED$1, `Failed to perform '${endpoint}' request: ${e}`, correlationId);
|
|
12494
15002
|
}
|
|
12495
15003
|
return this.handleApiResponse(response, correlationId);
|
|
12496
15004
|
}
|
|
12497
15005
|
ensureContinuationTokenIsValid(continuationToken, correlationId) {
|
|
12498
15006
|
if (!continuationToken) {
|
|
12499
|
-
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING, "Continuation token is missing in the response body", correlationId);
|
|
15007
|
+
throw new CustomAuthApiError(CONTINUATION_TOKEN_MISSING$1, "Continuation token is missing in the response body", correlationId);
|
|
12500
15008
|
}
|
|
12501
15009
|
}
|
|
12502
15010
|
readResponseCorrelationId(response, requestCorrelationId) {
|
|
@@ -12534,7 +15042,7 @@ class BaseApiClient {
|
|
|
12534
15042
|
}
|
|
12535
15043
|
const responseError = responseData;
|
|
12536
15044
|
if (!responseError) {
|
|
12537
|
-
throw new CustomAuthApiError(INVALID_RESPONSE_BODY, "Response error body is empty or invalid", correlationId);
|
|
15045
|
+
throw new CustomAuthApiError(INVALID_RESPONSE_BODY$1, "Response error body is empty or invalid", correlationId);
|
|
12538
15046
|
}
|
|
12539
15047
|
const attributes = !!responseError.required_attributes &&
|
|
12540
15048
|
responseError.required_attributes.length > 0
|
|
@@ -12892,17 +15400,6 @@ class CustomAuthApiClient {
|
|
|
12892
15400
|
}
|
|
12893
15401
|
}
|
|
12894
15402
|
|
|
12895
|
-
/*
|
|
12896
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12897
|
-
* Licensed under the MIT License.
|
|
12898
|
-
*/
|
|
12899
|
-
/**
|
|
12900
|
-
* Represents an HTTP method type.
|
|
12901
|
-
*/
|
|
12902
|
-
const HttpMethod = {
|
|
12903
|
-
GET: "GET",
|
|
12904
|
-
POST: "POST"};
|
|
12905
|
-
|
|
12906
15403
|
/*
|
|
12907
15404
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12908
15405
|
* Licensed under the MIT License.
|
|
@@ -17732,6 +20229,49 @@ class InteractionHandler {
|
|
|
17732
20229
|
}
|
|
17733
20230
|
}
|
|
17734
20231
|
|
|
20232
|
+
/*
|
|
20233
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20234
|
+
* Licensed under the MIT License.
|
|
20235
|
+
*/
|
|
20236
|
+
/**
|
|
20237
|
+
* Token types supported by the platform broker request contract.
|
|
20238
|
+
*/
|
|
20239
|
+
const PlatformAuthTokenType = {
|
|
20240
|
+
DPOP_WITH_PROOF: "dpop+proof",
|
|
20241
|
+
};
|
|
20242
|
+
const PROOF_OF_POSSESSION_TOKEN_TYPES = [
|
|
20243
|
+
AuthenticationScheme.POP,
|
|
20244
|
+
AuthenticationScheme.DPOP,
|
|
20245
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF,
|
|
20246
|
+
];
|
|
20247
|
+
/**
|
|
20248
|
+
* Returns whether a platform broker token type requires proof request metadata.
|
|
20249
|
+
*/
|
|
20250
|
+
function isProofOfPossessionTokenType(tokenType) {
|
|
20251
|
+
return (tokenType !== undefined &&
|
|
20252
|
+
PROOF_OF_POSSESSION_TOKEN_TYPES.includes(tokenType));
|
|
20253
|
+
}
|
|
20254
|
+
/**
|
|
20255
|
+
* Adds canonical proof request fields to the broker no-cache property bag.
|
|
20256
|
+
*/
|
|
20257
|
+
function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
|
|
20258
|
+
if (!isProofOfPossessionRequest) {
|
|
20259
|
+
return extraParametersNoCache;
|
|
20260
|
+
}
|
|
20261
|
+
return {
|
|
20262
|
+
...extraParametersNoCache,
|
|
20263
|
+
...(resourceRequestMethod && {
|
|
20264
|
+
pop_method: resourceRequestMethod,
|
|
20265
|
+
}),
|
|
20266
|
+
...(resourceRequestUri && {
|
|
20267
|
+
pop_url: resourceRequestUri,
|
|
20268
|
+
}),
|
|
20269
|
+
...(dpopNonce && {
|
|
20270
|
+
pop_nonce: dpopNonce,
|
|
20271
|
+
}),
|
|
20272
|
+
};
|
|
20273
|
+
}
|
|
20274
|
+
|
|
17735
20275
|
/*
|
|
17736
20276
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
17737
20277
|
* Licensed under the MIT License.
|
|
@@ -18010,6 +20550,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
18010
20550
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
18011
20551
|
account: cachedAccount,
|
|
18012
20552
|
forceRefresh: false,
|
|
20553
|
+
resource: request.extraParameters?.resource,
|
|
18013
20554
|
};
|
|
18014
20555
|
// Preserve FMI partition semantics for silent cache filtering.
|
|
18015
20556
|
if (request.attributeTokens) {
|
|
@@ -18347,6 +20888,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
18347
20888
|
}
|
|
18348
20889
|
: undefined;
|
|
18349
20890
|
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
20891
|
+
if (request.extraParameters?.resource) {
|
|
20892
|
+
cachedAccessToken.resource = request.extraParameters.resource;
|
|
20893
|
+
}
|
|
18350
20894
|
// save idtoken credential in configured browser storage
|
|
18351
20895
|
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
18352
20896
|
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
@@ -18431,7 +20975,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
18431
20975
|
* scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
|
|
18432
20976
|
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
18433
20977
|
*/
|
|
18434
|
-
const { scopes, claims } = request;
|
|
20978
|
+
const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
|
|
18435
20979
|
const scopeSet = new ScopeSet(scopes || [], this.correlationId);
|
|
18436
20980
|
scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
|
|
18437
20981
|
const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
|
|
@@ -18464,6 +21008,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
18464
21008
|
resourceRequestUri: request.resourceRequestUri,
|
|
18465
21009
|
shrClaims: request.shrClaims,
|
|
18466
21010
|
shrNonce: request.shrNonce,
|
|
21011
|
+
extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
|
|
18467
21012
|
};
|
|
18468
21013
|
if (hasAttributeTokens) {
|
|
18469
21014
|
validatedRequest.attributeTokens =
|
|
@@ -19291,9 +21836,12 @@ class PlatformAuthExtensionHandler {
|
|
|
19291
21836
|
async sendMessage(request) {
|
|
19292
21837
|
this.logger.trace(`0on4p2 ${this.platformAuthType}`, request.correlationId);
|
|
19293
21838
|
// fall back to native calls
|
|
21839
|
+
const extensionRequest = { ...request };
|
|
21840
|
+
delete extensionRequest.resourceRequestMethod;
|
|
21841
|
+
delete extensionRequest.resourceRequestUri;
|
|
19294
21842
|
const messageBody = {
|
|
19295
21843
|
method: NativeExtensionMethod.GetToken,
|
|
19296
|
-
request:
|
|
21844
|
+
request: extensionRequest,
|
|
19297
21845
|
};
|
|
19298
21846
|
const req = {
|
|
19299
21847
|
channel: PlatformAuthConstants.CHANNEL_ID,
|
|
@@ -19584,7 +22132,9 @@ class PlatformAuthDOMHandler {
|
|
|
19584
22132
|
}
|
|
19585
22133
|
initializePlatformDOMRequest(request) {
|
|
19586
22134
|
this.logger.trace(`15d6yv ${this.platformAuthType}`, request.correlationId);
|
|
19587
|
-
const { accountId, clientId, authority, scope, redirectUri, correlationId, state, extraParameters, ...remainingProperties } = request;
|
|
22135
|
+
const { accountId, clientId, authority, scope, redirectUri, correlationId, state, preferBinding, enclave, reqCnf, extraParametersNoCache, extraParameters, ...remainingProperties } = request;
|
|
22136
|
+
delete remainingProperties.resourceRequestMethod;
|
|
22137
|
+
delete remainingProperties.resourceRequestUri;
|
|
19588
22138
|
const validExtraParameters = this.getDOMExtraParams(remainingProperties, correlationId);
|
|
19589
22139
|
const platformDOMRequest = {
|
|
19590
22140
|
accountId: accountId,
|
|
@@ -19600,6 +22150,10 @@ class PlatformAuthDOMHandler {
|
|
|
19600
22150
|
redirectUri: redirectUri,
|
|
19601
22151
|
scope: scope,
|
|
19602
22152
|
state: state,
|
|
22153
|
+
preferBinding: preferBinding,
|
|
22154
|
+
enclave: enclave,
|
|
22155
|
+
requestConfirmation: reqCnf,
|
|
22156
|
+
extraParametersNoCache,
|
|
19603
22157
|
};
|
|
19604
22158
|
return platformDOMRequest;
|
|
19605
22159
|
}
|
|
@@ -19633,6 +22187,8 @@ class PlatformAuthDOMHandler {
|
|
|
19633
22187
|
}
|
|
19634
22188
|
convertToPlatformBrokerResponse(response, correlationId) {
|
|
19635
22189
|
this.logger.trace(`14913t ${this.platformAuthType}`, correlationId);
|
|
22190
|
+
const responseProperties = response.properties || {};
|
|
22191
|
+
const bindingAttested = this.parseDOMBoolean(responseProperties.binding_attested, "binding_attested", correlationId);
|
|
19636
22192
|
const nativeResponse = {
|
|
19637
22193
|
access_token: response.accessToken,
|
|
19638
22194
|
id_token: response.idToken,
|
|
@@ -19641,12 +22197,24 @@ class PlatformAuthDOMHandler {
|
|
|
19641
22197
|
expires_in: response.expiresIn,
|
|
19642
22198
|
scope: response.scopes,
|
|
19643
22199
|
state: response.state || "",
|
|
19644
|
-
properties:
|
|
22200
|
+
properties: responseProperties,
|
|
19645
22201
|
extendedLifetimeToken: response.extendedLifetimeToken ?? false,
|
|
19646
22202
|
shr: response.proofOfPossessionPayload,
|
|
22203
|
+
token_type: responseProperties.token_type,
|
|
22204
|
+
DPoP: responseProperties.dpop_proof,
|
|
22205
|
+
binding_attested: bindingAttested,
|
|
19647
22206
|
};
|
|
19648
22207
|
return nativeResponse;
|
|
19649
22208
|
}
|
|
22209
|
+
parseDOMBoolean(value, propertyName, correlationId) {
|
|
22210
|
+
if (value === undefined) {
|
|
22211
|
+
return undefined;
|
|
22212
|
+
}
|
|
22213
|
+
if (value === "true" || value === "false") {
|
|
22214
|
+
return value === "true";
|
|
22215
|
+
}
|
|
22216
|
+
throw createAuthError(unexpectedError, correlationId, `Platform broker returned invalid ${propertyName} value.`);
|
|
22217
|
+
}
|
|
19650
22218
|
getDOMExtraParams(extraParameters, correlationId) {
|
|
19651
22219
|
try {
|
|
19652
22220
|
const stringifiedProperties = {};
|
|
@@ -20274,12 +22842,17 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
20274
22842
|
async acquireToken(request) {
|
|
20275
22843
|
const validRequest = await invokeAsync(initializeAuthorizationRequest, StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Redirect, this.config, this.browserCrypto, this.browserStorage, this.logger, this.performanceClient, this.correlationId);
|
|
20276
22844
|
validRequest.platformBroker = isPlatformAuthAllowed(this.config, this.logger, this.correlationId, this.platformAuthProvider, request.authenticationScheme);
|
|
22845
|
+
let rejectBackButtonCancellation;
|
|
22846
|
+
const backButtonCancellation = new Promise((_, reject) => {
|
|
22847
|
+
rejectBackButtonCancellation = reject;
|
|
22848
|
+
});
|
|
20277
22849
|
const handleBackButton = (event) => {
|
|
20278
22850
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
20279
22851
|
if (event.persisted) {
|
|
20280
22852
|
this.logger.verbose("0udvtt", this.correlationId);
|
|
20281
22853
|
this.browserStorage.resetRequestCache(this.correlationId);
|
|
20282
22854
|
this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, this.correlationId, InteractionType.Redirect);
|
|
22855
|
+
rejectBackButtonCancellation(createBrowserAuthError(userCancelled, this.correlationId));
|
|
20283
22856
|
}
|
|
20284
22857
|
};
|
|
20285
22858
|
const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
@@ -20289,12 +22862,10 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
20289
22862
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
20290
22863
|
window.addEventListener("pageshow", handleBackButton);
|
|
20291
22864
|
try {
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
await this.executeCodeFlow(validRequest);
|
|
20297
|
-
}
|
|
22865
|
+
const redirectOperation = this.config.system.protocolMode === ProtocolMode.EAR
|
|
22866
|
+
? this.executeEarFlow(validRequest)
|
|
22867
|
+
: this.executeCodeFlow(validRequest);
|
|
22868
|
+
await Promise.race([redirectOperation, backButtonCancellation]);
|
|
20298
22869
|
}
|
|
20299
22870
|
catch (e) {
|
|
20300
22871
|
if (e instanceof AuthError) {
|
|
@@ -22671,9 +25242,11 @@ class CustomAuthStandardController extends StandardController {
|
|
|
22671
25242
|
* Constructor for CustomAuthStandardController.
|
|
22672
25243
|
* @param operatingContext - The operating context for the controller.
|
|
22673
25244
|
* @param customAuthApiClient - The client to use for custom auth API operations.
|
|
25245
|
+
* @param customAuthApiClientV2 - The client to use for V2 custom auth API operations.
|
|
22674
25246
|
*/
|
|
22675
|
-
constructor(operatingContext, customAuthApiClient) {
|
|
25247
|
+
constructor(operatingContext, customAuthApiClient, customAuthApiClientV2) {
|
|
22676
25248
|
super(operatingContext);
|
|
25249
|
+
this.signUpStateTransitionHandlerV2 = new SignUpStateTransitionHandlerV2();
|
|
22677
25250
|
if (!this.isBrowserEnvironment) {
|
|
22678
25251
|
this.logger.verbose("1f7i3q", "");
|
|
22679
25252
|
throw new UnsupportedEnvironmentError();
|
|
@@ -22690,6 +25263,8 @@ class CustomAuthStandardController extends StandardController {
|
|
|
22690
25263
|
this.jitClient = interactionClientFactory.create(JitClient);
|
|
22691
25264
|
this.mfaClient = interactionClientFactory.create(MfaClient);
|
|
22692
25265
|
this.cacheClient = interactionClientFactory.create(CustomAuthSilentCacheClient);
|
|
25266
|
+
this.flowClientV2 = new FlowInteractionClientV2(this.customAuthConfig, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.authority, customAuthApiClientV2 ??
|
|
25267
|
+
new CustomAuthApiClientV2(this.authority.getCustomAuthApiDomain(), this.customAuthConfig.auth.clientId, new FetchHttpClient(this.logger), this.customAuthConfig.customAuth?.customAuthApiQueryParams, this.customAuthConfig.customAuth?.requestInterceptor, this.logger));
|
|
22693
25268
|
}
|
|
22694
25269
|
/*
|
|
22695
25270
|
* Gets the current account from the cache.
|
|
@@ -22944,6 +25519,176 @@ class CustomAuthStandardController extends StandardController {
|
|
|
22944
25519
|
return ResetPasswordStartResult.createWithError(error);
|
|
22945
25520
|
}
|
|
22946
25521
|
}
|
|
25522
|
+
async resetPasswordV2(inputs) {
|
|
25523
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25524
|
+
try {
|
|
25525
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25526
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25527
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25528
|
+
this.logger.verbose("0301h1", correlationId);
|
|
25529
|
+
const result = await this.flowClientV2.resetPassword({
|
|
25530
|
+
correlationId,
|
|
25531
|
+
username: inputs.username,
|
|
25532
|
+
});
|
|
25533
|
+
this.logger.verbose("1yrzgs", correlationId);
|
|
25534
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25535
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25536
|
+
correlationId: result.correlationId,
|
|
25537
|
+
logger: this.logger,
|
|
25538
|
+
config: this.customAuthConfig,
|
|
25539
|
+
flowClient: this.flowClientV2,
|
|
25540
|
+
continuationState: result.continuationState,
|
|
25541
|
+
cacheClient: this.cacheClient,
|
|
25542
|
+
method: result.method,
|
|
25543
|
+
sentTo: result.sentTo,
|
|
25544
|
+
channel: result.channel,
|
|
25545
|
+
codeLength: result.codeLength,
|
|
25546
|
+
}), undefined, result.continuationState.scenario);
|
|
25547
|
+
}
|
|
25548
|
+
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
25549
|
+
correlationId: result.correlationId,
|
|
25550
|
+
logger: this.logger,
|
|
25551
|
+
config: this.customAuthConfig,
|
|
25552
|
+
flowClient: this.flowClientV2,
|
|
25553
|
+
continuationState: result.continuationState,
|
|
25554
|
+
cacheClient: this.cacheClient,
|
|
25555
|
+
methods: result.methods,
|
|
25556
|
+
}), undefined, result.continuationState.scenario);
|
|
25557
|
+
}
|
|
25558
|
+
catch (error) {
|
|
25559
|
+
this.logger.errorPii(`1f279y ${error}`, correlationId);
|
|
25560
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25561
|
+
errorType: ResetPasswordStartErrorV2,
|
|
25562
|
+
scenario: CustomAuthFlowScenarioV2.PasswordReset,
|
|
25563
|
+
correlationId,
|
|
25564
|
+
});
|
|
25565
|
+
}
|
|
25566
|
+
}
|
|
25567
|
+
async signInV2(inputs) {
|
|
25568
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25569
|
+
try {
|
|
25570
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25571
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25572
|
+
if (inputs.claims) {
|
|
25573
|
+
ensureArgumentIsJSONString("inputs.claims", inputs.claims, correlationId);
|
|
25574
|
+
}
|
|
25575
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25576
|
+
this.logger.verbose("145cnd", correlationId);
|
|
25577
|
+
const result = await this.flowClientV2.signIn({
|
|
25578
|
+
correlationId,
|
|
25579
|
+
username: inputs.username,
|
|
25580
|
+
password: inputs.password,
|
|
25581
|
+
scopes: inputs.scopes,
|
|
25582
|
+
});
|
|
25583
|
+
if (result.type === FLOW_COMPLETED_V2) {
|
|
25584
|
+
return new CustomAuthResultV2(new CompletedStateV2(), new CustomAuthAccountData(result.authenticationResult.account, this.customAuthConfig, this.cacheClient, this.logger, correlationId), CustomAuthFlowScenarioV2.SignIn);
|
|
25585
|
+
}
|
|
25586
|
+
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
25587
|
+
return new CustomAuthResultV2(new MFARequiredStateV2({
|
|
25588
|
+
correlationId: result.correlationId,
|
|
25589
|
+
logger: this.logger,
|
|
25590
|
+
config: this.customAuthConfig,
|
|
25591
|
+
flowClient: this.flowClientV2,
|
|
25592
|
+
continuationState: result.continuationState,
|
|
25593
|
+
cacheClient: this.cacheClient,
|
|
25594
|
+
methods: result.methods,
|
|
25595
|
+
}), undefined, result.continuationState.scenario);
|
|
25596
|
+
}
|
|
25597
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25598
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25599
|
+
correlationId: result.correlationId,
|
|
25600
|
+
logger: this.logger,
|
|
25601
|
+
config: this.customAuthConfig,
|
|
25602
|
+
flowClient: this.flowClientV2,
|
|
25603
|
+
continuationState: result.continuationState,
|
|
25604
|
+
cacheClient: this.cacheClient,
|
|
25605
|
+
method: result.method,
|
|
25606
|
+
sentTo: result.sentTo,
|
|
25607
|
+
channel: result.channel,
|
|
25608
|
+
codeLength: result.codeLength,
|
|
25609
|
+
}), undefined, result.continuationState.scenario);
|
|
25610
|
+
}
|
|
25611
|
+
if (result.type === FLOW_PASSWORD_REQUIRED_V2) {
|
|
25612
|
+
return new CustomAuthResultV2(new PasswordRequiredStateV2({
|
|
25613
|
+
correlationId: result.correlationId,
|
|
25614
|
+
logger: this.logger,
|
|
25615
|
+
config: this.customAuthConfig,
|
|
25616
|
+
flowClient: this.flowClientV2,
|
|
25617
|
+
continuationState: result.continuationState,
|
|
25618
|
+
cacheClient: this.cacheClient,
|
|
25619
|
+
}), undefined, result.continuationState.scenario);
|
|
25620
|
+
}
|
|
25621
|
+
throw new UnexpectedError("Unsupported native auth V2 sign-in result type.", correlationId);
|
|
25622
|
+
}
|
|
25623
|
+
catch (error) {
|
|
25624
|
+
this.logger.errorPii(`11afy0 ${error}`, correlationId);
|
|
25625
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25626
|
+
errorType: SignInStartErrorV2,
|
|
25627
|
+
scenario: CustomAuthFlowScenarioV2.SignIn,
|
|
25628
|
+
correlationId,
|
|
25629
|
+
});
|
|
25630
|
+
}
|
|
25631
|
+
}
|
|
25632
|
+
async signUpV2(inputs) {
|
|
25633
|
+
const correlationId = this.getCorrelationId(inputs);
|
|
25634
|
+
try {
|
|
25635
|
+
ensureArgumentIsNotNullOrUndefined("inputs", inputs, correlationId);
|
|
25636
|
+
ensureArgumentIsNotEmptyString("inputs.username", inputs.username, correlationId);
|
|
25637
|
+
if (Object.prototype.hasOwnProperty.call(inputs, "password")) {
|
|
25638
|
+
ensureArgumentIsNotNullOrUndefined("inputs.password", inputs.password, correlationId);
|
|
25639
|
+
ensureArgumentIsNotEmptyString("inputs.password", inputs.password, correlationId);
|
|
25640
|
+
}
|
|
25641
|
+
this.ensureUserNotSignedIn(correlationId);
|
|
25642
|
+
this.logger.verbose("0010xn", correlationId);
|
|
25643
|
+
const result = await this.flowClientV2.signUp({
|
|
25644
|
+
correlationId,
|
|
25645
|
+
username: inputs.username,
|
|
25646
|
+
password: inputs.password,
|
|
25647
|
+
attributes: inputs.attributes,
|
|
25648
|
+
scopes: inputs.scopes,
|
|
25649
|
+
claims: inputs.claims,
|
|
25650
|
+
});
|
|
25651
|
+
const commonStateParameters = {
|
|
25652
|
+
correlationId: result.correlationId,
|
|
25653
|
+
logger: this.logger,
|
|
25654
|
+
config: this.customAuthConfig,
|
|
25655
|
+
flowClient: this.flowClientV2,
|
|
25656
|
+
continuationState: result.continuationState,
|
|
25657
|
+
cacheClient: this.cacheClient,
|
|
25658
|
+
signUpStateTransitionHandler: this.signUpStateTransitionHandlerV2,
|
|
25659
|
+
};
|
|
25660
|
+
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
25661
|
+
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
25662
|
+
...commonStateParameters,
|
|
25663
|
+
sentTo: result.sentTo,
|
|
25664
|
+
channel: result.channel,
|
|
25665
|
+
codeLength: result.codeLength,
|
|
25666
|
+
}), undefined, result.continuationState.scenario);
|
|
25667
|
+
}
|
|
25668
|
+
if (result.type === FLOW_SIGN_UP_PASSWORD_REQUIRED_V2) {
|
|
25669
|
+
return new CustomAuthResultV2(new SignUpPasswordRequiredStateV2({
|
|
25670
|
+
...commonStateParameters,
|
|
25671
|
+
attributes: result.attributes,
|
|
25672
|
+
requiredPasswordAttribute: result.requiredPasswordAttribute,
|
|
25673
|
+
}), undefined, result.continuationState.scenario);
|
|
25674
|
+
}
|
|
25675
|
+
if (result.type === FLOW_ATTRIBUTES_REQUIRED_V2) {
|
|
25676
|
+
return new CustomAuthResultV2(new AttributesRequiredStateV2({
|
|
25677
|
+
...commonStateParameters,
|
|
25678
|
+
attributes: result.attributes,
|
|
25679
|
+
}), undefined, result.continuationState.scenario);
|
|
25680
|
+
}
|
|
25681
|
+
throw new UnexpectedError("Unsupported native auth V2 sign-up result type.", correlationId);
|
|
25682
|
+
}
|
|
25683
|
+
catch (error) {
|
|
25684
|
+
this.logger.errorPii(`196wno ${error}`, correlationId);
|
|
25685
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
25686
|
+
errorType: SignUpStartErrorV2,
|
|
25687
|
+
scenario: CustomAuthFlowScenarioV2.SignUp,
|
|
25688
|
+
correlationId,
|
|
25689
|
+
});
|
|
25690
|
+
}
|
|
25691
|
+
}
|
|
22947
25692
|
getCorrelationId(actionInputs) {
|
|
22948
25693
|
return (actionInputs?.correlationId || this.browserCrypto.createNewGuid());
|
|
22949
25694
|
}
|
|
@@ -23755,7 +26500,7 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
|
|
|
23755
26500
|
/**
|
|
23756
26501
|
* Creates a new instance of a PublicClientApplication with the given configuration and controller to start Native authentication flows
|
|
23757
26502
|
* @param {CustomAuthConfiguration} config - A configuration object for the PublicClientApplication instance
|
|
23758
|
-
* @returns {Promise<
|
|
26503
|
+
* @returns {Promise<ICustomAuthPublicClientApplicationV2>} - A promise that resolves to a CustomAuthPublicClientApplication instance
|
|
23759
26504
|
*/
|
|
23760
26505
|
static async create(config) {
|
|
23761
26506
|
CustomAuthPublicClientApplication.validateConfig(config);
|
|
@@ -23806,6 +26551,31 @@ class CustomAuthPublicClientApplication extends PublicClientApplication {
|
|
|
23806
26551
|
resetPassword(resetPasswordInputs) {
|
|
23807
26552
|
return this.customAuthController.resetPassword(resetPasswordInputs);
|
|
23808
26553
|
}
|
|
26554
|
+
/**
|
|
26555
|
+
* Starts native auth V2 sign-in and returns the authentication methods
|
|
26556
|
+
* offered for the first factor.
|
|
26557
|
+
* @param inputs - Inputs for the sign-in V2 flow.
|
|
26558
|
+
* @returns A promise that resolves to the sign-in start result.
|
|
26559
|
+
*/
|
|
26560
|
+
signInV2(inputs) {
|
|
26561
|
+
return this.customAuthController.signInV2(inputs);
|
|
26562
|
+
}
|
|
26563
|
+
/**
|
|
26564
|
+
* Starts native auth V2 sign-up.
|
|
26565
|
+
* @param inputs - Inputs for the sign-up V2 flow.
|
|
26566
|
+
* @returns A promise that resolves to the sign-up start result.
|
|
26567
|
+
*/
|
|
26568
|
+
signUpV2(inputs) {
|
|
26569
|
+
return this.customAuthController.signUpV2(inputs);
|
|
26570
|
+
}
|
|
26571
|
+
/**
|
|
26572
|
+
* Initiates the native auth V2 self-service password reset flow.
|
|
26573
|
+
* @param {ResetPasswordInputsV2} inputs - Inputs for the reset-password V2 flow
|
|
26574
|
+
* @returns {Promise<ResetPasswordStartResultV2>} - A promise that resolves to ResetPasswordStartResultV2
|
|
26575
|
+
*/
|
|
26576
|
+
resetPasswordV2(inputs) {
|
|
26577
|
+
return this.customAuthController.resetPasswordV2(inputs);
|
|
26578
|
+
}
|
|
23809
26579
|
/**
|
|
23810
26580
|
* Validates the configuration to ensure it is a valid CustomAuthConfiguration object.
|
|
23811
26581
|
* @param {CustomAuthConfiguration} config - The configuration object for the PublicClientApplication.
|
|
@@ -23845,6 +26615,7 @@ class UserAccountAttributeError extends CustomAuthError {
|
|
|
23845
26615
|
}
|
|
23846
26616
|
}
|
|
23847
26617
|
|
|
26618
|
+
exports.AttributesRequiredStateV2 = AttributesRequiredStateV2;
|
|
23848
26619
|
exports.AuthFlowActionRequiredStateBase = AuthFlowActionRequiredStateBase;
|
|
23849
26620
|
exports.AuthFlowStateBase = AuthFlowStateBase;
|
|
23850
26621
|
exports.AuthMethodRegistrationChallengeMethodError = AuthMethodRegistrationChallengeMethodError;
|
|
@@ -23854,11 +26625,17 @@ exports.AuthMethodRegistrationFailedState = AuthMethodRegistrationFailedState;
|
|
|
23854
26625
|
exports.AuthMethodRegistrationRequiredState = AuthMethodRegistrationRequiredState;
|
|
23855
26626
|
exports.AuthMethodRegistrationSubmitChallengeError = AuthMethodRegistrationSubmitChallengeError;
|
|
23856
26627
|
exports.AuthMethodRegistrationSubmitChallengeResult = AuthMethodRegistrationSubmitChallengeResult;
|
|
26628
|
+
exports.AuthMethodSelectionRequiredStateV2 = AuthMethodSelectionRequiredStateV2;
|
|
23857
26629
|
exports.AuthMethodVerificationRequiredState = AuthMethodVerificationRequiredState;
|
|
26630
|
+
exports.CodeRequiredStateV2 = CodeRequiredStateV2;
|
|
26631
|
+
exports.CompletedStateV2 = CompletedStateV2;
|
|
23858
26632
|
exports.CustomAuthAccountData = CustomAuthAccountData;
|
|
23859
26633
|
exports.CustomAuthApiError = CustomAuthApiError;
|
|
23860
26634
|
exports.CustomAuthError = CustomAuthError;
|
|
26635
|
+
exports.CustomAuthFlowScenarioV2 = CustomAuthFlowScenarioV2;
|
|
23861
26636
|
exports.CustomAuthPublicClientApplication = CustomAuthPublicClientApplication;
|
|
26637
|
+
exports.CustomAuthResultV2 = CustomAuthResultV2;
|
|
26638
|
+
exports.FailedStateV2 = FailedStateV2;
|
|
23862
26639
|
exports.GetAccessTokenResult = GetAccessTokenResult;
|
|
23863
26640
|
exports.GetAccountError = GetAccountError;
|
|
23864
26641
|
exports.GetAccountResult = GetAccountResult;
|
|
@@ -23866,6 +26643,8 @@ exports.GetCurrentAccountAccessTokenError = GetCurrentAccountAccessTokenError;
|
|
|
23866
26643
|
exports.HttpError = HttpError;
|
|
23867
26644
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
23868
26645
|
exports.InvalidConfigurationError = InvalidConfigurationError;
|
|
26646
|
+
exports.MFARequiredStateV2 = MFARequiredStateV2;
|
|
26647
|
+
exports.MFAVerificationRequiredStateV2 = MFAVerificationRequiredStateV2;
|
|
23869
26648
|
exports.MethodNotImplementedError = MethodNotImplementedError;
|
|
23870
26649
|
exports.MfaAwaitingState = MfaAwaitingState;
|
|
23871
26650
|
exports.MfaCompletedState = MfaCompletedState;
|
|
@@ -23876,8 +26655,11 @@ exports.MfaSubmitChallengeError = MfaSubmitChallengeError;
|
|
|
23876
26655
|
exports.MfaSubmitChallengeResult = MfaSubmitChallengeResult;
|
|
23877
26656
|
exports.MfaVerificationRequiredState = MfaVerificationRequiredState;
|
|
23878
26657
|
exports.MsalCustomAuthError = MsalCustomAuthError;
|
|
26658
|
+
exports.NewPasswordRequiredStateV2 = NewPasswordRequiredStateV2;
|
|
23879
26659
|
exports.NoCachedAccountFoundError = NoCachedAccountFoundError;
|
|
23880
26660
|
exports.ParsedUrlError = ParsedUrlError;
|
|
26661
|
+
exports.PasswordRequiredStateV2 = PasswordRequiredStateV2;
|
|
26662
|
+
exports.RequestChallengeErrorV2 = RequestChallengeErrorV2;
|
|
23881
26663
|
exports.ResetPasswordCodeRequiredState = ResetPasswordCodeRequiredState;
|
|
23882
26664
|
exports.ResetPasswordCompletedState = ResetPasswordCompletedState;
|
|
23883
26665
|
exports.ResetPasswordError = ResetPasswordError;
|
|
@@ -23885,6 +26667,7 @@ exports.ResetPasswordFailedState = ResetPasswordFailedState;
|
|
|
23885
26667
|
exports.ResetPasswordPasswordRequiredState = ResetPasswordPasswordRequiredState;
|
|
23886
26668
|
exports.ResetPasswordResendCodeError = ResetPasswordResendCodeError;
|
|
23887
26669
|
exports.ResetPasswordResendCodeResult = ResetPasswordResendCodeResult;
|
|
26670
|
+
exports.ResetPasswordStartErrorV2 = ResetPasswordStartErrorV2;
|
|
23888
26671
|
exports.ResetPasswordStartResult = ResetPasswordStartResult;
|
|
23889
26672
|
exports.ResetPasswordState = ResetPasswordState;
|
|
23890
26673
|
exports.ResetPasswordSubmitCodeError = ResetPasswordSubmitCodeError;
|
|
@@ -23893,13 +26676,16 @@ exports.ResetPasswordSubmitPasswordError = ResetPasswordSubmitPasswordError;
|
|
|
23893
26676
|
exports.ResetPasswordSubmitPasswordResult = ResetPasswordSubmitPasswordResult;
|
|
23894
26677
|
exports.SignInCodeRequiredState = SignInCodeRequiredState;
|
|
23895
26678
|
exports.SignInCompletedState = SignInCompletedState;
|
|
26679
|
+
exports.SignInContinuationErrorV2 = SignInContinuationErrorV2;
|
|
23896
26680
|
exports.SignInContinuationState = SignInContinuationState;
|
|
26681
|
+
exports.SignInContinuationStateV2 = SignInContinuationStateV2;
|
|
23897
26682
|
exports.SignInError = SignInError;
|
|
23898
26683
|
exports.SignInFailedState = SignInFailedState;
|
|
23899
26684
|
exports.SignInPasswordRequiredState = SignInPasswordRequiredState;
|
|
23900
26685
|
exports.SignInResendCodeError = SignInResendCodeError;
|
|
23901
26686
|
exports.SignInResendCodeResult = SignInResendCodeResult;
|
|
23902
26687
|
exports.SignInResult = SignInResult;
|
|
26688
|
+
exports.SignInStartErrorV2 = SignInStartErrorV2;
|
|
23903
26689
|
exports.SignInState = SignInState;
|
|
23904
26690
|
exports.SignInSubmitCodeError = SignInSubmitCodeError;
|
|
23905
26691
|
exports.SignInSubmitCodeResult = SignInSubmitCodeResult;
|
|
@@ -23913,9 +26699,11 @@ exports.SignUpCompletedState = SignUpCompletedState;
|
|
|
23913
26699
|
exports.SignUpError = SignUpError;
|
|
23914
26700
|
exports.SignUpFailedState = SignUpFailedState;
|
|
23915
26701
|
exports.SignUpPasswordRequiredState = SignUpPasswordRequiredState;
|
|
26702
|
+
exports.SignUpPasswordRequiredStateV2 = SignUpPasswordRequiredStateV2;
|
|
23916
26703
|
exports.SignUpResendCodeError = SignUpResendCodeError;
|
|
23917
26704
|
exports.SignUpResendCodeResult = SignUpResendCodeResult;
|
|
23918
26705
|
exports.SignUpResult = SignUpResult;
|
|
26706
|
+
exports.SignUpStartErrorV2 = SignUpStartErrorV2;
|
|
23919
26707
|
exports.SignUpState = SignUpState;
|
|
23920
26708
|
exports.SignUpSubmitAttributesError = SignUpSubmitAttributesError;
|
|
23921
26709
|
exports.SignUpSubmitAttributesResult = SignUpSubmitAttributesResult;
|
|
@@ -23923,8 +26711,12 @@ exports.SignUpSubmitCodeError = SignUpSubmitCodeError;
|
|
|
23923
26711
|
exports.SignUpSubmitCodeResult = SignUpSubmitCodeResult;
|
|
23924
26712
|
exports.SignUpSubmitPasswordError = SignUpSubmitPasswordError;
|
|
23925
26713
|
exports.SignUpSubmitPasswordResult = SignUpSubmitPasswordResult;
|
|
26714
|
+
exports.SubmitAttributesErrorV2 = SubmitAttributesErrorV2;
|
|
26715
|
+
exports.SubmitNewPasswordErrorV2 = SubmitNewPasswordErrorV2;
|
|
26716
|
+
exports.SubmitPasswordErrorV2 = SubmitPasswordErrorV2;
|
|
23926
26717
|
exports.UnexpectedError = UnexpectedError;
|
|
23927
26718
|
exports.UnsupportedEnvironmentError = UnsupportedEnvironmentError;
|
|
23928
26719
|
exports.UserAccountAttributeError = UserAccountAttributeError;
|
|
23929
26720
|
exports.UserAlreadySignedInError = UserAlreadySignedInError;
|
|
26721
|
+
exports.VerifyChallengeErrorV2 = VerifyChallengeErrorV2;
|
|
23930
26722
|
//# sourceMappingURL=msal-custom-auth.cjs.map
|