Ignore:
Timestamp:
Dec 20, 2009, 9:47:37 PM (15 years ago)
Author:
broder
Message:

view.py: clean up remote_user_login

Remove dead code, and make the docstring clear about what the function is
actually doing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy-rebased/code/view.py

    r2721 r2722  
    116116
    117117def 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.
    122119
    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."""
     120Get the current user based on environment variables set by SSL or
     121GSSAPI, and store it in the attribute cherrpy.request.login.
     122
     123Per the CherryPy API (http://www.cherrypy.org/wiki/RequestObject#login),
     124the attribute is set to the username on successful login, to False on
     125failed login, and is left at None if the user attempted no authentication.
     126"""
    127127    environ = cherrypy.request.wsgi_environ
    128128    user = environ.get('REMOTE_USER')
    129129    if user is None:
    130130        return
    131     else:
    132         cherrypy.request.login = None # clear what cherrypy put there
    133 
    134131    if environ.get('AUTH_TYPE') == 'Negotiate':
    135132        # Convert the krb5 principal into a krb4 username
    136133        if not user.endswith('@%s' % config.kerberos.realm):
    137             cherrypy.request.login = False # failed to login
     134            cherrypy.request.login = False # failed to log in
    138135        else:
    139136            cherrypy.request.login = user.split('@')[0].replace('/', '.')
Note: See TracChangeset for help on using the changeset viewer.