Package org.pac4j.core.profile.creator
Class LocalCachingProfileCreator
java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.profile.creator.LocalCachingProfileCreator
- All Implemented Interfaces:
ProfileCreator
A profile creator that caches the result of a profile creation based on the credentials.
Add the
guava dependency to use this class.- Since:
- 5.7.0
- Author:
- Jerome LELEU
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLocalCachingProfileCreator(ProfileCreator delegate, int cacheSize, int timeout, TimeUnit timeUnit) LocalCachingProfileCreator(ProfileCreator delegate, Store<Credentials, UserProfile> store) -
Method Summary
Modifier and TypeMethodDescriptioncreate(Credentials credentials, WebContext context, SessionStore sessionStore) Create a profile from a credentials.intgetStore()intprotected voidinternalInit(boolean forceReinit) Internal initialization of the object.booleanisCached(Credentials credentials) voidremoveFromCache(Credentials credentials) voidsetCacheSize(int cacheSize) voidsetDelegate(ProfileCreator delegate) voidsetStore(Store<Credentials, UserProfile> store) voidsetTimeout(int timeout) voidsetTimeUnit(TimeUnit timeUnit) toString()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
-
LocalCachingProfileCreator
public LocalCachingProfileCreator() -
LocalCachingProfileCreator
-
LocalCachingProfileCreator
public LocalCachingProfileCreator(ProfileCreator delegate, int cacheSize, int timeout, TimeUnit timeUnit)
-
-
Method Details
-
create
public Optional<UserProfile> create(Credentials credentials, WebContext context, SessionStore sessionStore) Description copied from interface:ProfileCreatorCreate a profile from a credentials.- Specified by:
createin interfaceProfileCreator- Parameters:
credentials- the given credentialscontext- the web contextsessionStore- the session store- Returns:
- the created profile (optional)
-
internalInit
protected void internalInit(boolean forceReinit) Description copied from class:InitializableObjectInternal initialization of the object.- Specified by:
internalInitin 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
-