def authorized(self, environ):
        if self.django and settings.LOGIN_REQUIRED:
            try:
                from django.conf import settings as django_settings
                from django.contrib.auth import SESSION_KEY
                from django.contrib.auth.models import User
                from django.contrib.sessions.models import Session
                from django.core.exceptions import ObjectDoesNotExist
                cookie = SimpleCookie(environ["HTTP_COOKIE"])
                cookie_name = django_settings.SESSION_COOKIE_NAME
                session_key = cookie[cookie_name].value
                session = Session.objects.get(session_key=session_key)
                user_id = session.get_decoded().get(SESSION_KEY)
                user = User.objects.get(id=user_id)
            except (ImportError, KeyError, ObjectDoesNotExist):
                return False
        return True
Send request on behalf of staging user from web app to staging server and expect success (no redirection).
dataset/ETHPy150Open stephenmcd/gnotty/gnotty/server.py/IRCApplication.authorized--crossover with--dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/test/staging_redirect_test.py/StagingRedirectionFromStagingServerOptionTestCase.testRedirectStagingUserWebClientFromStagingServer