Lightweight Directory Access Protocol aka LDAP is a protocol used for maintaining data over distributed ENV. Most of the organization will use LDAP for holding there user information and more often then not in almost all our application we will authenticate user against LDAP. In this post we will configure Apache Directory which is built completely in Java and is an open source project of Apache.
First download and install Apache DS
Second install Apache DS plugin from Eclipse Marketplace or using Install New Software option in Eclipse.
Third change your Eclipse Perspective to LDAP
Fourth Right Click under Servers view and New -> New Server and give some name for your server.
Fifth Right click on your server and select LDAP Browser -> Create a connection. You should get a message saying “Connection Created”.
Sixth Double click on your server, this should open server.xml which is the configuration file, change port number of LDAP and LDAPS (since 10389 and 10636 is default port and is used by default server which is part of Apache DS installation).
Seventh Right click on your server and select Run, similarly Right Click on your connection and select Open Connection. Once your connection is open you can expand DIT under LDAP Browser to see the default values.
Eigth Now we will create an organization struture inside our LDAP Server, for that again Double Click on your server this will open up server.xml, in the tabbed pane choose Partitions. Click on Add and provide ID = mycompany, Cache Size = 100 and suffix = o=mycompany
and save.You may have to restart your server and refresh your connection to see updated values.
Ninth Double click on Root DSE this will open up Root DSE editor which will display new Partition that we created.
Tenth Right Click on Root DSE and Select New -> New Context Entry -> Create entry from scratch.
Eleventh choose Organization from Available classes and click on Add.
Twelfth Select o=mycompany as Distinguished Name.
Thirteenth Click on Finish
Fourteenth we will create user and groups under our partition mycompany. To create user right click on mycompany and choose New -> New Entry -> Create entry from scrath.
Fifteenth Select organizationUnit from available classes and click on Add, click on next and then fill in RDN as ou = Groups
Click on Finish and repeat the steps to create organizationUnit for Users
Sixteenth Select Users and then right click select New -> New Entry -> Create Entry from scratch and select inetOrgPerson from available classes and click on Add.
Seventeenth Fill in RDN as uid = testNormalUser and click on Next.
Eighteenth Fill in values for Common Name (cn) and Last Name (sn)
Nineteenth Right click on the editor and choose New Attribute, in the subsequent page type in userPassword and click on Finish
Twentieth Choose Plain Text as Hash Method and type in user password and click on Ok and then click on Finish in user creation page.
Twenty First Right click on Groups and select New -> New Entry -> Create entry from scratch and select groupOfNames, click on Next and then fill in RDN as ou=testNormalGroup.
Twenty Second In DN Editor browse to testNormalUser which we created. Click on OK and then fill in Common Name (cn) for Group and then click finish.
In similar way we can create multiple users and groups. We didn’t use Apache Directory Studio since it is not available for 64 bit machine.
Hi, I really liked your post. Each step is clearly
explained with the correct sceenshots. A picture is indeed worth
over a thousand words. I am working on integrating Apache DS with
another application. Since I was about to write a detailed setup
process, I happened to stumble upon this blog post of yours. Would
it be OK if I could link to your post from mine to cover the LDAP
setup part? /Ashish
Yes sure please feel free
Hi Prabhat,
I’m wondering if you could help me, your way of explaining the process is really amazing. I want to use ApacheDS as an LDAP for Congos, but i want the ApacheDS to pick up the model objects from an exiting Java Application. Is it possible to do that.
I have a fully functional Hibernate Java application with all the required Domains and Business Logic for reporting. Would like the Cognos to communicate with this application through ApacheDS.
Any input would be really appreciated.
Thanks in advance.