I'm trying to use multiple Authentication backends in Django 1.5.
I want to use RemoteUserBackend
with a custom header
and the standard ModelBackend
Seems like I can make one or the other work, but not both. If I try to log in using ModelBackend
i get this error:
"'CustomHeaderMiddleware' object has no attribute 'authenticate'"
settings.py:
MIDDLEWARE_CLASSES = (
...
'myapp.backends.custom_auth.CustomHeaderMiddleware',
...
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'django.contrib.auth.backends.RemoteUserBackend',
'myapp.backends.custom_auth.CustomHeaderMiddleware',
)
custom_auth.py:
from django.contrib.auth.middleware import RemoteUserMiddleware
class CustomHeaderMiddleware(RemoteUserMiddleware):
header = "CUSTOM_USERID"
I'm not sure what I'm missing. It works if I set the 'CUSTOM_USERID', but I can't use the standard login.
What am I missing?