change case to Title case in IdP

Cameron Kerr cameron.kerr at otago.ac.nz
Tue May 29 07:23:48 EDT 2018


Here’s something similar I have done for the ‘title’ attribute, which our LDAP stores as uppercase.

Hope it helps.

    <AttributeDefinition xsi:type="ScriptedAttribute" id="title">
        <Dependency ref="MyLDAP" />
        <DisplayName xml:lang="en">Title</DisplayName>
        <AttributeEncoder xsi:type="SAML1String" name="urn:mace:dir:attribute-def:title" />
        <AttributeEncoder xsi:type="SAML2String" name="urn:oid:2.5.4.12" friendlyName="title" />
        <Script>
        <![CDATA[
            logger = Java.type("org.slf4j.LoggerFactory").getLogger("net.shibboleth.idp.attribute");

            if ( title.getValues().size() > 0 )
            {
              allUpper = title.getValues().get(0);

              titleCase = allUpper[0].toUpperCase() + allUpper.substring(1).toLowerCase();

              logger.debug("returning title as {}", titleCase);
              title.getValues().clear();
              title.getValues().add(titleCase);
            }
        ]]>
        </Script>
    </AttributeDefinition>

From: users <users-bounces at shibboleth.net> On Behalf Of Lalith Jayaweera
Sent: Tuesday, 29 May 2018 5:27 PM
To: Shib Users <users at shibboleth.net>
Subject: change case to Title case in IdP

Hi,
Currently we got the user name stored in Upper case in the source system (e.g. LDAP),

We want to change that into title case in the attribute resolver and pass it to SPs

What would be the easiest way to achieve this within attribute-resolver.

Thanks



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20180529/4219c9be/attachment.html>


More information about the users mailing list