Google
 

LDAP and JNDI Tutorial

in

This tutorial is meant for users who wish to use Sun's JNDI in their applications connecting to OpenLDAP servers. I will discuss how to install and configure an OpenLDAP server and then go into details of connecting to and accessing the LDAP server using JNDI API.

The JNDI API is a powerful yet fairly simple API that can be used to access a wide variety of data sources. It is certainly not limited to LDAP or directories for that matter: using different SPIs (Service Provider Interfaces), JNDI can access other resources such as the file system or even DNS. We will focus here on using the LDAP SPI which comes bundled with JDK v1.3 and higher. Because LDAP is a standardized protocol (currently in version 3), the method for connecting to an OpenLDAP server applies equally well to connecting to any other LDAP server you might come across. The JNDI provides a high level interface for accessing a host of such services, taking care of all protocol-specific tasks (via the various SPIs).

JNDI can be used as a general purpose service for accessing and retrieving a mixed set of data. Using LDAP as a backend, JNDI allows us to store Java Objects directly into the directory and provides the user with APIs to make modifications to the tree. The power comes in storing objects inside the tree itself. For example, a company might develop a Java application that retrieves a “settings” object from an LDAP server upon startup. This object might be available under each user's entry in the directory on an LDAP server. In this way, the application can customize itself for each user, regardless of the machine on which the application is being used. This is, of course, just one possible use for the JNDI with an LDAP backend.

To Download this E-Book Click Here.

Reply

The content of this field is kept private and will not be shown publicly.