Static variables in attribute-resolver.xml

Alvarez, Dyana I d.alvarez2 at miami.edu
Tue Mar 1 14:16:30 EST 2016


Hi!

I wanted to know if anyone can answer my question regarding Shibboleth's static variables in the attribute-resolver.xml file. How can I make my static variable "SwitchOn" to be single value and not an array.
When I display the value of "SwitchOn", it displays as an array like this

[true, value1, value2]

Because I have this based on other examples:

<resolver:DataConnector id="staticAttributes" xsi:type="dc:Static">
<dc:Attribute id="SwitchOn">
            <dc:Value>true</dc:Value>
           <dc:Value>value1</dc:Value>
          <dc:Value>value2</dc:Value>
</dc:Attribute>

If I were to only have a single value, how can I avoid the array and be just one single value.
If I decide to display it should be only

true

instead of [true]

and how can I access it to check for true.
Below I have the usual for an array which works but I wanted to switch the If statement to be more for a single value, rather than an array.
If I can do something like this would be great if (SwitchOn=="true").  I don't know if that's possible.


Code:
<resolver:DataConnector id="staticAttributes" xsi:type="dc:Static">
<dc:Attribute id="SwitchOn">
            <dc:Value>true</dc:Value>
</dc:Attribute>

Which I later use in a script in an attribute definition which

<resolver:AttributeDefinition xsi:type="ad:Script" xmlns="urn:mace:shibboleth:2.0:resolver:ad" id="Groups">
                                <resolver:Dependency ref="staticAttributes" />
<resolver:AttributeEncoder xsi:type="SAML2String" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
                                                   name="Groups" friendlyName="Groups" nameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"/>

                                <Script><![CDATA[
                                                importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);

                                                // Create attribute to be returned from definition
                                                Groups = new BasicAttribute("Groups");

                                                if (SwitchOn.getValues().get(0).toLowerCase().contains("true"))
                                                {
                                                                //TO DO
}

                                ]]></Script>

</resolver:AttributeDefinition>

I'd appreciate any help, please

Dyana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20160301/d2fd2a89/attachment-0001.html>


More information about the users mailing list