Class AttributeFilterPolicy

All Implemented Interfaces:
Component, DestructableComponent, IdentifiedComponent, InitializableComponent, UnmodifiableComponent

@ThreadSafe
public final class AttributeFilterPolicy
extends AbstractIdentifiedInitializableComponent
implements UnmodifiableComponent
A policy describing if a set of attribute value filters is applicable. Note, this filter policy operates on the AttributeFilterContext.getFilteredIdPAttributes() attribute set. The idea being that as policies run they will retain or remove attributes and values for this collection. After all policies run this collection will contain the final result.
  • Field Details

    • log

      private final org.slf4j.Logger log
      Class logger.
    • rule

      private final PolicyRequirementRule rule
      Criterion that must be met for this policy to be active for a given request.
    • valuePolicies

      private final List<AttributeRule> valuePolicies
      Filters to be used on attribute values.
    • logPrefix

      private String logPrefix
      Log prefix.
  • Constructor Details

  • Method Details

    • getPolicyRequirementRule

      @Nonnull public PolicyRequirementRule getPolicyRequirementRule()
      Gets the MatchFunctor that must be met for this policy to be active for a given request.
      Returns:
      MatchFunctor that must be met for this policy to be active for a given request
    • getAttributeRules

      @Nonnull @NonnullElements @Unmodifiable public List<AttributeRule> getAttributeRules()
      Gets the unmodifiable attribute rules that are in effect if this policy is in effect.
      Returns:
      attribute rules that are in effect if this policy is in effect
    • isApplicable

      private boolean isApplicable​(@Nonnull AttributeFilterContext filterContext)
      Checks if the given filter context meets the requirements for this attribute filter policy as given by the PolicyRequirementRule.
      Parameters:
      filterContext - current filter context
      Returns:
      true if this policy should be active for the given request, false otherwise
    • apply

      public void apply​(@Nonnull AttributeFilterContext filterContext) throws AttributeFilterException
      Applies this filter policy to the given filter context if it is applicable.
      Parameters:
      filterContext - current filter context
      Throws:
      AttributeFilterException - thrown if there is a problem filtering out the attributes and values for this request
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractIdentifiedInitializableComponent
      Throws:
      ComponentInitializationException
    • getLogPrefix

      public String getLogPrefix()
      Get the prefix for logging.
      Returns:
      Returns the logPrefix.