ScriptedPredicate

The predicate named shibboleth.Conditions.Scripted uses a JSR-223 script to provide return value.

Is an activation condition, which means that is can be automatically configured as an activation condition, this also means it can also configured anywhere that a ProfileRequestContext is supplied as input.

Configuration

Scripted Predicated are instantiated by one of two factory methods.

inlineScript

If provided with one parameter, this is the script to be executed.  If two parameters are the provided, the the first is the name of the (installed) JSR-223 lanuage and the second is the script

<bean id="MyCondition" parent="shibboleth.Conditions.Scripted" factory-method="inlineScript" p:customObject-ref="my.custom.object" hideExceptions="true">
    <constructor-arg>
        <value>
        <![CDATA[ Put Your Script here
         ]]>
        </value>
    </constructor-arg>
</bean>

resourceScript

If provided with one parameter this is the location (usually the file name) of the resource (file) containing the script. If two parameters are the provided, the the first is the name of the (installed) JSR-223 lanuage and the second is the script.

<bean id="MyCondition" parent="shibboleth.Conditions.Scripted" factory-method="resourceScript" c:_0="\opt\idp\path\to\script.js" c:_1="js" />

Properties

The following properties are available:

PropertyNameTypeDefaultDescription
customObjectbeannullThe name of the object to be made available to the script with the identifier custom
returnOnErrorbooleanfalseWhat to return if the script fails
hideExceptionsbooleanfalseif true then "returnOnError" is retuned if the script throws and exception, otherwise the exception is passed up

Script Context

The script has two variable predeclared for it: