Class LocalCachingAuthenticator<T extends Credentials>
- java.lang.Object
-
- org.pac4j.core.util.InitializableObject
-
- org.pac4j.core.credentials.authenticator.LocalCachingAuthenticator<T>
-
- All Implemented Interfaces:
Authenticator<T>
public class LocalCachingAuthenticator<T extends Credentials> extends InitializableObject implements Authenticator<T>
An authenticator that caches the result of an authentication event locally. The authentication is delegated to a pluggable component. Add theguava
dependency to use this class.- Since:
- 1.8
- Author:
- Misagh Moayyed
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description LocalCachingAuthenticator()
LocalCachingAuthenticator(Authenticator<T> delegate, int cacheSize, int timeout, TimeUnit timeUnit)
LocalCachingAuthenticator(Authenticator<T> delegate, Store<T,CommonProfile> store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCacheSize()
Authenticator<T>
getDelegate()
Store<T,CommonProfile>
getStore()
int
getTimeout()
TimeUnit
getTimeUnit()
protected void
internalInit()
Internal initialization of the object.boolean
isCached(T credentials)
void
removeFromCache(T credentials)
void
setCacheSize(int cacheSize)
void
setDelegate(Authenticator<T> delegate)
void
setStore(Store<T,CommonProfile> store)
void
setTimeout(int timeout)
void
setTimeUnit(TimeUnit timeUnit)
String
toString()
void
validate(T credentials, WebContext context)
Validate the credentials.-
Methods inherited from class org.pac4j.core.util.InitializableObject
init, isInitialized
-
-
-
-
Constructor Detail
-
LocalCachingAuthenticator
public LocalCachingAuthenticator()
-
LocalCachingAuthenticator
public LocalCachingAuthenticator(Authenticator<T> delegate, Store<T,CommonProfile> store)
-
LocalCachingAuthenticator
public LocalCachingAuthenticator(Authenticator<T> delegate, int cacheSize, int timeout, TimeUnit timeUnit)
-
-
Method Detail
-
validate
public void validate(T credentials, WebContext context)
Description copied from interface:Authenticator
Validate the credentials. It should throw aCredentialsException
in case of failure.- Specified by:
validate
in interfaceAuthenticator<T extends Credentials>
- Parameters:
credentials
- the given credentialscontext
- the web context
-
internalInit
protected void internalInit()
Description copied from class:InitializableObject
Internal initialization of the object.- Specified by:
internalInit
in classInitializableObject
-
removeFromCache
public void removeFromCache(T credentials)
-
isCached
public boolean isCached(T credentials)
-
getDelegate
public Authenticator<T> getDelegate()
-
setDelegate
public void setDelegate(Authenticator<T> delegate)
-
getCacheSize
public int getCacheSize()
-
setCacheSize
public void setCacheSize(int cacheSize)
-
getTimeout
public int getTimeout()
-
setTimeout
public void setTimeout(int timeout)
-
getTimeUnit
public TimeUnit getTimeUnit()
-
setTimeUnit
public void setTimeUnit(TimeUnit timeUnit)
-
getStore
public Store<T,CommonProfile> getStore()
-
setStore
public void setStore(Store<T,CommonProfile> store)
-
-