Class TokenManagerInMemory<T extends Token>
java.lang.Object
org.bardframework.commons.security.token.manager.TokenManagerInMemory<T>
- All Implemented Interfaces:
TokenManager<T>
public abstract class TokenManagerInMemory<T extends Token>
extends Object
implements TokenManager<T>
Implements simple token manager, that keeps a single token for each user. If user logs in again,
older token is invalidated.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longmillisecond token expire time -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclean expired tokensReturns user details for a token.longCreates a new token for the user and returns it.booleanRemoves a single token.
-
Field Details
-
tokensMap
-
tokenExpirationMills
protected final long tokenExpirationMillsmillisecond token expire time
-
-
Constructor Details
-
TokenManagerInMemory
protected TokenManagerInMemory(long tokenExpirationMills)
-
-
Method Details
-
put
Description copied from interface:TokenManagerCreates a new token for the user and returns it. It may add it to the token list or replace the previous one for the user. Never returnsnull.- Specified by:
putin interfaceTokenManager<T extends Token>
-
remove
Description copied from interface:TokenManagerRemoves a single token.- Specified by:
removein interfaceTokenManager<T extends Token>
-
get
Description copied from interface:TokenManagerReturns user details for a token.- Specified by:
getin interfaceTokenManager<T extends Token>
-
getTokenExpirationMills
public long getTokenExpirationMills() -
getTokensMap
-
cleanExpired
@Scheduled(cron="${token.manager.cleaner.cron:0 */1 * * * *}") public void cleanExpired()clean expired tokens
-