Class AccessTokenCacheImpl
- java.lang.Object
-
- org.bremersee.security.authentication.AccessTokenCacheImpl
-
- All Implemented Interfaces:
AccessTokenCache,org.springframework.beans.factory.DisposableBean
public class AccessTokenCacheImpl extends Object implements AccessTokenCache, org.springframework.beans.factory.DisposableBean
The access token cache implementation.- Author:
- Christian Bremer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.bremersee.security.authentication.AccessTokenCache
AccessTokenCache.Builder
-
-
Field Summary
-
Fields inherited from interface org.bremersee.security.authentication.AccessTokenCache
CACHE_NAME
-
-
Constructor Summary
Constructors Constructor Description AccessTokenCacheImpl()Instantiates a new access token cache.AccessTokenCacheImpl(Duration expirationTimeThreshold, String keyPrefix)Instantiates a new access token cache.AccessTokenCacheImpl(org.springframework.cache.Cache cache)Instantiates a new access token cache.AccessTokenCacheImpl(org.springframework.cache.Cache cache, Duration expirationTimeThreshold, String keyPrefix)Instantiates a new access token cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Optional<String>findAccessToken(String key)Find not expired access token from cache.voidputAccessToken(String key, String accessToken)Put new access token into the cache.StringtoString()
-
-
-
Constructor Detail
-
AccessTokenCacheImpl
public AccessTokenCacheImpl()
Instantiates a new access token cache.
-
AccessTokenCacheImpl
public AccessTokenCacheImpl(Duration expirationTimeThreshold, String keyPrefix)
Instantiates a new access token cache.- Parameters:
expirationTimeThreshold- the expiration time thresholdkeyPrefix- the key prefix
-
AccessTokenCacheImpl
public AccessTokenCacheImpl(org.springframework.cache.Cache cache)
Instantiates a new access token cache.- Parameters:
cache- the external cache
-
-
Method Detail
-
findAccessToken
public Optional<String> findAccessToken(String key)
Description copied from interface:AccessTokenCacheFind not expired access token from cache.- Specified by:
findAccessTokenin interfaceAccessTokenCache- Parameters:
key- the key- Returns:
- the access token
-
putAccessToken
public void putAccessToken(String key, String accessToken)
Description copied from interface:AccessTokenCachePut new access token into the cache.- Specified by:
putAccessTokenin interfaceAccessTokenCache- Parameters:
key- the keyaccessToken- the access token
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
-