Package org.wildfly.security.auth.realm
Class CachingSecurityRealm
- java.lang.Object
-
- org.wildfly.security.auth.realm.CachingSecurityRealm
-
- All Implemented Interfaces:
SecurityRealm
- Direct Known Subclasses:
CachingModifiableSecurityRealm
public class CachingSecurityRealm extends Object implements SecurityRealm
A wrapper class that provides caching capabilities for a
SecurityRealmand its identities.- Author:
- Pedro Igor
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.auth.server.SecurityRealm
EMPTY_REALM
-
-
Constructor Summary
Constructors Constructor Description CachingSecurityRealm(SecurityRealm realm, RealmIdentityCache cache)Creates a new instance.CachingSecurityRealm(SecurityRealm realm, RealmIdentityCache cache, Supplier<Provider[]> providerSupplier)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SecurityRealmgetCacheableRealm()Gets wrapped backing realm.SupportLevelgetCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec)SupportLevelgetEvidenceVerifySupport(Class<? extends Evidence> evidenceType, String algorithmName)RealmIdentitygetRealmIdentity(Principal principal)voidhandleRealmEvent(RealmEvent event)voidremoveAllFromCache()Removes all cached identities from the cache.voidremoveFromCache(Principal principal)Removes aRealmIdentityreferenced by the specifiedPrincipalfrom the cache.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.auth.server.SecurityRealm
getCredentialAcquireSupport, getRealmIdentity, getRealmIdentity
-
-
-
-
Constructor Detail
-
CachingSecurityRealm
public CachingSecurityRealm(SecurityRealm realm, RealmIdentityCache cache)
Creates a new instance.- Parameters:
realm- theSecurityRealmwhoseRealmIdentityshould be cached.cache- theRealmIdentityCacheinstance
-
CachingSecurityRealm
public CachingSecurityRealm(SecurityRealm realm, RealmIdentityCache cache, Supplier<Provider[]> providerSupplier)
Creates a new instance.- Parameters:
realm- theSecurityRealmwhoseRealmIdentityshould be cached.cache- theRealmIdentityCacheinstanceproviderSupplier- the provider supplier to use for verification purposes (must not benull)
-
-
Method Detail
-
getRealmIdentity
public RealmIdentity getRealmIdentity(Principal principal) throws RealmUnavailableException
- Specified by:
getRealmIdentityin interfaceSecurityRealm- Throws:
RealmUnavailableException
-
getCredentialAcquireSupport
public SupportLevel getCredentialAcquireSupport(Class<? extends Credential> credentialType, String algorithmName, AlgorithmParameterSpec parameterSpec) throws RealmUnavailableException
- Specified by:
getCredentialAcquireSupportin interfaceSecurityRealm- Throws:
RealmUnavailableException
-
getEvidenceVerifySupport
public SupportLevel getEvidenceVerifySupport(Class<? extends Evidence> evidenceType, String algorithmName) throws RealmUnavailableException
- Specified by:
getEvidenceVerifySupportin interfaceSecurityRealm- Throws:
RealmUnavailableException
-
handleRealmEvent
public void handleRealmEvent(RealmEvent event)
- Specified by:
handleRealmEventin interfaceSecurityRealm
-
removeFromCache
public void removeFromCache(Principal principal)
Removes aRealmIdentityreferenced by the specifiedPrincipalfrom the cache.- Parameters:
principal- thePrincipalthat references a previously cached realm identity
-
removeAllFromCache
public void removeAllFromCache()
Removes all cached identities from the cache.
-
getCacheableRealm
protected SecurityRealm getCacheableRealm()
Gets wrapped backing realm.- Returns:
- the wrapped backing realm
-
-