Search in sources :

Example 1 with ActivateFactorRequest

use of com.okta.authn.sdk.resource.ActivateFactorRequest in project okta-auth-java by okta.

the class LoginResource method activateMfa.

@POST
@Path("/mfa/activate/{factorType}")
public void activateMfa(@FormParam("passCode") String passCode) throws AuthenticationException {
    AuthenticationResponse previousAuthResult = getPreviousAuthResult();
    String factorId = previousAuthResult.getFactors().get(0).getId();
    ActivateFactorRequest request = authenticationClient.instantiate(ActivatePassCodeFactorRequest.class).setPassCode(passCode).setStateToken(previousAuthResult.getStateToken());
    authenticationClient.activateFactor(factorId, request, new ExampleAuthenticationStateHandler());
}
Also used : ExampleAuthenticationStateHandler(com.okta.authn.sdk.example.ExampleAuthenticationStateHandler) ActivateFactorRequest(com.okta.authn.sdk.resource.ActivateFactorRequest) AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

ExampleAuthenticationStateHandler (com.okta.authn.sdk.example.ExampleAuthenticationStateHandler)1 ActivateFactorRequest (com.okta.authn.sdk.resource.ActivateFactorRequest)1 AuthenticationResponse (com.okta.authn.sdk.resource.AuthenticationResponse)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1