Class ScriptedMatcher
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.impl.ScriptedMatcher
- All Implemented Interfaces:
Matcher
,Component
,DestructableComponent
,IdentifiableComponent
,IdentifiedComponent
,InitializableComponent
,UnmodifiableComponent
@ThreadSafe
public class ScriptedMatcher
extends AbstractIdentifiableInitializableComponent
implements Matcher, UnmodifiableComponent
A
Matcher
that delegates to a JSR-223 script for its actual processing.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Evaluator bound to the Matcher semantic. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Object
Custom object for script.private final org.slf4j.Logger
Class logger.Strategy used to locate theProfileRequestContext
to use.private Function<ProfileRequestContext,
SubjectContext> Strategy used to locate theSubjectContext
to use.private EvaluableScript
The script to evaluate.Evaluator.Fields inherited from interface net.shibboleth.idp.attribute.filter.Matcher
MATCHER_FAILS, MATCHES_ALL, MATCHES_NONE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
boolean
Return the custom (externally provided) object.getMatchingValues
(IdPAttribute attribute, AttributeFilterContext filterContext) Perform the AttributeValueMatching.Gets the script to be evaluated.int
hashCode()
void
setCustomObject
(Object object) Set the custom (externally provided) object.void
setProfileRequestContextLookupStrategy
(Function<AttributeFilterContext, ProfileRequestContext> strategy) Set the strategy used to locate theProfileRequestContext
associated with a givenAttributeFilterContext
.void
setScript
(EvaluableScript matcherScript) Sets the script to be evaluated.void
Set the strategy used to locate theSubjectContext
associated with a givenProfileRequestContext
.toString()
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
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, finalize, getClass, notify, notifyAll, 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. -
script
The script to evaluate. -
scriptEvaluator
Evaluator. -
customObject
Custom object for script. -
prcLookupStrategy
Strategy used to locate theProfileRequestContext
to use. -
scLookupStrategy
Strategy used to locate theSubjectContext
to use.
-
-
Constructor Details
-
ScriptedMatcher
public ScriptedMatcher()Constructor.
-
-
Method Details
-
getCustomObject
Return the custom (externally provided) object.- Returns:
- the custom object
-
setCustomObject
Set the custom (externally provided) object.- Parameters:
object
- the custom object
-
getScript
Gets the script to be evaluated.- Returns:
- the script to be evaluated
-
setScript
Sets the script to be evaluated.- Parameters:
matcherScript
- the script to be evaluated
-
setProfileRequestContextLookupStrategy
public void setProfileRequestContextLookupStrategy(@Nonnull Function<AttributeFilterContext, ProfileRequestContext> strategy) Set the strategy used to locate theProfileRequestContext
associated with a givenAttributeFilterContext
.- Parameters:
strategy
- strategy used to locate theProfileRequestContext
associated with a givenAttributeFilterContext
-
setSubjectContextLookupStrategy
public void setSubjectContextLookupStrategy(@Nonnull Function<ProfileRequestContext, SubjectContext> strategy) Set the strategy used to locate theSubjectContext
associated with a givenProfileRequestContext
.- Parameters:
strategy
- strategy used to locate theSubjectContext
associated with a givenProfileRequestContext
-
doInitialize
- Overrides:
doInitialize
in classAbstractIdentifiedInitializableComponent
- Throws:
ComponentInitializationException
-
getMatchingValues
@Nullable @NonnullElements @Unmodifiable public Set<IdPAttributeValue> getMatchingValues(@Nonnull IdPAttribute attribute, @Nonnull AttributeFilterContext filterContext) Perform the AttributeValueMatching.When the script is evaluated, the following properties will be available via the
ScriptContext
:filterContext
- the current instance ofAttributeFilterContext
attribute
- the attribute whose values are to be evaluated
The script MUST return a
Return thoseSet
containing theIdPAttributeValue
objects that were matched.IdPAttributeValue
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.
-
equals
-
hashCode
public int hashCode() -
toString
-