Class LocalCachingAuthenticator
- java.lang.Object
-
- org.pac4j.core.util.InitializableObject
-
- org.pac4j.core.credentials.authenticator.LocalCachingAuthenticator
-
- All Implemented Interfaces:
Authenticator
public class LocalCachingAuthenticator extends InitializableObject implements Authenticator
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 delegate, int cacheSize, int timeout, java.util.concurrent.TimeUnit timeUnit)
LocalCachingAuthenticator(Authenticator delegate, Store<Credentials,UserProfile> store)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCacheSize()
Authenticator
getDelegate()
Store<Credentials,UserProfile>
getStore()
int
getTimeout()
java.util.concurrent.TimeUnit
getTimeUnit()
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(java.util.concurrent.TimeUnit timeUnit)
java.lang.String
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
-
-
-
-
Constructor Detail
-
LocalCachingAuthenticator
public LocalCachingAuthenticator()
-
LocalCachingAuthenticator
public LocalCachingAuthenticator(Authenticator delegate, Store<Credentials,UserProfile> store)
-
LocalCachingAuthenticator
public LocalCachingAuthenticator(Authenticator delegate, int cacheSize, int timeout, java.util.concurrent.TimeUnit timeUnit)
-
-
Method Detail
-
validate
public void validate(Credentials credentials, WebContext context, SessionStore sessionStore)
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
public void removeFromCache(Credentials credentials)
-
isCached
public boolean isCached(Credentials credentials)
-
getDelegate
public Authenticator getDelegate()
-
setDelegate
public void setDelegate(Authenticator delegate)
-
getCacheSize
public int getCacheSize()
-
setCacheSize
public void setCacheSize(int cacheSize)
-
getTimeout
public int getTimeout()
-
setTimeout
public void setTimeout(int timeout)
-
getTimeUnit
public java.util.concurrent.TimeUnit getTimeUnit()
-
setTimeUnit
public void setTimeUnit(java.util.concurrent.TimeUnit timeUnit)
-
getStore
public Store<Credentials,UserProfile> getStore()
-
setStore
public void setStore(Store<Credentials,UserProfile> store)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-