

def _remove_invalid_user(self, request):
    '\n        Removes the current authenticated user in the request which is invalid\n        but only if the user is authenticated via the RemoteUserBackend.\n        '
    try:
        stored_backend = load_backend(request.session.get(auth.BACKEND_SESSION_KEY, ''))
    except ImportError:
        auth.logout(request)
    else:
        if isinstance(stored_backend, RemoteUserBackend):
            auth.logout(request)

dataset/ETHPy150Open django/django/django/contrib/auth/middleware.py RemoteUserMiddleware._remove_invalid_user/original