I am using Jira ScriptRunner to implement a REST endpoint that does an LDAP look-up. I am using secure LDAP (port 636) and authenticated bind.
The following piece of code throws me a PartialResultException, which is part of the Spring framework and documented here.
try
{
// The variables base, filter, scope and
// the class MyUserAttributesMapper are defined
// elsewhere in the code and not shown here
userInfoList = LdapUtil.withTemplate ("myLDAPPoolName") { template ->
template.search(base, filter, scope, new MyUserAttributesMapper())
}
}
catch (PartialResultException pre)
{
// All our results are lost 

}
I researched this issue and found a couple of workarounds online, none of which are suitable for our environment and/or use case:
- Include the following line in ScriptRunner Environment properties (doesn't work for us because of the way our AD forest is set-up)
java.naming.referral=follow
- Use LDAP port 3269 (Global Catalog Port) instead of port 636, but this doesn't work for me because my queries don't return all the attributes I'm interested in. This is expected behavior when using port 3269.
The Spring Framework documentation suggests suppressing the partial result exception by setting the ignorePartialResultException property (org.springframework.ldap.core.LdapTemplate object) to true. However, the ScriptRunner LdapUtil wrapper doesn't seem to expose this property or provide a way to set it.
I'm hoping someone from Adaptavist will take a look at my request, and:
- Suggest a solution (or a workaround), AND/OR
- Implement the ability to ignore partial result exceptions in one of their next releases.
Many thanks,
Kamran Ansari