Class LocalCachingAuthenticator
java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.credentials.authenticator.LocalCachingAuthenticator
- All Implemented Interfaces:
Authenticator
An authenticator that caches the result of an authentication based on the credentials.
Add the
guava
dependency to use this class.- Since:
- 1.8
- Author:
- Misagh Moayyed
-
Field Summary
Fields inherited from interface org.pac4j.core.credentials.authenticator.Authenticator
ALWAYS_VALIDATE
-
Constructor Summary
ConstructorDescriptionLocalCachingAuthenticator
(Authenticator delegate, int cacheSize, int timeout, TimeUnit timeUnit) LocalCachingAuthenticator
(Authenticator delegate, Store<Credentials, UserProfile> store) -
Method Summary
Modifier and TypeMethodDescriptionint
getStore()
int
protected void
internalInit
(boolean forceReinit) Internal initialization of the object.boolean
isCached
(Credentials credentials) void
removeFromCache
(Credentials credentials) void
setCacheSize
(int cacheSize) void
setDelegate
(Authenticator delegate) void
setStore
(Store<Credentials, UserProfile> store) void
setTimeout
(int timeout) void
setTimeUnit
(TimeUnit timeUnit) toString()
void
validate
(Credentials credentials, WebContext context, SessionStore sessionStore) Validate the credentials.Methods inherited from class org.pac4j.core.util.InitializableObject
afterInternalInit, beforeInternalInit, getLastAttempt, getMaxAttempts, getMinTimeIntervalBetweenAttemptsInMilliseconds, getNbAttempts, init, init, isInitialized, reinit, setMaxAttempts, setMinTimeIntervalBetweenAttemptsInMilliseconds, shouldInitialize
-
Field Details
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
LocalCachingAuthenticator
public LocalCachingAuthenticator() -
LocalCachingAuthenticator
-
LocalCachingAuthenticator
public LocalCachingAuthenticator(Authenticator delegate, int cacheSize, int timeout, TimeUnit timeUnit)
-
-
Method Details
-
validate
Description copied from interface:Authenticator
Validate the credentials. It should throw aCredentialsException
in case of failure.- Specified by:
validate
in interfaceAuthenticator
- Parameters:
credentials
- the given credentialscontext
- the web contextsessionStore
- the session store
-
internalInit
protected void internalInit(boolean forceReinit) Description copied from class:InitializableObject
Internal initialization of the object.- Specified by:
internalInit
in classInitializableObject
-
removeFromCache
-
isCached
-
getDelegate
-
setDelegate
-
getCacheSize
public int getCacheSize() -
setCacheSize
public void setCacheSize(int cacheSize) -
getTimeout
public int getTimeout() -
setTimeout
public void setTimeout(int timeout) -
getTimeUnit
-
setTimeUnit
-
getStore
-
setStore
-
toString
-