Package net.shibboleth.idp.attribute.filter.policyrule.impl

# Class ScriptedPolicyRule

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.attribute.filter.policyrule.impl.ScriptedPolicyRule

All Implemented Interfaces:
  `PolicyRequirementRule`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`

@ThreadSafe public class ScriptedPolicyRule extends AbstractIdentifiableInitializableComponent implements PolicyRequirementRule, UnmodifiableComponent
A `PolicyRequirementRule` that delegates to a JSR-223 script for its actual processing.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private class`
`ScriptedPolicyRule.PolicyRuleScriptEvaluator`
Evaluator bound to the Matcher semantic.

## Nested classes/interfaces inherited from interface net.shibboleth.idp.attribute.filter.PolicyRequirementRule

`PolicyRequirementRule.Tristate`

## Field Summary

Fields
Modifier and Type
Field
Description
`private Collection<FilterScriptContextExtender>`
`contextExtenders`
Extenders for script context.
`private Object`
`customObject`
The custom object we inject into all scripts.
`private final org.slf4j.Logger`
`log`
Class logger.
`private EvaluableScript`
`script`
Script to be evaluated.
`private ScriptedPolicyRule.PolicyRuleScriptEvaluator`
`scriptEvaluator`
Evaluator.

### Fields inherited from interface net.shibboleth.idp.attribute.filter.PolicyRequirementRule

`MATCHES_ALL, MATCHES_NONE, REQUIREMENT_RULE_FAILS`

## Constructor Summary

Constructors
Constructor
Description
`ScriptedPolicyRule()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`boolean`
`equals(Object obj)`
`Object`
`getCustomObject()`
Return the custom (externally provided) object.
`private EvaluableScript`
`getScript()`
Gets the script to be evaluated.
`int`
`hashCode()`
`PolicyRequirementRule.Tristate`
`matches(AttributeFilterContext filterContext)`
Evaluate what this rule means.
`void`
`setCustomObject(Object object)`
Set the custom (externally provided) object.
`void`
`setScript(EvaluableScript matcherScript)`
Sets the script to be evaluated.
`void`
`setScriptContextExtenders(Collection<FilterScriptContextExtender> extenders)`
Set any script context extenders to apply.
`String`
`toString()`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, 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.shared.component.IdentifiedComponent

`getId`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### script

@NonnullAfterInit private EvaluableScript script
Script to be evaluated.

### scriptEvaluator

@NonnullAfterInit private ScriptedPolicyRule.PolicyRuleScriptEvaluator scriptEvaluator
Evaluator.

### contextExtenders

@Nonnull private Collection<FilterScriptContextExtender> contextExtenders
Extenders for script context.

### customObject

@Nullable private Object customObject
The custom object we inject into all scripts.

## Constructor Details

### ScriptedPolicyRule

public ScriptedPolicyRule()
Constructor.

## Method Details

### getCustomObject

@Nullable public Object getCustomObject()
Return the custom (externally provided) object.

Returns:
  the custom object

### setCustomObject

public void setCustomObject(@Nullable Object object)
Set the custom (externally provided) object.

Parameters:
  `object` - the custom object

### getScript

@Nonnull private EvaluableScript getScript()
Gets the script to be evaluated.

Returns:
  the script to be evaluated

### setScript

public void setScript(@Nonnull EvaluableScript matcherScript)
Sets the script to be evaluated.

Parameters:
  `matcherScript` - the script to be evaluated

### setScriptContextExtenders

public void setScriptContextExtenders(@Nullable Collection<FilterScriptContextExtender> extenders)
Set any script context extenders to apply.

Parameters:
  `extenders` - script extenders
Since:
  5.0.0

### matches

@Nonnull public PolicyRequirementRule.Tristate matches(@Nonnull AttributeFilterContext filterContext)
Evaluate what this rule means.

Specified by:
  `matches` in interface `PolicyRequirementRule`
Parameters:
  `filterContext` - the context.
Returns:
  whether the rule holds

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`