Description
I encountered unexpected errors during LDAP testing with the Spring LDAP PoolingContextSource failing to borrow new DirContexts.
This turned out, after long, long, debugging to be caused by a bug in the DefaultDirContextValidator which "forgets" to set the right SearchControls scope (OBJECT_SCOPE) thereby falling back to the default ONELEVEL_SCOPE.
Looking through Spring LDAP JIRA issue, this one turned out to be reported already but still not yet fixed: http://jira.springframework.org/browse/LDAP-189
A workaround is easy to provide by setting a properly configured SearchControls object ourselves in the Spring assembly, which I will commit as example and default configuration in our security-ldap.xml Spring assembly file.