Class DPoPProofReplayValidator.InMemoryCache
java.lang.Object
org.springframework.security.oauth2.jwt.DPoPProofReplayValidator.InMemoryCache
- All Implemented Interfaces:
org.springframework.cache.Cache
- Enclosing class:
DPoPProofReplayValidator
public static final class DPoPProofReplayValidator.InMemoryCache
extends Object
implements org.springframework.cache.Cache
An in-memory
Cache implementation backed by a ConcurrentHashMap.
NOTE: This implementation has limitations as it only works in a single-node
setup. For production (and clustered) environments, it is recommended to use a
distributed Cache implementation (e.g. Redis, Hazelcast, etc.).
This implementation can be fine-tuned based on the following configuration settings:
setMaxSize(int)- Sets the maximum number of entries the cache can hold. The default is 100,000.setMaxRequestsPerKey(int)- Sets the maximum number of requests allowed perJWK thumbprint. The default is 1000.
- Since:
- 6.5.12
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.cache.Cache
org.springframework.cache.Cache.ValueRetrievalException, org.springframework.cache.Cache.ValueWrapper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()void@Nullable org.springframework.cache.Cache.ValueWrapper<T> @Nullable T<T> @Nullable TintReturns the maximum number of requests allowed perJWK thumbprint.intReturns the maximum number of entries the cache can hold.getName()void@Nullable org.springframework.cache.Cache.ValueWrapperputIfAbsent(Object key, @Nullable Object value) voidsetMaxRequestsPerKey(int maxRequestsPerKey) Sets the maximum number of requests allowed perJWK thumbprint.voidsetMaxSize(int maxSize) Sets the maximum number of entries the cache can hold.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.cache.Cache
evictIfPresent, invalidate, retrieve, retrieve
-
Constructor Details
-
InMemoryCache
public InMemoryCache()
-
-
Method Details
-
getMaxSize
public int getMaxSize()Returns the maximum number of entries the cache can hold.- Returns:
- the maximum number of entries the cache can hold
-
setMaxSize
public void setMaxSize(int maxSize) Sets the maximum number of entries the cache can hold. The default is 100,000.- Parameters:
maxSize- the maximum number of entries the cache can hold
-
getMaxRequestsPerKey
public int getMaxRequestsPerKey()Returns the maximum number of requests allowed perJWK thumbprint.- Returns:
- the maximum number of requests allowed per
JWK thumbprint
-
setMaxRequestsPerKey
public void setMaxRequestsPerKey(int maxRequestsPerKey) Sets the maximum number of requests allowed perJWK thumbprint. The default is 1000.- Parameters:
maxRequestsPerKey- the maximum number of requests allowed perJWK thumbprint
-
getName
- Specified by:
getNamein interfaceorg.springframework.cache.Cache
-
getNativeCache
- Specified by:
getNativeCachein interfaceorg.springframework.cache.Cache
-
get
- Specified by:
getin interfaceorg.springframework.cache.Cache
-
get
-
get
-
put
-
putIfAbsent
-
evict
- Specified by:
evictin interfaceorg.springframework.cache.Cache
-
clear
public void clear()- Specified by:
clearin interfaceorg.springframework.cache.Cache
-