new DefaultInitialDirContextFactory("ldap://localhost:10389/ou=system");
initialDirContextFactory.newInitialDirContext("uid=admin,ou=system", "secret");
String searchBase = "";
String searchFilter = "(uid={0})";
FilterBasedLdapUserSearch userSearch =
new FilterBasedLdapUserSearch(searchBase,
searchFilter,
initialDirContextFactory);
userSearch.setSearchSubtree(true);
BindAuthenticator authenticator = new BindAuthenticator(initialDirContextFactory);
authenticator.setUserSearch(userSearch);
authenticator.setUserDnPatterns(new String [] { "uid={0},ou=users"} );