@ThreadSafe @Transactional public class SwitchableTokenManagerImpl extends Object implements SwitchableTokenManager, SearchableTokenService
| Constructor and Description |
|---|
SwitchableTokenManagerImpl(boolean initialUseIsMemory,
TokenDAO daoMemory,
TokenDAO daoHibernate,
PropertyManager propertyManager,
ClusterService clusterService) |
SwitchableTokenManagerImpl(TokenDAO daoMemory,
TokenDAO daoHibernate,
PropertyManager propertyManager,
ClusterService clusterService) |
| 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.
|
boolean |
isUsingDatabaseStorage()
Returns true if the memory token manager is in use.
|
void |
remove(long directoryID,
String name)
Remove token.
|
void |
remove(Token token)
Removes a token.
|
void |
removeAll()
Removes all tokens from all implementations.
|
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.
|
List<AuthenticationToken> |
search(EntityQuery<? extends AuthenticationToken> query)
Searches for token based on criteria.
|
void |
setUsingDatabaseStorage(boolean useDatabaseStorage)
Performs the switch, if necessary.
|
void |
switchToHibernate()
If the In-memory DAO is in use, transparently switches to Hibernate DAO.
|
void |
switchToMemory()
If the Hibernate DAO is in use, transparently switches to In-memory DAO.
|
Token |
update(Token token) |
void |
updateTokenStorage()
Updates the switchable token manager to match the current configuration.
|
public SwitchableTokenManagerImpl(boolean initialUseIsMemory,
TokenDAO daoMemory,
TokenDAO daoHibernate,
PropertyManager propertyManager,
ClusterService clusterService)
public SwitchableTokenManagerImpl(TokenDAO daoMemory, TokenDAO daoHibernate, PropertyManager propertyManager, ClusterService clusterService)
public Token findByRandomHash(String randomHash) throws org.springframework.dao.DataAccessException, ObjectNotFoundException
SessionTokenStoragefindByRandomHash in interface SessionTokenStoragerandomHash - Random hash.ObjectNotFoundException - if the token identified by the random hash cannot be found.org.springframework.dao.DataAccessExceptionpublic Token findByIdentifierHash(String identifierHash) throws ObjectNotFoundException
SessionTokenStoragefindByIdentifierHash in interface SessionTokenStorageidentifierHash - Identifier hash.ObjectNotFoundException - if the token identified by the identifier hash cannot be found.public Token add(Token token) throws org.springframework.dao.DataAccessException, ObjectAlreadyExistsException
SessionTokenStorageadd in interface SessionTokenStoragetoken - Token.ObjectAlreadyExistsException - if a token with the same identifier hash already exists.org.springframework.dao.DataAccessExceptionpublic Token update(Token token) throws ObjectNotFoundException
update in interface SessionTokenStoragetoken - token to update.ObjectNotFoundExceptionpublic void remove(Token token) throws org.springframework.dao.DataAccessException
SessionTokenStorageremove in interface SessionTokenStoragetoken - Token.org.springframework.dao.DataAccessExceptionpublic List<AuthenticationToken> search(EntityQuery<? extends AuthenticationToken> query)
SearchableTokenStoragesearch in interface SearchableTokenStoragequery - Query.public void remove(long directoryID,
String name)
throws org.springframework.dao.DataAccessException
SessionTokenStorageremove in interface SessionTokenStoragedirectoryID - Directory id.name - User or application name.org.springframework.dao.DataAccessExceptionpublic void removeExcept(long directoryId,
String name,
String exclusionToken)
SessionTokenStorageexclusionToken.removeExcept in interface SessionTokenStoragedirectoryId - Directory id.name - User or application name.exclusionToken - the random hash of the token to retain, if presentpublic void removeAll(long directoryId)
SessionTokenStorageremoveAll in interface SessionTokenStoragedirectoryId - Directory id.public void removeExpiredTokens(Date currentTime, long maxLifeSeconds)
SessionTokenStorageremoveExpiredTokens in interface SessionTokenStoragecurrentTime - Current datemaxLifeSeconds - Max lifespan for tokens, unless they specific a shorter one.public void removeAll()
removeAll in interface SessionTokenStoragepublic boolean isUsingDatabaseStorage()
isUsingDatabaseStorage in interface SwitchableTokenManagerpublic void setUsingDatabaseStorage(boolean useDatabaseStorage)
throws PropertyManagerException
setUsingDatabaseStorage in interface SwitchableTokenManagerPropertyManagerExceptionpublic void switchToMemory()
public void switchToHibernate()
public void updateTokenStorage()
SwitchableTokenManagerSwitchableTokenManager.setUsingDatabaseStorage(boolean)),
for instance, after a backup restore.updateTokenStorage in interface SwitchableTokenManagerCopyright © 2024 Atlassian. All rights reserved.