Search in sources :

Example 1 with FactorEnrollRequest

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());
}
Also used : ExampleAuthenticationStateHandler(com.okta.authn.sdk.example.ExampleAuthenticationStateHandler) FactorEnrollRequest(com.okta.authn.sdk.resource.FactorEnrollRequest) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Aggregations

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