Package net.shibboleth.idp.profile.logic
Class DynamicAttributePredicate
java.lang.Object
net.shibboleth.idp.profile.logic.AbstractAttributePredicate
net.shibboleth.idp.profile.logic.DynamicAttributePredicate
- All Implemented Interfaces:
Predicate<ProfileRequestContext>
,Predicate<ProfileRequestContext>
public class DynamicAttributePredicate extends AbstractAttributePredicate
Predicate over an
AttributeContext
that derives the value(s) to match based
on one or more supplied Functions instead of static values.- Since:
- 3.4.0
-
Field Summary
Fields Modifier and Type Field Description private ListMultimap<String,Function<ProfileRequestContext,String>>
attributeFunctionMap
Map of attribute IDs to functions.private org.slf4j.Logger
log
Class logger. -
Constructor Summary
Constructors Constructor Description DynamicAttributePredicate()
Constructor. -
Method Summary
Modifier and Type Method Description protected boolean
findMatch(String toMatch, IdPAttribute attribute)
Look for a matching value in an attribute.protected boolean
hasMatch(Map<String,IdPAttribute> attributeMap)
Abstract implementation of the condition to evaluate.protected boolean
hasMatch(ProfileRequestContext profileRequestContext, Map<String,IdPAttribute> attributeMap)
Implementation of the condition to evaluate.void
setAttributeFunctionMap(Map<String,Collection<Function<ProfileRequestContext,String>>> map)
Set the map of attribute/function pairs (as a map of function collections) to check for.boolean
test(ProfileRequestContext input)
Methods inherited from class net.shibboleth.idp.profile.logic.AbstractAttributePredicate
allowNullAttributeContext, getAttributeContextLookupStrategy, isUseUnfilteredAttributes, setAttributeContextLookupStrategy, setUseUnfilteredAttributes
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
attributeFunctionMap
@Nonnull @NonnullElements private ListMultimap<String,Function<ProfileRequestContext,String>> attributeFunctionMapMap of attribute IDs to functions.
-
-
Constructor Details
-
DynamicAttributePredicate
public DynamicAttributePredicate()Constructor.
-
-
Method Details
-
setAttributeFunctionMap
public void setAttributeFunctionMap(@Nonnull @NonnullElements Map<String,Collection<Function<ProfileRequestContext,String>>> map)Set the map of attribute/function pairs (as a map of function collections) to check for.- Parameters:
map
- map of attribute/function pairs
-
test
- Specified by:
test
in interfacePredicate<ProfileRequestContext>
- Overrides:
test
in classAbstractAttributePredicate
-
hasMatch
Abstract implementation of the condition to evaluate.- Specified by:
hasMatch
in classAbstractAttributePredicate
- Parameters:
attributeMap
- the attributes to evaluate- Returns:
- the condition result
-
hasMatch
protected boolean hasMatch(@Nullable ProfileRequestContext profileRequestContext, @Nonnull @NonnullElements Map<String,IdPAttribute> attributeMap)Implementation of the condition to evaluate.- Parameters:
profileRequestContext
- current profile request contextattributeMap
- the attributes to evaluate- Returns:
- the condition result
-
findMatch
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
-