Attribute Script: Caused by: jdk.nashorn.internal.runtime.ECMAException: ReferenceError:

Reid Watson reid.watson at auckland.ac.nz
Wed Jul 27 01:53:45 EDT 2016


Hi Everyone, 

Im receiving the following error 

2016-07-27 16:38:44,295 - DEBUG [net.shibboleth.idp.attribute.resolver.ad.impl.ScriptedIdPAttributeImpl:89] - Attribute Definition 'primaryMail': scripted attribute 'primaryMail': values being prepared
2016-07-27 16:38:44,295 - DEBUG [net.shibboleth.idp.attribute.resolver.ad.impl.ScriptedIdPAttributeImpl:104] - Attribute Definition 'primaryMail': scripted attribute 'primaryMail': values are : []
2016-07-27 16:38:44,320 - ERROR [net.shibboleth.idp.profile.impl.ResolveAttributes:257] - Profile Action ResolveAttributes: Error resolving attributes
net.shibboleth.idp.attribute.resolver.ResolutionException: Attribute Definition 'primaryMail': unable to execute script
        at net.shibboleth.idp.attribute.resolver.ad.impl.ScriptedAttributeDefinition.doAttributeDefinitionResolve(ScriptedAttributeDefinition.java:169)
Caused by: javax.script.ScriptException: ReferenceError: "email" is not defined in <eval> at line number 3
        at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
Caused by: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "email" is not defined
        at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)


when  sourceAttributeID=“email” will be assigned with a NULL value it looks like the Nashorn scripting language doesn’t handle the condition correctly


java version (build 1.8.0_72-b15)
IDP: Shibboleth IdP Version 3.2.1

 <!-- Set primaryMail attribute -->
         <resolver:AttributeDefinition  xsi:type="Script" xmlns="urn:mace:shibboleth:2.0:resolver:ad"
                        sourceAttributeID="email" id="primaryMail">
                <resolver:Dependency ref=“LDAP" />
                <resolver:AttributeEncoder xsi:type="SAML1String" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
                                name="urn:mace:dir:attribute-def:mail" />
                <resolver:AttributeEncoder xsi:type="SAML2String" xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
                                name="urn:oid:0.9.2342.19200300.100.1.3" friendlyName="mail" />

                <Script>
                <![CDATA[
                primaryMail.getValues().clear();
 
                // Get list of emails from basic deffinition
                if (!email.getValues().empty) {
                    for (i = 0; i < email.getValues().size(); i++){
                        value = email.getValues().get(i);

                        if (value.endsWith("@auckland.ac.nz"))
                        {
                            //primaryMail.getValues().clear();
                            primaryMail.getValues().add(value);
                        } else
                        if (value.endsWith("@aucklanduni.ac.nz") && primaryMail.values.empty)
                        {
                            primaryMail.getValues().add(value);
                        }
                    }
                } 
                ]]>
                </Script>
        </resolver:AttributeDefinition>

Has any one else come across this issue 

Moving to Rhino engine for IDP3 is the best options ? 

Cheers

Reid 





More information about the users mailing list