How to use advanced LDAP functionality (javax.naming.ldap)?
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).
Nevertheless the following worked:
Code:
...
ContextExecutor ce = new ContextExecutor() {
public Object executeWithContext(DirContext ctx) throws NamingException {
LdapContext ldapCtx = (LdapContext) ctx;
ExtendedRequest req = new StartTlsRequest();
ldapCtx.extendedOperation(req);
return null;
}
};
template.executeReadOnly(ce);
...
But it would be nice, if the method signature would look like this
Code:
public Object executeWithContext(LdapContext ctx) throws NamingException
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.?
Thanks in advance,
Stefan