繁体   English   中英

UnboundID LDAP DIGEST-MD5绑定原因NPE

[英]UnboundID LDAP DIGEST-MD5 binding cause NPE

当我尝试使用UnboundID LDAP SDK将DIGEST-MD5绑定到ApacheDS时,出现以下错误。 我已经使用带有UnboundID和Apache Shiro的简单绑定测试了连接,因此ApacheDS可以正常工作。

LDAPException(resultCode=82 (local error), errorMessage='Unable to create a subsequent DIGEST-MD5 SASL request:  NullPointerException(trace='processChallenge(DigestMD5Client.java:339) / evaluateChallenge(DigestMD5Client.java:207) / processSASLBind(SASLHelper.java:149) / process(DIGESTMD5BindRequest.java:406) / bind(LDAPConnection.java:1837) / main(UnboundDemo.java:38)', revision=15579)')
    at com.unboundid.ldap.sdk.SASLHelper.processSASLBind(SASLHelper.java:154)
    at com.unboundid.ldap.sdk.DIGESTMD5BindRequest.process(DIGESTMD5BindRequest.java:406)
    at com.unboundid.ldap.sdk.LDAPConnection.bind(LDAPConnection.java:1837)
    at com.mizar.ldap.UnboundDemo.main(UnboundDemo.java:38)
Caused by: java.lang.NullPointerException
    at com.sun.security.sasl.digest.DigestMD5Client.processChallenge(DigestMD5Client.java:339)
    at com.sun.security.sasl.digest.DigestMD5Client.evaluateChallenge(DigestMD5Client.java:207)
    at com.unboundid.ldap.sdk.SASLHelper.processSASLBind(SASLHelper.java:149)
    ... 3 more

我遵循了JavaDoc中的示例,并且我的示例测试代码如下所示:

LDAPConnection conn;
BindResult bindResult;
DIGESTMD5BindRequest mdBind;  
try {
  conn = new LDAPConnection("1.1.1.1",389);
  mdBind = new DIGESTMD5BindRequest("dn:uid=someuser,ou=dev,dc=blah,dc=com", "test");
  bindResult = conn.bind(mdBind);
  System.out.println("MD5 bind success!");
}
catch (Exception e) {
  e.printStackTrace();
}

看起来此异常起源于用于处理SASL处理的JDK代码,而不是LDAP SDK本身。 基于我能够找到的com.sun.security.sasl.digest.DigestMD5Client类的源版本( http://grepcode.com/file/repository.grepcode.com/java/root/jdk/ openjdk / 6-b14 / com / sun / security / sasl / digest / DigestMD5Client.java ),看来这是一个问题,其中需要一个领域来完成绑定处理,但没有可用的领域。 如果切换到使用带域的DIGESTMD5BindRequest构造函数之一,并为该域提供适当的值(您可能需要从目录管理员那里找到),那么您应该能够使绑定成功。

我刚刚对LDAP SDK对CRAM-MD5,DIGEST-MD5和GSSAPI SASL机制的支持进行了更改,因此,如果将来会出现这种问题,希望它将提供更多有用的信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM