com.atlassian.crowd.manager.token
Class SimpleTokenManagerImpl

java.lang.Object
  extended by com.atlassian.crowd.manager.token.SimpleTokenManagerImpl
All Implemented Interfaces:
SessionTokenStorage, TokenManager

@Transactional
public class SimpleTokenManagerImpl
extends Object
implements TokenManager

A TokenManager that simply delegates to a single SessionTokenStorage.

Since:
v2.7

Constructor Summary
SimpleTokenManagerImpl(SessionTokenStorage tokenDAO)
           
 
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTokenManagerImpl

public SimpleTokenManagerImpl(SessionTokenStorage tokenDAO)
Method Detail

findByRandomHash

public Token findByRandomHash(String randomHash)
                       throws ObjectNotFoundException
Description copied from interface: SessionTokenStorage
Finds token by random hash.

Specified by:
findByRandomHash in interface SessionTokenStorage
Parameters:
randomHash - Random hash.
Returns:
Token.
Throws:
ObjectNotFoundException - if the token identified by the random hash cannot be found.

findByIdentifierHash

public Token findByIdentifierHash(String identifierHash)
                           throws ObjectNotFoundException
Description copied from interface: SessionTokenStorage
Finds token by identifier hash.

Specified by:
findByIdentifierHash in interface SessionTokenStorage
Parameters:
identifierHash - Identifier hash.
Returns:
Token.
Throws:
ObjectNotFoundException - if the token identified by the identifier hash cannot be found.

add

public Token add(Token token)
          throws ObjectAlreadyExistsException
Description copied from interface: SessionTokenStorage
Persists a new token.

Specified by:
add in interface SessionTokenStorage
Parameters:
token - Token.
Returns:
The persisted token.
Throws:
ObjectAlreadyExistsException - if a token with the same identifier hash already exists.

update

public Token update(Token token)
             throws ObjectNotFoundException
Specified by:
update in interface SessionTokenStorage
Parameters:
token - token to update.
Returns:
updates the last accessed date on the token (sets it to now).
Throws:
ObjectNotFoundException

remove

public void remove(Token token)
Description copied from interface: SessionTokenStorage
Removes a token.

Specified by:
remove in interface SessionTokenStorage
Parameters:
token - Token.

remove

public void remove(long directoryId,
                   String name)
Description copied from interface: SessionTokenStorage
Remove token.

Specified by:
remove in interface SessionTokenStorage
Parameters:
directoryId - Directory id.
name - User or application name.

removeExcept

public void removeExcept(long directoryId,
                         String name,
                         String exclusionToken)
Description copied from interface: SessionTokenStorage
Remove all tokens for the user except for the token specified by exclusionToken.

Specified by:
removeExcept in interface SessionTokenStorage
Parameters:
directoryId - Directory id.
name - User or application name.
exclusionToken - the random hash of the token to retain, if present

removeAll

public void removeAll(long directoryId)
Description copied from interface: SessionTokenStorage
Remove all tokens associated with the given directory id.

Specified by:
removeAll in interface SessionTokenStorage
Parameters:
directoryId - Directory id.

removeExpiredTokens

public void removeExpiredTokens(Date currentTime,
                                long maxLifeSeconds)
Description copied from interface: SessionTokenStorage
Remove all tokens that have expired. For a store that performs expiry asynchronously this may be a no-op.

Specified by:
removeExpiredTokens in interface SessionTokenStorage
Parameters:
currentTime - Current date
maxLifeSeconds - Max lifespan for tokens, unless they specific a shorter one.

removeAll

public void removeAll()
Description copied from interface: SessionTokenStorage
Wipes all tokens from the store.

Specified by:
removeAll in interface SessionTokenStorage


Copyright © 2013 Atlassian. All Rights Reserved.