Search in sources :

Example 6 with AnswerChallengeRequest

use of com.okta.idx.sdk.api.request.AnswerChallengeRequest in project okta-idx-java by okta.

the class IDXAuthenticationWrapper method verifyAuthenticator.

/**
 * Verify Authenticator with the supplied authenticator options.
 *
 * @param proceedContext the ProceedContext
 * @param verifyAuthenticatorOptions the verify Authenticator options
 * @return the Authentication response
 */
public AuthenticationResponse verifyAuthenticator(ProceedContext proceedContext, VerifyAuthenticatorOptions verifyAuthenticatorOptions) {
    try {
        Credentials credentials = new Credentials();
        credentials.setPasscode(verifyAuthenticatorOptions.getCode().toCharArray());
        // build answer password authenticator challenge request
        AnswerChallengeRequest challengeAuthenticatorRequest = AnswerChallengeRequestBuilder.builder().withStateHandle(proceedContext.getStateHandle()).withCredentials(credentials).build();
        return AuthenticationTransaction.proceed(client, proceedContext, () -> client.answerChallenge(challengeAuthenticatorRequest, proceedContext.getHref())).asAuthenticationResponse(AuthenticationStatus.AWAITING_PASSWORD_RESET);
    } catch (ProcessingException e) {
        return handleProcessingException(e);
    } catch (IllegalArgumentException e) {
        return handleIllegalArgumentException(e);
    }
}
Also used : AnswerChallengeRequest(com.okta.idx.sdk.api.request.AnswerChallengeRequest) Credentials(com.okta.idx.sdk.api.model.Credentials) WrapperUtil.handleIllegalArgumentException(com.okta.idx.sdk.api.client.WrapperUtil.handleIllegalArgumentException) ProcessingException(com.okta.idx.sdk.api.exception.ProcessingException) WrapperUtil.handleProcessingException(com.okta.idx.sdk.api.client.WrapperUtil.handleProcessingException)

Aggregations

ProcessingException (com.okta.idx.sdk.api.exception.ProcessingException)6 AnswerChallengeRequest (com.okta.idx.sdk.api.request.AnswerChallengeRequest)6 WrapperUtil.handleIllegalArgumentException (com.okta.idx.sdk.api.client.WrapperUtil.handleIllegalArgumentException)5 WrapperUtil.handleProcessingException (com.okta.idx.sdk.api.client.WrapperUtil.handleProcessingException)5 Credentials (com.okta.idx.sdk.api.model.Credentials)5 IdentifyRequest (com.okta.idx.sdk.api.request.IdentifyRequest)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 DefaultRequest (com.okta.commons.http.DefaultRequest)1 HttpException (com.okta.commons.http.HttpException)1 Request (com.okta.commons.http.Request)1 Response (com.okta.commons.http.Response)1 AnswerChallengeRequestBuilder (com.okta.idx.sdk.api.request.AnswerChallengeRequestBuilder)1 CancelRequest (com.okta.idx.sdk.api.request.CancelRequest)1 ChallengeRequest (com.okta.idx.sdk.api.request.ChallengeRequest)1 EnrollRequest (com.okta.idx.sdk.api.request.EnrollRequest)1 EnrollUserProfileUpdateRequest (com.okta.idx.sdk.api.request.EnrollUserProfileUpdateRequest)1 IntrospectRequest (com.okta.idx.sdk.api.request.IntrospectRequest)1 PollRequest (com.okta.idx.sdk.api.request.PollRequest)1 RecoverRequest (com.okta.idx.sdk.api.request.RecoverRequest)1 SkipAuthenticatorEnrollmentRequest (com.okta.idx.sdk.api.request.SkipAuthenticatorEnrollmentRequest)1