Class LoginController
- java.lang.Object
-
- com.okta.spring.example.controllers.LoginController
-
@Controller public class LoginController extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LoginController()
-
Method Summary
All Methods Instance Methods Concrete Methods 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(java.lang.String username, javax.servlet.http.HttpSession session)
Handle forgot password (password recovery) functionality.org.springframework.web.servlet.ModelAndView
login(java.lang.String username, java.lang.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
pollResults(javax.servlet.http.HttpSession session)
Handle poll functionality.org.springframework.web.servlet.ModelAndView
register(java.lang.String[] userProfileAttributes, javax.servlet.http.HttpSession session)
Handle new user registration functionality.org.springframework.web.servlet.ModelAndView
registerPassword(java.lang.String newPassword, java.lang.String confirmNewPassword, javax.servlet.http.HttpSession session)
Handle change password functionality.org.springframework.web.servlet.ModelAndView
registerPhone(java.lang.String phone, java.lang.String mode, javax.servlet.http.HttpSession session)
Handle phone authenticator enrollment functionality.org.springframework.web.servlet.ModelAndView
selectAuthenticator(java.lang.String authenticatorType, java.lang.String action, javax.servlet.http.HttpSession session)
Handle authenticator selection during authentication.org.springframework.web.servlet.ModelAndView
selectFactor(java.lang.String authenticatorId, java.lang.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(java.lang.String code, java.lang.String securityQuestionKey, javax.servlet.http.HttpSession session)
Handle authenticator verification functionality.org.springframework.web.servlet.ModelAndView
verifyChannelData(java.lang.String channelName, java.lang.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.
-
-
-
Method Detail
-
login
@PostMapping("/login") public org.springframework.web.servlet.ModelAndView login(@RequestParam("username") java.lang.String username, @RequestParam(value="password",required=false) java.lang.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") java.lang.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") java.lang.String authenticatorType, @RequestParam("action") java.lang.String action, javax.servlet.http.HttpSession session)
Handle authenticator selection during authentication.- Parameters:
authenticatorType
- the authenticatorTypesession
- the sessionaction
- the submit or cancel action from form post- Returns:
- select authenticator view or select factor view or error view
-
selectFactor
@PostMapping("/select-factor") public org.springframework.web.servlet.ModelAndView selectFactor(@RequestParam("authenticatorId") java.lang.String authenticatorId, @RequestParam("mode") java.lang.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") java.lang.String code, @RequestParam(value="security_question_key",required=false) java.lang.String securityQuestionKey, javax.servlet.http.HttpSession session)
Handle authenticator verification functionality.- Parameters:
code
- the verification codesecurityQuestionKey
- 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") java.lang.String channelName, @RequestParam("channelValue") java.lang.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
-session
- the session- Returns:
- the view associated with authentication response.
-
registerPassword
@PostMapping("/register-password") public org.springframework.web.servlet.ModelAndView registerPassword(@RequestParam("new-password") java.lang.String newPassword, @RequestParam("confirm-new-password") java.lang.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[]") java.lang.String[] userProfileAttributes, javax.servlet.http.HttpSession session)
Handle new user registration functionality.- Parameters:
userProfileAttributes
- string array for user profile attributes from register formsession
- the session- Returns:
- the enroll authenticators view.
-
registerPhone
@PostMapping("/register-phone") public org.springframework.web.servlet.ModelAndView registerPhone(@RequestParam("phone") java.lang.String phone, @RequestParam(value="mode",required=false) java.lang.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.
-
-