0

我有一个 JAVA 应用程序,它使用 UnboundID LDAP SDK 连接并验证到 LDAP 本地服务器。
该服务器是带有 Active Directory 的 Windows Server 2008 R2,它被配置为不允许匿名身份验证。
但是,如果我尝试使用我的应用程序执行匿名绑定,则 BindResult 会成功。我正在使用JAVADOC 所说的 SimpleBindRequest() 方法进行连接。这是我的代码:

 public boolean autenticarAnonimamente() throws AutenticacaoExcecao
 {       
    GerenciadorConexaoLdap gerenciadorLdap = new GerenciadorConexaoLdap();
    LDAPConnection connection;
    try {
        connection = gerenciadorLdap.conectarServidorLdap(ldap);
        SimpleBindRequest request = new SimpleBindRequest();

        BindResult result = connection.bind(request);
        boolean retorno = result.getResultCode().equals(ResultCode.SUCCESS);
        connection.close();
        return retorno;
    } catch (LDAPException | GeneralSecurityException ex) {
        throw new AutenticacaoExcecao(ex);            
    }   
}

我尝试使用 Google Apps Directory Sync 测试我的服务器,但它拒绝任何匿名绑定。如果我将服务器配置为允许匿名连接,Google 应用程序结果正常。
有谁知道可以是什么?

4

1 回答 1

2

目前尚不清楚有什么区别,但绝对是调用 connection.bind(new SimpleBindRequest()) 将向服务器发送匿名简单绑定请求并导致客户端从服务器读取响应的情况。

几乎可以肯定的是,Google Apps Directory Sync 正在发送不同的绑定请求(可能是 SASL ANONYMOUS 绑定请求,或者可能是具有非空 DN 但密码为空的请求),或者您失败了在 Google Apps Directory Sync 中看到的实际上并不是绑定失败,而是绑定后它试图做的事情。

我建议尝试检查客户端和服务器之间的流量,以了解 Google 客户端正在尝试做什么。UnboundID LDAP SDK 提供的 ldap-debugger 工具可用于完成此操作。它充当一个非常简单的 LDAP 代理,将显示有关通过它的任何流量的详细信息。您还可以使用任何类型的网络数据包捕获机制,如 snoop、tcpdump 或 Wireshark 来捕获网络通信以进行分析。

于 2014-05-21T07:25:41.817 回答