LDAP:如何跨多个组织单位搜索给定的 uid?
首先,我首先要说的是,我对使用 LDAP 完全陌生。
我正在开发一个与一些旧应用程序共享 LDAP 服务器的应用程序。
旧应用程序中的所有用户帐户均按 ID 组织到组织单位中。 每个条目都有一个 uid
,即用户的电子邮件地址。
我可以查找电子邮件地址为 [email protected] 的用户
存在于组织单位 12345
中,使用 dn
如下所示:ou=someGroup,ou=12345,[email protected]
但是,我想要做的是检查用户跨多个组织单位的存在。 例如,我希望能够检查任意数量的组织单位是否正在使用电子邮件。 (例如,检查 12345
、23452
和 34352
)。
经过谷歌搜索后,我似乎应该能够找到具有单个 dn
的多个条目,但我还没有弄清楚如何检查这种情况。
有谁知道我怎样才能进行这样的检查? 我正在使用 Spring LDAP。
First off, let me start by saying that I am totally new to working with LDAP.
I am working on an application that shares an LDAP server with a few legacy applications.
All of the user accounts in the legacy application are organized into Organizational Units by IDs. Each entry has a uid
that is the users email address.
I can find if a user with the email [email protected]
exists in the organizational unit 12345
by using a dn
something like this: ou=someGroup,ou=12345,[email protected]
However, what I'd like to be able to do is check for the existence of a user across multiple organizational units. For example, I'd like to be able to check if an email is in use within with an arbitrary number of organizational units. (for example, check within 12345
, 23452
, and 34352
).
After googling around, it seems that I should be able to find multiple entries with a single dn
, but I haven't figured out how to check for this scenario.
Does anyone know how I can do a check like this? I am using Spring LDAP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您应该能够按如下方式执行此操作:
当您的搜索 DN 仅指定域组件时:
BASE_DN = "DC=TEST,DC=COM"
作为您的过滤器,指定您的 CN 或 uid
FILTER = "UID=bob"
As您的搜索一定要指定“sub”或您的 Spring LDAP 特定参数,以搜索基本 DN 下面的整个子树。
根据您的设置,您可能需要要求搜索始终取消引用链接。
I believe you should be able to do this as follows:
As your search DN specify the domain components only:
BASE_DN = "DC=TEST,DC=COM"
As your filter, specify your CN or uid
FILTER = "UID=bob"
As your search be sure to specify "sub" or your Spring LDAP specific parameter to search the entire sub-tree below the base DN.
Depending on your setup, you may need to ask the search to Always Dereference links.