Class SpringLdapTemplateWrapper
Wrap a CrowdLdapTemplate
and perform all operations with the context
ClassLoader set to this class's ClassLoader.
com.sun.naming.internal.NamingManager
uses the context
ClassLoader so, without this wrapper, calls that originate from plugins and
end up using LDAP will fail when they can't see the Spring LDAP
implementation classes.
Also logs how long the ldap query took, at DEBUG
level for all queries, or at
INFO
level if the query's duration exceeds a threshold (default 1 second),
settable by com.atlassian.crowd.ldap.log.wait.threshold
.
This class is the blessed way to interact with LDAP. CrowdLdapTemplate should not be used directly,
as this could open us up to an LDAP object injection vulnerability (see CWD-4754). This class calls very specific
methods of CrowdLdapTemplate in order to avoid manipulation of the SearchControls
. CrowdLdapTemplate can set
the returnObj
flag in the SearchControls to true before executing the search, opening us up to that very
vulnerability. Care should be taken when upgrading Spring LDAP to ensure that the search methods called still behave
the same.
As a safety net around providing SearchControls with the returningObj
flag set to false, the search methods
of this class will throw an IllegalArgumentException
if the search controls provided had the said flag set to
true.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(CrowdLdapName dn, Object obj, Attributes attributes) lookup
(CrowdLdapName dn) <T> T
lookup
(CrowdLdapName dn, ContextMapperWithRequiredAttributes<T> mapper) void
lookup
(CrowdLdapName dn, String[] attributes, org.springframework.ldap.core.AttributesMapper mapper) void
modifyAttributes
(CrowdLdapName dn, ModificationItem[] mods) void
void
search
(CrowdLdapName base, String filter, SearchControls controls, AttributeToContextCallbackHandler handler, org.springframework.ldap.core.DirContextProcessor processor) search
(CrowdLdapName base, String filter, SearchControls controls, org.springframework.ldap.core.ContextMapper mapper) search
(CrowdLdapName base, String filter, SearchControls controls, org.springframework.ldap.core.ContextMapper mapper, org.springframework.ldap.core.DirContextProcessor processor) searchWithLimitedResults
(CrowdLdapName baseDN, String filter, SearchControls searchControls, org.springframework.ldap.core.ContextMapper contextMapper, org.springframework.ldap.core.DirContextProcessor processor, int limit) void
setIgnorePartialResultException
(boolean ignore) void
unbind
(CrowdLdapName dn)
-
Constructor Details
-
SpringLdapTemplateWrapper
-
-
Method Details
-
search
public List search(CrowdLdapName base, String filter, SearchControls controls, org.springframework.ldap.core.ContextMapper mapper) -
search
public List search(CrowdLdapName base, String filter, SearchControls controls, org.springframework.ldap.core.ContextMapper mapper, org.springframework.ldap.core.DirContextProcessor processor) -
lookup
-
search
public void search(CrowdLdapName base, String filter, SearchControls controls, AttributeToContextCallbackHandler handler, org.springframework.ldap.core.DirContextProcessor processor) -
unbind
-
bind
-
rename
-
modifyAttributes
-
lookup
public void lookup(CrowdLdapName dn, String[] attributes, org.springframework.ldap.core.AttributesMapper mapper) -
lookup
-
setIgnorePartialResultException
public void setIgnorePartialResultException(boolean ignore) -
searchWithLimitedResults
public List searchWithLimitedResults(CrowdLdapName baseDN, String filter, SearchControls searchControls, org.springframework.ldap.core.ContextMapper contextMapper, org.springframework.ldap.core.DirContextProcessor processor, int limit)
-