Class CachingPrincipalAttributesRepository
- java.lang.Object
-
- org.apereo.cas.authentication.principal.cache.AbstractPrincipalAttributesRepository
-
- org.apereo.cas.authentication.principal.cache.CachingPrincipalAttributesRepository
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.AutoCloseable
,org.apereo.cas.authentication.principal.PrincipalAttributesRepository
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 Summary
Fields Modifier and Type Field Description protected long
expiration
The expiration time.protected java.lang.String
timeUnit
Expiration time unit.
-
Constructor Summary
Constructors Constructor Description CachingPrincipalAttributesRepository(java.lang.String timeUnit, long expiryDuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Add principal attributes into the underlying cache instance.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)
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.static PrincipalAttributesRepositoryCache
getCacheInstanceFromApplicationContext()
Gets cache instance from application context.-
Methods inherited from class org.apereo.cas.authentication.principal.cache.AbstractPrincipalAttributesRepository
areAttributeRepositoryIdsDefined, close, convertAttributesToPrincipalAttributesAndCache, convertPersonAttributesToPrincipalAttributes, convertPrincipalAttributesToPersonAttributes, determineMergingStrategy, getAttributeRepository, getPrincipalAttributes, retrievePersonAttributesFromAttributeRepository
-
-
-
-
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 interfaceorg.apereo.cas.authentication.principal.PrincipalAttributesRepository
- Specified by:
getAttributes
in classAbstractPrincipalAttributesRepository
-
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 classAbstractPrincipalAttributesRepository
- Parameters:
id
- identifier used by the cache as key.attributes
- attributes to cacheregisteredService
- 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 principalregisteredService
- 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
-
-