/usr/lib/python2.7/dist-packages/hijack/middleware.py is in python-django-hijack 2.0.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | class HijackRemoteUserMiddleware(object):
"""
Middleware for hijack RemoteUser. One must place this middleware between
'django.contrib.auth.middleware.AuthenticationMiddleware' and
'django.contrib.auth.middleware.RemoteUserMiddleware' in MIDDLEWARE_CLASSES
Just makes remote user same as hijacked
"""
header = "REMOTE_USER"
def process_request(self, request):
is_hijacked = request.session.get('is_hijacked_user', False)
remote_username = request.META.get(self.header, None)
if not is_hijacked or not remote_username:
return
# Ok, we hijacked and remote. Just assign hijacked user to remote
if request.user.is_authenticated():
username = request.user.get_username()
if username != remote_username:
request.META[self.header] = username
def authenticate(self, *args, **kwargs):
return None
|