Class EntityAttributesFilter

  • All Implemented Interfaces:
    net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, org.opensaml.saml.metadata.resolver.filter.MetadataFilter

    public class EntityAttributesFilter
    extends net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
    implements org.opensaml.saml.metadata.resolver.filter.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 Summary

      Fields 
      Modifier and Type Field Description
      private Multimap<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​org.opensaml.saml.saml2.core.Attribute> applyMap
      Rules for adding attributes.
      private Predicate<org.opensaml.saml.saml2.core.Attribute> attributeFilter
      A condition to apply to pre-existing tags to determine their legitimacy.
      private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.ext.saml2mdattr.EntityAttributes> entityAttributesBuilder
      Builder for EntityAttributes.
      private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.Extensions> extBuilder
      Builder for Extensions.
      private Logger log
      Class logger.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void applyFilter​(org.opensaml.saml.saml2.metadata.EntityDescriptor descriptor)
      Apply whitelist to metadata on input.
      org.opensaml.core.xml.XMLObject filter​(org.opensaml.core.xml.XMLObject metadata, org.opensaml.saml.metadata.resolver.filter.MetadataFilterContext context)
      protected void filterEntitiesDescriptor​(org.opensaml.saml.saml2.metadata.EntitiesDescriptor descriptor)
      Filters entities descriptor.
      protected void filterEntityDescriptor​(org.opensaml.saml.saml2.metadata.EntityDescriptor descriptor)
      Filters entity descriptor.
      void setAttributeFilter​(Predicate<org.opensaml.saml.saml2.core.Attribute> condition)
      Set a condition to apply to any pre-existing extension attributes, such that failure causes their removal.
      void setRules​(Map<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​Collection<org.opensaml.saml.saml2.core.Attribute>> rules)
      Set the mappings from Predicate to Attribute collection to apply.
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
    • Field Detail

      • log

        @Nonnull
        private final Logger log
        Class logger.
      • applyMap

        @Nonnull
        @NonnullElements
        private Multimap<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​org.opensaml.saml.saml2.core.Attribute> applyMap
        Rules for adding attributes.
      • attributeFilter

        @Nullable
        private Predicate<org.opensaml.saml.saml2.core.Attribute> attributeFilter
        A condition to apply to pre-existing tags to determine their legitimacy.
      • extBuilder

        @Nonnull
        private final org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.Extensions> extBuilder
        Builder for Extensions.
      • entityAttributesBuilder

        @Nonnull
        private final org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.ext.saml2mdattr.EntityAttributes> entityAttributesBuilder
        Builder for EntityAttributes.
    • Constructor Detail

      • EntityAttributesFilter

        public EntityAttributesFilter()
        Constructor.
    • Method Detail

      • setRules

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

        public void setAttributeFilter​(@Nullable
                                       Predicate<org.opensaml.saml.saml2.core.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 org.opensaml.core.xml.XMLObject filter​(@Nullable
                                                      org.opensaml.core.xml.XMLObject metadata,
                                                      @Nonnull
                                                      org.opensaml.saml.metadata.resolver.filter.MetadataFilterContext context)
                                               throws org.opensaml.saml.metadata.resolver.filter.FilterException
        Specified by:
        filter in interface org.opensaml.saml.metadata.resolver.filter.MetadataFilter
        Throws:
        org.opensaml.saml.metadata.resolver.filter.FilterException
      • filterEntityDescriptor

        protected void filterEntityDescriptor​(@Nonnull
                                              org.opensaml.saml.saml2.metadata.EntityDescriptor descriptor)
        Filters entity descriptor.
        Parameters:
        descriptor - entity descriptor to filter
      • filterEntitiesDescriptor

        protected void filterEntitiesDescriptor​(@Nonnull
                                                org.opensaml.saml.saml2.metadata.EntitiesDescriptor descriptor)
        Filters entities descriptor.
        Parameters:
        descriptor - entities descriptor to filter
      • applyFilter

        @Nullable
        private void applyFilter​(@Nonnull
                                 org.opensaml.saml.saml2.metadata.EntityDescriptor descriptor)
        Apply whitelist to metadata on input.
        Parameters:
        descriptor - input to evaluate