Class CachingPrincipalAttributesRepository

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.AutoCloseable, org.apereo.cas.authentication.principal.RegisteredServicePrincipalAttributesRepository

    public class CachingPrincipalAttributesRepository
    extends AbstractPrincipalAttributesRepository
    Wrapper around an attribute repository where attributes cached for a configurable period based on google guava's caching library.
    Since:
    4.2
    See Also:
    Serialized Form
    • Field Detail

      • expiration

        protected long expiration
        The expiration time.
      • timeUnit

        protected java.lang.String timeUnit
        Expiration time unit.
    • Constructor Detail

      • CachingPrincipalAttributesRepository

        public CachingPrincipalAttributesRepository​(java.lang.String timeUnit,
                                                    long expiryDuration)
    • Method Detail

      • getAttributes

        public java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> getAttributes​(org.apereo.cas.authentication.principal.Principal principal,
                                                                                                    org.apereo.cas.services.RegisteredService registeredService)
        Specified by:
        getAttributes in interface org.apereo.cas.authentication.principal.RegisteredServicePrincipalAttributesRepository
        Specified by:
        getAttributes in class AbstractPrincipalAttributesRepository
      • addPrincipalAttributes

        protected void addPrincipalAttributes​(java.lang.String id,
                                              java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> attributes,
                                              org.apereo.cas.services.RegisteredService registeredService)
        Description copied from class: AbstractPrincipalAttributesRepository
        Add principal attributes into the underlying cache instance.
        Specified by:
        addPrincipalAttributes in class AbstractPrincipalAttributesRepository
        Parameters:
        id - identifier used by the cache as key.
        attributes - attributes to cache
        registeredService - the registered service
      • getCachedPrincipalAttributes

        protected java.util.Map<java.lang.String,​java.util.List<java.lang.Object>> getCachedPrincipalAttributes​(org.apereo.cas.authentication.principal.Principal principal,
                                                                                                                      org.apereo.cas.services.RegisteredService registeredService)
        Gets cached principal attributes.
        Parameters:
        principal - the principal
        registeredService - the registered service
        Returns:
        the cached principal attributes
      • getCacheInstanceFromApplicationContext

        public static PrincipalAttributesRepositoryCache getCacheInstanceFromApplicationContext()
        Gets cache instance from application context.
        Returns:
        the cache instance from application context