Announcement Announcement Module
Collapse
No announcement yet.
How to use advanced LDAP functionality (javax.naming.ldap)? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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).

    Comment


    • #3
      Thanks Mattias for this quick and detailed answer. I will definitely take a look at the control part at your svn repository.

      Stefan

      Comment


      • #4
        TLS connections

        Hi,

        I was wondering when you would be adding TLS connections?

        Comment


        • #5
          Originally posted by RBS View Post
          Hi,

          I was wondering when you would be adding TLS connections?
          Well, as I noted before it probably won't be included in the coming release. Possibly the one after that.

          Comment

          Working...
          X