Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleJavascript Example
collapsetrue
<!-- 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>
            // an            // if the predicate function returns true, the activation condition
            // is satisfied.implementation of Predicate<ProfileRequestContext>
            //
            // the profileContext argument is of type:
            // org.opensaml.profile.context.ProfileRequestContext
            //
            (function (context) {
                "use strict";
                 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;   var subcontext;

            // check the parameter
                if (context profileContext!=== null) { return false; }
                 // check the entityID of the relying party
                subcontext = contextprofileContext.getSubcontext(subcontextClass);

               if (subcontext =!== null) {
return false; }                result return= subcontext.getRelyingPartyId().equals(id);
               } 
       }(profileContext))      }
             result;
        ]]>
		</value>
	</constructor-arg>
</bean>

...