com.novell.ldap.LDAPConnection.search()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中com.novell.ldap.LDAPConnection.search()方法的一些代码示例,展示了LDAPConnection.search()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.search()方法的具体详情如下:
包路径:com.novell.ldap.LDAPConnection
类名称:LDAPConnection
方法名:search

LDAPConnection.search介绍

[英]Synchronously performs the search specified by the LDAP URL, returning an enumerable LDAPSearchResults object.
[中]同步执行LDAP URL指定的搜索,返回可枚举的LDAPSearchResults对象。

代码示例

代码示例来源:origin: stackoverflow.com

public static List<SearchResultEntry> getResults(LDAPConnection connection, String baseDN, String filter) throws LDAPSearchException {
  SearchResult searchResult;

  if (connection.isConnected()) {
    searchResult = connection.search(baseDN, SearchScope.ONE, filter);

    return searchResult.getSearchEntries();
  }

  return null;
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

LDAPSearchResults searchResults = null;
if (attributeList == null || attributeList.size() == 0) {
  searchResults = lc.search(searchBase, searchScope, searchFilter, null, false, cons);
} else {
  searchResults = lc.search(searchBase, searchScope, searchFilter, attributeList.toArray(new String[0]), false, cons);

代码示例来源:origin: com.novell.ldap/jldap

/**
 * Synchronously performs the search specified by the LDAP URL, returning
 * an enumerable LDAPSearchResults object.
 *
 * @param toGet The LDAP URL specifying the entry to read.
 *
 * @exception LDAPException A general exception which includes an error
 * message and an LDAP error code.
 */
public static LDAPSearchResults search(LDAPUrl toGet)
  throws LDAPException
{
  // Get a clone of default search constraints, method alters batchSize
  return search( toGet, null);
}

代码示例来源:origin: com.novell.ldap/jldap

throws LDAPException
return search(base, scope, filter, attrs, typesOnly, defSearchCons);

代码示例来源:origin: com.novell.ldap/jldap

throws LDAPException
return search(base, scope, filter, attrs, typesOnly,
       queue, defSearchCons);

代码示例来源:origin: org.xwiki.platform/xwiki-platform-ldap-authenticator

/**
 * @param baseDN the root DN from where to search.
 * @param filter filter the LDAP filter
 * @param attr the attributes names of values to return
 * @param ldapScope the scope of the entries to search. The following are the valid options:
 *            <ul>
 *            <li>SCOPE_BASE - searches only the base DN
 *            <li>SCOPE_ONE - searches only entries under the base DN
 *            <li>SCOPE_SUB - searches the base DN and all entries within its subtree
 *            </ul>
 * @return a result stream. LDAPConnection#abandon should be called when it's not needed anymore.
 * @throws LDAPException error when searching
 * @since 3.3M1
 */
public LDAPSearchResults search(String baseDN, String filter, String[] attr, int ldapScope) throws LDAPException
{
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("LDAP search: baseDN=[{}] query=[{}] attr=[{}] ldapScope=[{}]", new Object[] {baseDN, filter,
    attr != null ? Arrays.asList(attr) : null, ldapScope});
  }
  return this.connection.search(baseDN, ldapScope, filter, attr, false);
}

代码示例来源:origin: stackoverflow.com

LDAPConnection ld = new LDAPConnection();
ld.connect(LDAP_SERVER, LDAP_PORT);
LDAPSearchResults res = ld.search(BASE_DN, SEARCH_SCOPE, "(uid=" + THE_ID +")", null, false);

代码示例来源:origin: stackoverflow.com

SearchResult searchResult = connection.search(searchRequest);
for (SearchResultEntry e : searchResult.getSearchEntries())

代码示例来源:origin: stackoverflow.com

SearchResult searchResult = connection.search(searchRequest);
for (SearchResultEntry e : searchResult.getSearchEntries())

代码示例来源:origin: stackoverflow.com

searchRequest.setResponseTimeoutMillis(responseTimeoutMillis);
SearchResult searchResult = ldapConnection.search(searchRequest);

代码示例来源:origin: stackoverflow.com

LDAPConnection conn = new LDAPConnection();
conn.connect("blah.blah.address", 389);

String[] attrIDs = {"uniqueMember"};
LDAPSearchResults search = conn.search("dc=foo,dc=bar",
                    LDAPConnection.SCOPE_ONE,
                    "cn=testgroup", attrIDs, false);

while(search.hasMore()) {
  LDAPEntry entry = search.next();
  for (String string : entry.getAttribute("uniqueMember").getStringValueArray()) {
    System.out.println(string);
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

searchResults = this.connection.search(baseDN, ldapScope, filter, attr, false);

代码示例来源:origin: stackoverflow.com

import com.unboundid.ldap.sdk.Filter;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.SearchScope;
import com.unboundid.ldap.sdk.SearchResult;

public final class BSFilter {
 public static void main(String... args) {
  try {
   Filter searchFilter =
    Filter.create("cn=abc\"and'def");
   LDAPConnection connection =
    new LDAPConnection("localhost",1389);
   SearchResult searchResult =
    connection.search("dc=example,dc=com",SearchScope.ONE,
             searchFilter,"1.1");
   assert(searchResult.getSearchEntries().size() == 0);
  } catch(LDAPException lex) {
   lex.printStackTrace();
   return;
  }
 }
}

代码示例来源:origin: com.novell.ldap/jldap

conn.search( base,
       scope,
       filter,

代码示例来源:origin: com.novell.ldap/jldap

/**
 * Synchronously performs the search specified by the LDAP URL, returning
 * an enumerable LDAPSearchResults object.
 *
 * @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#search(com.novell.ldap.LDAPUrl)">
    com.novell.ldap.LDAPConnection.search(LDAPUrl)</a>
 */
public static LDAPSearchResults search(LDAPUrl toGet)
  throws LDAPException
{
  try {
    return new LDAPSearchResults(
          com.novell.ldap.LDAPConnection.search(
                    toGet.getWrappedObject()));
  } catch( com.novell.ldap.LDAPException ex) {
    if( ex instanceof com.novell.ldap.LDAPReferralException) {
      throw new LDAPReferralException(
          (com.novell.ldap.LDAPReferralException)ex);
    } else {
      throw new LDAPException( ex);
    }
  }
}

代码示例来源:origin: stackoverflow.com

LDAPSearchResults searchResults = conn.search("ou=people,dc=mycompany,dc=com",
  LDAPConnection.SCOPE_ONE, "cn=Surname Name", null, false);
LDAPEntry entry = searchResults.next();

代码示例来源:origin: com.novell.ldap/jldap

/**
 * Synchronously perfoms the search specified by the LDAP URL, using
 * the specified search constraints.
 *
 * @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#search(com.novell.ldap.LDAPUrl,
    com.novell.ldap.LDAPSearchConstraints)">
    com.novell.ldap.LDAPConnection.search(LDAPUrl,
    LDAPSearchConstraints)</a>
 */
public static LDAPSearchResults search(LDAPUrl toGet,
                    LDAPSearchConstraints cons)
  throws LDAPException
{
  try {
    return new LDAPSearchResults(
          com.novell.ldap.LDAPConnection.search(
                    toGet.getWrappedObject(),
                    cons.getWrappedSearchObject()));
  } catch( com.novell.ldap.LDAPException ex) {
    if( ex instanceof com.novell.ldap.LDAPReferralException) {
      throw new LDAPReferralException(
          (com.novell.ldap.LDAPReferralException)ex);
    } else {
      throw new LDAPException( ex);
    }
  }
}

代码示例来源:origin: com.novell.ldap/jldap

"read(" + dn + ")");
LDAPSearchResults sr = search(dn, SCOPE_BASE,
               null,
               attrs, false, cons);

代码示例来源:origin: com.novell.ldap/jldap

/**
 * Class to wrap an application's LDAPUnsolicitedNotificationListener
 */
private class UnsolImpl
    implements com.novell.ldap.LDAPUnsolicitedNotificationListener
{
  org.ietf.ldap.LDAPUnsolicitedNotificationListener listen;
  private UnsolImpl( org.ietf.ldap.LDAPUnsolicitedNotificationListener ul)
  {
    listen = ul;
    // Remember this association so we can do remove properly
    synchronized( listenerQueues) {
      listenerQueues.put( ul, this);
    }
    return;
  }
  public void messageReceived( com.novell.ldap.LDAPExtendedResponse msg)
  {
    listen.messageReceived(
        new LDAPExtendedResponse( msg));
    return;
  }
  private
  org.ietf.ldap.LDAPUnsolicitedNotificationListener getWrappedObject()
  {
    return listen;
  }
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-ldap

LDAPSearchResults lsrs = lc.search(ldapBean.getSearchDc(), LDAPConnection.SCOPE_SUB, filter, null, false);

相关文章