Search in sources :

Example 1 with MfaVerifyView

use of com.okta.authn.sdk.example.views.authn.MfaVerifyView in project okta-auth-java by okta.

the class LoginResource method verifyMfa.

@POST
@Path("/mfa/resend/{type}")
public MfaVerifyView verifyMfa(@PathParam("type") String type) throws AuthenticationException {
    AuthenticationResponse previousAuthResult = getPreviousAuthResult();
    com.okta.authn.sdk.resource.Factor factor = getFactor(type, previousAuthResult);
    authenticationClient.resendVerifyFactor(factor.getId(), previousAuthResult.getStateToken(), new ExampleAuthenticationStateHandler());
    return new MfaVerifyView(factor);
}
Also used : ExampleAuthenticationStateHandler(com.okta.authn.sdk.example.ExampleAuthenticationStateHandler) AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) MfaVerifyView(com.okta.authn.sdk.example.views.authn.MfaVerifyView) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 2 with MfaVerifyView

use of com.okta.authn.sdk.example.views.authn.MfaVerifyView in project okta-auth-java by okta.

the class LoginResource method getResendVerifyMfaView.

@GET
@Path("/mfa/resend/{type}")
public MfaVerifyView getResendVerifyMfaView(@PathParam("type") String type) {
    AuthenticationResponse authenticationResponse = getPreviousAuthResult();
    com.okta.authn.sdk.resource.Factor factor = getFactor(type, authenticationResponse);
    return new MfaVerifyView(factor);
}
Also used : AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) MfaVerifyView(com.okta.authn.sdk.example.views.authn.MfaVerifyView) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 3 with MfaVerifyView

use of com.okta.authn.sdk.example.views.authn.MfaVerifyView in project okta-auth-java by okta.

the class LoginResource method getVerifyMfaView.

@GET
@Path("/mfa/verify/{type}")
public MfaVerifyView getVerifyMfaView(@PathParam("type") String type) throws AuthenticationException {
    AuthenticationResponse authenticationResponse = getPreviousAuthResult();
    com.okta.authn.sdk.resource.Factor factor = getFactor(type, authenticationResponse);
    if (factor.getType().equals(FactorType.TOKEN_SOFTWARE_TOTP)) {
        return new MfaVerifyView(factor);
    } else {
        return new MfaVerifyView(challengeFactor(factor, authenticationResponse));
    }
}
Also used : AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) MfaVerifyView(com.okta.authn.sdk.example.views.authn.MfaVerifyView) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

MfaVerifyView (com.okta.authn.sdk.example.views.authn.MfaVerifyView)3 AuthenticationResponse (com.okta.authn.sdk.resource.AuthenticationResponse)3 Path (javax.ws.rs.Path)3 GET (javax.ws.rs.GET)2 ExampleAuthenticationStateHandler (com.okta.authn.sdk.example.ExampleAuthenticationStateHandler)1 POST (javax.ws.rs.POST)1