Interface CrowdRememberMeTokenDAO

All Known Implementing Classes:
CrowdRememberMeTokenDAOHibernate

public interface CrowdRememberMeTokenDAO
Component representing database access layer for InternalCrowdRememberMeToken
  • Method Details

    • findByIdExclusiveLock

      Optional<InternalCrowdRememberMeToken> findByIdExclusiveLock(Long id)
      Find token by the id, if present
    • findTokensForUser

      List<InternalCrowdRememberMeToken> findTokensForUser(String username, long directoryId)
      Lists tokens for the given username and the directory id
      Parameters:
      directoryId - directory id to be searched for
      username - username of the user
      Returns:
      collection of tokens
    • save

      Saves the token
    • removeAllExpiredTokens

      int removeAllExpiredTokens(LocalDateTime lastValidTokenCreateTime, LocalDateTime lastValidUsedBeforeTime)
      Removes all tokens having createdTime before the lastValidTokenCreateTime, or usedTime before the lastValidUsedBeforeTime
      Parameters:
      lastValidTokenCreateTime - Last valid token create timestamp (exclusive)
      lastValidUsedBeforeTime - Last valid token used timestamp (exclusive)
      Returns:
      number of tokens deleted
    • removeTokensForSeries

      int removeTokensForSeries(String series)
      Removes tokens for all the given series
      Parameters:
      series - Series to remove all tokens for
      Returns:
      number of tokens deleted
    • findBySeriesAndToken

      Optional<InternalCrowdRememberMeToken> findBySeriesAndToken(@Nonnull String series, @Nonnull String token)
      Parameters:
      series - Series to match token
      token - token value to match
      Returns:
      a matching remember me token if exists
    • removeTokensForUserInDirectory

      int removeTokensForUserInDirectory(String username, long directoryId)
      Removes all tokens for a user in the given directory
      Parameters:
      username - username of the user
      directoryId - directory id to which the user belongs
      Returns:
      number of tokens deleted
    • removeTokensForDirectory

      int removeTokensForDirectory(long directoryId)
      Removes all the tokens for the given directory
      Parameters:
      directoryId - directory id to which the tokens belongs
      Returns:
      number of tokens deleted
    • setUsedByRemoteAddress

      boolean setUsedByRemoteAddress(CrowdRememberMeToken crowdRememberMeToken)
      Tries to claim the given token if it is not yet claimed (used)
      Parameters:
      crowdRememberMeToken - token to be claimed
      Returns:
      whether attempt was successful or not
    • removeAll

      void removeAll()
      Removes all remember me tokens present
    • refresh

      void refresh(InternalCrowdRememberMeToken token)
      Reload the properties from database
      Parameters:
      token - token to be refreshed