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 void
destroy()
Optional<String>
findAccessToken(String key)
Find not expired access token from cache.void
putAccessToken(String key, String accessToken)
Put new access token into the cache.String
toString()
-
-
-
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:AccessTokenCache
Find not expired access token from cache.- Specified by:
findAccessToken
in interfaceAccessTokenCache
- Parameters:
key
- the key- Returns:
- the access token
-
putAccessToken
public void putAccessToken(String key, String accessToken)
Description copied from interface:AccessTokenCache
Put new access token into the cache.- Specified by:
putAccessToken
in interfaceAccessTokenCache
- Parameters:
key
- the keyaccessToken
- the access token
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
-