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 Details

    • DefaultPolicyAspectProcessor

      public DefaultPolicyAspectProcessor(PolicyEvaluator policyEvaluator)
  • Method Details

    • 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 the Policy annotated method call
      Specified by:
      validate in interface PolicyAspectProcessor
      Parameters:
      joinPoint - metadata about the method call
      aspect - the instance of the Aspect 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)
      Extract Policy or PolicyOverride harvested params into a generic PolicyInformation structure.
      Parameters:
      identityTypes - see Policy.identityTypes()
      permissionRoots - see Policy.permissionRoots()
      operationTypes - see Policy.operationTypes()
      multipleRootsMatchingStrategy - see Policy.permissionMatchingStrategy()
      ownerIdentifier - see Policy.ownerIdentifier()
      param - see Policy.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 OperationTypes
      contextInfo - 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 failed PolicyResponse
      Parameters:
      policyResponse - Failed response