Class NameIDFormatFilter

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, MetadataFilter

public class NameIDFormatFilter extends AbstractInitializableComponent implements MetadataFilter
A filter that adds NameIDFormat content to entities in order to drive software behavior based on them. The entities to annotate are identified with a Predicate, and multiple formats can be associated with each.
  • Field Details

  • Constructor Details

    • NameIDFormatFilter

      public NameIDFormatFilter()
  • Method Details

    • setRemoveExistingFormats

      public void setRemoveExistingFormats(boolean flag)
      Set whether the filter should remove any existing formats from an entity to which it adds new ones.

      Defaults to false (for compatibility).

      flag - flag to set
    • setRules

      public void setRules(@Nonnull @NonnullElements Map<Predicate<EntityDescriptor>,Collection<String>> rules)
      Set the mappings from Predicate to format collection to apply.
      rules - rules to apply
    • 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
      metadata - the metadata to be filtered.
      context - the metadata filter context
      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.
      FilterException - thrown if an error occurs during the filtering process
    • filterEntityDescriptor

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

      protected void filterRoleDescriptor(@Nonnull RoleDescriptor role, @Nonnull @NonnullElements Collection<String> formats)
      Filters role descriptor.
      role - role to modify
      formats - formats to attach
    • filterEntitiesDescriptor

      protected void filterEntitiesDescriptor(@Nonnull EntitiesDescriptor descriptor)
      Filters entities descriptor.
      descriptor - entities descriptor to filter