首页 文章

使用NTLM连接到LDAP(Active Directory)

提问于
浏览
1

目前,我正在使用用户和密码作为ldap的连接凭据(以便在此AD上进行搜索) .

我的代码看起来像:

env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, ...);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, ...);
env.put(Context.SECURITY_CREDENTIALS, ...);
env.put("com.sun.jndi.ldap.connect.timeout", ...);

try {
  ctx = new InitialLdapContext(env, null);
}
catch (NamingException e) {
    System.out.println("error")
}

我想更改此代码,因此它不会使用用户密码作为LDAP的凭据 . 我希望它使用NTLM进行身份验证 .

我该怎么做?你能提供一个例子吗?

2 回答

  • 1

    https://sourceforge.net/projects/javaldapntlmbind/

    该解决方案使用UnboundID Java LDAP SDK,对于NTLM处理,它使用samba.org的JCIF Java库 . 由于使用JCIF,它独立于平台,不需要在Windows上运行 .

  • 0

    没有机会,JGSS不支持NTLM作为SASL机制 . 将Kerberos(GSS-API)与SASL一起使用 .

相关问题