use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler in project okta-auth-java by okta.
the class LoginResource method resendActivateMfa.
@POST
@Path("/mfa/activate/{factorType}/resend")
public void resendActivateMfa(@PathParam("factorType") String type) throws AuthenticationException {
AuthenticationResponse previousAuthResult = getPreviousAuthResult();
com.okta.authn.sdk.resource.Factor factor = getFactor(type, previousAuthResult);
authenticationClient.resendActivateFactor(factor.getId(), previousAuthResult.getStateToken(), new ExampleAuthenticationStateHandler());
}
use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler in project okta-auth-java by okta.
the class LoginResource method recoveryWithAnswer.
@POST
@Path("/recovery")
public void recoveryWithAnswer(@FormParam("answer") String answer) throws AuthenticationException {
AuthenticationResponse previousAuthResult = getPreviousAuthResult();
authenticationClient.answerRecoveryQuestion(answer, previousAuthResult.getStateToken(), new ExampleAuthenticationStateHandler());
}
use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler 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);
}
use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler in project okta-auth-java by okta.
the class LoginResource method enrollMfa.
@POST
@Path("/mfa/enroll/{factorType}")
public void enrollMfa(@PathParam("factorType") String factorType, Form form) throws AuthenticationException {
FactorEnrollRequest request = authenticationClient.instantiate(FactorEnrollRequest.class).setProvider(FactorProvider.OKTA).setStateToken(getPreviousAuthResult().getStateToken()).setFactorType(MfaVerifyView.fromRelativeLink(factorType)).setFactorProfile(authenticationClient.instantiate(SmsFactorProfile.class).setPhoneNumber(form.asMap().getFirst("phoneNumber")));
authenticationClient.enrollFactor(request, new ExampleAuthenticationStateHandler());
}
use of com.okta.authn.sdk.example.ExampleAuthenticationStateHandler in project okta-auth-java by okta.
the class LoginResource method recoverChallenge.
@POST
@Path("/recover/verify")
public void recoverChallenge(@FormParam("passCode") String passCode) throws AuthenticationException {
AuthenticationResponse previousAuthResult = getPreviousAuthResult();
VerifyFactorRequest request = authenticationClient.instantiate(VerifyPassCodeFactorRequest.class).setPassCode(passCode).setStateToken(previousAuthResult.getStateToken());
authenticationClient.verifyFactor(previousAuthResult.getFactors().get(0).getId(), request, new ExampleAuthenticationStateHandler());
}
Aggregations