How to use LDAP for authentication in Tomcat with Custom Authorization

Posted by djc4 on Stack Overflow See other posts from Stack Overflow or by djc4
Published on 2010-06-10T15:30:47Z Indexed on 2010/06/10 15:32 UTC
Read the original article Hit count: 190

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about ldap