Search in sources :

Example 6 with CursorException

use of org.apache.directory.api.ldap.model.cursor.CursorException in project jackrabbit-oak by apache.

the class LdapIdentityProvider method getUser.

@Override
public ExternalUser getUser(@Nonnull String userId) throws ExternalIdentityException {
    DebugTimer timer = new DebugTimer();
    LdapConnection connection = connect();
    timer.mark("connect");
    try {
        Entry entry = getEntry(connection, config.getUserConfig(), userId, config.getCustomAttributes());
        timer.mark("lookup");
        if (log.isDebugEnabled()) {
            log.debug("getUser({}) {}", userId, timer.getString());
        }
        if (entry != null) {
            return createUser(entry, userId);
        } else {
            return null;
        }
    } catch (LdapException e) {
        throw lookupFailedException(e, timer);
    } catch (CursorException e) {
        throw lookupFailedException(e, timer);
    } finally {
        disconnect(connection);
    }
}
Also used : DebugTimer(org.apache.jackrabbit.oak.commons.DebugTimer) Entry(org.apache.directory.api.ldap.model.entry.Entry) SearchResultEntry(org.apache.directory.api.ldap.model.message.SearchResultEntry) CursorException(org.apache.directory.api.ldap.model.cursor.CursorException) LdapException(org.apache.directory.api.ldap.model.exception.LdapException) LdapConnection(org.apache.directory.ldap.client.api.LdapConnection)

Aggregations

CursorException (org.apache.directory.api.ldap.model.cursor.CursorException)6 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)6 Entry (org.apache.directory.api.ldap.model.entry.Entry)4 IOException (java.io.IOException)3 SearchResultEntry (org.apache.directory.api.ldap.model.message.SearchResultEntry)3 LdapNetworkConnection (org.apache.directory.ldap.client.api.LdapNetworkConnection)3 LdapEntry (org.graylog2.shared.security.ldap.LdapEntry)3 LdapInvalidDnException (org.apache.directory.api.ldap.model.exception.LdapInvalidDnException)2 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)2 LdapConnectionConfig (org.apache.directory.ldap.client.api.LdapConnectionConfig)2 DebugTimer (org.apache.jackrabbit.oak.commons.DebugTimer)2 ValidationException (org.graylog2.plugin.database.ValidationException)2 TrustAllX509TrustManager (org.graylog2.security.TrustAllX509TrustManager)2 Timed (com.codahale.metrics.annotation.Timed)1 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)1 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1