本文整理了Java中com.unboundid.ldap.sdk.LDAPConnection.searchForEntry()
方法的一些代码示例,展示了LDAPConnection.searchForEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.searchForEntry()
方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.LDAPConnection
类名称:LDAPConnection
方法名:searchForEntry
[英]Processes the provided search request. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.
Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.
[中]处理提供的搜索请求。预计搜索最多返回一个条目,并且不需要来自成功搜索结果的其他内容(例如,诊断消息或响应控件)。
请注意,如果搜索未成功完成,将抛出LDAPSearchException。在某些情况下,在收到失败响应之前,可能已返回一个或多个搜索结果条目或引用。在这种情况下,可以使用诸如getEntryCount、getSearchEntries、getReferenceCount和getSearchReferences之类的LDAPSearchException方法来获取关于这些条目和引用的信息。
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
throws LDAPSearchException
return searchForEntry((SearchRequest) searchRequest);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
throws LDAPSearchException
return searchForEntry((SearchRequest) searchRequest);
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
throws LDAPSearchException
return searchForEntry(new SearchRequest(baseDN, scope,
DereferencePolicy.NEVER, 1, 0, false, filter, attributes));
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
throws LDAPSearchException
return searchForEntry(new SearchRequest(baseDN, scope,
DereferencePolicy.NEVER, 1, 0, false, filter, attributes));
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public String getAccountDN(String subject) throws LdapSystemException {
try (LDAPConnection conn = ldapPool.getConnection()) {
String baseDn = config.getLdapUserBaseDN();
SearchResultEntry entry = conn.searchForEntry(baseDn, ONE, "(employeeNumber=" + subject + ")", "uid");
return entry != null ? entry.getDN() : null;
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public LdapAccount getAccountInfo(String subject) throws LdapSystemException {
LdapAccount result = null;
try (LDAPConnection conn = ldapPool.getConnection()) {
String baseDn = config.getLdapUserBaseDN();
SearchResultEntry entry = conn.searchForEntry(baseDn, ONE, "(employeeNumber=" + subject + ")");
if (entry != null) {
result = accountFromEntry(entry);
// result.setSyncGsuitePassword(config.isGsuiteSyncPassword());
}
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
return result;
}
代码示例来源:origin: hlavki/g-suite-identity-sync
/**
* Read group from LDAP. If there is no group it returns NULL.
*
* @param groupName name of gruop
* @param conn ldap connection
* @return LDAP group or null if there is no group
* @throws LDAPException
*/
protected LdapGroup getGroup(String groupName, LDAPConnection conn) throws LdapSystemException {
try {
LdapGroup result = null;
String baseDN = config.getLdapGroupsBaseDN();
Filter groupFilter = Filter.createEqualityFilter(GROUP_NAME_ATTR, groupName);
SearchResultEntry entry = conn.searchForEntry(baseDN, ONE, groupFilter,
GROUP_NAME_ATTR, config.getLdapGroupsMemberAttr(), GROUP_DESC_ATTR);
if (entry != null) {
String dn = entry.getDN();
String name = entry.getAttributeValue(GROUP_NAME_ATTR);
String description = entry.getAttributeValue(GROUP_DESC_ATTR);
Set<String> members = new HashSet<>(Arrays.asList(entry.getAttributeValues(config.getLdapGroupsMemberAttr())));
result = new LdapGroup(name, dn, description, members);
}
return result;
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
final Entry schemaEntry = connection.searchForEntry(subschemaSubentryDN,
SearchScope.BASE,
Filter.createEqualityFilter("objectClass", "subschema"),
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
final Entry schemaEntry = connection.searchForEntry(subschemaSubentryDN,
SearchScope.BASE,
Filter.createEqualityFilter("objectClass", "subschema"),
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
final SearchResultEntry entry = conn.searchForEntry(searchRequest);
releaseConnection(conn);
return entry;
final SearchResultEntry entry = newConn.searchForEntry(searchRequest);
releaseConnection(newConn);
return entry;
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
final SearchResultEntry entry = conn.searchForEntry(searchRequest);
releaseConnection(conn);
return entry;
final SearchResultEntry entry = newConn.searchForEntry(searchRequest);
releaseConnection(newConn);
return entry;
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
return searchForEntry(r);
return searchForEntry(r);
throws LDAPSearchException
return searchForEntry(new SearchRequest(baseDN, scope, derefPolicy, 1,
timeLimit, typesOnly, filter, attributes));
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
return searchForEntry(r);
return searchForEntry(r);
throws LDAPSearchException
return searchForEntry(new SearchRequest(baseDN, scope, derefPolicy, 1,
timeLimit, typesOnly, filter, attributes));
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
r.setSizeLimit(1);
final Entry e = c.searchForEntry(r);
if (e == null)
内容来源于网络,如有侵权,请联系作者删除!