All you have to do if You want to make Tomcat Authenticat with LDAP for Your WebApplication is.
Follow the following three steps:
1. Copy the ldap.jar:
copy the ldap jar into /usr/java/tomcat5/common/lib or /usr/java/tomcat5/server/lib The difference between those two paths is that The First one make the jar accessable to both the webApplication and the server. The Second one make the jar accessable to the server only.
Note: the above paths are relative to my tomcat path.
2. Create Realm:
Add the following Realm to Your context.xml which are located under WebApplication/Web Pages/META-INF/context.xml
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldap://opencraft.local"
userPattern="uid={0},ou=People,dc=opencraft,dc=local"
roleBase="ou=RolesCRX,dc=opencraft,dc=local"
roleName="cn"
roleSearch="(member={0})"
/>
3. Create Security Constarint and Login Config:
Add the following to Your web.xml which are located under WebApplication/Web Pages/WEB-INF/web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Administration Area</web-resource-name>
<url-pattern>*.jsf</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>OpenCraftUser</role-name>
</auth-constraint>
</security-constraint>
<!-- here I tell it to use BASIC HTTP authentication --> <login-config> <auth-method>BASIC</auth-method> </login-config>
<!-- and here we are just telling the system that there
is an administrator role. You can have 1..n
“security-role�s here.-->
<security-role>
<role-name>OpenCraftUser</role-name>
</security-role>
where OpenCraftUser is the role that your application users must have.
For additional Information visit this link http://tomcat.apache.org/tomcat-5.0-doc/realm-howto.html#Quick%20Start

subject
Hello, this absurde! Hello, this absurde!
Hello
Excellent!!! !
Greetings
Great post !! !
Thank you both I hope it helps
Thank you both I hope it helps
Ali Abdel-Aziz.
Greetings
Great post !! !