django admin 的不同身份验证后端

发布于 2024-08-18 19:55:13 字数 42 浏览 2 评论 0原文

为 Django 管理站点使用不同的身份验证后端的最佳解决方案是什么?

What would be the best solution to use a different authentication backend for the Django admin site?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柏拉图鍀咏恒 2024-08-25 19:55:14

请参阅文档,其中包含此内容引用:

Django 管理系统非常严格
耦合到 Django User 对象
在本文开头描述的
文档。目前来说,最好的办法是
处理这个问题是创建一个Django
每个存在的用户的 User 对象
对于您的后端(例如,在您的 LDAP 中)
目录,您的外部 SQL 数据库,
等)您可以编写一个脚本来
提前这样做,或者你的
验证方法可以做到这一点
用户第一次登录时。

See the documentation, which contains this quote:

The Django admin system is tightly
coupled to the Django User object
described at the beginning of this
document. For now, the best way to
deal with this is to create a Django
User object for each user that exists
for your backend (e.g., in your LDAP
directory, your external SQL database,
etc.) You can either write a script to
do this in advance, or your
authenticate method can do it the
first time a user logs in.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文