Class SpringSessionRememberMeServices

java.lang.Object
org.springframework.session.security.web.authentication.SpringSessionRememberMeServices
All Implemented Interfaces:
org.springframework.security.web.authentication.logout.LogoutHandler, org.springframework.security.web.authentication.RememberMeServices

public class SpringSessionRememberMeServices extends Object implements org.springframework.security.web.authentication.RememberMeServices, org.springframework.security.web.authentication.logout.LogoutHandler
A RememberMeServices implementation that uses Spring Session backed HttpSession to provide remember-me service capabilities.
Since:
1.3.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Remember-me login request attribute name.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.springframework.security.core.Authentication
    autoLogin(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
     
    final void
    loginFail(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
     
    final void
    loginSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication successfulAuthentication)
     
    void
    logout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)
     
    protected boolean
    rememberMeRequested(jakarta.servlet.http.HttpServletRequest request, String parameter)
    Allows customization of whether a remember-me login has been requested.
    void
    setAlwaysRemember(boolean alwaysRemember)
     
    void
    setRememberMeParameterName(String rememberMeParameterName)
    Set the name of the parameter which should be checked for to see if a remember-me has been requested during a login request.
    void
    setValiditySeconds(int validitySeconds)
     

    Methods inherited from class java.lang.Object

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

    • REMEMBER_ME_LOGIN_ATTR

      public static final String REMEMBER_ME_LOGIN_ATTR
      Remember-me login request attribute name.
  • Constructor Details

    • SpringSessionRememberMeServices

      public SpringSessionRememberMeServices()
  • Method Details

    • autoLogin

      public final org.springframework.security.core.Authentication autoLogin(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Specified by:
      autoLogin in interface org.springframework.security.web.authentication.RememberMeServices
    • loginFail

      public final void loginFail(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Specified by:
      loginFail in interface org.springframework.security.web.authentication.RememberMeServices
    • loginSuccess

      public final void loginSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication successfulAuthentication)
      Specified by:
      loginSuccess in interface org.springframework.security.web.authentication.RememberMeServices
    • rememberMeRequested

      protected boolean rememberMeRequested(jakarta.servlet.http.HttpServletRequest request, String parameter)
      Allows customization of whether a remember-me login has been requested. The default is to return true if the configured parameter name has been included in the request and is set to the value true.
      Parameters:
      request - the request submitted from an interactive login, which may include additional information indicating that a persistent login is desired.
      parameter - the configured remember-me parameter name.
      Returns:
      true if the request includes information indicating that a persistent login has been requested.
    • setRememberMeParameterName

      public void setRememberMeParameterName(String rememberMeParameterName)
      Set the name of the parameter which should be checked for to see if a remember-me has been requested during a login request. This should be the same name you assign to the checkbox in your login form.
      Parameters:
      rememberMeParameterName - the request parameter
    • setAlwaysRemember

      public void setAlwaysRemember(boolean alwaysRemember)
    • setValiditySeconds

      public void setValiditySeconds(int validitySeconds)
    • logout

      public void logout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication)
      Specified by:
      logout in interface org.springframework.security.web.authentication.logout.LogoutHandler