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 Summary
Fields Modifier and Type Field Description private Multimap<Predicate<EntityDescriptor>,Attribute>
applyMap
Rules for adding attributes.private Predicate<Attribute>
attributeFilter
A condition to apply to pre-existing tags to determine their legitimacy.private SAMLObjectBuilder<EntityAttributes>
entityAttributesBuilder
Builder forEntityAttributes
.private SAMLObjectBuilder<Extensions>
extBuilder
Builder forExtensions
.private org.slf4j.Logger
log
Class logger. -
Constructor Summary
Constructors Constructor Description EntityAttributesFilter()
Constructor. -
Method Summary
Modifier and Type Method Description private void
addEntityAttribute(EntityDescriptor descriptor, EntityAttributes container, Attribute input)
Get or createAttribute
based on the input/template object.private void
applyFilter(EntityDescriptor descriptor)
Apply include policy to metadata on input.XMLObject
filter(XMLObject metadata, MetadataFilterContext context)
Filters the given metadata, perhaps to remove elements that are not wanted.protected void
filterEntitiesDescriptor(EntitiesDescriptor descriptor)
Filters entities descriptor.protected void
filterEntityDescriptor(EntityDescriptor descriptor)
Filters entity descriptor.void
setAttributeFilter(Predicate<Attribute> condition)
Set a condition to apply to any pre-existing extension attributes, such that failure causes their removal.void
setRules(Map<Predicate<EntityDescriptor>,Collection<Attribute>> rules)
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
applyMap
Rules for adding attributes. -
attributeFilter
A condition to apply to pre-existing tags to determine their legitimacy. -
extBuilder
Builder forExtensions
. -
entityAttributesBuilder
Builder forEntityAttributes
.
-
-
Constructor Details
-
EntityAttributesFilter
public EntityAttributesFilter()Constructor.
-
-
Method Details
-
setRules
public void setRules(@Nonnull @NonnullElements Map<Predicate<EntityDescriptor>,Collection<Attribute>> rules)- Parameters:
rules
- rules to apply
-
setAttributeFilter
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 FilterExceptionFilters the given metadata, perhaps to remove elements that are not wanted.- Specified by:
filter
in interfaceMetadataFilter
- 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
Filters entity descriptor.- Parameters:
descriptor
- entity descriptor to filter
-
filterEntitiesDescriptor
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 createAttribute
based on the input/template object.- Parameters:
descriptor
- parent entitycontainer
- extension containerinput
- input object
-
applyFilter
Apply include policy to metadata on input.- Parameters:
descriptor
- input to evaluate
-