Class DefaultPolicyAspectProcessor
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.policy.DefaultPolicyAspectProcessor
-
- All Implemented Interfaces:
PolicyAspectProcessor
public class DefaultPolicyAspectProcessor extends Object implements PolicyAspectProcessor
- Author:
- Jeff Fischer
-
-
Constructor Summary
Constructors Constructor Description DefaultPolicyAspectProcessor(PolicyEvaluator policyEvaluator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PolicyInformation
buildPolicyInformation(IdentityType[] identityTypes, String[] permissionRoots, OperationType[] operationTypes, PermissionMatchingStrategy multipleRootsMatchingStrategy, String ownerIdentifier, int param, int ownerIdentifierParam)
protected OperationType
narrowType(PolicyInformation policy, ContextInfo contextInfo)
Figure out the OperationType to use, given the policy and contextInfo.protected void
notify(PolicyResponse policyResponse)
Raise an exception for a failedPolicyResponse
void
setOverrides(List<PolicyOverride> injected)
Object
validate(org.aspectj.lang.ProceedingJoinPoint joinPoint, Object aspect)
Validate thePolicy
annotated method call
-
-
-
Constructor Detail
-
DefaultPolicyAspectProcessor
public DefaultPolicyAspectProcessor(PolicyEvaluator policyEvaluator)
-
-
Method Detail
-
setOverrides
@Autowired public void setOverrides(@Nullable List<PolicyOverride> injected)
-
validate
public Object validate(org.aspectj.lang.ProceedingJoinPoint joinPoint, Object aspect) throws Throwable
Description copied from interface:PolicyAspectProcessor
Validate thePolicy
annotated method call- Specified by:
validate
in interfacePolicyAspectProcessor
- Parameters:
joinPoint
- metadata about the method callaspect
- the instance of theAspect
annotate class driving this call- Returns:
- the result of the call
- Throws:
Throwable
- any exception
-
buildPolicyInformation
protected PolicyInformation buildPolicyInformation(IdentityType[] identityTypes, String[] permissionRoots, OperationType[] operationTypes, PermissionMatchingStrategy multipleRootsMatchingStrategy, String ownerIdentifier, int param, int ownerIdentifierParam)
- Parameters:
identityTypes
- seePolicy.identityTypes()
permissionRoots
- seePolicy.permissionRoots()
operationTypes
- seePolicy.operationTypes()
multipleRootsMatchingStrategy
- seePolicy.permissionMatchingStrategy()
ownerIdentifier
- seePolicy.ownerIdentifier()
param
- seePolicy.param()
ownerIdentifierParam
-- Returns:
- The constructed, generic policy information at a particular pointcut
-
narrowType
protected OperationType narrowType(PolicyInformation policy, ContextInfo contextInfo)
Figure out the OperationType to use, given the policy and contextInfo.- If there is only one operationType described in Policy:
- If it's not UNKNOWN, use it
- If there's not contextInfo, return UNKNOWN
- Otherwise, return the operation type on the contextInfo
- Otherwise, find and use the first match of contextInfo operationType in those defined by Policy, or the first OperationType in the policy defined list if no match is found
- Parameters:
policy
- The policy annotation on the method that optionally defines one or more OperationTypescontextInfo
- The optional contextInfo that describes an overall operationType for the context of the request- Returns:
- The final OperationType to use for the policy validation
-
notify
protected void notify(PolicyResponse policyResponse)
Raise an exception for a failedPolicyResponse
- Parameters:
policyResponse
- Failed response
-
-