summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérôme Schneider <jschneider@entrouvert.com>2014-12-05 12:39:58 (GMT)
committerJérôme Schneider <jschneider@entrouvert.com>2014-12-09 17:22:27 (GMT)
commit69917267cb7203f8108292a132cd1c48b3fc6d6c (patch)
treee9451c7f9e9f6df1a812f75e0722e9a4f3663114
parent69d1dc3eadb119675e128cc384ee206071f318b0 (diff)
downloadmandaye-69917267cb7203f8108292a132cd1c48b3fc6d6c.zip
mandaye-69917267cb7203f8108292a132cd1c48b3fc6d6c.tar.gz
mandaye-69917267cb7203f8108292a132cd1c48b3fc6d6c.tar.bz2
saml2: improve attributes management
-rw-r--r--mandaye/auth/saml2.py8
1 files changed, 7 insertions, 1 deletions
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()