From 577cc1776409cbc563a98387179bd2d9d24ac071 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sat, 20 May 2006 18:02:04 +0000 Subject: [PATCH] Removed individual search controls setter methods in favour of supplying complete search controls object. Added comment for 'compare' method. --- .../org/acegisecurity/ldap/LdapTemplate.java | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/org/acegisecurity/ldap/LdapTemplate.java b/core/src/main/java/org/acegisecurity/ldap/LdapTemplate.java index 61174298d3..46e52602f9 100644 --- a/core/src/main/java/org/acegisecurity/ldap/LdapTemplate.java +++ b/core/src/main/java/org/acegisecurity/ldap/LdapTemplate.java @@ -78,27 +78,11 @@ public class LdapTemplate { this.password = password; } - public void setSearchScope(int searchScope) { - searchControls.setSearchScope(searchScope); - } - - /** - * The time (in milliseconds) which to wait before the search fails; - * the default is zero, meaning forever. - */ - public void setSearchTimeLimit(int searchTimeLimit) { - searchControls.setTimeLimit(searchTimeLimit); - } - /** - * Sets the corresponding property on the SearchControls instance used - * in the search. + * Sets the search controls which will be used for search operations by the template. * + * @param searchControls the SearchControls instance which will be cached in the template. */ - public void setDerefLinkFlag(boolean deref) { - searchControls.setDerefLinkFlag(deref); - } - public void setSearchControls(SearchControls searchControls) { this.searchControls = searchControls; } @@ -120,7 +104,15 @@ public class LdapTemplate { } } - + /** + * Performs an LDAP compare operation of the value of an attribute for a + * particular directory entry. + * + * @param dn the entry who's attribute is to be used + * @param attributeName the attribute who's value we want to compare + * @param value the value to be checked against the directory value + * @return true if the supplied value matches that in the directory + */ public boolean compare(final String dn, final String attributeName, final Object value) { final String comparisonFilter = "(" + attributeName + "={0})"; @@ -165,6 +157,8 @@ public class LdapTemplate { public Object execute(DirContext ctx) throws NamingException { Set unionOfValues = new HashSet(); + // We're only interested in a single attribute for this method, so we make a copy of + // the search controls and override the returningAttributes property SearchControls ctls = new SearchControls(); ctls.setSearchScope(searchControls.getSearchScope());