@Override
  public Principal authenticate(final Properties credentials, final DistributedMember member) {
    final String userName = credentials.getProperty(UserPasswordAuthInit.USER_NAME);
    if (userName == null) {
      throw new AuthenticationFailedException("LdapUserAuthenticator: user name property ["
          + UserPasswordAuthInit.USER_NAME + "] not provided");
    }

    String password = credentials.getProperty(UserPasswordAuthInit.PASSWORD);
    if (password == null) {
      password = "";
    }

    final Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, ldapUrlScheme + ldapServer + '/' + baseDomainName);
    env.put(Context.SECURITY_PRINCIPAL, "uid=" + userName + "," + baseDomainName);
    env.put(Context.SECURITY_CREDENTIALS, password);

    try {
      final DirContext ctx = new InitialDirContext(env);
      ctx.close();
    } catch (Exception e) {
      throw new AuthenticationFailedException(
          "LdapUserAuthenticator: Failure with provided username, password combination for user name: "
              + userName,
          e);
    }

    return new UsernamePrincipal(userName);
  }
An implementation of {@link Authenticator} that uses LDAP.

@since GemFire 5.5
geode-dunit/src/main/java/org/apache/geode/security/templates/LdapUserAuthenticator.java