From 69917267cb7203f8108292a132cd1c48b3fc6d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Fri, 5 Dec 2014 13:39:58 +0100 Subject: [PATCH] saml2: improve attributes management --- mandaye/auth/saml2.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mandaye/auth/saml2.py b/mandaye/auth/saml2.py index 1a1a435..2f0880c 100644 --- a/mandaye/auth/saml2.py +++ b/mandaye/auth/saml2.py @@ -270,7 +270,13 @@ class SAML2Auth(AuthForm): env['beaker.session']['validated'] = True attributes = saml2utils.get_attributes_from_assertion(login.assertion, logger) - env['beaker.session']['attributes'] = attributes + clean_attributes = dict() + for k, v in attributes.iteritems(): + if len(k) > 1: + clean_attributes[k[0]] = v + else: + clean_attributes[k] = v + env['beaker.session']['attributes'] = clean_attributes env['beaker.session']['unique_id'] = login.nameIdentifier.content env['beaker.session']['liberty_session'] = login.session.dump() env['beaker.session'].save()