How can I make tomcat/jndi use the authenticating user to bind to ldap for the group search?
The problem:
I would like the Role Search to be done by the user who is currently authenticating, but even in Bind mode, wireshark shows that an anonymous bind is done after the initial user auth.
Workarounds that work, but are not what I want:
(I have no control over the ldap server)
From my (non-working) server.xml
<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://localhost:389"
userPattern="cn={0},ou=people,o=myO,dc=myDc,dc=com"
roleBase="ou=groups,o=myO,dc=myDc,dc=com"
roleName="cn"
roleSearch="member={0}" />
If you don't have any control over the LDAP server and Tomcat's JNDIRealm really behaves that way, you don't seem to have any choice but to use a connection name/password. It's easy enough to check the JNDIRealm source code: it's not a large file.