简体   繁体   中英

User managed security in Java EE

I want to protect my JSF pages in a Java EE 6 app.

I want to store users and roles in the DB and have privileged users administer them via a web tool. The privileged users would add users to roles and set certain pages to require certain roles for access.

It seems to me that container managed security won't let me do that. Would JAAS be the way forward?

Any suggestions and links to examples would be appreciated.

The short answer is yes. JAAS will allow you manage security against a database use a LoginModule(many container implementations JBoss offer these pre-canned out of the box) and you can check out this article( http://weblogs.java.net/blog/2006/03/07/repost-using-jaas-jsf ) or this book( http://www.java.net/external?url=http://purl.oclc.org/NET/jsfbook/ ) for more specifics how to authenticate Users and determine authorization parameters with JAAS and JSF.

For your second requirement, I can't see any reason why you can then create a separate tool that has access to those tables to modify credential information. Though this seems like a problem that has already been solved by using an LDAP provider with any one of a number of free and open source web interfaces.

Another nifty feature because of the clear separation of concerns is that you can later easily migrate to LDAP or third party services with little effort.

I recommend that you take a look at Spring Security .

Spring Security is a powerful and highly customizable authentication and access-control framework.

Here is an article that explains using Spring Security with JSF .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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