ScriptedAttribute: is there a coding guide (Objects/Classes/methods and for loops)?
Paul Fardy
paul.fardy at utoronto.ca
Thu Jul 29 20:08:27 UTC 2021
The wiki states:
The ScriptedAttribute AttributeDefinition constructs an output attribute via the execution of a JSR-223<https://docs.oracle.com/en/java/javase/11/scripting/index.html> script.
The JSR-223 link goes Oracles Java Scripting docs, but I have not found an Object/Class library guide. I think it's just a top level doc.
I know a limited set of operations, e.g.:
if (some_attribute.getValues().contains("this")) {
my_attribute.getValues().add("that");
}
But I'd like a complete guide.
My immediate want is to copy an attribute and then add values. How do I copy-assign from one attribute to another? I want the IdP to enhance our eduPersonAffiliation so it expressly asserts some POSET rules. e.g.
staff → employee
student → member
<AttributeDefinition id="affilAsPOSET" xsi:type="ScriptedAttribute" >
<InputAttributeDefinition ref="affiliation" />
<AttributeEncoder xsi:type="SAML2String" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1"
friendlyName="eduPersonAffiliation" />
<Script><![CDATA[
for (value in affiliation.getValues()) {
affliAsPOSET.getValues().add(value);
}
if (affiliation.getValues().contains("faculty") {
affilAsPOSET.getValues().add("employee");
}
]]>
</Script>
</AttributeDefinition>
The for loop doesn't work. Nor does this one:
a = affiliation.getValues();
for (affil in ("staff", "student", "faculty")) {
if (a.contains(affil)) {
affilAsPOSET.getValues().add(affil);
}
}
Where do I find docs on the correct use of for loops?
What class is "affiliation"? What methods are supported? How to I copy an object?
Paul
--
Paul Fardy, Shib Admin, Info Security, ITS
University of Toronto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20210729/f9da6b84/attachment.htm>
More information about the users
mailing list