简体   繁体   English

使用Windows上登录的用户在Java中查询Active Directory

[英]Query Active Directory in Java using a logged on user on windows

How do I query the active directory in Java using the current logged on user in windows? 如何使用Windows中当前登录的用户查询Java中的活动目录?

This is possible using C++ with ldap_bind_s and passing null in the credential. 这可以使用带有ldap_bind_s的C ++并在凭证中传递null。 It lets you bind to the AD with the current logged on user and query AD but I could not find its equivalent in Java. 它允许您使用当前登录的用户和查询AD绑定到AD,但我无法在Java中找到它的等效项。

I saw at other places that I can use kerberos but kerberos forces me to generate a keytab file for the user and uses it to communicate with AD using GSSAPI. 我在其他地方看到我可以使用kerberos但kerberos强迫我为用户生成一个keytab文件,并使用它与ADSAPI进行通信。 I want to avoid asking users to generate keytab file. 我想避免要求用户生成keytab文件。

I see that NTLMLoginModule lets you login without asking for any kind of keytab file or credential but then again there is no java library for binding to AD using the NTLMLoginModule. 我看到NTLMLoginModule允许您登录而不需要任何类型的密钥表文件或凭证,但是再次没有用于使用NTLMLoginModule绑定到AD的Java库。

Again, I am looking for a solution only for AD and not a generic LDAP solution. 同样,我正在寻找仅适用于AD的解决方案,而不是通用的LDAP解决方案。 I know that a generic LDAP solution will not work this way. 我知道通用的LDAP解决方案不会以这种方式工作。

I'm going off of this guy's post . 我要离开这家伙的帖子了 You can go with the commercial Jespa library , which uses NTLMv2. 您可以使用使用NTLMv2的商业Jespa库 Or you can go with the open source com4j project that uses ADSI, created by Kohsuke Kawaguchi . 或者你可以使用由Kohsuke Kawaguchi创建的使用ADSI的开源com4j项目

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

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