Search in sources :

Example 16 with ProceedContext

use of com.okta.idx.sdk.api.client.ProceedContext in project okta-idx-java by okta.

the class LoginController method forgotPassword.

/**
 * Handle forgot password (password recovery) functionality.
 *
 * @param username the username
 * @param session the session
 * @return the verify view (if password recovery operation is successful),
 * else the forgot password page with errors.
 */
@PostMapping("/forgot-password")
public ModelAndView forgotPassword(@RequestParam("username") final String username, final HttpSession session) {
    logger.info(":: Forgot Password ::");
    ProceedContext proceedContext = Util.getProceedContextFromSession(session);
    AuthenticationResponse authenticationResponse = idxAuthenticationWrapper.recoverPassword(username, proceedContext);
    if (responseHandler.needsToShowErrors(authenticationResponse)) {
        ModelAndView modelAndView = new ModelAndView("forgot-password");
        modelAndView.addObject("errors", authenticationResponse.getErrors());
        return modelAndView;
    }
    return responseHandler.handleKnownTransitions(authenticationResponse, session);
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) AuthenticationResponse(com.okta.idx.sdk.api.response.AuthenticationResponse) ProceedContext(com.okta.idx.sdk.api.client.ProceedContext) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

ProceedContext (com.okta.idx.sdk.api.client.ProceedContext)16 AuthenticationResponse (com.okta.idx.sdk.api.response.AuthenticationResponse)15 ModelAndView (org.springframework.web.servlet.ModelAndView)13 PostMapping (org.springframework.web.bind.annotation.PostMapping)12 VerifyAuthenticatorOptions (com.okta.idx.sdk.api.model.VerifyAuthenticatorOptions)6 GetMapping (org.springframework.web.bind.annotation.GetMapping)6 Authenticator (com.okta.idx.sdk.api.client.Authenticator)5 VerifyChannelDataOptions (com.okta.idx.sdk.api.model.VerifyChannelDataOptions)5 List (java.util.List)5 ContextualData (com.okta.idx.sdk.api.model.ContextualData)4 VerifyAuthenticatorAnswer (com.okta.idx.sdk.api.model.VerifyAuthenticatorAnswer)4 PollResults (com.okta.spring.example.helpers.PollResults)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 Assert (com.okta.commons.lang.Assert)3 Strings (com.okta.commons.lang.Strings)3 IDXAuthenticationWrapper (com.okta.idx.sdk.api.client.IDXAuthenticationWrapper)3 AuthenticationOptions (com.okta.idx.sdk.api.model.AuthenticationOptions)3 AuthenticationStatus (com.okta.idx.sdk.api.model.AuthenticationStatus)3 FormValue (com.okta.idx.sdk.api.model.FormValue)3 Qrcode (com.okta.idx.sdk.api.model.Qrcode)3