Class LoginController

java.lang.Object
com.okta.spring.example.controllers.LoginController

@Controller public class LoginController extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.servlet.ModelAndView
    enrollWebauthn(WebAuthnRequest webauthnRequest, javax.servlet.http.HttpSession session)
    Handle webauthn authenticator enrollment functionality.
    org.springframework.web.servlet.ModelAndView
    forgotPassword(String username, javax.servlet.http.HttpSession session)
    Handle forgot password (password recovery) functionality.
    org.springframework.web.servlet.ModelAndView
    login(String username, String password, javax.servlet.http.HttpSession session)
    Handle login with the supplied username and optional password.
    org.springframework.web.servlet.ModelAndView
    poll(javax.servlet.http.HttpSession session)
    Handle Okta verify functionality.
    pollResults(javax.servlet.http.HttpSession session)
    Handle poll functionality.
    org.springframework.web.servlet.ModelAndView
    register(String[] userProfileAttributes, char[] password, javax.servlet.http.HttpSession session)
    Handle new user registration functionality.
    org.springframework.web.servlet.ModelAndView
    registerPassword(String newPassword, String confirmNewPassword, javax.servlet.http.HttpSession session)
    Handle change password functionality.
    org.springframework.web.servlet.ModelAndView
    registerPhone(String phone, String mode, javax.servlet.http.HttpSession session)
    Handle phone authenticator enrollment functionality.
    org.springframework.web.servlet.ModelAndView
    selectAuthenticator(String authenticatorType, String action, javax.servlet.http.HttpSession session)
    Handle authenticator selection during authentication.
    org.springframework.web.servlet.ModelAndView
    selectFactor(String authenticatorId, String mode, javax.servlet.http.HttpSession session)
    Handle factor selection during authentication.
    org.springframework.web.servlet.ModelAndView
    Show authenticator verification form.
    org.springframework.web.servlet.ModelAndView
    verify(String code, String securityQuestion, String securityQuestionKey, javax.servlet.http.HttpSession session)
    Handle authenticator verification functionality.
    org.springframework.web.servlet.ModelAndView
    verifyChannelData(String channelName, String channelValue, javax.servlet.http.HttpSession session)
    Handle channel data verification functionality.
    org.springframework.web.servlet.ModelAndView
    verifyWebAuthn(WebAuthnRequest webauthnRequest, javax.servlet.http.HttpSession session)
    Handle webauthn authenticator verification functionality.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LoginController

      public LoginController()
  • Method Details

    • login

      @PostMapping("/login") public org.springframework.web.servlet.ModelAndView login(@RequestParam("username") String username, @RequestParam(value="password",required=false) String password, javax.servlet.http.HttpSession session)
      Handle login with the supplied username and optional password.
      Parameters:
      username - the username
      password - the password (optional)
      session - the session
      Returns:
      the home page view (if login is successful), else the login page with errors.
    • forgotPassword

      @PostMapping("/forgot-password") public org.springframework.web.servlet.ModelAndView forgotPassword(@RequestParam("username") String username, javax.servlet.http.HttpSession session)
      Handle forgot password (password recovery) functionality.
      Parameters:
      username - the username
      session - the session
      Returns:
      the verify view (if password recovery operation is successful), else the forgot password page with errors.
    • selectAuthenticator

      @PostMapping("/select-authenticator") public org.springframework.web.servlet.ModelAndView selectAuthenticator(@RequestParam("authenticator-type") String authenticatorType, @RequestParam("action") String action, javax.servlet.http.HttpSession session)
      Handle authenticator selection during authentication.
      Parameters:
      authenticatorType - the authenticatorType
      action - the submit or cancel action from form post
      session - the session
      Returns:
      select authenticator view or select factor view or error view
    • selectFactor

      @PostMapping("/select-factor") public org.springframework.web.servlet.ModelAndView selectFactor(@RequestParam("authenticatorId") String authenticatorId, @RequestParam("mode") String mode, javax.servlet.http.HttpSession session)
      Handle factor selection during authentication.
      Parameters:
      authenticatorId - the authenticator ID of selected authenticator
      mode - the sms or voice factor mode
      session - the session
      Returns:
      the view associated with authentication response.
    • verify

      @GetMapping("/verify") public org.springframework.web.servlet.ModelAndView verify()
      Show authenticator verification form.
      Returns:
      verify.html.
    • verify

      @PostMapping("/verify") public org.springframework.web.servlet.ModelAndView verify(@RequestParam("code") String code, @RequestParam(value="security_question",required=false) String securityQuestion, @RequestParam(value="security_question_key",required=false) String securityQuestionKey, javax.servlet.http.HttpSession session)
      Handle authenticator verification functionality.
      Parameters:
      code - the verification code
      securityQuestion - the security question (custom case)
      securityQuestionKey - the security question key
      session - the session
      Returns:
      the view associated with authentication response.
    • verifyChannelData

      @PostMapping("/verify-channel-data") public org.springframework.web.servlet.ModelAndView verifyChannelData(@RequestParam("channelName") String channelName, @RequestParam("channelValue") String channelValue, javax.servlet.http.HttpSession session)
      Handle channel data verification functionality.
      Parameters:
      channelName - the channel name
      channelValue - the value for channel
      session - the session
      Returns:
      the view associated with authentication response.
    • pollResults

      @GetMapping("/poll") @ResponseBody public PollResults pollResults(javax.servlet.http.HttpSession session)
      Handle poll functionality.
      Parameters:
      session - the session
      Returns:
      the view associated with authentication response.
    • poll

      @PostMapping("/poll") public org.springframework.web.servlet.ModelAndView poll(javax.servlet.http.HttpSession session)
      Handle Okta verify functionality.
      Parameters:
      session - the session
      Returns:
      the view associated with authentication response.
    • verifyWebAuthn

      @PostMapping("/verify-webauthn") public org.springframework.web.servlet.ModelAndView verifyWebAuthn(@RequestBody WebAuthnRequest webauthnRequest, javax.servlet.http.HttpSession session)
      Handle webauthn authenticator verification functionality.
      Parameters:
      webauthnRequest - web authn request object
      session - the session
      Returns:
      the view associated with authentication response.
    • registerPassword

      @PostMapping("/register-password") public org.springframework.web.servlet.ModelAndView registerPassword(@RequestParam("new-password") String newPassword, @RequestParam("confirm-new-password") String confirmNewPassword, javax.servlet.http.HttpSession session)
      Handle change password functionality.
      Parameters:
      newPassword - the new password
      confirmNewPassword - the confirmation of the new password
      session - the session
      Returns:
      the view associated with authentication response.
    • register

      @PostMapping("/register") public org.springframework.web.servlet.ModelAndView register(@RequestParam("userProfileAttribute[]") String[] userProfileAttributes, @RequestParam(value="password",required=false) char[] password, javax.servlet.http.HttpSession session)
      Handle new user registration functionality.
      Parameters:
      userProfileAttributes - string array for user profile attributes from register form
      password - the password (optional)
      session - the session
      Returns:
      the enroll authenticators view.
    • registerPhone

      @PostMapping("/register-phone") public org.springframework.web.servlet.ModelAndView registerPhone(@RequestParam("phone") String phone, @RequestParam(value="mode",required=false) String mode, javax.servlet.http.HttpSession session)
      Handle phone authenticator enrollment functionality.
      Parameters:
      phone - the phone number
      mode - the delivery mode - sms or voice
      session - the session
      Returns:
      the view associated with authentication response.
    • enrollWebauthn

      @PostMapping("/enroll-webauthn") public org.springframework.web.servlet.ModelAndView enrollWebauthn(@RequestBody WebAuthnRequest webauthnRequest, javax.servlet.http.HttpSession session)
      Handle webauthn authenticator enrollment functionality.
      Parameters:
      webauthnRequest - body
      session - the session
      Returns:
      the view associated with authentication response.