ScriptedConsumer

ScriptedConsumer

The bean named shibboleth.Consumers.Scripted executes a JSR-223 scriptlet to implement an arbitrary Consumer signature.

The bean named shibboleth.BiConsumers.Scripted executes a JSR-223 scriptlet to implement an arbitrary BiConsumer signature.

Configuration

A Scripted Consumer is instantiated using one of two static factory methods (rather than created directly by invoking a Java constructor), so they have a different syntax in Spring. You can refer to the javadoc (ScriptedConsumer, ScriptedBiConsumer) for complete details.

If provided with one parameter, this is the script to be executed. If two parameters are the provided, then the first is the name of the (installed) JSR-223 lanuage and the second is the script. <bean id="MyConsumer" parent="shibboleth.Consumers.Scripted" factory-method="inlineScript" p:inputType="org.example.SomeClass" p:hideExceptions="true"> <constructor-arg> <value> <![CDATA[ input.doSomething(); ]]> </value> </constructor-arg> </bean>
If provided with one parameter this is the location (usually the file name) of the resource (file) containing the script. If two parameters are provided, the the first is the name of the (installed) JSR-223 lanuage and the second is the location. <bean id="MyConsumer" parent="shibboleth.Consumers.Scripted" factory-method="resourceScript" c:_0="javascript" c:_1="%{idp.home}/conf/script.js" />

Reference

The following additional bean properties are available: Name Type Default Description customObject Bean/Reference An object to make available to the script via a variable named custom hideExceptions boolean false If true, then any exception raised by the script is masked inputType (Consumer variant) Class<?> Adds type checking against the input to the consumer to enforce type safety inputTypes (BiConsumer variant) Pair<Class<?>,Class<?>> Adds type checking against the input to the consumer to enforce type safety
For the Consumer variant, the script environment will have these variables populated: input - the consumer input custom - the object set via the customObject property, if any For the BiConsumer variant, the script environment will have these variables populated: input1 - the first consumer input input2 - the second consumer input custom - the object set via the customObject property, if any