TechHui

Hawaiʻi's Technology Community

I've heard many times about LDAP (Lightweight Directory Access Protocol), yet never had the time to experiment with this technology. Somehow I always thought it was for those 'cool' developers, who actually had the opportunity to spend extra hours researching this topic. Well, the time has also come for me to enter the 'cool' club :)
Wikipedia was a good place to start, though it only gave me general theoretical knowledge. My next step was to check with Amazon, to see if there are any outstanding books on the subject. (I like Amazon, because one can easily pin-point good reads by looking at reviews).
Safari bookshelf was my next bet. They are great when looking for information, I just don't like the 'bookshelf' feature. As a programmer, sometimes I need to scan a number of sources before finding my answers, so '10 at a time approach for a month' does not exactly work, and upgrades are pricey :( Anyway, since I run
Ubuntu, their help docs was the next logical place to start. Ubuntu supports
OpenLDAP, which is an open source LDAP implementation. I love Ubuntu mainly because of their documentation, since getting something to work on linux could be a real pain. In this case, their
OpenLDAP page is where you'll probably spend most of your time. Getting comfortable with LDAP 'mind-set' could take some time getting used to. After going through some readings, I was convinced that it actually brings something unique to the programmer's table. Once I was comfortable with my install, I needed some program that could help me manage LDAP entries. After a brief search,
Apache Directory Studio was a clear winner! Eclipse plugin install went smoothly, and, in no time, I was able to browse my newly created LDAP directory, create entries, add attributes, etc.. clearly a 'must have' for an LDAP newbie like me :) In my case, I needed a PHP script that fetches user information. Php does not come with LDAP module, so it needs to be installed separately, like this:
sudo apt-get install php5-ldap
Once that was done, I had to write a simple php script that tests my connection. Php help docs had plenty of useful code examples to get started. Note, that your php ldap_bind code will not work without this line:
ldap_set_option($ldapLink,LDAP_OPT_PROTOCOL_VERSION,3)
I probably spent a couple of hours trying to figure this out :) Finally my code worked and I saw LDAP entries printed out with my newly created php module. Cool! Now is the time to go back to books and theory, to check all these cool ways of organizing information using a directory structure. Wishing everyone a cool summer and happy coding! Source code: ldap.php.txt (image posted from OpenLDAP.org)
Ikayzo - Design • Build • Localize | Web • Desktop • Mobile

Views: 1110

Comment

You need to be a member of TechHui to add comments!

Join TechHui

Sponsors

web design, web development, localization

© 2024   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service