Class EmbeddedLoginAuthenticationSuccessHandler<P extends PasswordToken,U extends User>

java.lang.Object
com.broadleafcommerce.auth.user.session.embedded.EmbeddedLoginAuthenticationSuccessHandler<P,U>
All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationSuccessHandler

public class EmbeddedLoginAuthenticationSuccessHandler<P extends PasswordToken,U extends User> extends Object implements org.springframework.security.web.authentication.AuthenticationSuccessHandler
Writes a One-Time Passcode to the response on Embedded Login success.
Author:
Nathan Moore (nathandmoore), Cade Rea (cade-rea)
  • Field Details

  • Constructor Details

    • EmbeddedLoginAuthenticationSuccessHandler

      public EmbeddedLoginAuthenticationSuccessHandler(PasscodeService<P,U> passcodeService, UserService<U> userService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • onAuthenticationSuccess

      public void onAuthenticationSuccess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)
      Specified by:
      onAuthenticationSuccess in interface org.springframework.security.web.authentication.AuthenticationSuccessHandler
    • writeOTPtoResponse

      protected void writeOTPtoResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      Create a new passcode and write it to the response.
      Parameters:
      request - The HttpServletRequest that is being processed.
      response - The HttpServletResponse that will be sent back to the user.
    • readUser

      protected Optional<U> readUser(javax.servlet.http.HttpServletRequest request)
      Get a user from request parameters.
      Parameters:
      request - HttpServletRequest with "client_id" and "username" parameters.
      Returns:
      An Optional with a User that corresponds to the client_id and username from the request.
    • writeToResponse

      protected void writeToResponse(javax.servlet.http.HttpServletResponse response, P token) throws IOException
      Write a One-Time Passcode wrapped in a EmbeddedLoginAuthenticationSuccessHandler.EmbeddedLoginOTPResponse to the response.
      Parameters:
      response - The HttpServletResponse that will be sent back to the user.
      token - The PasswordToken to write to the response.
      Throws:
      IOException - If there is a problem serializing the EmbeddedLoginAuthenticationSuccessHandler.EmbeddedLoginOTPResponse or writing to the response.
    • getPasscodeService

      protected PasscodeService<P,U> getPasscodeService()
    • getUserService

      protected UserService<U> getUserService()
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()