Interface CrowdRememberMeTokenDAO
- All Known Implementing Classes:
CrowdRememberMeTokenDAOHibernate
public interface CrowdRememberMeTokenDAO
Component representing database access layer for
InternalCrowdRememberMeToken
-
Method Summary
Modifier and TypeMethodDescriptionFind token by the id, if presentfindBySeriesAndToken
(String series, String token) findTokensForUser
(String username, long directoryId) Lists tokens for the given username and the directory idvoid
Reload the properties from databasevoid
Removes all remember me tokens presentint
removeAllExpiredTokens
(LocalDateTime lastValidTokenCreateTime, LocalDateTime lastValidUsedBeforeTime) Removes all tokens having createdTime before the lastValidTokenCreateTime, or usedTime before the lastValidUsedBeforeTimeint
removeTokensForDirectory
(long directoryId) Removes all the tokens for the given directoryint
removeTokensForSeries
(String series) Removes tokens for all the given seriesint
removeTokensForUserInDirectory
(String username, long directoryId) Removes all tokens for a user in the given directorysave
(InternalCrowdRememberMeToken token) Saves the tokenboolean
setUsedByRemoteAddress
(CrowdRememberMeToken crowdRememberMeToken) Tries to claim the given token if it is not yet claimed (used)
-
Method Details
-
findByIdExclusiveLock
Find token by the id, if present -
findTokensForUser
Lists tokens for the given username and the directory id- Parameters:
directoryId
- directory id to be searched forusername
- username of the user- Returns:
- collection of tokens
-
save
Saves the token -
removeAllExpiredTokens
int removeAllExpiredTokens(LocalDateTime lastValidTokenCreateTime, LocalDateTime lastValidUsedBeforeTime) Removes all tokens having createdTime before the lastValidTokenCreateTime, or usedTime before the lastValidUsedBeforeTime- Parameters:
lastValidTokenCreateTime
- Last valid token create timestamp (exclusive)lastValidUsedBeforeTime
- Last valid token used timestamp (exclusive)- Returns:
- number of tokens deleted
-
removeTokensForSeries
Removes tokens for all the given series- Parameters:
series
- Series to remove all tokens for- Returns:
- number of tokens deleted
-
findBySeriesAndToken
Optional<InternalCrowdRememberMeToken> findBySeriesAndToken(@Nonnull String series, @Nonnull String token) - Parameters:
series
- Series to match tokentoken
- token value to match- Returns:
- a matching remember me token if exists
-
removeTokensForUserInDirectory
Removes all tokens for a user in the given directory- Parameters:
username
- username of the userdirectoryId
- directory id to which the user belongs- Returns:
- number of tokens deleted
-
removeTokensForDirectory
int removeTokensForDirectory(long directoryId) Removes all the tokens for the given directory- Parameters:
directoryId
- directory id to which the tokens belongs- Returns:
- number of tokens deleted
-
setUsedByRemoteAddress
Tries to claim the given token if it is not yet claimed (used)- Parameters:
crowdRememberMeToken
- token to be claimed- Returns:
- whether attempt was successful or not
-
removeAll
void removeAll()Removes all remember me tokens present -
refresh
Reload the properties from database- Parameters:
token
- token to be refreshed
-