Changeset 2397 for package_branches/invirt-web/cherrypy/code
- Timestamp:
- Aug 9, 2009, 6:45:27 PM (15 years ago)
- Location:
- package_branches/invirt-web/cherrypy/code
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/main.conf
r2388 r2397 4 4 engine.auto_reload = False 5 5 tools.mako.module_directory = "/tmp/invirt-web-templatecache" 6 tools.remote_user_login.on = True 6 7 7 8 engine.SIGHUP = None -
package_branches/invirt-web/cherrypy/code/main.py
r2396 r2397 691 691 return templates.error(searchList=[d]) 692 692 693 def getUser(environ):694 """Return the current user based on the SSL environment variables"""695 user = environ.get('REMOTE_USER')696 if user is None:697 return698 699 if environ.get('AUTH_TYPE') == 'Negotiate':700 # Convert the krb5 principal into a krb4 username701 if not user.endswith('@%s' % config.kerberos.realm):702 return703 else:704 return user.split('@')[0].replace('/', '.')705 else:706 return user707 708 693 def handler(username, state, path, fields): 709 694 operation, path = pathSplit(path) -
package_branches/invirt-web/cherrypy/code/view.py
r2391 r2397 6 6 import simplejson 7 7 import datetime, decimal 8 from invirt.config import structs as config 8 9 9 10 class MakoHandler(cherrypy.dispatch.LateParamPageHandler): … … 77 78 "You are not authorized to access that resource") 78 79 79 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login) 80 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150) 81 82 def remote_user_login(): 83 """Get the current user based on the SSL or GSSAPI environment variables""" 84 environ = cherrypy.request.wsgi_environ 85 user = environ.get('REMOTE_USER') 86 if user is None: 87 return 88 else: 89 cherrypy.request.login = None # clear what cherrypy put there 90 91 if environ.get('AUTH_TYPE') == 'Negotiate': 92 # Convert the krb5 principal into a krb4 username 93 if not user.endswith('@%s' % config.kerberos.realm): 94 cherrypy.request.login = False # failed to login 95 else: 96 cherrypy.request.login = user.split('@')[0].replace('/', '.') 97 else: 98 cherrypy.request.login = user 99 100 cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50) 80 101 81 102 class View(object):
Note: See TracChangeset
for help on using the changeset viewer.