com.atlassian.crowd.dao.token
Interface ExpirableUserTokenDao


public interface ExpirableUserTokenDao

DAO for ExpirableUserToken

Since:
v2.8

Method Summary
 ExpirableUserToken add(ExpirableUserToken token)
          Persist the given token
 com.atlassian.fugue.Option<ExpirableUserToken> findByToken(String token)
          Find the token with the given random hash
 boolean removeByDirectoryAndUsername(long directoryId, String username)
          Remove all the tokens matching the username and directory id
 boolean removeByToken(String token)
          Removes the token with the given random hash
 boolean removeExpiredTokens(Date expiryDate)
          Remove all the tokens whose expiry date is older than the given cutoff date
 

Method Detail

findByToken

com.atlassian.fugue.Option<ExpirableUserToken> findByToken(String token)
Find the token with the given random hash

Parameters:
token - a random hash
Returns:
the token that was found, or none

add

ExpirableUserToken add(ExpirableUserToken token)
                       throws ObjectAlreadyExistsException
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

boolean removeByToken(String token)
Removes the token with the given random hash

Parameters:
token - a random hash
Returns:
true if a token was deleted, false otherwise

removeExpiredTokens

boolean removeExpiredTokens(Date expiryDate)
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)
Remove all the tokens matching the username and directory id

Parameters:
directoryId - directory where the user lives
username - username to remove tokens for
Returns:
true if some tokens were deleted, false otherwise


Copyright © 2016 Atlassian. All Rights Reserved.