Table of Contents
Introduction#
For ages, some people have desired an LDAP client sufficient to use as an address book.
Such an LDAP client must have the following features:
- Create, update and delete LDAP entries
- Edit attributes which are part of the distinguished name (DN)
- Create update and delete attributes
Starting from:
Need to continue using the DN=uid=random,uid=realuser,ou=People... trick as not sure how to describe "uniqueness" in LDAP without unique DNs.
The URIs for the contacts will be http://server:port/addressbook/contact/uid
Exiting LDAP CLients#
- Apache Directory Studio: awesome tool, but overkill for an address book
- Evolution: great but only for Linux users
- Apple Address Book.app: read only
- Thunderbird: read only
ldapservice#
The ldapservice project provides a Java EE web application with a REST API for interacting with an LDAP server.
- Public SVN repository: http://spacepirates.com/ro/ldapservice/
- Committers SVN repository: http://spacepirates.com/rw/ldapservice/
ldapclient#
The ldapclient project provides and HTML5 application which is a GUI interacting with the ldapservice.
Dealing with Updating DN#
- Edit DN: clone, change DN, remove original, insert clone with new DN
Tools#
Hints#
- Use Spring @Autowired with Jersey
- Jersey @Produces both XML and JSON
- Spring LDAP OdrManager Example
- Spring 3 Required Libraries
- Spring Security Expression Language Reference
Learning#
Netbeans 7 has some handy code generation tools (e.g. constructors, toString, hashCode, etc.).Netbeans 7 automatically detects Jersey web services and shows the RESTful Web Service node in the project tree.
Netbeans 7 detects copy and pasted class references and generates the necessary import statements.
Netbeans 7 autodeploy on change to Tomcat is working nicely, even detects changes to Spring context.xml.
Netbeans 7 automatically fills in the correct xsi:schemalocation URLs when you add an xmlns: to your Spring context.xml.
Status#
Code has been committed. Here's is an XML output from the "addressbook" service:
And here's the mocked contact output in JSON:
{"contact":[ { "displayName":"Joe Lion","faxNumber":"","firstName":"Joe", "homePhone":"510 222 5555","htmlEmail":"false","lastName":"Lion", "mobileNumber":"510 333 6666","nickname":"JoeL","pagerNumber":"", "primaryEmail":"joelion@jungle.com","secondaryEmail":"", "uid":"1","workPhone":"" }, { "displayName":"Sam Snake","faxNumber":"","firstName":"Sam", "homePhone":"510 444 5555","htmlEmail":"false","lastName":"Snake", "mobileNumber":"510 555 6666","nickname":"SamS","pagerNumber":"", "primaryEmail":"samsnake@jungle.com","secondaryEmail":"", "uid":"2","workPhone":"" } ]}
Add new attachment
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
png |
addressbook-xml.png | 111.2 kB | 1 | 06-Jun-2012 22:43 | scott | mocked up 2 contacts |