Ignore:
Timestamp:
Dec 19, 2009, 10:00:06 PM (14 years ago)
Author:
price
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/code/view.py

    r2643 r2644  
    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.