0

I'm doing a web app where I have to login as an LDAP user (which works fine until now), but the thing is that for every user, I need some roles that aren't in LDAP but in my Database. I'm working with J2EE 7, Glassfish, and MySQL.

Anyone knows how to do this?

Thanks!

Example of the table user:

|    uid   |   first name  |  last name  | role |
-------------------------------------------------
| lceledon |      Luis     |   Celedon   | admin|

So I need that lceledon have the admin role and specific authorizations to some views. And yes, the user (uid) that are in the table are known, and also their roles. Anyone who is not in the table has the role "student"

I've seen this: [Implement a Tomcat Realm with LDAP authentication and JDBC authorization

Where there is a realm for Tomcat, but the thing is that I need the realm for Glassfish. I have the sample realm, but there are so many differences that I don't know what it has to be on it.

Community
  • 1
  • 1
  • (1) have you considered XACML? Maybe overkill for your needs, maybe a good fit... (2) look into writing a servlet filter that will fetch roles from the db for you – David Brossard Nov 16 '14 at 18:13
  • Side note: Glassfish is dying... Can you change container? – David Brossard Nov 16 '14 at 18:14
  • I will look the part of writing a servlet, all this time I was trying to do and hybrid LDAP/JDBC Realm. But the servlet make sense anyway, can I do that in the LoginController?. And no, I can't change container, because we have a lot of work done in the app and change that it would be a really tough work. Thanks for answer. – Miguel Cárcamo Nov 16 '14 at 20:25

0 Answers0