summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-03-02 18:06:44 -0500
committerSimo Sorce <simo@redhat.com>2014-03-02 18:10:39 -0500
commit768e7740d5a37b34794b5bdc823a13c55a4cc9b7 (patch)
treeb78e27d0d3e362a175538a9f5b8ec597e859ba3c
parent78198cc8a258ec9143c00b0b3c12d5c57a1f858d (diff)
downloadipsilon-768e7740d5a37b34794b5bdc823a13c55a4cc9b7.tar.gz
ipsilon-768e7740d5a37b34794b5bdc823a13c55a4cc9b7.tar.xz
ipsilon-768e7740d5a37b34794b5bdc823a13c55a4cc9b7.zip
Add way to save user data after login
The login manager that successfully authenticated the user can now pass data to be stored in the user facility of the session. Signed-off-by: Simo Sorce <simo@redhat.com>
-rwxr-xr-xipsilon/login/common.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ipsilon/login/common.py b/ipsilon/login/common.py
index 4ffdd8a..b7000b2 100755
--- a/ipsilon/login/common.py
+++ b/ipsilon/login/common.py
@@ -34,7 +34,7 @@ class LoginManagerBase(PluginObject):
base = cherrypy.config.get('base.mount', "")
raise cherrypy.HTTPRedirect('%s/login/%s' % (base, path))
- def auth_successful(self, username):
+ def auth_successful(self, username, userdata=None):
# save ref before calling UserSession login() as it
# may regenerate the session
session = UserSession()
@@ -43,6 +43,12 @@ class LoginManagerBase(PluginObject):
ref = cherrypy.config.get('base.mount', "") + '/'
session.login(username)
+
+ # Save additional data provided by the login manager
+ if userdata:
+ for key in userdata:
+ session.save_data('user', key, userdata[key])
+
raise cherrypy.HTTPRedirect(ref)
def auth_failed(self):