Interface SessionTokenStorage

All Known Subinterfaces:
TokenDAO
All Known Implementing Classes:
TokenDAOMemory

public interface SessionTokenStorage
A store of session tokens, that may be created, retrieved and deleted.
  • Method Details

    • findByRandomHash

      Token findByRandomHash(String randomHash) throws ObjectNotFoundException
      Finds token by random hash.
      Parameters:
      randomHash - Random hash.
      Returns:
      Token.
      Throws:
      ObjectNotFoundException - if the token identified by the random hash cannot be found.
    • findByIdentifierHash

      Token findByIdentifierHash(String identifierHash) throws ObjectNotFoundException
      Finds token by identifier hash.
      Parameters:
      identifierHash - Identifier hash.
      Returns:
      Token.
      Throws:
      ObjectNotFoundException - if the token identified by the identifier hash cannot be found.
    • add

      Persists a new token.
      Parameters:
      token - Token.
      Returns:
      The persisted token.
      Throws:
      ObjectAlreadyExistsException - if a token with the same identifier hash already exists.
    • update

      Token update(Token token) throws ObjectNotFoundException
      Parameters:
      token - token to update.
      Returns:
      updates the last accessed date on the token (sets it to now).
      Throws:
      ObjectNotFoundException
    • remove

      void remove(Token token)
      Removes a token.
      Parameters:
      token - Token.
    • remove

      void remove(long directoryId, String name)
      Remove token.
      Parameters:
      directoryId - Directory id.
      name - User or application name.
    • removeExcept

      void removeExcept(long directoryId, String name, String exclusionToken)
      Remove all tokens for the user except for the token specified by exclusionToken.
      Parameters:
      directoryId - Directory id.
      name - User or application name.
      exclusionToken - the random hash of the token to retain, if present
    • removeAll

      void removeAll(long directoryId)
      Remove all tokens associated with the given directory id.
      Parameters:
      directoryId - Directory id.
    • removeExpiredTokens

      void removeExpiredTokens(Date currentTime, long maxLifeSeconds)
      Remove all tokens that have expired. For a store that performs expiry asynchronously this may be a no-op.
      Parameters:
      currentTime - Current date
      maxLifeSeconds - Max lifespan for tokens, unless they specific a shorter one.
    • removeAll

      void removeAll()
      Wipes all tokens from the store.