2015-05-04 31 views
0

我有一个基于用户登录的spring MVC web应用程序。我有另一个用django写的应用程序。现在,当用户点击django中的Dashboard链接时,我希望用户直接看到他的Spring Web应用程序主页(因为他已经登录到django应用程序中,所以不需要用户名和密码)。从外部应用程序登录到春季webapp

可以这样做吗?

回答

1

你把自己扔进了死坑。

Django对您的Spring MVC应用程序一无所知。

为了使这成为可能,您需要在这两个框架之间有某种共享会话存储,否则您无法确认用户是实际从仪表板访问其帐户的用户。尽管share states 被认为是一个坏主意,但一个简单的解决方案是使用redis-session backend 将会话保存在redis中。

然后在Spring MVC的需要:

1. To grab the Django session ID from the user’s cookie. 
2. If the session ID is found in Redis, you return the session matching that ID and display the users home page 
3. If not, you redirect them to a login page. 

我建议仔细研究这个情况,但因为这引入了额外的攻击向量。