How to map Ldap groups to Tomcat Roles (Java) -
i writing web project using servlets/jsp etc.. @ moment program uses basic authentication security.. work want security roles picked our active directory.
i have modified apache's server.xml 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, not know how map ldap groups tomcat roles.
i have tried adding things group-name entries deployment descriptor no avail.
i have heard extending jndirealm class , overriding getroles method might give me want..but cant find full details on might required.
so best way map ldap groups tomcat roles?
the application still not picking roles.
my realm details currently:
<realm classname="org.apache.catalina.realm.jndirealm" debug="99" connectionurl="ldap://adclds001.mycomp.local:389" connectionname="trainee1@mycomp.local: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 security constaint in 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 have:
<login-config> <auth-method>basic</auth-method> </login-config> also
my dept telling me in following group: cn=domain users,cn=users,dc=mycompgroup,dc=local
can suggest why not able use domain users role?
you've done it. when user logs in, cn of roles in associated user automatically. there nothing left do.
Comments
Post a Comment