【问题标题】:Anonymous Bind using UnboundID LDAP sdk使用 UnboundID LDAP sdk 进行匿名绑定
【发布时间】:2014-07-08 21:10:21
【问题描述】:

我有一个 JAVA 应用程序,它使用 UnboundID LDAP SDK 连接到 LDAP 本地服务器并对其进行身份验证。
该服务器是带有 Active Directory 的 Windows Server 2008 R2,它被配置为不允许匿名身份验证。
但是,如果我尝试使用我的应用程序执行匿名绑定,则 BindResult 会成功。 我正在使用 JAVADOC says 之类的 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 应用程序结果正常。
有谁知道可以是什么?

【问题讨论】:

    标签: java active-directory ldap bind unboundid-ldap-sdk


    【解决方案1】:

    不清楚有什么区别,但肯定是调用 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 来捕获网络通信以进行分析。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-29
      • 2014-09-24
      相关资源
      最近更新 更多