Shibboleth HTTP Dataconnector

From NIEF Wiki
Jump to navigation Jump to search


This is a sample of the Shibboleth HTTP DataConnector.

IIR Sample

The URL seen on line 6 is a test URL that always returns false. You will also need to contact IIR to get an authorization code to use the service.

<DataConnector id="myHTTP" xsi:type="HTTP"
    <InputAttributeDefinition ref="EmailAddress" />
        <![CDATA[[get code from IIR]

    <BodyTemplate MIMEType="application/json">
        { 'email': '$EmailAddress.get(0)' }

        var logger = Java.type("org.slf4j.LoggerFactory").getLogger("net.shibboleth.idp.attribute");

        var HashSet = Java.type("java.util.HashSet");
        var HttpClientSupport = Java.type("");
        var IdPAttribute = Java.type("net.shibboleth.idp.attribute.IdPAttribute");
        var StringAttributeValue = Java.type("net.shibboleth.idp.attribute.StringAttributeValue");
        // Limits length to 64k
        var body = HttpClientSupport.toString(response.getEntity(), "UTF-8", 65536);"Query Response = " + body);

        var result = JSON.parse(body);
        //"Parsed JSON Completed = " + result.completed);

        var attr = new IdPAttribute("CFRCertified");
        var values = new HashSet();
        if (result.completed) {
           values.add(new StringAttributeValue("true"));
        } else {
           values.add(new StringAttributeValue("false"));

    <ResultCache expireAfterWrite="PT45M"/>

shibboleth.NonCachingHttpClient triggers a deprecation warning, but currently it's unclear what should replace this client, so we have not updated these instructions at this time.