File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes ldap authentication. JNDIRealm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "ldap authentication. JNDIRealm" Watch "ldap authentication. JNDIRealm" New topic

ldap authentication. JNDIRealm

Avinash venna

Joined: Jun 10, 2010
Posts: 17

Can some one tell me how to achieve server based authentication. I have installed openldap in my windows system. I am unable to add users to it. and there is nothing like role attribute in it..

Then what is <role-name> in web.xml file. please give me a detailed explanation about this.
please give me exact mapping to server.xml in tomcat to web.xml.

one more thing is do we need ldap.jar file to be placed in catalina/server/lib?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Last question first: The LDAP/JNDI client is part of the system, so you don't have to request it specifically.

LDAP is a general-purpose directory system and in the case of LDAP, "directory" is more like "telephone directory" than "filesystem directory", despite its hierarchical capabilities.

The LDAP JNDI Realm for Tomcat works by doing LDAP searches. There's not predefined "user" or "role" type, just entries that match the searches. If you were using Active Directory, you'd probably want to use entries that are defined for Windows Authentication, and the same applies to Solaris, but in a generic LDAP environment, you can use whatever you like.

Here's a sample user definition:

This user is only accessing via the Internet, so there's no Unix account attributes on that person's directory entry.

Here's a role definition:

People whose member UID's are in this group are authorized to log into the Legacy Trac system. It's not a Java webapp, so it only has one grouping. For J2EE apps, there would be groups for each role, so I'd set up group dn's such as cn=tracusers_submitter,ou=legacy,ou=groups,dc=mousetech,dc=com, as well as cn=tracusers_dispatcher,ou=legacy,ou=groups,dc=mousetech,dc=com and so forth.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: ldap authentication. JNDIRealm
It's not a secret anymore!