Search in sources :

Example 1 with ExampleAuthenticationStateHandler

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

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

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

Example 4 with ExampleAuthenticationStateHandler

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

Example 5 with 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());
}
Also used : ExampleAuthenticationStateHandler(com.okta.authn.sdk.example.ExampleAuthenticationStateHandler) AuthenticationResponse(com.okta.authn.sdk.resource.AuthenticationResponse) VerifyFactorRequest(com.okta.authn.sdk.resource.VerifyFactorRequest) 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