use of com.okta.authn.sdk.resource.FactorEnrollRequest 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());
}
Aggregations