help xml-ifying a script attribute definition ?

Chad La Joie lajoie at shibboleth.net
Tue Jan 24 23:26:56 GMT 2012



On 1/24/12 5:01 PM, Tom Zeller wrote:
> 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 ?

That's a statement open for much debate, I suspect.  According to
current web culture, nothing is easier to read than ECMAscript.

> The attribute definition returns the value of returnAttr if the
> sourceAttr contains a string. In other words, if foo =~ bar, return
> cat.

As Brent already said, I think the Mapped attribute definition is in
fact what you're looking for, unless I'm just missing something with
your script.

> 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>
> --
> To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net


More information about the users mailing list