Can I use HTTP Basic Authentication with Django?

前端 未结 7 2198
借酒劲吻你
借酒劲吻你 2020-12-02 12:36

We have a website running on Apache, access to which has a number of static pages protected via HTTP Basic authentication.

I\'ve written a new part of the site with

相关标签:
7条回答
  • 2020-12-02 13:10

    This seems to be a task for custom AuthenticationBackend - see Django documentation on this subject, djangosnippets.org has some real-life examples of such code (see 1 or 2) (and this is not really a hard thing).

    AuthenticationBackend subclasses have to have only 2 methods defined and their code is pretty straightforward: one has to return User object for user ID, the second has to perform credentials check and return User object if the credentials are valid.

    0 讨论(0)
提交回复
热议问题