Search in sources :

Example 1 with LdapSearchScope

use of io.apiman.gateway.engine.components.ldap.LdapSearchScope in project apiman by apiman.

the class DefaultLdapSearchImpl method getResults.

private void getResults(String searchDn, String filter, LdapSearchScope scope, final IAsyncResultHandler<List<SearchResultEntry>> result) {
    try {
        SearchScope searchScope = (scope == LdapSearchScope.ONE) ? SearchScope.ONE : SearchScope.SUB;
        List<SearchResultEntry> searchResults = connection.search(searchDn, searchScope, filter).getSearchEntries();
        result.handle(AsyncResultImpl.create(searchResults));
    } catch (LDAPException e) {
        if (ldapErrorHandler == null) {
            LOGGER.error("LDAP Error Handler not set. Error may be swallowed; " + "this is probably not what you intended.", e);
        }
        ldapErrorHandler.handle(DefaultExceptionFactory.create(e));
    } catch (Exception e) {
        result.handle(AsyncResultImpl.<List<SearchResultEntry>>create(e));
    }
}
Also used : LDAPException(com.unboundid.ldap.sdk.LDAPException) LdapSearchScope(io.apiman.gateway.engine.components.ldap.LdapSearchScope) SearchScope(com.unboundid.ldap.sdk.SearchScope) ArrayList(java.util.ArrayList) List(java.util.List) LdapException(io.apiman.gateway.engine.components.ldap.result.LdapException) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchResultEntry(com.unboundid.ldap.sdk.SearchResultEntry)

Aggregations

LDAPException (com.unboundid.ldap.sdk.LDAPException)1 SearchResultEntry (com.unboundid.ldap.sdk.SearchResultEntry)1 SearchScope (com.unboundid.ldap.sdk.SearchScope)1 LdapSearchScope (io.apiman.gateway.engine.components.ldap.LdapSearchScope)1 LdapException (io.apiman.gateway.engine.components.ldap.result.LdapException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1