Search in sources :

Example 6 with ExampleAuthenticationStateHandler

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

the class LoginResource method unlockAccountChallenge.

@POST
@Path("/unlock/recovery")
public void unlockAccountChallenge(@FormParam("passCode") String passCode) throws AuthenticationException {
    AuthenticationResponse previousAuthResult = getPreviousAuthResult();
    VerifyRecoveryRequest request = authenticationClient.instantiate(VerifyRecoveryRequest.class).setStateToken(previousAuthResult.getStateToken()).setPassCode(passCode);
    authenticationClient.verifyUnlockAccount(previousAuthResult.getFactors().get(0).getType(), request, new ExampleAuthenticationStateHandler());
}
Also used : ExampleAuthenticationStateHandler(com.okta.authn.sdk.example.ExampleAuthenticationStateHandler) AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) VerifyRecoveryRequest(com.okta.authn.sdk.resource.VerifyRecoveryRequest) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 7 with ExampleAuthenticationStateHandler

use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler 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)7 POST (javax.ws.rs.POST)7 Path (javax.ws.rs.Path)7 AuthenticationResponse (com.okta.authn.sdk.resource.AuthenticationResponse)6 MfaVerifyView (com.okta.authn.sdk.example.views.authn.MfaVerifyView)1 ActivateFactorRequest (com.okta.authn.sdk.resource.ActivateFactorRequest)1 FactorEnrollRequest (com.okta.authn.sdk.resource.FactorEnrollRequest)1 VerifyFactorRequest (com.okta.authn.sdk.resource.VerifyFactorRequest)1 VerifyRecoveryRequest (com.okta.authn.sdk.resource.VerifyRecoveryRequest)1