V3 -- Scripted Attribute Definition

Jann Malenkoff jannmalenkoff at gmail.com
Thu Jun 8 13:19:48 EDT 2017


We are working jointly -- it's a typo sent earlier - darn.

Sorry for wasting your time.

The actual script is as below.

Copying Joel's description: The 'logger.info' is showing the correct value
calculated for fooBarEntitlement  -- however the  value calculated is not
sent to the SP --- the release steps -- all seems good.

Any ideas? We are juggling many balls in the air with the migration --
under short time -- so we may be missing something very obvious.


<resolver:AttributeDefinition id="fooBarEntitlement" xsi:type="Script"
xmlns="urn:mace:shibboleth:2.0:resolver:ad" sourceAttributeID="InComing_
Attribute">
                    <resolver:Dependency ref="InComing_Source_DataSource" />
                    <resolver:AttributeEncoder xsi:type="SAML2String"
xmlns="urn:mace:shibboleth:2.0:attribute:encoder"

name="urn:mace:dir:attribute-def:fooBarEntitlement"

                                friendlyName="fooBarEntitlement" />


                        <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.fooBarEntitlement");

                                fooBarEntitlement = new
BasicAttribute("fooBarEntitlement");


                                if (InComing_Attribute.getValues() ==
'BLAH')
                                {
                                     fooBarEntitlement.getValues().add("Blue
Sky);
                                }
                                else
                                {
                                    fooBarEntitlement.getValues().add("Cloudy
Sky);
                                }
                                 logger.info("Values of fooBarEntitlement
are: " + fooBarEntitlement.getValues());

                          ]]>
                      </Script>
          </resolver:AttributeDefinition>

On Tue, Jun 6, 2017 at 8:27 AM, Cantor, Scott <cantor.2 at osu.edu> wrote:

> On 6/6/17, 11:20 AM, "users on behalf of Joel Levin" <
> users-bounces at shibboleth.net on behalf of joel.aaron.levin at gmail.com>
> wrote:
>
> > Could anyone help?
>
> Well, principally, the definition says you're creating fooBarEntitlement,
> but then your script creates an Attribute called scriptedValueEntitlement,
> so that's just not going to work.
>
> Secondarily, this isn't how V3 (or V2, under Nashorn) scripts work. You
> need to prevent creating a "new" copy of the attribute because V3 already
> creates the output attribute (see ScriptedAttributeDefinition, Java 1.8 and
> Nashorn).
>
> My advice is that you get your scripts working under V2 and Java 8/Nashorn
> first. Once that's done, they should work largely unmodified under V3.
> You're mixing changes here. There's no way that script could have worked
> under V2 that I can see because of the name mismatch.
>
> -- 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/20170608/0a7d453c/attachment-0001.html>


More information about the users mailing list