@Transactional public class SimpleTokenManagerImpl extends Object implements TokenManager
Constructor and Description |
---|
SimpleTokenManagerImpl(SessionTokenStorage tokenDAO) |
Modifier and Type | Method and Description |
---|---|
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) |
public SimpleTokenManagerImpl(SessionTokenStorage tokenDAO)
public Token findByRandomHash(String randomHash) throws ObjectNotFoundException
SessionTokenStorage
findByRandomHash
in interface SessionTokenStorage
randomHash
- Random hash.ObjectNotFoundException
- if the token identified by the random hash cannot be found.public Token findByIdentifierHash(String identifierHash) throws ObjectNotFoundException
SessionTokenStorage
findByIdentifierHash
in interface SessionTokenStorage
identifierHash
- Identifier hash.ObjectNotFoundException
- if the token identified by the identifier hash cannot be found.@Transactional(propagation=NESTED, rollbackFor=ObjectAlreadyExistsException.class) public Token add(Token token) throws ObjectAlreadyExistsException
SessionTokenStorage
add
in interface SessionTokenStorage
token
- Token.ObjectAlreadyExistsException
- if a token with the same identifier hash already exists.public Token update(Token token) throws ObjectNotFoundException
update
in interface SessionTokenStorage
token
- token to update.ObjectNotFoundException
public void remove(Token token)
SessionTokenStorage
remove
in interface SessionTokenStorage
token
- Token.public void remove(long directoryId, String name)
SessionTokenStorage
remove
in interface SessionTokenStorage
directoryId
- Directory id.name
- User or application name.public void removeExcept(long directoryId, String name, String exclusionToken)
SessionTokenStorage
exclusionToken
.removeExcept
in interface SessionTokenStorage
directoryId
- Directory id.name
- User or application name.exclusionToken
- the random hash of the token to retain, if presentpublic void removeAll(long directoryId)
SessionTokenStorage
removeAll
in interface SessionTokenStorage
directoryId
- Directory id.public void removeExpiredTokens(Date currentTime, long maxLifeSeconds)
SessionTokenStorage
removeExpiredTokens
in interface SessionTokenStorage
currentTime
- Current datemaxLifeSeconds
- Max lifespan for tokens, unless they specific a shorter one.public void removeAll()
SessionTokenStorage
removeAll
in interface SessionTokenStorage
Copyright © 2016 Atlassian. All rights reserved.