help xml-ifying a script attribute definition ?
Tom Zeller
tzeller at unicon.net
Tue Jan 24 22:01:51 GMT 2012
I am looking for suggestions on how to replace the following script
attribute definition with one or more v2 built-in attribute
definitions. I think xml is easier to understand than ecma script ?
The attribute definition returns the value of returnAttr if the
sourceAttr contains a string. In other words, if foo =~ bar, return
cat.
I have looked at the Mapped, Template, and RegexSplit definitions, but
I do not think it is possible to combine them to replace this script.
Is it ?
Thanks,
TomZ
<resolver:AttributeDefinition
id="attr"
xsi:type="ad:Script">
<resolver:Dependency ref="dataConnector" />
<ad:Script><![CDATA[
importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);
attr = new BasicAttribute("attr");
if (typeof sourceAttr != "undefined" && sourceAttr != null ){
if (sourceAttr.getValues().contains("regex")) {
if (typeof returnAttr != "undefined" && returnAttr != null ){
attr.getValues().add(returnAttr.getValues().get(0));
}
}
}
]]></ad:Script>
</resolver:AttributeDefinition>
More information about the users
mailing list