Announcement Announcement Module
No announcement yet.
LdapTemplate.authenticate and PoolingContextSource Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • LdapTemplate.authenticate and PoolingContextSource

    I have a question.

    I have successfully used this new way of authenticating using Spring LDAP ldapTemplate.authenticate(userId, password), and it works great. However, I was wondering if it would be more performant to use a PoolingContextSource, similar to pooling database connections.

    After I added the PoolingContextSource, I was happily greeted with a UnsupportedOperationException. This is because the getContext(principal, credentials) is not supported. So does this mean that it would not be beneficial to pool LDAP connections when using this new api method? If it would be beneficial from a performance standpoint, to pool the connections, could you offer some advice on how to go about doing that?

    Thanks in advance for any help you are able to contribute.

  • #2
    For the benefit of other forum readers, I'll post Mattias answer to the same question on our team blog:

    There’s actually a very simple explanation for this. In order to authenticate the user the ContextSource will perform an LDAP ‘bind’ operation, which means creating a new connection to the server using the specified user DN and password. This obviously means that these connections cannot be pooled.

    Now, this is one of the use cases that LDAP is specifically designed for; LDAP connections are very lightweight, so you should be all right anyway.


    • #3
      Thanks ulsa....

      I appreciate the quick response.