[英]How to use Java DirContext to search for users with down-level logon name (NETBIOS\sAMAccountName)
I am using javax.naming.directory.DirContext to connect with Microsoft AD. 我正在使用javax.naming.directory.DirContext与Microsoft AD连接。 I can authenticate a user by performing bind using SECURITY_PRINCIPAL as NETBIOS\\sAMAccountName, but post this, I need this user's attributes from AD.
我可以通过使用SECURITY_PRINCIPAL作为NETBIOS \\ sAMAccountName执行绑定来对用户进行身份验证,但是发布此消息后,我需要AD中该用户的属性。 I am not able to figure out how to do this.
我不知道该怎么做。 If I should use DirContext.search, or DirContext.GetAttributes, what search filter or name shall be provided?
如果我应该使用DirContext.search或DirContext.GetAttributes,应提供什么搜索过滤器或名称? I can't simply use sAMAccountName as there may be many users with same sAMAccountName.
我不能简单地使用sAMAccountName,因为可能有许多用户具有相同的sAMAccountName。
We have some JNDI Examples on how to Generically perform several JNDI functions. 我们有一些有关如何一般地执行几个JNDI功能的JNDI示例 。
The BasicAdminSearchBind.java is probably a good place to start. BasicAdminSearchBind.java可能是一个不错的起点。
The ADConnection.java specific to Microsoft Active Directory. 特定于Microsoft Active Directory的ADConnection.java 。
NOTE: These are examples -- Use at your own risk! 注意:这些只是示例-使用后果自负!
-jim -吉姆
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.