Interface RememberMeService


public interface RememberMeService
Provides remember-me authentication
Since:
4.12
  • Method Summary

    Modifier and Type
    Method
    Description
    authenticate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Attempts to authenticate a request using the remember-me cookie provided on the request.
    void
    createCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Generates a new remember-me token for the user and sets the corresponding cookie on the response.
    void
    logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Clears the remember-me cookie and removes all remember-me tokens for the corresponding series
  • Method Details

    • authenticate

      @Nullable ApplicationUser authenticate(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
      Attempts to authenticate a request using the remember-me cookie provided on the request. If authentication succeeds, a new remember-me token is created for the user and a new cookie is set on the response. If authentication fails for any reason, the cookie is cleared on the response.
      Parameters:
      request - the request
      response - the response
      Returns:
      the authenticated user, or null if authentication failed.
    • logout

      void logout(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
      Clears the remember-me cookie and removes all remember-me tokens for the corresponding series
      Parameters:
      request - the request
      response - the response
    • createCookie

      void createCookie(@Nonnull javax.servlet.http.HttpServletRequest request, @Nonnull javax.servlet.http.HttpServletResponse response)
      Generates a new remember-me token for the user and sets the corresponding cookie on the response. This will cancel an existing remember me cookie if such was provided. The user needs to be set in the AuthenticationContext first.
      Parameters:
      request - the request
      response - the response