Creation of new attribute from script

Terry Soucy terry.soucy at unb.ca
Fri Jan 6 14:30:44 GMT 2012


On 2012-01-06, at 10:08 AM, Chris Phillips wrote:

> Hi Terry,
> Happy new year!
> I've been following your thread on the resolution of this.  What is the
> final incarnation of the script with the extra pieces?  Was it just added
> the != "undefined" check?
> It may be useful to post back to the mailing list as it is archived and could be a useful record for others ..

Good idea Chris.

Here is my final script.  The purpose is to generate a uniqueUid attribute from the record which may be designated by the uid (active person) or our unbCaAlumniUid attribute (alumni).  Only one attribute is present on a record, never both.  This includes only the SAML2 encoder, but the SAML1 encoder should be pretty straight-forward.


    <!-- uniqueUid resolver, to include Alumni, which do NOT have uid -->
    <resolver:AttributeDefinition
            xsi:type="Script"
            id="uniqueUid"
            xmlns="urn:mace:shibboleth:2.0:resolver:ad">
        <resolver:Dependency
                ref="myLDAP" />
        <resolver:AttributeEncoder
                xsi:type="enc:SAML2String"
                name="urn:oid:0.9.2342.19200300.100.1.1"
                friendlyName="uniqueUid" />
        <Script><![CDATA[
            importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);

            uniqueUid = new BasicAttribute("uniqueUid");

            if (typeof unbCaAlumniUid == "undefined") {
                uniqueUid.getValues().add(uid.getValues().get(0));
            } else {
                uniqueUid.getValues().add(unbCaAlumniUid.getValues().get(0));
            }
        ]]></Script>
    </resolver:AttributeDefinition>

Hope this helps any future needs out there.  Once again, thanks of the list members for their assistance.


--
Terry Soucy, Systems Analyst             Information Technology Services
University of New Brunswick, Fredericton Campus  http://www.unbf.ca/its
Voice: 506.447.3018     Fax: 506.453.3590    E-mail: terry.soucy at unb.ca
**    ITS is a scent-reduced workplace - www.unbf.ca/its/policies    **




On 2012-01-06, at 10:08 AM, Chris Phillips wrote:

> Hi Terry,
> Happy new year!
> I've been following your thread on the resolution of this.  What is the
> final incarnation of the script with the extra pieces?  Was it just added
> the != "undefined" check?
> It may be useful to post back to the mailing list as it is archived and
> could be a useful record for others ..
> 
> C.




More information about the users mailing list