Class AttributeInMetadataMatcher
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.filter.matcher.saml.impl.AttributeInMetadataMatcher
- All Implemented Interfaces:
Matcher
,Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
public class AttributeInMetadataMatcher
extends AbstractIdentifiableInitializableComponent
implements Matcher
Matcher that checks whether an attribute is enumerated in an SP's metadata as a required or optional attribute. Also
supports simple value filtering.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
The SAML Attribute Name to look for in the metadata.private String
The SAML Attribute NameFormat to look for in the metadata.private final org.slf4j.Logger
Class logger.private String
The String used to prefix log message.private boolean
Whether to return a match if the metadata does not contain an ACS descriptor.private boolean
Whether optionally requested attributes should be matched.Fields inherited from interface net.shibboleth.idp.attribute.filter.Matcher
MATCHER_FAILS, MATCHES_ALL, MATCHES_NONE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Set<IdPAttributeValue>
filterValues
(String attributeToLog, IdPAttribute attribute, List<XMLObject> requestedValues) Given an attribute and the requested values do the filtering.private Set<IdPAttributeValue>
filterValues
(IdPAttribute attribute, List<IdPAttributeValue> requestedValues) Given an attribute and the requested values do the filtering.private RequestedAttribute
findInMetadata
(AttributeConsumingService service, String name, String nameFormat) Locates a RequestedAttribute object in metadata that matches a specific Attribute Name and NameFormat.private AttributeConsumingService
getAttributeConsumingService
(AttributeFilterContext filterContext) Get the appropriateAttributeConsumingService
.Get the SAML Attribute Name to look for in the metadata.Get the SAML Attribute NameFormat to look for in the metadata.protected String
return a string which is to be prepended to all log messages.boolean
Gets whether to matched if the metadata contains no AttributeConsumingService.getMatchingValues
(IdPAttribute attribute, AttributeFilterContext filterContext) Return thoseIdPAttributeValue
s which match this rule, or null if the matcher failed.boolean
Gets whether optionally requested attributes should be matched.private boolean
Checks whether an XMLObject's "value" matches a candidate value.void
setAttributeName
(String name) Set the SAML Attribute Name to look for in the metadata.void
setAttributeNameFormat
(String format) Set the SAML Attribute NameFormat to look for in the metadata.void
setMatchIfMetadataSilent
(boolean flag) Sets whether to match if the metadata contains no AttributeConsumingService.void
setOnlyIfRequired
(boolean flag) Sets whether optionally requested attributes should be matched.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
doInitialize, getId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
onlyIfRequired
private boolean onlyIfRequiredWhether optionally requested attributes should be matched. -
matchIfMetadataSilent
private boolean matchIfMetadataSilentWhether to return a match if the metadata does not contain an ACS descriptor. -
attributeName
The SAML Attribute Name to look for in the metadata. -
attributeNameFormat
The SAML Attribute NameFormat to look for in the metadata. -
logPrefix
The String used to prefix log message.
-
-
Constructor Details
-
AttributeInMetadataMatcher
public AttributeInMetadataMatcher()
-
-
Method Details
-
getOnlyIfRequired
public boolean getOnlyIfRequired()Gets whether optionally requested attributes should be matched.- Returns:
- Whether optionally requested attributes should be matched.
-
setOnlyIfRequired
public void setOnlyIfRequired(boolean flag) Sets whether optionally requested attributes should be matched.- Parameters:
flag
- whether optionally requested attributes should be matched
-
getMatchIfMetadataSilent
public boolean getMatchIfMetadataSilent()Gets whether to matched if the metadata contains no AttributeConsumingService.- Returns:
- whether to match if the metadata contains no AttributeConsumingService
-
setMatchIfMetadataSilent
public void setMatchIfMetadataSilent(boolean flag) Sets whether to match if the metadata contains no AttributeConsumingService.- Parameters:
flag
- whether to match if the metadata contains no AttributeConsumingService
-
getAttributeName
Get the SAML Attribute Name to look for in the metadata. If not used, the evaluated attribute's own eventual encoded name(s) will be used to find a match.- Returns:
- the Name to look for
-
setAttributeName
Set the SAML Attribute Name to look for in the metadata. If not used, the evaluated attribute's own eventual encoded name(s) will be used to find a match.This allows a "look aside" to match a different SAML Attribute Name in the metadata.
- Parameters:
name
- the Name to look for
-
getAttributeNameFormat
Get the SAML Attribute NameFormat to look for in the metadata. If not used, the evaluated attribute's own eventual encoded name format(s) will be used to find a match.- Returns:
- the Name to look for
-
setAttributeNameFormat
Set the SAML Attribute NameFormat to look for in the metadata. If not used, the evaluated attribute's own eventual encoded name format(s) will be used to find a match.This allows a "look aside" to match a different SAML Attribute NameFormat in the metadata.
- Parameters:
format
- the NameFormat to look for
-
getMatchingValues
@Nonnull public Set<IdPAttributeValue> getMatchingValues(@Nonnull IdPAttribute attribute, @Nonnull AttributeFilterContext filterContext) Return thoseIdPAttributeValue
s which match this rule, or null if the matcher failed.- Specified by:
getMatchingValues
in interfaceMatcher
- Parameters:
attribute
- the attribute under question.filterContext
- the filter context- Returns:
- The result of this rule. Null if we failed.
-
getAttributeConsumingService
@Nullable private AttributeConsumingService getAttributeConsumingService(@Nonnull AttributeFilterContext filterContext) Get the appropriateAttributeConsumingService
.- Parameters:
filterContext
- the context for the operation- Returns:
- the service, or null
-
findInMetadata
@Nullable private RequestedAttribute findInMetadata(@Nonnull AttributeConsumingService service, @Nonnull String name, @Nullable String nameFormat) Locates a RequestedAttribute object in metadata that matches a specific Attribute Name and NameFormat.- Parameters:
service
- the metadata descriptor to searchname
- Attribute Name to matchnameFormat
- Attribute NameFormat to match- Returns:
- a matching RequestedAttribute, or null
-
filterValues
@Nonnull private Set<IdPAttributeValue> filterValues(@Nullable IdPAttribute attribute, @Nonnull @NonnullElements List<IdPAttributeValue> requestedValues) Given an attribute and the requested values do the filtering.- Parameters:
attribute
- the attributerequestedValues
- the values- Returns:
- the result of the filter
-
filterValues
@Nonnull @Unmodifiable @NonnullElements private Set<IdPAttributeValue> filterValues(@Nonnull String attributeToLog, @Nullable IdPAttribute attribute, @Nonnull @NonnullElements List<XMLObject> requestedValues) Given an attribute and the requested values do the filtering.- Parameters:
attributeToLog
- name of attribute to logattribute
- the attributerequestedValues
- the values- Returns:
- the result of the filter
-
match
Checks whether an XMLObject's "value" matches a candidate value.- Parameters:
xmlObj
- the XMLObject to matchattributeValue
- the candidate value to match against- Returns:
- true iff the two parameters are non-null and match
-
getLogPrefix
return a string which is to be prepended to all log messages.- Returns:
- "Attribute Filter '<filterID>' :"
-