Interface CrowdRememberMeService

All Known Implementing Classes:
TransactionalRememberMeService

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

    Modifier and Type
    Method
    Description
    Optional<org.springframework.security.core.Authentication>
    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
    Clears all expired remember me tokens
    void
    Clears all remember me tokens for all the users
    void
    Clears all remember me tokens for the users belonging to the given directoryId
    void
    Clears all remember me tokens for the user with given series
    void
    Clears all remember me tokens for the user with given username, and directory id
    void
    createCookie(org.springframework.security.core.Authentication authentication, 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.
    Retrieves current configuration
    void
    removeCookie(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
    void
    Validates and stores passed configuration, if CrowdSpecificRememberMeSettings.isEnabled() happens to be false all existing tokens will be expired immediately
  • Method Details

    • authenticate

      Optional<org.springframework.security.core.Authentication> 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 Optional.empty() if authentication failed.
    • removeCookie

      void removeCookie(@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 org.springframework.security.core.Authentication authentication, @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..
      Parameters:
      authentication - valid authentication containing the user context
      request - the request
      response - the response
    • 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