Friday, June 22, 2007

Working with LDAP & AD

PART 1 : (Getting a connection between AD,IplanetLDAP & openLDAP)

Now this time i am planning to share my knowledge about getting a connection between LDAP/AD to your JAVA based Web Application.

Let me tell the requirements first.. You need to have ldapjdk.jar you can download from the following location .

Code snippet for getting connection

netscape.ldap.LDAPConnection ldapconnection = new netscape.ldap.LDAPConnection();

By using the above three lines you can get the connection from LDAP/AD.Where the adminDN will change from LDAP& AD. {Where DN represents Distinguished Name}

Let us see sample adminDN for the above all..

adminDN format for AD ==>"cn=administrator,cn=users,dc=balamurugans,dc=com"

adminDN format for IPlanetLDAP ==>"uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot"

adminDN format for openLDAP ==>"cn=Bala,dc=balamurugans,dc=com"

Note default port number is "389" for all LDAP.

let us see how to fetch the data from the above LDAP's in my next post.

No comments: