Access request.session from backend.get_user
authentication, django, request, session
Solution
The `RemoteUserBackend` (from `django.contrib.auth.backends`) uses special middleware, `RemoteUserMiddleware`, to access request data. Maybe you could do it this way, too.
Problem
first of all: this is not the same as this. The ModelBackend has no `request` member. I want to access the session of the current user without access to the global request object or his/her session ID. Why? I wrote my own authentication backend, extending `ModelBackend`. In that I have the function `get_user (self, user_id)`, that gets called with every request (this is done automatically by the Django auth middleware). Unfortunately, `get_user` doesn't have access to `request`, but nonetheless in my case I want to check with data in the session (Why again? Because I don't have a local database and get all data from a remote middleware. The session would be a comfortable way to do some kind of caching).