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());
}
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());
}
Aggregations