String userSearchBase = ldapServerProperties.get().getUserSearchBase();
String userSearchFilter = ldapServerProperties.get().getUserSearchFilter();
FilterBasedLdapUserSearch userSearch = new FilterBasedLdapUserSearch(userSearchBase, userSearchFilter, springSecurityContextSource);
BindAuthenticator bindAuthenticator = new BindAuthenticator(springSecurityContextSource);
bindAuthenticator.setUserSearch(userSearch);
LdapAuthenticationProvider authenticationProvider = new LdapAuthenticationProvider(bindAuthenticator, authoritiesPopulator);
providerThreadLocal.set(authenticationProvider);
}