Class EntityAttributesFilter

java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
org.opensaml.saml.metadata.resolver.filter.impl.EntityAttributesFilter
All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, MetadataFilter

public class EntityAttributesFilter extends AbstractInitializableComponent implements MetadataFilter
A filter that adds EntityAttributes extension content to entities in order to drive software behavior based on them.

The entities to annotate are identified with a Predicate, and multiple attributes can be associated with each.

As of 3.4.0, another predicate can be set to validate pre-existing extension content to better protect use cases of this component.

  • Field Details

  • Constructor Details

    • EntityAttributesFilter

      public EntityAttributesFilter()
      Constructor.
  • Method Details

    • setRules

      public void setRules(@Nonnull @NonnullElements Map<Predicate<EntityDescriptor>,Collection<Attribute>> rules)
      Set the mappings from Predicate to Attribute collection to apply.
      Parameters:
      rules - rules to apply
    • setAttributeFilter

      public void setAttributeFilter(@Nullable Predicate<Attribute> condition)
      Set a condition to apply to any pre-existing extension attributes, such that failure causes their removal.

      If not set, then anything is allowed.

      Parameters:
      condition - condition to apply
      Since:
      3.4.0
    • filter

      @Nullable public XMLObject filter(@Nullable XMLObject metadata, @Nonnull MetadataFilterContext context) throws FilterException
      Filters the given metadata, perhaps to remove elements that are not wanted.
      Specified by:
      filter in interface MetadataFilter
      Parameters:
      metadata - the metadata to be filtered.
      context - the metadata filter context
      Returns:
      the filtered XMLObject, which may or may not be the same as the XMLObject instance passed in to the method. Maybe be null, for example if the top-level element was removed by the filter.
      Throws:
      FilterException - thrown if an error occurs during the filtering process
    • filterEntityDescriptor

      protected void filterEntityDescriptor(@Nonnull EntityDescriptor descriptor)
      Filters entity descriptor.
      Parameters:
      descriptor - entity descriptor to filter
    • filterEntitiesDescriptor

      protected void filterEntitiesDescriptor(@Nonnull EntitiesDescriptor descriptor)
      Filters entities descriptor.
      Parameters:
      descriptor - entities descriptor to filter
    • addEntityAttribute

      @Nonnull private void addEntityAttribute(@Nonnull EntityDescriptor descriptor, @Nonnull EntityAttributes container, @Nonnull Attribute input)
      Get or create Attribute based on the input/template object.
      Parameters:
      descriptor - parent entity
      container - extension container
      input - input object
    • applyFilter

      @Nullable private void applyFilter(@Nonnull EntityDescriptor descriptor)
      Apply include policy to metadata on input.
      Parameters:
      descriptor - input to evaluate