Extending the script context of ScriptedPredicate by configuration

Daniel Lutz daniel.lutz at switch.ch
Wed Sep 9 12:45:42 EDT 2015


I have a use case (SPNEGO/Kerberos) where I want to use
ScriptedPredicate to configure an activation predicate for a flow.
The script should get access to the HTTPServletRequest object.
But currently, only the ProfileRequestContext object
is available in the script context.

Has someone already thought about a method how to extend
the script context of the ScriptedPredicate?

My idea is to extend the class ScriptedPredicate to allow
setting a map of named objects that are added to the
script context. This would allow a deployer to configure
a ScriptedPredicate bean with any script context.

Example configuration:

<bean id="shibboleth.SPNEGOKerberosActivationCondition"
      class="net.shibboleth.idp.profile.logic.ScriptedPredicate"
      factory-method="">
    <constructor-arg index="0" value="JavaScript" />
    <constructor-arg index="1">
        <value>
            <![CDATA[

            // script accessing httpRequest

            ]]>
        </value>
    </constructor-arg>
    <property name="scriptContext">
        <map>
            <entry key="httpRequest" value-ref="shibboleth.HttpServletRequest" />
        </map>
    </property>
</bean>

Would this be a suitable solution?

Daniel


More information about the dev mailing list