Univention Bugzilla – Attachment 5436 Details for
Bug 24422
Single-Sign-On for UMC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
little code cleanup
sso.patch (text/plain), 4.14 KB, created by
Florian Best
on 2013-09-18 10:48 CEST
(
hide
)
Description:
little code cleanup
Filename:
MIME Type:
Creator:
Florian Best
Created:
2013-09-18 10:48 CEST
Size:
4.14 KB
patch
obsolete
>Index: univention-management-console-frontend/univention-management-console-web-server >=================================================================== >--- univention-management-console-frontend/univention-management-console-web-server (Revision 44155) >+++ univention-management-console-frontend/univention-management-console-web-server (Arbeitskopie) >@@ -34,7 +34,6 @@ > import cherrypy > import httplib > import os >-import threading > import Queue > from optparse import OptionParser > import simplejson >@@ -75,6 +74,9 @@ > except (cherrypy.HTTPError, cherrypy.HTTPRedirect): > # ignore common cherrypy exceptions > raise >+ except (KeyboardInterrupt, SystemExit): >+ # ignore >+ raise > except Exception, ex: > CORE.error('Traceback in %s(%r, %r):\n%s' % (f.__name__, args, kwargs, traceback.format_exc())) > raise >@@ -420,6 +422,18 @@ > self._log(99, 'sessionid="%s"' % (sessionid)) > return sessionid > >+ def set_session_id(self, sessionid): >+ # set the cookie once during successful authentication >+ # force expiration of cookie in 5 years from now on... >+ # IE does not support max-age >+ expiration = datetime.datetime.now() >+ expiration = expiration.replace(year=expiration.year + 5) >+ expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") >+ cherrypy.response.cookie['UMCSessionId'] = sessionid >+ cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr >+ cherrypy.response.cookie['UMCSessionId']['version'] = 1 >+ cherrypy.response.cookie['UMCSessionId']['path'] = '/' >+ > @logExceptions > def load_json(self, body): > try: >@@ -511,16 +525,7 @@ > # update IP address of sesssion ==> address changes during single sign on > UMCP_Dispatcher.sessions[login_token.sessionid].ip = self.get_ip_address() > >- # set the cookie once during successful authentication >- # force expiration of cookie in 5 years from now on... >- # IE does not support max-age >- expiration = datetime.datetime.now() >- expiration = expiration.replace(year=expiration.year + 5) >- expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") >- cherrypy.response.cookie['UMCSessionId'] = login_token.sessionid >- cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr >- cherrypy.response.cookie['UMCSessionId']['version'] = 1 >- cherrypy.response.cookie['UMCSessionId']['path'] = '/' >+ self.set_session_id(login_token.sessionid) > cherrypy.response.cookie['UMCUsername'] = login_token.username > cherrypy.response.cookie['UMCUsername']['expires'] = expirationStr > cherrypy.response.cookie['UMCUsername']['version'] = 1 >@@ -683,16 +688,7 @@ > # add new one time session > UMCP_Dispatcher.logintokens.add_session(response.body.get('sessionid'), json[ 'options' ].get('username','')) > >- # set the cookie once during successful authentication >- # force expiration of cookie in 5 years from now on... >- # IE does not support max-age >- expiration = datetime.datetime.now() >- expiration = expiration.replace(year=expiration.year + 5) >- expirationStr = expiration.strftime("%a, %d-%b-%Y %H:%M:%S GMT") >- cherrypy.response.cookie['UMCSessionId'] = response.body.get('sessionid') >- cherrypy.response.cookie['UMCSessionId']['expires'] = expirationStr >- cherrypy.response.cookie['UMCSessionId']['version'] = 1 >- cherrypy.response.cookie['UMCSessionId']['path'] = '/' >+ self.set_session_id(response.body.get('sessionid')) > > return "" > >Index: univention-management-console-module-lib/umc/python/lib/server.py >=================================================================== >--- univention-management-console-module-lib/umc/python/lib/server.py (Revision 44155) >+++ univention-management-console-module-lib/umc/python/lib/server.py (Arbeitskopie) >@@ -170,7 +170,7 @@ > opener.add_handler(urllib2.HTTPCookieProcessor(cookie_jar)) > MODULE.process('Sending request...') > try: >- response = opener.open(urllib2.Request(url, body, {'Content-Type': 'application/json'})) >+ response = opener.open(urllib2.Request(url, body, {'Content-Type': 'application/json', 'User-Agent': 'UMC 2'})) > MODULE.process('Got response ...') > except (urllib2.HTTPError, urllib2.URLError), ex: > MODULE.error('sso_getsession: unable to connect to %r: %s' % (host, ex))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 24422
:
5435
| 5436