AttributeDefinition: Merge results from 2 Data Connectors

Joel Levin joel.aaron.levin at gmail.com
Wed Feb 8 18:07:00 EST 2017


Getting closer -- leveraging the Dependency as the givenName and lastName
come from 2 distinct AttributeResolvers (each has their own
AttributeDefinitions).

The following does not sent any values for displayName as an
AttribureDefinition (although script attribute has the givenName+sn value)
-- any thoughts on why?

Thanks.

 <AttributeDefinition id="displayName" xsi:type="ScriptedAttribute">
            <Dependency ref="givenName" />
            <Dependency ref="sn" />
            <Script>
             <![CDATA[
                    load("nashorn:mozilla_compat.js");

importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);
                    importPackage(Packages.org.slf4j);
                     logger =
LoggerFactory.getLogger("edu.internet2.middleware.shibboleth.resolver.Script.scriptLog");
                     displayName = new BasicAttribute("displayName");
                     if (givenName != null || sn != null)
                     {
                         if (!givenName.getValues().isEmpty() ||
!sn.getValues().isEmpty())
                         {
                             logger.info("givenName was not null or empty:
" +givenName.getValues());
                             logger.info("sn was not null or empty: "
+givenName.getValues());

displayName.getValues().add(givenName.getValues());
                             displayName.getValues().add(" ");
                             displayName.getValues().add(sn.getValues());
                             logger.info("displayName: "
+displayName.getValues());
                         }
                     }
                ]]>
            </Script>
            <AttributeEncoder xsi:type="SAML2String"
name="urn:oid:2.16.840.1.113730.3.1.241"
friendlyName="displayName"/>

       </AttributeDefinition>

On Wed, Feb 8, 2017 at 2:45 PM, Lipscomb, Gary <glipscomb at csu.edu.au> wrote:

> Hi Joel,
>
> Try this (v2 IdP)
>
>     <resolver:AttributeDefinition xsi:type="Template"
> xmlns="urn:mace:shibboleth:2.0:resolver:ad"
>             id="displayName">
>         <resolver:Dependency ref="myLDAP" />
>         <resolver:DisplayName xml:lang="en">Display
> Name</resolver:DisplayName>
>         <resolver:AttributeEncoder xsi:type="SAML1String"
> xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:mace:dir:attribute-def:displayname" />
>         <resolver:AttributeEncoder xsi:type="SAML2String"
> xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:oid:2.16.840.1.113730.3.1.241"
> friendlyName="Display Name" />
>         <Template>
>             <![CDATA[
>                 ${givenName} ${sn}
>             ]]>
>         </Template>
>             <SourceAttribute>sn</SourceAttribute>
>             <SourceAttribute>givenName</SourceAttribute>
>         </resolver:AttributeDefinition>
>
> Gary
>
> From: users [mailto:users-bounces at shibboleth.net] On Behalf Of Joel Levin
> Sent: Thursday, 9 February 2017 9:23
> To: Shib Users <users at shibboleth.net>
> Subject: Re: AttributeDefinition: Merge results from 2 Data Connectors
>
> Thanks for the tip --- the below sends both 'givenName' & 'sn' -- but not
> in format of 'givenName sn' (with space between 'givenName' & 'sn').
> I am not too sure how to parse this via Script if 2 dependencies -- are
> there any examples or tips that can point me?
>
> <AttributeDefinition id="displayName" xsi:type="Simple">
>             <Dependency ref="givenName" />
>             <Dependency ref="sn" />
>             <AttributeEncoder xsi:type="SAML2String"
> name="urn:oid:2.16.840.1.113730.3.1.241" friendlyName="displayName"/>
>
>        </AttributeDefinition>
>
> On Wed, Feb 8, 2017 at 1:21 PM, Cantor, Scott <cantor.2 at osu.edu> wrote:
> On 2/8/17, 4:15 PM, "users on behalf of Brent Putman" <
> users-bounces at shibboleth.net on behalf of putmanb at georgetown.edu> wrote:
>
> > Ah.  The template wiki docs actually illustrate 2 deps:
>
> Oh, then it probably just works. I forgot Template lets you specify each
> source ID separately inside its own config, so that probably addresses it,
> it probably checks each dependency for a match.
>
> > but perhaps the first is intended to be an AttributeDefinition rather
> than DataConnector.  If 2 data connectors is a
> > problem, I guess one could always define 2 simple 'sn' and 'givenName'
> AttributeDefinitions to feed to the template one.
>
> Yes, if it can't automatically locate the right source data the way it
> should, that would work.
>
> -- Scott
>
>
> --
> To unsubscribe from this list send an email to
> users-unsubscribe at shibboleth.net
>
> --
> 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/20170208/d99f35a5/attachment.html>


More information about the users mailing list