gpt4 book ai didi

ldap - UnboundID LDAP Java SDK - 需要列出给定父 DN 的后代

转载 作者:行者123 更新时间:2023-12-01 23:54:08 26 4
gpt4 key购买 nike

如何使用 UnboundID LDAP SDK 查询 LDAP 中父条目的所有后代?

我正在寻找类似过滤器的东西,它可以说基于父 DN 的过滤器。或者以某种方式列出给定条目的所有子项。

是否可以使用 UnboundID LDAP SDK?我找不到提及此类操作的示例或文档。

最佳答案

确保任何容器的后代都应该通过使用LDAP Search Scope获得

在 UnboundID 类中 SearchScope用于 SearchRequest并在他们的示例中显示:

 // Construct a filter that can be used to find everyone in the Sales
// department, and then create a search request to find all such users
// in the directory.
Filter filter = Filter.createEqualityFilter("ou", "Sales");
SearchRequest searchRequest =
new SearchRequest("dc=example,dc=com", SearchScope.SUB, filter,
"cn", "mail");
SearchResult searchResult;

try
{
searchResult = connection.search(searchRequest);

for (SearchResultEntry entry : searchResult.getSearchEntries())
{
String name = entry.getAttributeValue("cn");
String mail = entry.getAttributeValue("mail");
}
}
catch (LDAPSearchException lse)
{
// The search failed for some reason.
searchResult = lse.getSearchResult();
ResultCode resultCode = lse.getResultCode();
String errorMessageFromServer = lse.getDiagnosticMessage();
}

-吉姆

关于ldap - UnboundID LDAP Java SDK - 需要列出给定父 DN 的后代,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24992987/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com