Interface ExpirableUserTokenDao

All Known Implementing Classes:
ExpirableUserTokenDaoHibernate

public interface ExpirableUserTokenDao
Since:
v2.8
  • Method Details

    • findByToken

      Optional<ExpirableUserToken> findByToken(String token)
      Find the token with the given random hash
      Parameters:
      token - a random hash
      Returns:
      the token that was found, or none
    • add

      Persist the given token
      Parameters:
      token - a token
      Returns:
      the persisted token
      Throws:
      ObjectAlreadyExistsException - if a token with the same random hash already exists
    • removeByToken

      boolean removeByToken(String token)
      Removes the token with the given random hash
      Parameters:
      token - a random hash
      Returns:
      true if a token was deleted, false otherwise
    • removeExpiredTokens

      boolean removeExpiredTokens(Date expiryDate)
      Remove all the tokens whose expiry date is older than the given cutoff date
      Parameters:
      expiryDate - a date
      Returns:
      true if some tokens were deleted, false otherwise
    • removeByDirectoryAndUsername

      boolean removeByDirectoryAndUsername(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType)
      Remove all the tokens matching the username and directory id
      Parameters:
      directoryId - directory where the user lives
      username - username to remove tokens for
      expirableUserTokenType - token type
      Returns:
      true if some tokens were deleted, false otherwise
    • findAllTokens

      Set<ExpirableUserToken> findAllTokens(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType)
      Returns all tokens for a given user.
      Parameters:
      directoryId - user's directory ID
      username - username of the user
      expirableUserTokenType - token type
      Returns:
      set of all tokens belonging to the user, or empty set if no tokens