@azure/msal-browser 5.26.0 → 5.28.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/README.md +2 -0
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +54 -14
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +9 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +7 -6
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +4 -2
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +21 -7
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +14 -1
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +9 -2
- package/dist/cache/BrowserCacheManager.mjs.map +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 +32 -4
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +100 -11
- package/dist/controllers/StandardController.mjs.map +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 +14 -1
- package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -1
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +14 -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 +1 -1
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +68 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +3 -2
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +87 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +5 -3
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -2
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +4 -3
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +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 +246 -73
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -2
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +10 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +118 -25
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +2 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +2 -12
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +2 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +17 -3
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +9 -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 +3 -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/state/NewPasswordRequiredStateV2.mjs +32 -13
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +14 -2
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +9 -2
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +504 -75
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +54 -20
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +30 -16
- 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 +44 -32
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +7 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +79 -19
- 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 +43 -25
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +35 -11
- package/dist/request/RequestHelpers.mjs.map +1 -1
- package/dist/request/SilentRequestHelpers.mjs +6 -6
- package/dist/request/SilentRequestHelpers.mjs.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +3 -2
- package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserDetection.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +7 -2
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/IframeMonitor.mjs +81 -0
- package/dist/utils/IframeMonitor.mjs.map +1 -0
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/utils/PopupMonitor.mjs +119 -0
- package/dist/utils/PopupMonitor.mjs.map +1 -0
- package/dist/utils/PopupOriginCheck.mjs +88 -0
- package/dist/utils/PopupOriginCheck.mjs.map +1 -0
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
- package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
- package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
- package/dist/webBrokerBridge/index.mjs +1 -1
- package/lib/custom-auth-path/log-strings-mapping.json +71 -11
- package/lib/custom-auth-path/msal-custom-auth.cjs +2085 -451
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +2085 -451
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +39 -11
- package/lib/msal-browser.cjs +1461 -320
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1461 -320
- 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 +1 -1
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +108 -8
- package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +15 -0
- package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +6 -21
- package/src/broker/nativeBroker/PlatformAuthProvider.ts +3 -1
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +12 -8
- package/src/broker/nativeBroker/PlatformAuthResponse.ts +31 -0
- package/src/cache/AsyncMemoryStorage.ts +16 -0
- package/src/cache/BrowserCacheManager.ts +19 -1
- package/src/config/Configuration.ts +63 -6
- package/src/controllers/StandardController.ts +153 -14
- package/src/crypto/TokenBindingKeyManager.ts +21 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +23 -0
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +1 -1
- package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +2 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +94 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +7 -2
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +132 -0
- package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +8 -2
- package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +13 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +8 -2
- package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +1 -0
- package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +445 -91
- package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +25 -0
- package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +34 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +9 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +262 -43
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +4 -7
- package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +21 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +41 -2
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +44 -19
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +4 -6
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +6 -1
- package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +25 -1
- package/src/custom_auth/core/telemetry/PublicApiId.ts +6 -0
- package/src/custom_auth/index.ts +11 -0
- package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
- package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +47 -15
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +18 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +13 -0
- package/src/interaction_client/PlatformAuthInteractionClient.ts +851 -128
- package/src/interaction_client/PopupClient.ts +140 -83
- package/src/interaction_client/RedirectClient.ts +88 -35
- package/src/interaction_client/SilentIframeClient.ts +121 -95
- package/src/interaction_client/StandardInteractionClient.ts +6 -0
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +80 -46
- package/src/request/RequestHelpers.ts +64 -11
- package/src/request/SilentRequestHelpers.ts +8 -9
- package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
- package/src/utils/BrowserUtils.ts +8 -1
- package/src/utils/IframeMonitor.ts +98 -0
- package/src/utils/PopupMonitor.ts +158 -0
- package/src/utils/PopupOriginCheck.ts +94 -0
- package/types/app/PublicClientApplication.d.ts +6 -4
- package/types/app/PublicClientApplication.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +6 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +21 -0
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
- package/types/cache/AsyncMemoryStorage.d.ts +5 -0
- package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/types/cache/BrowserCacheManager.d.ts +4 -0
- package/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/types/config/Configuration.d.ts +16 -0
- package/types/config/Configuration.d.ts.map +1 -1
- package/types/controllers/StandardController.d.ts +5 -0
- package/types/controllers/StandardController.d.ts.map +1 -1
- package/types/crypto/TokenBindingKeyManager.d.ts +9 -0
- package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -1
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +15 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +2 -1
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +22 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +28 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +3 -2
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -0
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -5
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +17 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +18 -2
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +8 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +8 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +3 -3
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +12 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +29 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +30 -17
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +3 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +3 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +6 -1
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts +6 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
- package/types/custom_auth/index.d.ts +5 -0
- package/types/custom_auth/index.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +4 -4
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +2 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +2 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +2 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +106 -5
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PopupClient.d.ts +12 -0
- package/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/protocol/Authorize.d.ts +4 -4
- package/types/protocol/Authorize.d.ts.map +1 -1
- package/types/request/RequestHelpers.d.ts +21 -3
- package/types/request/RequestHelpers.d.ts.map +1 -1
- package/types/request/SilentRequestHelpers.d.ts.map +1 -1
- package/types/telemetry/BrowserPerformanceEvents.d.ts +1 -0
- package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
- package/types/utils/BrowserUtils.d.ts +2 -1
- package/types/utils/BrowserUtils.d.ts.map +1 -1
- package/types/utils/IframeMonitor.d.ts +17 -0
- package/types/utils/IframeMonitor.d.ts.map +1 -0
- package/types/utils/PopupMonitor.d.ts +37 -0
- package/types/utils/PopupMonitor.d.ts.map +1 -0
- package/types/utils/PopupOriginCheck.d.ts +27 -0
- package/types/utils/PopupOriginCheck.d.ts.map +1 -0
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
import { FlowContinuationStateV2 } from "../FlowContinuationStateV2.js";
|
|
7
7
|
import { UserAccountAttributes } from "../../../../UserAccountAttributes.js";
|
|
8
|
+
import type {
|
|
9
|
+
AuthenticationFactorV2,
|
|
10
|
+
EnrollmentMethodV2,
|
|
11
|
+
} from "../../../network_client/custom_auth_api/v2/result/BaseResultsV2.js";
|
|
12
|
+
import type { AuthenticationMethodRegistrationV2 } from "../../../auth_flow/v2/AuthenticationMethodRegistrationV2.js";
|
|
8
13
|
|
|
9
14
|
/*
|
|
10
15
|
* Input parameters for V2 interaction-client actions. Continuing actions carry
|
|
@@ -34,11 +39,13 @@ export interface FlowSignUpStartParamsV2 extends FlowStartParamsV2 {
|
|
|
34
39
|
// Request the challenge for the selected method, sending the one-time code to it.
|
|
35
40
|
export interface FlowChallengeParamsV2 extends FlowParamsBaseV2 {
|
|
36
41
|
continuationState: FlowContinuationStateV2;
|
|
42
|
+
authenticationFactor?: AuthenticationFactorV2;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
// Submit the one-time code the user received.
|
|
40
46
|
export interface FlowSubmitCodeParamsV2 extends FlowParamsBaseV2 {
|
|
41
47
|
continuationState: FlowContinuationStateV2;
|
|
48
|
+
authenticationFactor?: AuthenticationFactorV2;
|
|
42
49
|
code: string;
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -62,3 +69,21 @@ export interface FlowSubmitSignUpAttributesParamsV2 extends FlowParamsBaseV2 {
|
|
|
62
69
|
export interface FlowSignInWithContinuationParamsV2 extends FlowParamsBaseV2 {
|
|
63
70
|
continuationState: FlowContinuationStateV2;
|
|
64
71
|
}
|
|
72
|
+
|
|
73
|
+
export interface FlowAuthMethodRegistrationRequiredParamsV2
|
|
74
|
+
extends FlowParamsBaseV2 {
|
|
75
|
+
continuationState: FlowContinuationStateV2;
|
|
76
|
+
methods: EnrollmentMethodV2[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface FlowRegisterAuthMethodParamsV2 extends FlowParamsBaseV2 {
|
|
80
|
+
continuationState: FlowContinuationStateV2;
|
|
81
|
+
method: AuthenticationMethodRegistrationV2;
|
|
82
|
+
verificationContact: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface FlowVerifyAuthMethodRegistrationParamsV2
|
|
86
|
+
extends FlowParamsBaseV2 {
|
|
87
|
+
continuationState: FlowContinuationStateV2;
|
|
88
|
+
code: string;
|
|
89
|
+
}
|
|
@@ -7,6 +7,7 @@ import { AuthenticationResult } from "../../../../../response/AuthenticationResu
|
|
|
7
7
|
import { AuthenticationMethodV2 } from "../../../auth_flow/v2/AuthenticationMethodV2.js";
|
|
8
8
|
import { FlowContinuationStateV2 } from "../FlowContinuationStateV2.js";
|
|
9
9
|
import { SignUpAttributeV2 } from "../../../network_client/custom_auth_api/v2/result/SignUpResultsV2.js";
|
|
10
|
+
import { AuthenticationMethodRegistrationV2 } from "../../../auth_flow/v2/AuthenticationMethodRegistrationV2.js";
|
|
10
11
|
|
|
11
12
|
/*
|
|
12
13
|
* Unified outcome envelope returned by V2 interaction-client actions. The L1
|
|
@@ -102,18 +103,35 @@ export interface FlowCompletedResultV2 extends FlowActionResultBaseV2 {
|
|
|
102
103
|
authenticationResult: AuthenticationResult;
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
export interface FlowAuthMethodRegistrationRequiredResultV2
|
|
107
|
+
extends FlowActionResultBaseV2 {
|
|
108
|
+
type: typeof FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2;
|
|
109
|
+
continuationState: FlowContinuationStateV2;
|
|
110
|
+
methods: AuthenticationMethodRegistrationV2[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface FlowAuthMethodVerificationRequiredResultV2
|
|
114
|
+
extends FlowActionResultBaseV2 {
|
|
115
|
+
type: typeof FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2;
|
|
116
|
+
continuationState: FlowContinuationStateV2;
|
|
117
|
+
sentTo?: string;
|
|
118
|
+
codeLength: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
105
121
|
export type FlowSubmitCodeResultV2 =
|
|
106
122
|
| FlowNewPasswordRequiredResultV2
|
|
107
123
|
| FlowSignUpPasswordRequiredResultV2
|
|
108
124
|
| FlowAttributesRequiredResultV2
|
|
109
125
|
| FlowSignInContinuationRequiredResultV2
|
|
110
126
|
| FlowMFARequiredResultV2
|
|
127
|
+
| FlowAuthMethodRegistrationRequiredResultV2
|
|
111
128
|
| FlowCompletedResultV2;
|
|
112
129
|
|
|
113
130
|
export type FlowSignUpActionResultV2 =
|
|
114
131
|
| FlowCodeRequiredResultV2
|
|
115
132
|
| FlowSignUpPasswordRequiredResultV2
|
|
116
133
|
| FlowAttributesRequiredResultV2
|
|
134
|
+
| FlowAuthMethodRegistrationRequiredResultV2
|
|
117
135
|
| FlowSignInContinuationRequiredResultV2;
|
|
118
136
|
|
|
119
137
|
// Result type discriminators.
|
|
@@ -129,6 +147,10 @@ export const FLOW_ATTRIBUTES_REQUIRED_V2 = "FlowAttributesRequiredResultV2";
|
|
|
129
147
|
export const FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 =
|
|
130
148
|
"FlowSignInContinuationRequiredResultV2";
|
|
131
149
|
export const FLOW_COMPLETED_V2 = "FlowCompletedResultV2";
|
|
150
|
+
export const FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 =
|
|
151
|
+
"FlowAuthMethodRegistrationRequiredResultV2";
|
|
152
|
+
export const FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2 =
|
|
153
|
+
"FlowAuthMethodVerificationRequiredResultV2";
|
|
132
154
|
|
|
133
155
|
export function createFlowMethodSelectionRequiredResultV2(
|
|
134
156
|
input: Omit<FlowMethodSelectionRequiredResultV2, "type">
|
|
@@ -183,3 +205,15 @@ export function createFlowCompletedResultV2(
|
|
|
183
205
|
): FlowCompletedResultV2 {
|
|
184
206
|
return { type: FLOW_COMPLETED_V2, ...input };
|
|
185
207
|
}
|
|
208
|
+
|
|
209
|
+
export function createFlowAuthMethodRegistrationRequiredResultV2(
|
|
210
|
+
input: Omit<FlowAuthMethodRegistrationRequiredResultV2, "type">
|
|
211
|
+
): FlowAuthMethodRegistrationRequiredResultV2 {
|
|
212
|
+
return { type: FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2, ...input };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function createFlowAuthMethodVerificationRequiredResultV2(
|
|
216
|
+
input: Omit<FlowAuthMethodVerificationRequiredResultV2, "type">
|
|
217
|
+
): FlowAuthMethodVerificationRequiredResultV2 {
|
|
218
|
+
return { type: FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2, ...input };
|
|
219
|
+
}
|
|
@@ -12,10 +12,19 @@ export const CHALLENGE_RELATION = "challenge";
|
|
|
12
12
|
export const VERIFY_RELATION = "verify";
|
|
13
13
|
export const RISK_VERIFY_RELATION = "riskverify";
|
|
14
14
|
export const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
|
|
15
|
+
export const ENROLL_RELATION = "enroll";
|
|
16
|
+
export const ACTIVATE_RELATION = "activate";
|
|
17
|
+
export const RESEND_RELATION = "resend";
|
|
18
|
+
export const POLL_RELATION = "poll";
|
|
15
19
|
|
|
16
20
|
export const AuthenticationMethodTypeV2 = {
|
|
17
21
|
EMAIL: "email",
|
|
18
22
|
PASSWORD: "password",
|
|
23
|
+
PHONE: "phone",
|
|
24
|
+
SMS: "sms",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export const PhoneRegistrationChannelV2 = {
|
|
19
28
|
SMS: "sms",
|
|
20
29
|
} as const;
|
|
21
30
|
|
|
@@ -15,11 +15,12 @@ import {
|
|
|
15
15
|
StartResultV2,
|
|
16
16
|
StartMethodV2,
|
|
17
17
|
ChallengeResultV2,
|
|
18
|
-
ChallengeNextActionV2,
|
|
19
18
|
ChallengeVerificationResultV2,
|
|
20
19
|
VerifyResultV2,
|
|
21
|
-
VerifyNextActionV2,
|
|
22
20
|
AuthenticationFactorV2,
|
|
21
|
+
ActivationResultV2,
|
|
22
|
+
EnrollmentResultV2,
|
|
23
|
+
EnrollmentMethodV2,
|
|
23
24
|
} from "./result/BaseResultsV2.js";
|
|
24
25
|
import {
|
|
25
26
|
SignUpStartApiResultV2,
|
|
@@ -40,6 +41,9 @@ import {
|
|
|
40
41
|
PollResponseV2,
|
|
41
42
|
ParsedResponseV2,
|
|
42
43
|
EmbeddedMethodV2,
|
|
44
|
+
EmbeddedEnrollmentMethodV2,
|
|
45
|
+
EnrollmentResponseV2,
|
|
46
|
+
HalResponseBaseV2,
|
|
43
47
|
} from "./response/ResponsesV2.js";
|
|
44
48
|
import {
|
|
45
49
|
RequestContextV2,
|
|
@@ -51,6 +55,8 @@ import {
|
|
|
51
55
|
VerifyRequestV2,
|
|
52
56
|
UpdatePasswordRequestV2,
|
|
53
57
|
PollRequestV2,
|
|
58
|
+
AuthMethodRegistrationRequestV2,
|
|
59
|
+
AuthMethodRegistrationVerificationRequestV2,
|
|
54
60
|
} from "./request/RequestsV2.js";
|
|
55
61
|
import {
|
|
56
62
|
CHALLENGE_RELATION,
|
|
@@ -60,6 +66,10 @@ import {
|
|
|
60
66
|
RISK_VERIFY_RELATION,
|
|
61
67
|
AuthenticationMethodTypeV2,
|
|
62
68
|
ResponseStateV2,
|
|
69
|
+
ACTIVATE_RELATION,
|
|
70
|
+
ENROLL_RELATION,
|
|
71
|
+
RESEND_RELATION,
|
|
72
|
+
POLL_RELATION,
|
|
63
73
|
} from "./ApiClientConstantsV2.js";
|
|
64
74
|
import {
|
|
65
75
|
INVALID_HAL_RESPONSE,
|
|
@@ -182,6 +192,20 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
182
192
|
};
|
|
183
193
|
}
|
|
184
194
|
|
|
195
|
+
if (parsedResponse.body.action === ENROLL_RELATION) {
|
|
196
|
+
return {
|
|
197
|
+
nextAction: ENROLL_RELATION,
|
|
198
|
+
continuationToken,
|
|
199
|
+
methods: this.resolveEnrollmentMethods(
|
|
200
|
+
this.handler.requireMethods(
|
|
201
|
+
parsedResponse.body._embedded?.methods,
|
|
202
|
+
correlationId
|
|
203
|
+
),
|
|
204
|
+
correlationId
|
|
205
|
+
),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
185
209
|
const message =
|
|
186
210
|
"Invalid HAL response: sign-up attribute submission returned no known next action";
|
|
187
211
|
this.logger?.error(message, correlationId);
|
|
@@ -265,6 +289,100 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
265
289
|
return this.toVerifyResult(parsedResponse);
|
|
266
290
|
}
|
|
267
291
|
|
|
292
|
+
async enrollAuthMethod(
|
|
293
|
+
enrollHref: string,
|
|
294
|
+
request: AuthMethodRegistrationRequestV2,
|
|
295
|
+
context: RequestContextV2
|
|
296
|
+
): Promise<EnrollmentResultV2> {
|
|
297
|
+
return this.sendEnrollmentRequest(enrollHref, request, context);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async resendAuthMethodRegistrationChallenge(
|
|
301
|
+
resendHref: string,
|
|
302
|
+
request: ChallengeRequestV2,
|
|
303
|
+
context: RequestContextV2
|
|
304
|
+
): Promise<EnrollmentResultV2> {
|
|
305
|
+
return this.sendEnrollmentRequest(resendHref, request, context);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
private async sendEnrollmentRequest(
|
|
309
|
+
href: string,
|
|
310
|
+
request: ChallengeRequestV2,
|
|
311
|
+
context: RequestContextV2
|
|
312
|
+
): Promise<EnrollmentResultV2> {
|
|
313
|
+
const parsedResponse =
|
|
314
|
+
await this.sendActionRequest<EnrollmentResponseV2>(
|
|
315
|
+
href,
|
|
316
|
+
HttpMethod.POST,
|
|
317
|
+
request,
|
|
318
|
+
context
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
if (parsedResponse.body.action !== ACTIVATE_RELATION) {
|
|
322
|
+
throw new CustomAuthApiError(
|
|
323
|
+
INVALID_HAL_RESPONSE,
|
|
324
|
+
"Invalid HAL response: enrollment returned no activation action",
|
|
325
|
+
parsedResponse.correlationId
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const links = parsedResponse.body._links;
|
|
330
|
+
|
|
331
|
+
return {
|
|
332
|
+
nextAction: ACTIVATE_RELATION,
|
|
333
|
+
continuationToken: this.handler.requireContinuationToken(
|
|
334
|
+
parsedResponse.continuationToken,
|
|
335
|
+
parsedResponse.correlationId
|
|
336
|
+
),
|
|
337
|
+
hint: parsedResponse.body.hint,
|
|
338
|
+
codeLength: this.normalizeCodeLength(
|
|
339
|
+
parsedResponse.body.codeLength
|
|
340
|
+
),
|
|
341
|
+
activateHref: this.handler.requireHref(
|
|
342
|
+
links?.activate?.href,
|
|
343
|
+
ACTIVATE_RELATION,
|
|
344
|
+
parsedResponse.correlationId
|
|
345
|
+
),
|
|
346
|
+
resendHref:
|
|
347
|
+
links && "resend" in links
|
|
348
|
+
? this.handler.requireHref(
|
|
349
|
+
links.resend?.href,
|
|
350
|
+
RESEND_RELATION,
|
|
351
|
+
parsedResponse.correlationId
|
|
352
|
+
)
|
|
353
|
+
: undefined,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
async activateAuthMethod(
|
|
358
|
+
activateHref: string,
|
|
359
|
+
request: AuthMethodRegistrationVerificationRequestV2,
|
|
360
|
+
context: RequestContextV2
|
|
361
|
+
): Promise<ActivationResultV2> {
|
|
362
|
+
const parsedResponse = await this.sendActionRequest<HalResponseBaseV2>(
|
|
363
|
+
activateHref,
|
|
364
|
+
HttpMethod.POST,
|
|
365
|
+
request,
|
|
366
|
+
context
|
|
367
|
+
);
|
|
368
|
+
|
|
369
|
+
if (parsedResponse.body.state !== ResponseStateV2.CONTINUE) {
|
|
370
|
+
throw new CustomAuthApiError(
|
|
371
|
+
INVALID_HAL_RESPONSE,
|
|
372
|
+
"Invalid HAL response: activation returned no continuation state",
|
|
373
|
+
parsedResponse.correlationId
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return {
|
|
378
|
+
nextAction: ResponseStateV2.CONTINUE,
|
|
379
|
+
continuationToken: this.handler.requireContinuationToken(
|
|
380
|
+
parsedResponse.continuationToken,
|
|
381
|
+
parsedResponse.correlationId
|
|
382
|
+
),
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
|
|
268
386
|
/*
|
|
269
387
|
* Submits the new password and returns the link used to poll for completion.
|
|
270
388
|
*/
|
|
@@ -297,7 +415,7 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
297
415
|
}
|
|
298
416
|
|
|
299
417
|
/*
|
|
300
|
-
*
|
|
418
|
+
* Sends a poll request and validates the data needed for the next flow step.
|
|
301
419
|
*/
|
|
302
420
|
async poll(
|
|
303
421
|
pollHref: string,
|
|
@@ -311,21 +429,54 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
311
429
|
context
|
|
312
430
|
);
|
|
313
431
|
|
|
314
|
-
const
|
|
315
|
-
|
|
432
|
+
const correlationId = parsedResponse.correlationId;
|
|
433
|
+
const continuationToken = this.handler.requireContinuationToken(
|
|
434
|
+
parsedResponse.continuationToken,
|
|
435
|
+
correlationId
|
|
436
|
+
);
|
|
437
|
+
const nextAction =
|
|
438
|
+
parsedResponse.body.action ?? parsedResponse.body.state;
|
|
316
439
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
440
|
+
if (nextAction === ENROLL_RELATION) {
|
|
441
|
+
return {
|
|
442
|
+
nextAction,
|
|
443
|
+
continuationToken,
|
|
444
|
+
enrollmentMethods: this.resolveEnrollmentMethods(
|
|
445
|
+
this.handler.requireMethods(
|
|
446
|
+
parsedResponse.body._embedded?.methods,
|
|
447
|
+
correlationId
|
|
448
|
+
),
|
|
449
|
+
correlationId
|
|
450
|
+
),
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (nextAction === POLL_RELATION) {
|
|
455
|
+
return {
|
|
456
|
+
nextAction: POLL_RELATION,
|
|
457
|
+
continuationToken,
|
|
458
|
+
pollHref: this.handler.requireHref(
|
|
459
|
+
parsedResponse.body._links?.poll?.href,
|
|
460
|
+
POLL_RELATION,
|
|
461
|
+
correlationId
|
|
462
|
+
),
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (nextAction === ResponseStateV2.CONTINUE) {
|
|
467
|
+
return {
|
|
468
|
+
nextAction,
|
|
469
|
+
continuationToken,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
const message = `Password reset poll next action '${nextAction}' is not supported.`;
|
|
474
|
+
this.logger?.error(message, correlationId);
|
|
475
|
+
throw new CustomAuthApiError(
|
|
476
|
+
INVALID_HAL_RESPONSE,
|
|
477
|
+
message,
|
|
478
|
+
correlationId
|
|
479
|
+
);
|
|
329
480
|
}
|
|
330
481
|
|
|
331
482
|
private async sendStartRequest(
|
|
@@ -345,7 +496,10 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
345
496
|
return {
|
|
346
497
|
continuationToken,
|
|
347
498
|
methods: this.resolveMethods(
|
|
348
|
-
|
|
499
|
+
this.handler.requireMethods(
|
|
500
|
+
parsedResponse.body._embedded?.methods,
|
|
501
|
+
parsedResponse.correlationId
|
|
502
|
+
),
|
|
349
503
|
parsedResponse.correlationId
|
|
350
504
|
),
|
|
351
505
|
authenticationFactor: this.resolveAuthenticationFactor(
|
|
@@ -367,14 +521,14 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
367
521
|
|
|
368
522
|
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
369
523
|
return {
|
|
370
|
-
nextAction:
|
|
524
|
+
nextAction: ResponseStateV2.CONTINUE,
|
|
371
525
|
continuationToken,
|
|
372
526
|
};
|
|
373
527
|
}
|
|
374
528
|
|
|
375
529
|
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
376
530
|
return {
|
|
377
|
-
nextAction:
|
|
531
|
+
nextAction: COLLECT_ATTRIBUTES_RELATION,
|
|
378
532
|
continuationToken,
|
|
379
533
|
attributes: parsedResponse.body.attributes ?? [],
|
|
380
534
|
submitAttributesHref: this.handler.requireHref(
|
|
@@ -387,7 +541,7 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
387
541
|
|
|
388
542
|
if (parsedResponse.body.action === UPDATE_RELATION) {
|
|
389
543
|
return {
|
|
390
|
-
nextAction:
|
|
544
|
+
nextAction: UPDATE_RELATION,
|
|
391
545
|
continuationToken,
|
|
392
546
|
updateHref: this.handler.requireHref(
|
|
393
547
|
parsedResponse.body._links?.update?.href,
|
|
@@ -399,14 +553,31 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
399
553
|
|
|
400
554
|
if (parsedResponse.body.action === CHALLENGE_RELATION) {
|
|
401
555
|
return {
|
|
402
|
-
nextAction:
|
|
556
|
+
nextAction: CHALLENGE_RELATION,
|
|
403
557
|
continuationToken,
|
|
404
558
|
authenticationFactor: this.resolveAuthenticationFactor(
|
|
405
559
|
parsedResponse.body.challengeContext?.authenticationFactor,
|
|
406
560
|
correlationId
|
|
407
561
|
),
|
|
408
562
|
methods: this.resolveMethods(
|
|
409
|
-
|
|
563
|
+
this.handler.requireMethods(
|
|
564
|
+
parsedResponse.body._embedded?.methods,
|
|
565
|
+
correlationId
|
|
566
|
+
) as EmbeddedMethodV2[],
|
|
567
|
+
correlationId
|
|
568
|
+
),
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (parsedResponse.body.action === ENROLL_RELATION) {
|
|
573
|
+
return {
|
|
574
|
+
nextAction: ENROLL_RELATION,
|
|
575
|
+
continuationToken,
|
|
576
|
+
methods: this.resolveEnrollmentMethods(
|
|
577
|
+
this.handler.requireMethods(
|
|
578
|
+
parsedResponse.body._embedded?.methods,
|
|
579
|
+
correlationId
|
|
580
|
+
) as EmbeddedEnrollmentMethodV2[],
|
|
410
581
|
correlationId
|
|
411
582
|
),
|
|
412
583
|
};
|
|
@@ -419,6 +590,43 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
419
590
|
);
|
|
420
591
|
}
|
|
421
592
|
|
|
593
|
+
private resolveEnrollmentMethods(
|
|
594
|
+
methods: EmbeddedEnrollmentMethodV2[],
|
|
595
|
+
correlationId: string
|
|
596
|
+
): EnrollmentMethodV2[] {
|
|
597
|
+
return methods.map((method) => {
|
|
598
|
+
if (typeof method.type !== "string" || !method.type.trim()) {
|
|
599
|
+
throw new CustomAuthApiError(
|
|
600
|
+
INVALID_HAL_RESPONSE,
|
|
601
|
+
"Invalid HAL response: enrollment method type is malformed",
|
|
602
|
+
correlationId
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if (
|
|
607
|
+
method.channels !== undefined &&
|
|
608
|
+
(!Array.isArray(method.channels) ||
|
|
609
|
+
method.channels.length === 0)
|
|
610
|
+
) {
|
|
611
|
+
throw new CustomAuthApiError(
|
|
612
|
+
INVALID_HAL_RESPONSE,
|
|
613
|
+
"Invalid HAL response: enrollment method channels are malformed",
|
|
614
|
+
correlationId
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return {
|
|
619
|
+
type: method.type,
|
|
620
|
+
channels: method.channels,
|
|
621
|
+
enrollHref: this.handler.requireHref(
|
|
622
|
+
method._links?.enroll?.href,
|
|
623
|
+
ENROLL_RELATION,
|
|
624
|
+
correlationId
|
|
625
|
+
),
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
|
|
422
630
|
private resolveAuthenticationFactor(
|
|
423
631
|
authenticationFactor: string | undefined,
|
|
424
632
|
correlationId: string
|
|
@@ -450,7 +658,7 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
450
658
|
parsedResponse.body as RiskVerificationRequiredResponseV2;
|
|
451
659
|
|
|
452
660
|
return {
|
|
453
|
-
nextAction:
|
|
661
|
+
nextAction: RISK_VERIFY_RELATION,
|
|
454
662
|
continuationToken: this.handler.requireContinuationToken(
|
|
455
663
|
parsedResponse.continuationToken,
|
|
456
664
|
parsedResponse.correlationId
|
|
@@ -490,36 +698,47 @@ export class CustomAuthApiClientV2 extends BaseApiClientV2 {
|
|
|
490
698
|
"payload" in parsedResponse.body
|
|
491
699
|
? parsedResponse.body
|
|
492
700
|
: undefined;
|
|
701
|
+
const isPasswordChallenge =
|
|
702
|
+
parsedResponse.body.type?.toLowerCase() ===
|
|
703
|
+
AuthenticationMethodTypeV2.PASSWORD;
|
|
704
|
+
const verifyHref = this.handler.requireHref(
|
|
705
|
+
links?.verify?.href,
|
|
706
|
+
VERIFY_RELATION,
|
|
707
|
+
parsedResponse.correlationId
|
|
708
|
+
);
|
|
709
|
+
const resendHref =
|
|
710
|
+
!isPasswordChallenge && links && "resend" in links
|
|
711
|
+
? this.handler.requireHref(
|
|
712
|
+
links.resend?.href,
|
|
713
|
+
RESEND_RELATION,
|
|
714
|
+
parsedResponse.correlationId
|
|
715
|
+
)
|
|
716
|
+
: undefined;
|
|
717
|
+
const codeLength = isPasswordChallenge
|
|
718
|
+
? undefined
|
|
719
|
+
: this.normalizeCodeLength(
|
|
720
|
+
codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength
|
|
721
|
+
);
|
|
493
722
|
|
|
494
723
|
return {
|
|
495
|
-
nextAction:
|
|
724
|
+
nextAction: VERIFY_RELATION,
|
|
496
725
|
continuationToken,
|
|
497
|
-
verifyHref
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
parsedResponse.correlationId
|
|
501
|
-
),
|
|
502
|
-
resendHref:
|
|
503
|
-
links && "resend" in links ? links.resend?.href : undefined,
|
|
504
|
-
codeLength:
|
|
505
|
-
codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength,
|
|
726
|
+
verifyHref,
|
|
727
|
+
resendHref,
|
|
728
|
+
codeLength,
|
|
506
729
|
hint: codeMetadata?.hint,
|
|
507
730
|
type: parsedResponse.body.type,
|
|
508
731
|
};
|
|
509
732
|
}
|
|
510
733
|
|
|
734
|
+
private normalizeCodeLength(value: unknown): number {
|
|
735
|
+
return typeof value === "number" && Number.isInteger(value) ? value : 0;
|
|
736
|
+
}
|
|
737
|
+
|
|
511
738
|
private resolveMethods(
|
|
512
|
-
|
|
513
|
-
_embedded?: {
|
|
514
|
-
methods?: EmbeddedMethodV2[];
|
|
515
|
-
};
|
|
516
|
-
},
|
|
739
|
+
methods: EmbeddedMethodV2[],
|
|
517
740
|
correlationId: string
|
|
518
741
|
): StartMethodV2[] {
|
|
519
|
-
const methods = this.handler.requireMethods(
|
|
520
|
-
body._embedded?.methods,
|
|
521
|
-
correlationId
|
|
522
|
-
);
|
|
523
742
|
const resolved: StartMethodV2[] = [];
|
|
524
743
|
|
|
525
744
|
methods.forEach((method, index) => {
|
|
@@ -7,7 +7,7 @@ import { Logger } from "@azure/msal-common/browser";
|
|
|
7
7
|
import { HttpHeaderKeys } from "../../../../CustomAuthConstants.js";
|
|
8
8
|
import { CustomAuthApiError } from "../../../error/CustomAuthApiError.js";
|
|
9
9
|
import { normalizeServerErrorV2 } from "./response/ErrorNormalizerV2.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ParsedResponseV2 } from "./response/ResponsesV2.js";
|
|
11
11
|
import {
|
|
12
12
|
CONTINUATION_TOKEN_MISSING,
|
|
13
13
|
INVALID_HAL_RESPONSE,
|
|
@@ -64,12 +64,12 @@ export class ResponseHandlerV2 {
|
|
|
64
64
|
|
|
65
65
|
// Required href; throws when it is absent.
|
|
66
66
|
requireHref(
|
|
67
|
-
href:
|
|
67
|
+
href: unknown,
|
|
68
68
|
relation: string,
|
|
69
69
|
correlationId: string,
|
|
70
70
|
missingHrefError?: { code: string; message: string }
|
|
71
71
|
): string {
|
|
72
|
-
if (!href) {
|
|
72
|
+
if (typeof href !== "string" || !href.trim()) {
|
|
73
73
|
const errorCode = missingHrefError?.code ?? INVALID_HAL_RESPONSE;
|
|
74
74
|
const errorMessage =
|
|
75
75
|
missingHrefError?.message ??
|
|
@@ -109,10 +109,7 @@ export class ResponseHandlerV2 {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// Required embedded auth methods; throws when `_embedded.methods` is absent or empty.
|
|
112
|
-
requireMethods(
|
|
113
|
-
methods: EmbeddedMethodV2[] | undefined,
|
|
114
|
-
correlationId: string
|
|
115
|
-
): EmbeddedMethodV2[] {
|
|
112
|
+
requireMethods<T>(methods: T[] | undefined, correlationId: string): T[] {
|
|
116
113
|
if (!methods?.length) {
|
|
117
114
|
this.logger?.error(
|
|
118
115
|
"V2 HAL response is missing the required embedded authentication methods",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { ApiRequestBase } from "../../types/ApiTypesBase.js";
|
|
7
7
|
import { UserAccountAttributes } from "../../../../../UserAccountAttributes.js";
|
|
8
|
+
import { PhoneRegistrationChannelV2 } from "../ApiClientConstantsV2.js";
|
|
8
9
|
|
|
9
10
|
/*
|
|
10
11
|
* Per-request context threaded through every V2 network-layer call. These shared fields drive
|
|
@@ -92,6 +93,26 @@ export interface SignUpSubmitAttributesRequestV2 extends ActionRequestBaseV2 {
|
|
|
92
93
|
// Request or resend a challenge.
|
|
93
94
|
export type ChallengeRequestV2 = ActionRequestBaseV2;
|
|
94
95
|
|
|
96
|
+
export interface EmailAuthMethodRegistrationRequestV2
|
|
97
|
+
extends ActionRequestBaseV2 {
|
|
98
|
+
email: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface PhoneAuthMethodRegistrationRequestV2
|
|
102
|
+
extends ActionRequestBaseV2 {
|
|
103
|
+
phoneNumber: string;
|
|
104
|
+
channel: typeof PhoneRegistrationChannelV2.SMS;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type AuthMethodRegistrationRequestV2 =
|
|
108
|
+
| EmailAuthMethodRegistrationRequestV2
|
|
109
|
+
| PhoneAuthMethodRegistrationRequestV2;
|
|
110
|
+
|
|
111
|
+
export interface AuthMethodRegistrationVerificationRequestV2
|
|
112
|
+
extends ActionRequestBaseV2 {
|
|
113
|
+
otp: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
95
116
|
// Submit a single credential to `/methods/{type}/{id}/verify`.
|
|
96
117
|
/*
|
|
97
118
|
* The credential is a distinct top-level key per method type (never overloaded onto one field):
|