Update ReturnAttributes Override

Issue gh-465
This commit is contained in:
Orlando Souto
2021-02-03 19:19:02 -03:00
committed by Josh Cummings
parent 264da5a2a5
commit becfdc9eb8

View File

@@ -1830,8 +1830,10 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
}
// extend search controls with the attributes to return
String[] attributes = odm.manageClass(clazz);
searchControls.setReturningAttributes(attributes);
if (isNotCustomReturningAttributes(searchControls)) {
String[] attributes = this.odm.manageClass(clazz);
searchControls.setReturningAttributes(attributes);
}
if (LOG.isDebugEnabled()) {
LOG.debug(String.format("Searching - base=%1$s, finalFilter=%2$s, scope=%3$s", base, finalFilter, searchControls));
@@ -1877,6 +1879,10 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
return result.get(0);
}
private boolean isNotCustomReturningAttributes(SearchControls searchControls) {
return searchControls.getReturningAttributes() == null || searchControls.getReturningAttributes().length == 0;
}
/**
* The status of an authentication attempt.