This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

How to use advanced LDAP functionality (javax.naming.ldap)?Page Title Module

How to use advanced LDAP functionality (javax.naming.ldap)?

Sep 24th, 2006, 09:55 AM

Maybe, I am wrong, but it looks to me that Spring LDAP hides advanced LDAP functionality like controls and extended operations.

I thought a good point to start for (I confess extraordinary) operations is ContextExecutor, but the method signature of executeWithContext has DirContext as a parameter, not LdapContext (from javax.naming.ldap).

With this, no cast is necessary (will it always work?), and the advanced LDAP features are available. Due to fact, that Spring LDAP is meant to integrate LDAP directories only, the choice of LdapContext seems appropriate to me.

Or is there another way, Spring LDAP provides to access functionality like controls etc.?

First of all, the use of DirContext rather than LdapContext in the interfaces is because DirContext is needed when working against LDAPv2 servers. It's a bummer, but I'm afraid you'll need to live with the casting...

When it comes to request controls this is actually something we're currently working on for the next release. It's in place in subversion if you'd like to have a look at it (DirContextProcessor and package org.springframework.support.control).

Extended operations could be performed using a ContextExecutor as you demonstrate. However, you'll need to take care of the lot here; e.g. if you want to perform a search on the tls connection in your example you'll need to do all the NamingEnumeration stuff yourself and that way you won't have won all that much. However, TLS connections is another subject we've considered to include in the future (probably not the next release though).