Package com.okta.idx.sdk.api.client
Class IDXAuthenticationWrapper
java.lang.Object
com.okta.idx.sdk.api.client.IDXAuthenticationWrapper
Wrapper to enable a client to interact with the backend IDX APIs.
-
Constructor Summary
ConstructorDescriptionCreatesIDXAuthenticationWrapper
instance.IDXAuthenticationWrapper
(String issuer, String clientId, String clientSecret, Set<String> scopes, String redirectUri) CreatesIDXAuthenticationWrapper
instance. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate
(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 statusbegin()
Begin flow without any recovery or activation token or request context.begin
(RequestContext requestContext) Begin flow withRequestContext
reference.beginPasswordRecovery
(String token, RequestContext requestContext) Begin password recovery flow with a recovery token.beginUserActivation
(String token, RequestContext requestContext) Begin password recovery flow with an activation token.cancel
(ProceedContext proceedContext) Cancel transaction.enrollAuthenticator
(ProceedContext proceedContext, String authenticatorId) fetchSignUpFormValues
(ProceedContext proceedContext) Populate UI form values for signing up a new user.fetchTokenWithInteractionCode
(ProceedContext proceedContext, String interactionCode) Exchange interaction code for token.Get IDX client context by calling interact endpoint.getPollInfo
(AuthenticationResponse authenticationResponse) Helper to get polling information from authentication response.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.poll
(ProceedContext proceedContext) Handle Polling.recoverPassword
(String username, ProceedContext proceedContext) Recover Password with the supplied username.register
(ProceedContext proceedContext, UserProfile userProfile, Credentials credentials) Register new user with the supplied user profile reference.resend
(ProceedContext proceedContext) Resend code.void
revokeToken
(TokenType tokenType, String token) Revoke the oauth2 token.selectAuthenticator
(ProceedContext proceedContext, Authenticator authenticator) Select authenticator of the supplied type.selectFactor
(ProceedContext proceedContext, Authenticator.Factor factor) Select authenticator of the supplied type.skipAuthenticatorEnrollment
(ProceedContext proceedContext) Skip optional authenticator enrollment.submitPhoneAuthenticator
(ProceedContext proceedContext, String phone, Authenticator.Factor factor) Submit phone authenticator enrollment with the provided phone number.verifyAuthenticator
(ProceedContext proceedContext, VerifyAuthenticatorAnswer verifyAuthenticatorAnswer) Verify Authenticator with the supplied authenticator options.verifyAuthenticator
(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions) Verify Authenticator with the supplied authenticator options.verifyAuthenticator
(ProceedContext proceedContext, VerifyChannelDataOptions verifyChannelDataOptions) com.okta.commons.http.Response
verifyEmailToken
(String token) Helper to verify the token query parameter contained in the link of user verification email.verifyWebAuthn
(ProceedContext proceedContext, WebAuthnRequest webauthnRequest) Verify Webauthn Authenticator.
-
Constructor Details
-
IDXAuthenticationWrapper
public IDXAuthenticationWrapper()CreatesIDXAuthenticationWrapper
instance. -
IDXAuthenticationWrapper
public IDXAuthenticationWrapper(String issuer, String clientId, String clientSecret, Set<String> scopes, String redirectUri) CreatesIDXAuthenticationWrapper
instance.- Parameters:
issuer
- the issuer urlclientId
- the client idclientSecret
- the client secretscopes
- the set of scopesredirectUri
- the redirect uri
-
-
Method Details
-
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
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, Credentials credentials) Register new user with the supplied user profile reference.- Parameters:
proceedContext
- the ProceedContextuserProfile
- the user profilecredentials
- the password (optional)- 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, String authenticatorId) -
verifyAuthenticator
public AuthenticationResponse verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions) Verify Authenticator with the supplied authenticator options.- Parameters:
proceedContext
- the ProceedContextverifyAuthenticatorOptions
- 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, 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
Skip optional authenticator enrollment.- Parameters:
proceedContext
- the ProceedContext- Returns:
- the Authentication response
-
resend
Resend code.- Parameters:
proceedContext
- the ProceedContext- Returns:
- the Authentication response
-
cancel
Cancel transaction.- Parameters:
proceedContext
- the ProceedContext- Returns:
- the Authentication response
-
poll
Handle Polling.- Parameters:
proceedContext
- the ProceedContext- Returns:
- the Authentication response
-
getClientContext
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
Revoke the oauth2 token.- Parameters:
tokenType
- the token type (access|refresh)token
- the token
-
introspect
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
Populate UI form values for signing up a new user.- Parameters:
proceedContext
- the proceedContext- Returns:
- the authentication response
-
verifyEmailToken
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
Helper to get polling information from authentication response.- Parameters:
authenticationResponse
- the authentication response- Returns:
- polling info wrapper object.
-
isSkipAuthenticatorPresent
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
Begin flow without any recovery or activation token or request context.- Returns:
- authentication response
-
begin
Begin flow withRequestContext
reference.- Parameters:
requestContext
- the RequestContext- Returns:
- authentication response
-
beginPasswordRecovery
Begin password recovery flow with a recovery token.- Parameters:
token
- recovery tokenrequestContext
- request context (optional)- Returns:
- authentication response
-
beginUserActivation
Begin password recovery flow with an activation token.- Parameters:
token
- activation tokenrequestContext
- request context (optional)- Returns:
- authentication response
-
fetchTokenWithInteractionCode
public AuthenticationResponse fetchTokenWithInteractionCode(ProceedContext proceedContext, String interactionCode) Exchange interaction code for token.- Parameters:
proceedContext
- proceed contextinteractionCode
- interaction code- Returns:
- authentication response
-