Package com.atlassian.crowd.dao.token
Interface ExpirableUserTokenDao
- All Known Implementing Classes:
ExpirableUserTokenDaoHibernate
public interface ExpirableUserTokenDao
DAO for
ExpirableUserToken
- Since:
- v2.8
-
Method Summary
Modifier and TypeMethodDescriptionadd
(ExpirableUserToken token) Persist the given tokenfindAllTokens
(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Returns all tokens for a given user.findByToken
(String token) Find the token with the given random hashboolean
removeByDirectoryAndUsername
(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Remove all the tokens matching the username and directory idboolean
removeByToken
(String token) Removes the token with the given random hashboolean
removeExpiredTokens
(Date expiryDate) Remove all the tokens whose expiry date is older than the given cutoff date
-
Method Details
-
findByToken
Find the token with the given random hash- Parameters:
token
- a random hash- Returns:
- the token that was found, or none
-
add
Persist the given token- Parameters:
token
- a token- Returns:
- the persisted token
- Throws:
ObjectAlreadyExistsException
- if a token with the same random hash already exists
-
removeByToken
Removes the token with the given random hash- Parameters:
token
- a random hash- Returns:
- true if a token was deleted, false otherwise
-
removeExpiredTokens
Remove all the tokens whose expiry date is older than the given cutoff date- Parameters:
expiryDate
- a date- Returns:
- true if some tokens were deleted, false otherwise
-
removeByDirectoryAndUsername
boolean removeByDirectoryAndUsername(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Remove all the tokens matching the username and directory id- Parameters:
directoryId
- directory where the user livesusername
- username to remove tokens forexpirableUserTokenType
- token type- Returns:
- true if some tokens were deleted, false otherwise
-
findAllTokens
Set<ExpirableUserToken> findAllTokens(long directoryId, String username, ExpirableUserTokenType expirableUserTokenType) Returns all tokens for a given user.- Parameters:
directoryId
- user's directory IDusername
- username of the userexpirableUserTokenType
- token type- Returns:
- set of all tokens belonging to the user, or empty set if no tokens
-