Package ch.tocco.nice2.security.spi
Interface SecurityDomain
- All Known Implementing Classes:
AbstractEntitySecurityDomain
,AbstractSecurityDomain
,ActionSecurityDomain
,AdminMenuSecurityDomain
,EntityPathSecurityDomain
,EntitySecurityDomain
,GuardCachingSecurityDomain
,InfoboxSecurityDomain
,ManagerSecurityDomain
,ReportSecurityDomain
public interface SecurityDomain
Specifies a domain (usually based on the obejct type) for security. The domain is
responsible for selecting objects (when reducing the policies), creating object
indicators, resolving paths etc.
-
Method Summary
Modifier and TypeMethodDescriptionaggregateSupportedObjects
(List<?> securedObjects) This method should group all secured objects, which can be evaluated together in aListGuard
, and return a list of these groups.void
clearGuardCache
(SecurityContext securityContext) Clear all cached objects belonging to the given security context.default boolean[]
evaluateCondition
(List<?> object, SecurityContext ctx, Rule rule, Permission askedPermission) getOrCreateFilteredPolicy
(SecurityContext securityContext, List<?> objects, Callable<Policy> provider) Return a policy for the given objects.Create a selector factory.
-
Method Details
-
aggregateSupportedObjects
This method should group all secured objects, which can be evaluated together in aListGuard
, and return a list of these groups. This means all objects in a sub-list must require the same policy, (every object in the list would select the same rules of a policy, seegetSelectorFactory()
). Secured objects that are not supported by this domain at all should not be returned from this method. If none of the objects are supported, an empty list should be returned. -
getSelectorFactory
SelectorFactory getSelectorFactory()Create a selector factory. A selector factory is an object which creates selectors. There is no interface as the arguments defined in the policy will be matched to factory methods using reflection. The contract for the object returned by this method is as follows:It specify several methods called
createSelector
with the return typeSelector
. It may take any number of arguments. Supported argument types are all Java primitives, String, enumerations and arrays of enumerations. The last argument may be an array, which indicates varargs. Wildcards will be passed asnull
. The methods may throw anInvalidArgumentException
.- Returns:
- The selector factory.
-
evaluateCondition
default boolean[] evaluateCondition(List<?> object, SecurityContext ctx, Rule rule, Permission askedPermission) throws EvaluationException - Throws:
EvaluationException
-
getOrCreateFilteredPolicy
Policy getOrCreateFilteredPolicy(SecurityContext securityContext, List<?> objects, Callable<Policy> provider) throws Exception Return 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 givenCallable
can be used to create a new one.- Throws:
Exception
-
clearGuardCache
Clear all cached objects belonging to the given security context.
-