I am trying to just have simple, WWW-Authenticate HTTP authentication in Django using REMOTE_USER. This is done with RemoteUserMiddleware.
Unfortunately, after changing my config file like such:
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.RemoteUserBackend',
)
and adding @login_required decorator to my view, it is not working. When I view the page, it directs me to accounts/login/?next=/page/I/tried/to/access, which doesn't exist and raises a 404 error.
Why doesn't it just send WWW-Authenticate? If this isn't the right way to do that, how can I?