Changeset 2670
- Timestamp:
- Dec 20, 2009, 9:44:19 PM (15 years ago)
- Location:
- package_branches/invirt-web/cherrypy-rebased/code
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy-rebased/code/main.conf
r2662 r2670 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-rebased/code/main.py
r2669 r2670 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-rebased/code/view.py
r2669 r2670 79 79 "You are not authorized to access that resource") 80 80 81 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login) 81 cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150) 82 83 def remote_user_login(): 84 """Get the current user based on the SSL or GSSAPI environment variables""" 85 environ = cherrypy.request.wsgi_environ 86 user = environ.get('REMOTE_USER') 87 if user is None: 88 return 89 else: 90 cherrypy.request.login = None # clear what cherrypy put there 91 92 if environ.get('AUTH_TYPE') == 'Negotiate': 93 # Convert the krb5 principal into a krb4 username 94 if not user.endswith('@%s' % config.kerberos.realm): 95 cherrypy.request.login = False # failed to login 96 else: 97 cherrypy.request.login = user.split('@')[0].replace('/', '.') 98 else: 99 cherrypy.request.login = user 100 101 cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50) 82 102 83 103 def invirtwebstate_init():
Note: See TracChangeset
for help on using the changeset viewer.