Interface CrowdRememberMeService

All Known Implementing Classes:
TransactionalRememberMeService

public interface CrowdRememberMeService
Service allowing storage, retrieval and manipulation of CrowdRememberMeToken
Since:
v3.4
  • Method Details

    • authenticate

      Optional<org.springframework.security.core.Authentication> authenticate(@Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.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 Optional.empty() if authentication failed.
    • removeCookie

      void removeCookie(@Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.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 User user, @Nonnull jakarta.servlet.http.HttpServletRequest request, @Nonnull jakarta.servlet.http.HttpServletResponse response)
      Generates and saves a new remember-me token for the user. Sets the corresponding cookie on the response. If a remember-me cookie is already present in the response it will be overwritten.
      Parameters:
      user - the authenticating user
      request - the request
      response - the response
      Since:
      6.2
    • clearAllTokensForSeries

      void clearAllTokensForSeries(String series)
      Clears all remember me tokens for the user with given series
    • clearAllTokensForUserInDirectory

      void clearAllTokensForUserInDirectory(String username, Long directoryId)
      Clears all remember me tokens for the user with given username, and directory id
    • clearAllTokens

      void clearAllTokens()
      Clears all remember me tokens for all the users
    • clearAllExpiredTokens

      void clearAllExpiredTokens()
      Clears all expired remember me tokens
    • clearAllTokensForDirectory

      void clearAllTokensForDirectory(Long directoryId)
      Clears all remember me tokens for the users belonging to the given directoryId
    • saveConfiguration

      void saveConfiguration(CrowdSpecificRememberMeSettings configuration)
      Validates and stores passed configuration, if CrowdSpecificRememberMeSettings.isEnabled() happens to be false all existing tokens will be expired immediately
      Parameters:
      configuration - new configuration
    • getConfiguration

      Retrieves current configuration
      Returns:
      configuration