How to use LDAP for authentication in Tomcat with Custom Authorization
- by djc4
Hello,
I'm using JNDIRealm with Tomcat for authentication, which at the moment works fine. However, we do not store any roles in the LDAP, so all authenticated users are not returning any roles. This sends user's to an HTTP 401 failed authorization page.
I'd like to assign an "Admin" role to any and all user's who authenticate successfully. Here is my fragment from my web.xml file.
SecurityConstraint
Resource
Resource
*.jsp
GET
POST
Admin
FORM
login.jsp
loginError.jsp
Admin
Should I be using a JAASRealm with custom LoginModule? After the realm calls the authenticate() method and returns success, should I override another method to explicitly set the RolePrincipal to "Admin" so that authorization succeeds?
Please help!
Thanks,
Andy