Making Attribute Lowercase

McKean, Brandon Scott - mckeanbs mckeanbs at jmu.edu
Tue Sep 26 16:11:21 EDT 2017


Thanks much Scott. This is what I arrived at that works:



    <resolver:AttributeDefinition xsi:type="ad:Simple" id="cn" sourceAttributeID="lcn">
    <resolver:Dependency ref="lcn" />
<resolver:AttributeEncoder xsi:type="enc:SAML1String" name="urn:mace:dir:attribute-def:cn" />
                <resolver:AttributeEncoder xsi:type="enc:SAML2String" name="urn:oid:2.5.4.3" friendlyName="cn" />
                            </resolver:AttributeDefinition>

<resolver:AttributeDefinition xsi:type="ad:Script" id="lcn" dependencyOnly="true">
        <resolver:Dependency ref="oud" />
<ad:Script>
        <![CDATA[
                var value = cn.getValues().get(0);
lcn.addValue(value.toLowerCase());
        ]]>
        </ad:Script>
</resolver:AttributeDefinition>



Is that the sort of approach you're referring to?

--
Brandon McKean
IT / Systems
Linux Administrator
(540)568-4235


________________________________
From: users <users-bounces at shibboleth.net> on behalf of Cantor, Scott <cantor.2 at osu.edu>
Sent: Tuesday, September 26, 2017 2:59:43 PM
To: Shib Users
Subject: Re: Making Attribute Lowercase

On 9/26/17, 1:58 PM, "users on behalf of McKean, Brandon Scott - mckeanbs" <users-bounces at shibboleth.net on behalf of mckeanbs at jmu.edu> wrote:

> But it doesn't work due to what I'm guessing is getValues not producing a string.

You don't have to guess.

https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.shibboleth.net_confluence_display_IDP30_ScriptedAttributeDefinition&d=DwICAg&c=eLbWYnpnzycBCgmb7vCI4uqNEB9RSjOdn_5nBEmmeq0&r=iZ_ekq9_90q96juMacb0Sg&m=i9rvrkgsIF5RHt4uFahCVO6_OfJD-gXPZT1NP61YiKs&s=Bh7tozqN7r0s5IjL94fZWesrbZnukc1D_Ivou8bNqzg&e=

See link to ScriptedIdPAttribute, whose javadoc documents getValues as Collection<Object> (and which notes it's there for simplification for scripts written for V2 that assume string values are just exposed as strings).

Collection however is somewhat annoying to use because you can't index into it for simple cases but for iteration it's fine.

ScriptedIdPAttribute.getNativeAttribute is simpler sometimes, but the values are still wrapped inside typed classes so it depends on the scenario.

But fundamentally your script here isn't workable, you can't take an input attribute and start changing its values, that won't work. You need to layer a new one on top of the dependency.

-- Scott


--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20170926/dad80884/attachment-0001.html>


More information about the users mailing list