Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Tomcat and the fly likes JNDIRealm in Tomcat 6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JNDIRealm in Tomcat 6.0" Watch "JNDIRealm in Tomcat 6.0" New topic
Author

JNDIRealm in Tomcat 6.0

Vijay Krishnan Chennai
Greenhorn

Joined: May 05, 2008
Posts: 1
Hi

I got this working in Tomcat 5.5

Server.xml
==========
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldap://XX.XXX.XXX.XXX:389"
userBase="ou=myCompanyusers,dc=cts,dc=com"
userPattern="{0}@mycompany.com"
/>

web.xml
=======
<security-constraint>
<web-resource-collection>
<web-resource-name>Portal</web-resource-name>
<description>...</description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>mycompany</realm-name>
</login-config>

I tried the same thing in Tomcat 6.0 but the authentication popup keeps coming and finally authentication fails. If i switch back to 5.5, it works perfectly. What could be the problem?

Thanks,
Vijay Krishnan
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14104
    
  16

Welcome to JavaRanch.

I have no experience with this myself, but it's possible that Tomcat 6.0 needs a different way of configuring it than Tomcat 5.5.

Have a look at this in the documentation of Tomcay 6.0 and check if your configuration is correct: Apache Tomcat 6.0 - JNDIRealm


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDIRealm in Tomcat 6.0