Releasing Forms language as attribute

Feyaerts Vincent vincent.feyaerts at uantwerpen.be
Tue Dec 13 06:05:50 EST 2016


Yes, thanks, that worked. If anyone else should want to do this, this is an example of a Scripted Attribute that references a HTTP Request header.

I probably need to add some checking to see if the actual header exists, but it's a start.

    <AttributeDefinition id="language" xsi:type="ScriptedAttribute" customObjectRef="shibboleth.HttpServletRequest">
        <AttributeEncoder xsi:type="SAML2String" name="https://idpx.uantwerpen.be/attributes/language" friendlyName="language" encodeType="false" />
        <Script>
          <![CDATA[
            language.addValue(custom.getHeader('Accept-Language'));
            logger = Java.type("org.slf4j.LoggerFactory").getLogger("net.shibboleth.idp.attribute");
            logger.info("Values of language were : {}", language.getValues());
          ]]>
        </Script>
    </AttributeDefinition>

-----Original Message-----
From: users [mailto:users-bounces at shibboleth.net] On Behalf Of Rod Widdowson
Sent: dinsdag 13 december 2016 11:21
To: 'Shib Users' <users at shibboleth.net>
Subject: RE: Releasing Forms language as attribute

> Unfortunately I have no idea where in the java tree this client http 
> request information could be found ? Is it possible? Has
anyone done this before?

If I understand you correctly you want the HttpServletRequest ?

In that case you "just" need to reference the bean called "shibboleth.HttpServletRequest".  I cannot lay my hand on the definitive documentation, but [1] alludes to it and should get you going. 


[1]
https://wiki.shibboleth.net/confluence/display/IDP30/ScriptedAttributeDefinition#ScriptedAttributeDefinition-Accessingotherinformati
on


--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net


More information about the users mailing list