Class LoginController
java.lang.Object
com.okta.spring.example.controllers.LoginController
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.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
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
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
verify()
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.
-
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 usernamepassword
- 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 usernamesession
- 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 authenticatorTypeaction
- the submit or cancel action from form postsession
- 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 authenticatormode
- the sms or voice factor modesession
- 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 codesecurityQuestion
- the security question (custom case)securityQuestionKey
- the security question keysession
- 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 namechannelValue
- the value for channelsession
- 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 objectsession
- 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 passwordconfirmNewPassword
- the confirmation of the new passwordsession
- 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 formpassword
- 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 numbermode
- the delivery mode - sms or voicesession
- 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
- bodysession
- the session- Returns:
- the view associated with authentication response.
-