...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<!-- A script that checks a Relying Party name --> <bean id="MyCondition" parent="shibboleth.Conditions.Scripted" factory-method="inlineScript"> <constructor-arg> <value> <![CDATA[ "use strict"; var result = false; // an implementation of Predicate<ProfileRequestContext> // The IdP environment provides two variables "profileContext" and "custom". // the profileContext argument is of type: // profileContext is of //type org.opensaml.profile.context.ProfileRequestContext // custom is whatever you injected // The value of the last statement in this function is the reurn value var id = "https://sp.example.com/shibboleth"; // an entityID // specify the child context of the root ProfileRequestContext var subcontextClass = "net.shibboleth.idp.profile.context.RelyingPartyContext"; var subcontext; // check the parameter if (profileContext!== null) { // check the entityID of the relying party subcontext = profileContext.getSubcontext(subcontextClass); if (subcontext !== null) { result = subcontext.getRelyingPartyId().equals(id); } } result; ]]> </value> </constructor-arg> </bean> |
...