Package com.atlassian.crowd.dao.token
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 Summary
Modifier and TypeMethodDescriptionPersists a new token.findByIdentifierHash(String identifierHash) Finds token by identifier hash.findByRandomHash(String randomHash) Finds token by random hash.voidRemove token.voidRemoves a token.voidWipes all tokens from the store.voidremoveAll(long directoryId) Remove all tokens associated with the given directory id.voidremoveExcept(long directoryId, String name, String exclusionToken) Remove all tokens for the user except for the token specified byexclusionToken.voidremoveExpiredTokens(Date currentTime, long maxLifeSeconds) Remove all tokens that have expired.
-
Method Details
-
findByRandomHash
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
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
- Parameters:
token- token to update.- Returns:
- updates the last accessed date on the token (sets it to now).
- Throws:
ObjectNotFoundException
-
remove
Removes a token.- Parameters:
token- Token.
-
remove
Remove token.- Parameters:
directoryId- Directory id.name- User or application name.
-
removeExcept
Remove all tokens for the user except for the token specified byexclusionToken.- 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
Remove all tokens that have expired. For a store that performs expiry asynchronously this may be a no-op.- Parameters:
currentTime- Current datemaxLifeSeconds- Max lifespan for tokens, unless they specific a shorter one.
-
removeAll
void removeAll()Wipes all tokens from the store.
-