Package net.shibboleth.idp.profile.logic
Class SimpleAttributePredicate
- java.lang.Object
-
- net.shibboleth.idp.profile.logic.AbstractAttributePredicate
-
- net.shibboleth.idp.profile.logic.SimpleAttributePredicate
-
- All Implemented Interfaces:
Predicate<ProfileRequestContext>,Predicate<ProfileRequestContext>
public class SimpleAttributePredicate extends AbstractAttributePredicate
Predicate that evaluates anAttributeContextand checks for particular attribute/value pairs.A map to a collection of strings is used to represent the attribute(s) and value(s) to evaluate. The values are evaluated as a disjunction (OR) and the attributes are evaluated as a conjunction (AND).
This handles only simple string-valued data.
For the special case of checking for an attribute's presence, regardless of values, the '*' value is supported. Note that this does NOT exclude pathological cases such as empty or null values. A more advanced predicate should be used to deal with such cases.
-
-
Field Summary
Fields Modifier and Type Field Description private ListMultimap<String,String>attributeValueMapMap of attribute IDs to values.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description SimpleAttributePredicate()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanallowNullAttributeContext()Get the result of the predicate in the case the attribute context is null.protected booleanfindMatch(String toMatch, IdPAttribute attribute)Look for a matching value in an attribute.protected booleanhasMatch(Map<String,IdPAttribute> attributeMap)Abstract implementation of the condition to evaluate.voidsetAttributeValueMap(Map<String,Collection<String>> map)Set the map of attribute/value pairs (as a map of string collections) to check for.-
Methods inherited from class net.shibboleth.idp.profile.logic.AbstractAttributePredicate
getAttributeContextLookupStrategy, isUseUnfilteredAttributes, setAttributeContextLookupStrategy, setUseUnfilteredAttributes, test
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
attributeValueMap
@Nonnull @NonnullElements private ListMultimap<String,String> attributeValueMap
Map of attribute IDs to values.
-
-
Method Detail
-
setAttributeValueMap
public void setAttributeValueMap(@Nonnull @NonnullElements Map<String,Collection<String>> map)
Set the map of attribute/value pairs (as a map of string collections) to check for.- Parameters:
map- map of attribute/value pairs
-
allowNullAttributeContext
protected boolean allowNullAttributeContext()
Get the result of the predicate in the case the attribute context is null.- Overrides:
allowNullAttributeContextin classAbstractAttributePredicate- Returns:
- null context result
-
hasMatch
protected boolean hasMatch(Map<String,IdPAttribute> attributeMap)
Abstract implementation of the condition to evaluate.- Specified by:
hasMatchin classAbstractAttributePredicate- Parameters:
attributeMap- the attributes to evaluate- Returns:
- the condition result
-
findMatch
protected boolean findMatch(@Nonnull @NotEmpty String toMatch, @Nonnull IdPAttribute attribute)
Look for a matching value in an attribute.- Parameters:
toMatch- value to look forattribute- attribute to check- Returns:
- true iff the value is one of the attribute's values
-
-