Package com.okta.idx.sdk.api.client
Class IDXAuthenticationWrapper
- java.lang.Object
-
- com.okta.idx.sdk.api.client.IDXAuthenticationWrapper
-
public class IDXAuthenticationWrapper extends java.lang.ObjectWrapper to enable a client to interact with the backend IDX APIs.
-
-
Constructor Summary
Constructors Constructor Description IDXAuthenticationWrapper()CreatesIDXAuthenticationWrapperinstance.IDXAuthenticationWrapper(java.lang.String issuer, java.lang.String clientId, java.lang.String clientSecret, java.util.Set<java.lang.String> scopes, java.lang.String redirectUri)CreatesIDXAuthenticationWrapperinstance.IDXAuthenticationWrapper(java.lang.String issuer, java.lang.String clientId, java.lang.String clientSecret, java.util.Set<java.lang.String> scopes, java.lang.String redirectUri, DeviceContext deviceContext)CreatesIDXAuthenticationWrapperinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AuthenticationResponseauthenticate(AuthenticationOptions authenticationOptions, ProceedContext proceedContext)Authenticate user with the supplied Authentication options (username and password) and returns the Authentication response object that contains: - IDX Client context - Token (access_token/id_token/refresh_token) object - Authentication statusAuthenticationResponsebegin()Begin flow without any recovery or activation tokenAuthenticationResponsebeginPasswordRecovery(java.lang.String token)Begin password recovery flow with a recovery tokenAuthenticationResponsebeginUserActivation(java.lang.String token)Begin password recovery flow with an activation tokenAuthenticationResponsecancel(ProceedContext proceedContext)Cancel transaction.AuthenticationResponseenrollAuthenticator(ProceedContext proceedContext, Authenticator.Factor factor)Enroll authenticator of the supplied type.AuthenticationResponseenrollAuthenticator(ProceedContext proceedContext, java.lang.String authenticatorId)AuthenticationResponsefetchSignUpFormValues(ProceedContext proceedContext)Populate UI form values for signing up a new user.AuthenticationResponsefetchTokenWithInteractionCode(ProceedContext proceedContext, java.lang.String interactionCode)Exchange interaction code for tokenAuthenticationResponsefetchTokenWithInteractionCode(java.lang.String issuer, ProceedContext proceedContext, java.lang.String interactionCode)Deprecated.theissuerparam is automatically resolved.IDXClientContextgetClientContext()Get IDX client context by calling interact endpoint.PollInfogetPollInfo(AuthenticationResponse authenticationResponse)Helper to get polling information from authentication response.AuthenticationResponseintrospect(IDXClientContext clientContext)Introspect to get the current state of the authentication.booleanisSkipAuthenticatorPresent(ProceedContext proceedContext)Helper to check if we have optional authenticators to skip in current remediation step.AuthenticationResponsepoll(ProceedContext proceedContext)Handle Polling.AuthenticationResponserecoverPassword(java.lang.String username, ProceedContext proceedContext)Recover Password with the supplied username.AuthenticationResponseregister(ProceedContext proceedContext, UserProfile userProfile)Register new user with the supplied user profile reference.AuthenticationResponseresend(ProceedContext proceedContext)Resend code.voidrevokeToken(TokenType tokenType, java.lang.String token)Revoke the oauth2 token.AuthenticationResponseselectAuthenticator(ProceedContext proceedContext, Authenticator authenticator)Select authenticator of the supplied type.AuthenticationResponseselectFactor(ProceedContext proceedContext, Authenticator.Factor factor)Select authenticator of the supplied type.AuthenticationResponseskipAuthenticatorEnrollment(ProceedContext proceedContext)Skip optional authenticator enrollment.AuthenticationResponsesubmitPhoneAuthenticator(ProceedContext proceedContext, java.lang.String phone, Authenticator.Factor factor)Submit phone authenticator enrollment with the provided phone number.AuthenticationResponseverifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorAnswer verifyAuthenticatorAnswer)Verify Authenticator with the supplied authenticator options.AuthenticationResponseverifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions)Verify Authenticator with the supplied authenticator options.AuthenticationResponseverifyAuthenticator(ProceedContext proceedContext, VerifyChannelDataOptions verifyChannelDataOptions)com.okta.commons.http.ResponseverifyEmailToken(java.lang.String token)Helper to verify the token query parameter contained in the link of user verification email.AuthenticationResponseverifyWebAuthn(ProceedContext proceedContext, WebAuthnRequest webauthnRequest)Verify Webauthn Authenticator.
-
-
-
Constructor Detail
-
IDXAuthenticationWrapper
public IDXAuthenticationWrapper()
CreatesIDXAuthenticationWrapperinstance.
-
IDXAuthenticationWrapper
public IDXAuthenticationWrapper(java.lang.String issuer, java.lang.String clientId, java.lang.String clientSecret, java.util.Set<java.lang.String> scopes, java.lang.String redirectUri)CreatesIDXAuthenticationWrapperinstance.- Parameters:
issuer- the issuer urlclientId- the client idclientSecret- the client secretscopes- the set of scopesredirectUri- the redirect uri
-
IDXAuthenticationWrapper
public IDXAuthenticationWrapper(java.lang.String issuer, java.lang.String clientId, java.lang.String clientSecret, java.util.Set<java.lang.String> scopes, java.lang.String redirectUri, DeviceContext deviceContext)CreatesIDXAuthenticationWrapperinstance.- Parameters:
issuer- the issuer urlclientId- the client idclientSecret- the client secretscopes- the set of scopesredirectUri- the redirect urideviceContext- the device context information
-
-
Method Detail
-
authenticate
public AuthenticationResponse authenticate(AuthenticationOptions authenticationOptions, ProceedContext proceedContext)
Authenticate user with the supplied Authentication options (username and password) and returns the Authentication response object that contains: - IDX Client context - Token (access_token/id_token/refresh_token) object - Authentication statusNote: This requires 'Password' as the ONLY required factor in app Sign-on policy configuration.
- Parameters:
authenticationOptions- the Authenticator optionsproceedContext- the proceed context for the transaction- Returns:
- the Authentication response
-
recoverPassword
public AuthenticationResponse recoverPassword(java.lang.String username, ProceedContext proceedContext)
Recover Password with the supplied username.- Parameters:
username- the usernameproceedContext- the proceed context- Returns:
- the Authentication response
-
register
public AuthenticationResponse register(ProceedContext proceedContext, UserProfile userProfile)
Register new user with the supplied user profile reference.- Parameters:
proceedContext- the ProceedContextuserProfile- the user profile- Returns:
- the Authentication response
-
selectAuthenticator
public AuthenticationResponse selectAuthenticator(ProceedContext proceedContext, Authenticator authenticator)
Select authenticator of the supplied type.- Parameters:
proceedContext- the ProceedContextauthenticator- the authenticator- Returns:
- the Authentication response
-
selectFactor
public AuthenticationResponse selectFactor(ProceedContext proceedContext, Authenticator.Factor factor)
Select authenticator of the supplied type.- Parameters:
proceedContext- the ProceedContextfactor- the factor- Returns:
- the Authentication response
-
enrollAuthenticator
public AuthenticationResponse enrollAuthenticator(ProceedContext proceedContext, java.lang.String authenticatorId)
-
enrollAuthenticator
public AuthenticationResponse enrollAuthenticator(ProceedContext proceedContext, Authenticator.Factor factor)
Enroll authenticator of the supplied type.- Parameters:
proceedContext- the ProceedContextfactor- the factor- Returns:
- the Authentication response
-
verifyAuthenticator
public AuthenticationResponse verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions)
Verify Authenticator with the supplied authenticator options.- Parameters:
proceedContext- the ProceedContextverifyAuthenticatorOptions- the verify Authenticator options- Returns:
- the Authentication response
-
verifyAuthenticator
public AuthenticationResponse verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorAnswer verifyAuthenticatorAnswer)
Verify Authenticator with the supplied authenticator options.- Parameters:
proceedContext- the ProceedContextverifyAuthenticatorAnswer- the verify Authenticator answer- Returns:
- the Authentication response
-
verifyAuthenticator
public AuthenticationResponse verifyAuthenticator(ProceedContext proceedContext, VerifyChannelDataOptions verifyChannelDataOptions)
-
verifyWebAuthn
public AuthenticationResponse verifyWebAuthn(ProceedContext proceedContext, WebAuthnRequest webauthnRequest)
Verify Webauthn Authenticator.- Parameters:
proceedContext- the ProceedContextwebauthnRequest- object- Returns:
- the Authentication response
-
submitPhoneAuthenticator
public AuthenticationResponse submitPhoneAuthenticator(ProceedContext proceedContext, java.lang.String phone, Authenticator.Factor factor)
Submit phone authenticator enrollment with the provided phone number.- Parameters:
proceedContext- the ProceedContextphone- the phone numberfactor- factor- Returns:
- the Authentication response
-
skipAuthenticatorEnrollment
public AuthenticationResponse skipAuthenticatorEnrollment(ProceedContext proceedContext)
Skip optional authenticator enrollment.- Parameters:
proceedContext- the ProceedContext- Returns:
- the Authentication response
-
resend
public AuthenticationResponse resend(ProceedContext proceedContext)
Resend code.- Parameters:
proceedContext- the ProceedContext- Returns:
- the Authentication response
-
cancel
public AuthenticationResponse cancel(ProceedContext proceedContext)
Cancel transaction.- Parameters:
proceedContext- the ProceedContext- Returns:
- the Authentication response
-
poll
public AuthenticationResponse poll(ProceedContext proceedContext)
Handle Polling.- Parameters:
proceedContext- the ProceedContext- Returns:
- the Authentication response
-
getClientContext
public IDXClientContext getClientContext() throws ProcessingException
Get IDX client context by calling interact endpoint. ClientContext reference contains the interaction handle and PKCE params.This function can be used by the client applications to get a handle of
IDXClientContextwhich can be used to reenter/resume the flow.- Returns:
- the idx client context
- Throws:
ProcessingException- if the backend interact API call fails
-
revokeToken
public void revokeToken(TokenType tokenType, java.lang.String token)
Revoke the oauth2 token.- Parameters:
tokenType- the token type (access|refresh)token- the token
-
introspect
public AuthenticationResponse introspect(IDXClientContext clientContext)
Introspect to get the current state of the authentication. This is useful when doing social auth, and not getting back an interaction_code.- Parameters:
clientContext- the client context- Returns:
- a AuthenticationResponse with a status representing the current location in the authentication flow.
-
fetchSignUpFormValues
public AuthenticationResponse fetchSignUpFormValues(ProceedContext proceedContext)
Populate UI form values for signing up a new user.- Parameters:
proceedContext- the proceedContext- Returns:
- the authentication response
-
verifyEmailToken
public com.okta.commons.http.Response verifyEmailToken(java.lang.String token) throws ProcessingExceptionHelper to verify the token query parameter contained in the link of user verification email.- Parameters:
token- the token string.- Returns:
- response object.
- Throws:
ProcessingException- when there is an error
-
getPollInfo
public PollInfo getPollInfo(AuthenticationResponse authenticationResponse)
Helper to get polling information from authentication response.- Parameters:
authenticationResponse- the authentication response- Returns:
- polling info wrapper object.
-
isSkipAuthenticatorPresent
public boolean isSkipAuthenticatorPresent(ProceedContext proceedContext)
Helper to check if we have optional authenticators to skip in current remediation step.- Parameters:
proceedContext- the ProceedContext- Returns:
- true if we have optional authenticators to skip; false otherwise.
-
begin
public AuthenticationResponse begin()
Begin flow without any recovery or activation token
-
beginPasswordRecovery
public AuthenticationResponse beginPasswordRecovery(java.lang.String token)
Begin password recovery flow with a recovery token
-
beginUserActivation
public AuthenticationResponse beginUserActivation(java.lang.String token)
Begin password recovery flow with an activation token
-
fetchTokenWithInteractionCode
public AuthenticationResponse fetchTokenWithInteractionCode(ProceedContext proceedContext, java.lang.String interactionCode)
Exchange interaction code for token
-
fetchTokenWithInteractionCode
@Deprecated public AuthenticationResponse fetchTokenWithInteractionCode(java.lang.String issuer, ProceedContext proceedContext, java.lang.String interactionCode)
Deprecated.theissuerparam is automatically resolved.Exchange interaction code for token.
-
-