Changeset 2531 for package_branches
- Timestamp:
- Oct 29, 2009, 2:12:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy/code/view.py
r2522 r2531 101 101 def require_login(): 102 102 """If the user isn't logged in, raise 403 with an error.""" 103 if not cherrypy.request.login:103 if cherrypy.request.login is False: 104 104 raise cherrypy.HTTPError(403, 105 105 "You are not authorized to access that resource") … … 116 116 117 117 def remote_user_login(): 118 """Get the current user based on the SSL or GSSAPI environment variables""" 118 """Get the current user based on the SSL or GSSAPI environment 119 variables and store it in the request object's login variable. This 120 conforms to the CherryPy API: 121 http://www.cherrypy.org/wiki/RequestObject#login 122 123 If the user is logged in successfully, cherrypy.request.login is set 124 to the username. If the user failed to log in, cherrypy.request.login 125 is set to False. If the user did not attempt authentication, 126 cherrypy.request.login is set to None.""" 119 127 environ = cherrypy.request.wsgi_environ 120 128 user = environ.get('REMOTE_USER') 121 129 if user is None: 122 cherrypy.request.login = None123 130 return 131 else: 132 cherrypy.request.login = None # clear what cherrypy put there 124 133 125 134 if environ.get('AUTH_TYPE') == 'Negotiate': 126 135 # Convert the krb5 principal into a krb4 username 127 136 if not user.endswith('@%s' % config.kerberos.realm): 128 cherrypy.request.login = None137 cherrypy.request.login = False # failed to login 129 138 else: 130 139 cherrypy.request.login = user.split('@')[0].replace('/', '.')
Note: See TracChangeset
for help on using the changeset viewer.