Class NameIDFormatFilter

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

      Fields 
      Modifier and Type Field Description
      private Multimap<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​String> applyMap
      Rules for adding formats.
      private org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.NameIDFormat> formatBuilder
      Builder for NameIDFormat.
      private org.slf4j.Logger log
      Class logger.
      private boolean removeExistingFormats
      Whether to strip any existing Formats when adding new ones.
    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • removeExistingFormats

        private boolean removeExistingFormats
        Whether to strip any existing Formats when adding new ones.
      • applyMap

        @Nonnull
        @NonnullElements
        private Multimap<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​String> applyMap
        Rules for adding formats.
      • formatBuilder

        @Nonnull
        private final org.opensaml.saml.common.SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.NameIDFormat> formatBuilder
        Builder for NameIDFormat.
    • Constructor Detail

      • NameIDFormatFilter

        public NameIDFormatFilter()
        Constructor.
    • Method Detail

      • 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).

        Parameters:
        flag - flag to set
      • setRules

        public void setRules​(@Nonnull @NonnullElements
                             Map<Predicate<org.opensaml.saml.saml2.metadata.EntityDescriptor>,​Collection<String>> rules)
        Set the mappings from Predicate to format collection to apply.
        Parameters:
        rules - rules to apply
      • 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
      • filterRoleDescriptor

        protected void filterRoleDescriptor​(@Nonnull
                                            org.opensaml.saml.saml2.metadata.RoleDescriptor role,
                                            @Nonnull @NonnullElements
                                            Collection<String> formats)
        Filters role descriptor.
        Parameters:
        role - role to modify
        formats - formats to attach
      • filterEntitiesDescriptor

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