/** * Constructor for group search scenarios. <tt>userRoleAttributes</tt> may still be set as a * property. * * @param contextSource supplies the contexts used to search for user roles. * @param groupSearchBase if this is an empty string the search will be performed from the root * DN of the context factory. If null, no search will be performed. */ public BindingLdapAuthoritiesPopulator(ContextSource contextSource, String groupSearchBase) { Assert.notNull(contextSource, "contextSource must not be null"); // use a binding LdapTemplate, that doesn't make searches without // authentication ldapTemplate = new BindingLdapTemplate(contextSource); ldapTemplate.setSearchControls(searchControls); this.groupSearchBase = groupSearchBase; if (groupSearchBase == null) { logger.info("groupSearchBase is null. No group search will be performed."); } else if (groupSearchBase.length() == 0) { logger.info( "groupSearchBase is empty. Searches will be performed from the context source base"); } }
DirContext ctx = getContextSource().getContext(username, password); ContextExecutor ce = new ContextExecutor() {
template = new BindingLdapTemplate(ldapContext); } else { template = new SpringSecurityLdapTemplate(ldapContext);