Class CacheServiceImpl
java.lang.Object
net.shibboleth.idp.plugin.authn.webauthn.storage.impl.CacheServiceImpl
- All Implemented Interfaces:
CacheService
An implementation of a
CacheService that handles the consistent conversion between
CredentialRecords and username cache entries using the supplied strategies.- Since:
- 1.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder to safely construct this object.static interfaceA builder stage.static interfaceA builder stage. -
Field Summary
FieldsModifier and TypeFieldDescriptionThe mapping cache.private final Function<CredentialRecord,String> The strategy to use to convert aCredentialRecordinto a key suitable for the cache.private final org.slf4j.LoggerClass logger.The strategy to use to convert a ByteArray into a key suitable for the cache.private final Function<CredentialRecord,String> The strategy to use to convert aCredentialRecordinto a suitable value for the cache. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCacheServiceImpl(CacheServiceImpl.Builder builder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new builder.getCache()Get the cache, for testing.getIfPresent(com.yubico.webauthn.data.ByteArray keyBytes) Returns the value associated with key in this cache, ornullif there is no cached value.voidinvalidate(com.yubico.webauthn.data.ByteArray key) Removes any cached value for the key.voidRemoves all entries in the cache.voidput(CredentialRecord registration) Associates the registration with the username in this cache.
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
cache
The mapping cache. -
keyExtractionStrategy
The strategy to use to convert aCredentialRecordinto a key suitable for the cache. -
lookupKeyExtractionStrategy
@Nonnull private final Function<com.yubico.webauthn.data.ByteArray,String> lookupKeyExtractionStrategyThe strategy to use to convert a ByteArray into a key suitable for the cache. -
valueExtractionStrategy
The strategy to use to convert aCredentialRecordinto a suitable value for the cache.
-
-
Constructor Details
-
CacheServiceImpl
Constructor.- Parameters:
builder- the builder used to construct the class
-
-
Method Details
-
getCache
Get the cache, for testing.- Returns:
- the cache
-
getIfPresent
Description copied from interface:CacheServiceReturns the value associated with key in this cache, ornullif there is no cached value.- Specified by:
getIfPresentin interfaceCacheService- Parameters:
keyBytes- the key to use- Returns:
- the username associated with key in the cache, or
nullif no mapping is found.
-
put
Description copied from interface:CacheServiceAssociates the registration with the username in this cache. If the cache previously contained a value associated with this registration, the old value is replaced by the username in the registration.- Specified by:
putin interfaceCacheService- Parameters:
registration- the registration to extract the mapping from.
-
invalidate
public void invalidate(@Nonnull com.yubico.webauthn.data.ByteArray key) Description copied from interface:CacheServiceRemoves any cached value for the key.- Specified by:
invalidatein interfaceCacheService- Parameters:
key- the key
-
invalidateAll
public void invalidateAll()Description copied from interface:CacheServiceRemoves all entries in the cache.- Specified by:
invalidateAllin interfaceCacheService
-
builder
Create a new builder.- Returns:
- the builder
-