简体   繁体   English

如何使用Java DirContext搜索具有下级登录名(NETBIOS \\ sAMAccountName)的用户

[英]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.

相关问题 搜索没有名称的DirContext - Search DirContext without name 使用“sAMAccountName”而不是“CN”从Java中的dirContext获取LDAP属性 - Get LDAP-Attributes from an dirContext in Java with the “sAMAccountName” instead of “CN” java-如何告诉LDAP DirContext.search(...)。hasMore()返回false而不是抛出PartialResultException - java- how to tell LDAP DirContext.search(…).hasMore() to return false instead of throwing a PartialResultException Java / Android中NetBIOS / FQDN名称的IP地址 - Ip address to NetBIOS/FQDN name in Java/Android 具有多个参数的DirContext搜索数组 - DirContext search array with multiple parameters Java DirContext更改DN格式 - Java DirContext change DN format 如何使用 sAMaccountName 在活动目录中搜索用户,其中 sAMaccountName 是 (firstinitial+lastName)+(regex) 以任何数字结尾的连接? - How to search user in active directory with sAMaccountName, where sAMaccountName is a concat of (firstinitial+lastName)+(regex)ending with any digits? 如何为ldap DirContext.search(…)一起指定搜索范围和返回属性 - how to specify search scope and returning attributes together for ldap DirContext.search(…) Java DirContext片段仅记录几条 - Java DirContext sreach only few records 检索 LDAP 组中用户的 sAMAccountName - Retrieve sAMAccountName of users in LDAP group
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM