문제

My problem is the integration of a security system in my java ee 7 web application with glass fish 4. I have seen several examples of authentication declarative but also programmatic but none of them covered my problem. In my application i have 2 groups which need authentication.

  • ADMIN = All access rights
  • EMPLOYEE = Only a subset of the admin rights.

The problem is that the users of these groups are always changing so i want to store all the users in a DB table. Also i want to use @RolesAllowed annotation and programmatic security like ctx.isCallerInRole("ADMIN") because of simplicity.

Summary: I want to store all users in a database table and i want to use @RolesAllowed annotation and programmatic security like ctx.isCallerInRole("ADMIN"). Is this possible to accomplish?

도움이 되었습니까?

해결책

Yes, this is possible. E.g. look for the "JDBC Realm".

Here is an older tutorial. It might still work with GlassFish 4, though:

https://blogs.oracle.com/swchan/entry/jdbcrealm_in_glassfish

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top