Search in sources :

Example 1 with PollResults

use of com.okta.spring.example.helpers.PollResults in project okta-idx-java by okta.

the class LoginController method pollResults.

/**
 * Handle poll functionality.
 *
 * @param session the session
 * @return the view associated with authentication response.
 */
@GetMapping("/poll")
@ResponseBody
public PollResults pollResults(final HttpSession session) {
    PollResults pollResults = new PollResults();
    ProceedContext proceedContext = Util.getProceedContextForPoll(session);
    if (proceedContext == null) {
        proceedContext = Util.getProceedContextFromSession(session);
    }
    AuthenticationResponse authenticationResponse = idxAuthenticationWrapper.poll(proceedContext);
    if (responseHandler.needsToShowErrors(authenticationResponse)) {
        pollResults.setErrors(authenticationResponse.getErrors());
    }
    pollResults.setStatus(authenticationResponse.getAuthenticationStatus());
    if (authenticationResponse.getAuthenticationStatus() == AuthenticationStatus.SUCCESS) {
        responseHandler.handleTerminalTransitions(authenticationResponse, session);
    }
    return pollResults;
}
Also used : PollResults(com.okta.spring.example.helpers.PollResults) AuthenticationResponse(com.okta.idx.sdk.api.response.AuthenticationResponse) ProceedContext(com.okta.idx.sdk.api.client.ProceedContext) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ProceedContext (com.okta.idx.sdk.api.client.ProceedContext)1 AuthenticationResponse (com.okta.idx.sdk.api.response.AuthenticationResponse)1 PollResults (com.okta.spring.example.helpers.PollResults)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1