I am writing a web project using Servlets/JSP etc.. At the moment the program uses basic authentication for security.. but my work want the security roles picked up from our active directory.
I have modified apache's server.xml with the following:
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldap://adclds001.mycompgroup.local:389"
connectionName="************.local:389"
connectionPassword="********"
userPattern="CN={0},OU=Trainers, OU=Academy, OU=Staff, OU=Users, OU=UK, OU=Countries, DC=mycompgroup, DC=local"
roleBase="OU=Trainers, OU=Academy, OU=Staff, OU=Users, OU=UK, OU=Countries, DC=mycompgroup, DC=local"
roleName="cn"
roleSearch="member={0}"
/>
The authentication works fine, but I do not know how to map ldap groups to Tomcat roles.
I have tried adding things like group-name to the entries to the deployment descriptor but to no avail.
I have also heard that extending the JNDIRealm class and overriding the getRoles method might give me what I want..But I cant find full details on what might be required.
So what is the best way to map ldap groups to tomcat roles?
The application is still not picking up the roles.
My realm details are currently:
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldap://adclds001.mycomp.local:389"
connectionName="[email protected]:389"
connectionPassword="****"
userPattern="CN={0},OU=Trainers, OU=Academy, OU=Staff, OU=Users, OU=UK, OU=Countries, DC=mycompgroup, DC=local"
userRoleName="Domain Users"
roleBase="OU=Trainers, OU=Academy, OU=Staff, OU=Users, OU=UK, OU=Countries, DC=mycompgroup, DC=local"
roleName="cn"
roleSearch="member={0}"
/>
I have a security constaint in my deployment descriptor:
<security-constraint>
<web-resource-collection>
<web-resource-name>Wildcard means whole app requires authentication</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Domain Users</role-name>
<role-name>admin_user</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
security roles in web.xml:
<security-role>
<role-name>basic_user</role-name>
</security-role>
<security-role>
<role-name>admin_user</role-name>
</security-role>
<security-role>
<role-name>Domain Users</role-name>
</security-role>
I also have:
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
Also
My IT dept are telling me that everybody is in the following group: CN=Domain Users,CN=Users,DC=mycompgroup,DC=local
Can anybody suggest why I am not able to use the Domain Users role?