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.Object
Wrapper to enable a client to interact with the backend IDX APIs.
-
-
Constructor Summary
Constructors Constructor Description IDXAuthenticationWrapper()
CreatesIDXAuthenticationWrapper
instance.IDXAuthenticationWrapper(java.lang.String issuer, java.lang.String clientId, java.lang.String clientSecret, java.util.Set<java.lang.String> scopes, java.lang.String redirectUri)
CreatesIDXAuthenticationWrapper
instance.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)
CreatesIDXAuthenticationWrapper
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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 statusAuthenticationResponse
begin()
Begin flow without any recovery or activation tokenAuthenticationResponse
beginPasswordRecovery(java.lang.String token)
Begin password recovery flow with a recovery tokenAuthenticationResponse
beginUserActivation(java.lang.String token)
Begin password recovery flow with an activation tokenAuthenticationResponse
cancel(ProceedContext proceedContext)
Cancel transaction.AuthenticationResponse
enrollAuthenticator(ProceedContext proceedContext, Authenticator.Factor factor)
Enroll authenticator of the supplied type.AuthenticationResponse
enrollAuthenticator(ProceedContext proceedContext, java.lang.String authenticatorId)
AuthenticationResponse
fetchSignUpFormValues(ProceedContext proceedContext)
Populate UI form values for signing up a new user.AuthenticationResponse
fetchTokenWithInteractionCode(ProceedContext proceedContext, java.lang.String interactionCode)
Exchange interaction code for tokenAuthenticationResponse
fetchTokenWithInteractionCode(java.lang.String issuer, ProceedContext proceedContext, java.lang.String interactionCode)
Deprecated.theissuer
param is automatically resolved.IDXClientContext
getClientContext()
Get IDX client context by calling interact endpoint.PollInfo
getPollInfo(AuthenticationResponse authenticationResponse)
Helper to get polling information from authentication response.AuthenticationResponse
introspect(IDXClientContext clientContext)
Introspect to get the current state of the authentication.boolean
isSkipAuthenticatorPresent(ProceedContext proceedContext)
Helper to check if we have optional authenticators to skip in current remediation step.AuthenticationResponse
poll(ProceedContext proceedContext)
Handle Polling.AuthenticationResponse
recoverPassword(java.lang.String username, ProceedContext proceedContext)
Recover Password with the supplied username.AuthenticationResponse
register(ProceedContext proceedContext, UserProfile userProfile)
Register new user with the supplied user profile reference.AuthenticationResponse
resend(ProceedContext proceedContext)
Resend code.void
revokeToken(TokenType tokenType, java.lang.String token)
Revoke the oauth2 token.AuthenticationResponse
selectAuthenticator(ProceedContext proceedContext, Authenticator authenticator)
Select authenticator of the supplied type.AuthenticationResponse
selectFactor(ProceedContext proceedContext, Authenticator.Factor factor)
Select authenticator of the supplied type.AuthenticationResponse
skipAuthenticatorEnrollment(ProceedContext proceedContext)
Skip optional authenticator enrollment.AuthenticationResponse
submitPhoneAuthenticator(ProceedContext proceedContext, java.lang.String phone, Authenticator.Factor factor)
Submit phone authenticator enrollment with the provided phone number.AuthenticationResponse
verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorAnswer verifyAuthenticatorAnswer)
Verify Authenticator with the supplied authenticator options.AuthenticationResponse
verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions)
Verify Authenticator with the supplied authenticator options.AuthenticationResponse
verifyAuthenticator(ProceedContext proceedContext, VerifyChannelDataOptions verifyChannelDataOptions)
com.okta.commons.http.Response
verifyEmailToken(java.lang.String token)
Helper to verify the token query parameter contained in the link of user verification email.AuthenticationResponse
verifyWebAuthn(ProceedContext proceedContext, WebAuthnRequest webauthnRequest)
Verify Webauthn Authenticator.
-
-
-
Constructor Detail
-
IDXAuthenticationWrapper
public IDXAuthenticationWrapper()
CreatesIDXAuthenticationWrapper
instance.
-
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)
CreatesIDXAuthenticationWrapper
instance.- 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)
CreatesIDXAuthenticationWrapper
instance.- 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
IDXClientContext
which 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 ProcessingException
Helper 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.theissuer
param is automatically resolved.Exchange interaction code for token.
-
-