简体   繁体   English

具有多个数据库的JSF2登录身份验证

[英]JSF2 Login authentication with multiple databases

I'm writing web app using JSF2 and primefaces with Glassfish 3.1.2. 我正在使用JSF2和Primefaces与Glassfish 3.1.2编写Web应用程序。 I want to start with login/logout mechanism but i'm not sure about solution. 我想从登录/注销机制开始,但是我不确定解决方案。

What I want to achieve: Three main goals: 我要实现的目标:三个主要目标:

  • web application in JSF 2.1 JSF 2.1中的Web应用程序

  • this application will use many databases (but every db will have the same user, password and "security table" with application login and password). 此应用程序将使用许多数据库(但每个数据库将具有相同的用户,密码以及带有应用程序登录名和密码的“安全表”)。 So user during authentication must give database name, user and password. 因此,用户在身份验证期间必须提供数据库名称,用户名和密码。

  • I want to be able to logout and login on different user without closing browser. 我希望能够在不关闭浏览器的情况下注销和登录其他用户。

What authentication method will be the best in that case ? 在那种情况下,哪种身份验证方法是最好的? I cannot just create a new Realm with database name because it is not const in my situation. 我不能仅使用数据库名称创建新的Realm,因为在我的情况下它不是const。

I thought about web-services, which will take db_name, app_login and app_password as parameters and return whether it is ok or not.. And then create a simple managed bean, which will tell me whether user is logged. 我考虑过Web服务,它将db_name,app_login和app_password作为参数,并返回是否可以。.然后创建一个简单的托管bean,它将告诉我用户是否已登录。 But i want to totally separate login logic from other stuff.. and I want to check whether user is logged before I view every page in application. 但是我想将登录逻辑与其他内容完全分开..并且我想在查看应用程序中的每个页面之前检查用户是否已登录。

Thanks for your tips, Regards 谢谢你的提示,问候

I don't know if you already have taken a look at the Seam Security functionalities, but I think it may fit your needs considering the Identity Manager: 我不知道您是否已经看过Seam Security功能,但是考虑到Identity Manager,我认为它可能满足您的需求:

http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/security.html#d0e8804 http://docs.jboss.com/seam/2.1.1.GA/reference/zh-CN/html/security.html#d0e8804

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

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