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
-
Constructor Summary
ConstructorDescriptionLocalCachingProfileCreator
(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.int
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
(ProfileCreator delegate) void
setStore
(Store<Credentials, UserProfile> store) void
setTimeout
(int timeout) void
setTimeUnit
(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:ProfileCreator
Create a profile from a credentials.- Specified by:
create
in 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: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
-