简体   繁体   English

是否可以针对来自两个不同Django部署的单一来源进行身份验证?

[英]Is it possible to authenticate against a single source from two distinct Django deployments?

I'm hoping there's a straightforward answer to this question. 我希望这个问题有一个简单的答案。

First, some history: I deployed a Django project and it uses all of the authentication mechanisms provided in Django. 首先,有一些历史记录:我部署了一个Django项目,它使用了Django提供的所有身份验证机制。 Namely, users are stored in auth_users and my login app validates against the records found in that table. 即,用户存储在auth_users中,我的登录应用程序根据该表中找到的记录进行验证。

Now, I have a second, distinct Django project that needs to authenticate against the database from the original application. 现在,我还有另一个独特的Django项目,该项目需要针对原始应用程序中的数据库进行身份验证。 I'm not entirely sure how can I approach the problem, so I'm hoping someone in the stackoverflow community can help. 我不完全确定如何解决该问题,因此我希望stackoverflow社区中的某人可以提供帮助。

One thought was to add "myfirstproject.login" to the INSTALLED_APPS of the second project, but I'm uncertain if that's a viable option (CSRF issues?). 一个想法是将“ myfirstproject.login”添加到第二个项目的INSTALLED_APPS中,但是我不确定这是否可行(CSRF问题?)。 Again, any insight is appreciated. 同样,任何见解都值得赞赏。

Try the sites module? 尝试使用网站模块吗? http://docs.djangoproject.com/en/1.3/ref/contrib/sites/ http://docs.djangoproject.com/en/1.3/ref/contrib/sites/

Create an auth backend? 创建身份验证后端? http://docs.djangoproject.com/en/1.3/topics/auth/#specifying-authentication-backends http://docs.djangoproject.com/zh-CN/1.3/topics/auth/#specifying-authentication-backends

Inherit from contrib.auth to create your own auth module? 从contrib.auth继承来创建自己的auth模块?

CSRF would only be an issue if you were trying to authenticate by telling the client browser to ask the first site for auth; 仅当您通过告诉客户端浏览器向第一个站点进行身份验证来尝试进行身份验证时,CSRF才是问题。 which is unlikely to be the best path to take. 这不太可能是最好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM