Kasper Laudrup
unread,Apr 15, 2019, 1:05:20 PM4/15/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Hi fellow django users,
I have a web site where I require authentication for all views and have
successfully created custom middleware to handle that (all
unauthenticated requests redirect to the login view unless the request
is for the login view).
Now, I want to extend that a bit to support HTTP BASIC AUTH so a request
can be made for a non authorized user if the correct credentials are
provided in the AUTH header.
It would probably be possible to hack a bit with my custom middleware to
support that by reading the AUTH header (if present) decoding it and
validating against the django user database, but I just have a feeling
that django must provide support for something like this already one way
or another.
I have tried to search the documentation for HTTP BASIC AUTH without
much luck.
Any ideas on how to approach this, or is the "custom middleware hack"
the right way to go?
I'll happily share any code if that helps.
Thanks a lot.
Kind regards,
Kasper Laudrup