Javascript example that works with attribute-resolver.xml and Java 8
Eric Wedaa
Eric.Wedaa at marist.edu
Thu Jun 23 15:56:36 EDT 2016
Just in case somebody else needs help writing a script for Shib IDPV3 with Java 8...
I had to create a "firstname" field based off of "cn" (commonname in LDAP)
What follows is the script that works in my attribute-resolver.xml file. It took waaay too long to get this to work so maybe this is helpful to somebody else
<resolver:AttributeDefinition id="firstname" xsi:type="Script" sourceAttributeID="cn"
xmlns="urn:mace:shibboleth:2.0:resolver:ad" >
<resolver:Dependency ref="myLDAP" />
<resolver:Dependency ref="cn" />
<resolver:AttributeEncoder xsi:type="SAML2String"
xmlns="urn:mace:shibboleth:2.0:attribute:encoder" name="firstname" />
<Script><![CDATA[
if (cn != null && cn.getValues().size() > 0) {
gnvalue = cn.getValues().get(0);
result=gnvalue.split(" ");
gnvalue = result[0];
} else {
gnvalue = "-";
}
firstname.getValues().add(gnvalue);
]]></Script>
</resolver:AttributeDefinition>
More information about the users
mailing list