Changeset 2397 for package_branches/invirt-web/cherrypy/code/view.py
- Timestamp:
- Aug 9, 2009, 6:45:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.