Changeset 2722 for package_branches/invirt-web
- Timestamp:
- Dec 20, 2009, 9:47:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy-rebased/code/view.py
r2721 r2722 116 116 117 117 def remote_user_login(): 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 118 """Get remote user from SSL or GSSAPI, and store in request object. 122 119 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.""" 120 Get the current user based on environment variables set by SSL or 121 GSSAPI, and store it in the attribute cherrpy.request.login. 122 123 Per the CherryPy API (http://www.cherrypy.org/wiki/RequestObject#login), 124 the attribute is set to the username on successful login, to False on 125 failed login, and is left at None if the user attempted no authentication. 126 """ 127 127 environ = cherrypy.request.wsgi_environ 128 128 user = environ.get('REMOTE_USER') 129 129 if user is None: 130 130 return 131 else:132 cherrypy.request.login = None # clear what cherrypy put there133 134 131 if environ.get('AUTH_TYPE') == 'Negotiate': 135 132 # Convert the krb5 principal into a krb4 username 136 133 if not user.endswith('@%s' % config.kerberos.realm): 137 cherrypy.request.login = False # failed to log in134 cherrypy.request.login = False # failed to log in 138 135 else: 139 136 cherrypy.request.login = user.split('@')[0].replace('/', '.')
Note: See TracChangeset
for help on using the changeset viewer.