com.atlassian.crowd.dao.token
Interface SessionTokenStorage

All Known Subinterfaces:
SwitchableTokenManager, TokenDAO, TokenManager
All Known Implementing Classes:
SimpleTokenManagerImpl, SwitchableTokenManagerImpl, TokenDAOHibernate, TokenDAOMemory

public interface SessionTokenStorage

A store of session tokens, that may be created, retrieved and deleted.


Method Summary
 Token add(Token token)
          Persists a new token.
 Token findByIdentifierHash(String identifierHash)
          Finds token by identifier hash.
 Token findByRandomHash(String randomHash)
          Finds token by random hash.
 void remove(long directoryId, String name)
          Remove token.
 void remove(Token token)
          Removes a token.
 void removeAll()
          Wipes all tokens from the store.
 void removeAll(long directoryId)
          Remove all tokens associated with the given directory id.
 void removeExcept(long directoryId, String name, String exclusionToken)
          Remove all tokens for the user except for the token specified by exclusionToken.
 void removeExpiredTokens(Date currentTime, long maxLifeSeconds)
          Remove all tokens that have expired.
 Token update(Token token)
           
 

Method Detail

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

Token add(Token token)
          throws ObjectAlreadyExistsException
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.



Copyright © 2013 Atlassian. All Rights Reserved.