LdapAuthenticationProvider ldapAuthenticationProvider =
new LdapAuthenticationProvider(authenticator, authoritiesPopulator);
LdapUserInfo user = authenticator.authenticate(userDetails.getUsername(),
(String)authentication.getCredentials());
if (user != null) {
UserDetails u = ldapAuthenticationProvider.retrieveUser(userDetails.getUsername(),
authentication);
System.out.println("user " + u);
}
else {
throw new BadCredentialsException(messages.getMessage(