ResolverScriptAttributeDefinition problem with clojure

Francesco Malvezzi francesco.malvezzi at
Mon Nov 21 15:31:57 GMT 2011

I've a problem using clojure as a jsr223 scripting language.

clojure places all variables in a namespace, for instance 'user' (which
is the default namespace). A variable named 'cljattr' in a jsr223 script
is read by java as 'user/cljattr'.

The matter is that, while ScriptedAttributeDefinition actually receives
'user/cljattr', some step later ShibbolethAttributeResolver tries
cleanResolvedAttributes on 'cljattr' (the part before the slash has been
stripped). cljattr of course does not exist and I have a
Exception in thread "main" java.lang.NullPointerException

wiki at
already covers what is (in my opinion) the same problem, in a symmetric way:
	Attribute IDs may contain illegal characters
Some scripting languages place certain restrictions on variable names
(e.g. may not contain a "-"). Ensure that any attribute you wish to use
does not contain such an illegal character in its ID. If it does use a
Simple Attribute Definition to create a new attribute, with a different
ID, whose source attribute is the attribute with the problematic ID.

What am I doing wrong? Is there a work-around?

Thank you,


PS: follows the source of the test script:
<resolver:AttributeDefinition id="user/cljattr" xsi:type="Script"
language="Clojure" xmlns="urn:mace:shibboleth:2.0:resolver:ad">
        <resolver:Dependency ref="ldap1" />
        <resolver:AttributeEncoder xsi:type="SAML1String"
            name="urn:mace:dir:attribute-def:cljattr" />
        <resolver:AttributeEncoder xsi:type="SAML2String"
friendlyName="cljattr" />
(ns user)
(import org.slf4j.LoggerFactory)
(import edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute)
(def logger (. org.slf4j.LoggerFactory getLogger
(def cljattr (BasicAttribute. "cljattr"))
(.add (.getValues cljattr) "CLOJURE")
(.info logger (str "cljattr class: " (.getClass cljattr)))
(.info logger (str "cljattr: " (.getValues cljattr)))

More information about the users mailing list