Class GuardCachingSecurityDomain<T>
java.lang.Object
ch.tocco.nice2.persist.security.impl.provider.GuardCachingSecurityDomain<T>
- All Implemented Interfaces:
SecurityDomain
- Direct Known Subclasses:
AbstractEntitySecurityDomain
Abstract
SecurityDomain that caches Policy instances and shares them between different secured objects
that use the same rules (per SecurityContext).
The policy may contain hundreds of rules that need to checked to see if they apply to the current secured object.
Therefore it makes sense to cache them if a lot of Guard objects are created for a SecurityDomain.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearGuardCache(SecurityContext securityContext) Clear all cached objects belonging to the given security context.protected abstract TcreateCacheKey(List<?> objects) Converts the list of secured objects into an object that is used to group policies.getOrCreateFilteredPolicy(SecurityContext securityContext, List<?> objects, Callable<Policy> provider) Return a policy for the given objects.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.security.spi.SecurityDomain
aggregateSupportedObjects, evaluateCondition, getSelectorFactory
-
Field Details
-
context
-
-
Constructor Details
-
GuardCachingSecurityDomain
-
-
Method Details
-
getOrCreateFilteredPolicy
public Policy getOrCreateFilteredPolicy(SecurityContext securityContext, List<?> objects, Callable<Policy> provider) throws Exception Description copied from interface:SecurityDomainReturn a policy for the given objects. This can be used to cache and reuse policies for different objects. If no cached policy is available, the givenCallablecan be used to create a new one.- Specified by:
getOrCreateFilteredPolicyin interfaceSecurityDomain- Throws:
Exception
-
createCacheKey
Converts the list of secured objects into an object that is used to group policies. That means if two different lists return the same object, they will share the same policy. -
buildCache
-
clearGuardCache
Description copied from interface:SecurityDomainClear all cached objects belonging to the given security context.- Specified by:
clearGuardCachein interfaceSecurityDomain
-