Index: /package_branches/invirt-web/cherrypy-rebased/code/main.conf
===================================================================
--- /package_branches/invirt-web/cherrypy-rebased/code/main.conf	(revision 2669)
+++ /package_branches/invirt-web/cherrypy-rebased/code/main.conf	(revision 2670)
@@ -4,4 +4,5 @@
 engine.auto_reload = False
 tools.mako.module_directory = "/tmp/invirt-web-templatecache"
+tools.remote_user_login.on = True
 
 engine.SIGHUP = None
Index: /package_branches/invirt-web/cherrypy-rebased/code/main.py
===================================================================
--- /package_branches/invirt-web/cherrypy-rebased/code/main.py	(revision 2669)
+++ /package_branches/invirt-web/cherrypy-rebased/code/main.py	(revision 2670)
@@ -691,19 +691,4 @@
     return templates.error(searchList=[d])
 
-def getUser(environ):
-    """Return the current user based on the SSL environment variables"""
-    user = environ.get('REMOTE_USER')
-    if user is None:
-        return
-    
-    if environ.get('AUTH_TYPE') == 'Negotiate':
-        # Convert the krb5 principal into a krb4 username
-        if not user.endswith('@%s' % config.kerberos.realm):
-            return
-        else:
-            return user.split('@')[0].replace('/', '.')
-    else:
-        return user
-
 def handler(username, state, path, fields):
     operation, path = pathSplit(path)
Index: /package_branches/invirt-web/cherrypy-rebased/code/view.py
===================================================================
--- /package_branches/invirt-web/cherrypy-rebased/code/view.py	(revision 2669)
+++ /package_branches/invirt-web/cherrypy-rebased/code/view.py	(revision 2670)
@@ -79,5 +79,25 @@
             "You are not authorized to access that resource")
 
-cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login)
+cherrypy.tools.require_login = cherrypy.Tool('on_start_resource', require_login, priority=150)
+
+def remote_user_login():
+    """Get the current user based on the SSL or GSSAPI environment variables"""
+    environ = cherrypy.request.wsgi_environ
+    user = environ.get('REMOTE_USER')
+    if user is None:
+        return
+    else:
+        cherrypy.request.login = None # clear what cherrypy put there
+
+    if environ.get('AUTH_TYPE') == 'Negotiate':
+        # Convert the krb5 principal into a krb4 username
+        if not user.endswith('@%s' % config.kerberos.realm):
+            cherrypy.request.login = False # failed to login
+        else:
+            cherrypy.request.login = user.split('@')[0].replace('/', '.')
+    else:
+        cherrypy.request.login = user
+
+cherrypy.tools.remote_user_login = cherrypy.Tool('on_start_resource', remote_user_login, priority=50)
 
 def invirtwebstate_init():
