Class LocalCachingProfileCreator

java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.profile.creator.LocalCachingProfileCreator
All Implemented Interfaces:
ProfileCreator

public class LocalCachingProfileCreator extends InitializableObject implements 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
  • Constructor Details

    • LocalCachingProfileCreator

      public LocalCachingProfileCreator()

      Constructor for LocalCachingProfileCreator.

    • LocalCachingProfileCreator

      public LocalCachingProfileCreator(ProfileCreator delegate, Store<Credentials,UserProfile> store)

      Constructor for LocalCachingProfileCreator.

      Parameters:
      delegate - a ProfileCreator object
      store - a Store object
    • LocalCachingProfileCreator

      public LocalCachingProfileCreator(ProfileCreator delegate, int cacheSize, int timeout, TimeUnit timeUnit)

      Constructor for LocalCachingProfileCreator.

      Parameters:
      delegate - a ProfileCreator object
      cacheSize - a int
      timeout - a int
      timeUnit - a TimeUnit object
  • Method Details

    • create

      public Optional<UserProfile> create(CallContext ctx, Credentials credentials)
      Create a profile from a credentials.
      Specified by:
      create in interface ProfileCreator
      Parameters:
      ctx - the context
      credentials - the given credentials
      Returns:
      the created profile (optional)
    • internalInit

      protected void internalInit(boolean forceReinit)
      Internal initialization of the object.
      Specified by:
      internalInit in class InitializableObject
      Parameters:
      forceReinit - a boolean
    • removeFromCache

      public void removeFromCache(Credentials credentials)

      removeFromCache.

      Parameters:
      credentials - a Credentials object
    • isCached

      public boolean isCached(Credentials credentials)

      isCached.

      Parameters:
      credentials - a Credentials object
      Returns:
      a boolean