/** * Checks if the specified LDAP result code indicates the LDAP server * is unavailable, disconnected or timing out. * * @param code The LDAP result code. Must not be {@code null}. * * @return {@code true} if the LDAP result code indicates the LDAP * server is unavailable, disconnected or timing out, else * {@code false}. */ protected static boolean indicatesConnectionException(final ResultCode code) { return code.equals(ResultCode.CONNECT_ERROR) || code.equals(ResultCode.SERVER_DOWN) || code.equals(ResultCode.TIMEOUT) || code.equals(ResultCode.UNAVAILABLE); }
/** * Checks if the specified LDAP result code indicates the LDAP server * is unavailable, disconnected or timing out. * * @param code The LDAP result code. Must not be {@code null}. * * @return {@code true} if the LDAP result code indicates the LDAP * server is unavailable, disconnected or timing out, else * {@code false}. */ protected static boolean indicatesConnectionException(final ResultCode code) { return code.equals(ResultCode.CONNECT_ERROR) || code.equals(ResultCode.SERVER_DOWN) || code.equals(ResultCode.TIMEOUT) || code.equals(ResultCode.UNAVAILABLE); }
/** * Indicates whether the compare operation matched the target entry. * * @return {@code true} if the compare operation matched the target entry, * or {@code false} if not. */ public boolean compareMatched() { return (getResultCode().equals(ResultCode.COMPARE_TRUE)); } }
/** * Indicates whether the compare operation matched the target entry. * * @return {@code true} if the compare operation matched the target entry, * or {@code false} if not. */ public boolean compareMatched() { return (getResultCode().equals(ResultCode.COMPARE_TRUE)); } }
boolean authenticate(final LDAPConnection ldap, final String userDN, final String password) throws LDAPException { final BindResult bindResult = ldap.bind(userDN, password); if (bindResult.getResultCode().equals(ResultCode.SUCCESS)) { LOG.debug("Login successful: " + userDN); // don't expose user names at successful login as this is a security issue return true; } else { LOG.warn("Access denied: " + userDN); return false; } } }
if (rc.equals(result.getResultCode()))
if (rc.equals(result.getResultCode()))
/** * Indicates whether there are any more search results to return. * * @return {@code true} if there are more search results to return, or * {@code false} if not. */ public boolean hasMoreElements() { final Object o = nextObject(); if (o == null) { return false; } if (o instanceof SearchResult) { final SearchResult r = (SearchResult) o; if (r.getResultCode().equals(ResultCode.SUCCESS)) { lastControls.set(r.getResponseControls()); searchDone.set(true); nextResult.set(null); return false; } } return true; }
if (! searchResult.getResultCode().equals(ResultCode.SUCCESS))
if (rc.equals(exception.getResultCode()))
if (rc.equals(exception.getResultCode()))
/** * {@inheritDoc} This is intended for internal use only and should not be * called by anything outside of the LDAP SDK itself. */ @InternalUseOnly() public void searchResultReceived(final AsyncRequestID requestID, final SearchResult searchResult) { this.searchResult.set(searchResult); if (! searchResult.getResultCode().equals(ResultCode.SUCCESS)) { addToQueue(new EntrySourceException(false, new LDAPSearchException(searchResult))); } closeInternal(false); }
credentials.getPassword() ); if (bindResult.getResultCode().equals(ResultCode.SUCCESS)) { LOG.info("Login successful: " + credentials.getUsername()); authOK = true;
/** * {@inheritDoc} */ public void processPreAuthenticatedConnection(final LDAPConnection connection) throws LDAPException { final StartTLSExtendedRequest startTLSRequest; if (sslContext == null) { startTLSRequest = new StartTLSExtendedRequest(sslSocketFactory); } else { startTLSRequest = new StartTLSExtendedRequest(sslContext); } // Since the StartTLS processing will occur during the course of // establishing the connection for use in the pool, set the connect timeout // for the operation to be equal to the connect timeout from the connection // options. final LDAPConnectionOptions opts = connection.getConnectionOptions(); startTLSRequest.setResponseTimeoutMillis(opts.getConnectTimeoutMillis()); final ExtendedResult r = connection.processExtendedOperation(startTLSRequest); if (! r.getResultCode().equals(ResultCode.SUCCESS)) { throw new LDAPExtendedOperationException(r); } }
/** * {@inheritDoc} */ public void processPreAuthenticatedConnection(final LDAPConnection connection) throws LDAPException { final StartTLSExtendedRequest startTLSRequest; if (sslContext == null) { startTLSRequest = new StartTLSExtendedRequest(sslSocketFactory); } else { startTLSRequest = new StartTLSExtendedRequest(sslContext); } // Since the StartTLS processing will occur during the course of // establishing the connection for use in the pool, set the connect timeout // for the operation to be equal to the connect timeout from the connection // options. final LDAPConnectionOptions opts = connection.getConnectionOptions(); startTLSRequest.setResponseTimeoutMillis(opts.getConnectTimeoutMillis()); final ExtendedResult r = connection.processExtendedOperation(startTLSRequest); if (! r.getResultCode().equals(ResultCode.SUCCESS)) { throw new LDAPExtendedOperationException(r); } }
connection.processExtendedOperation(new StartTLSExtendedRequest( startTLSSocketFactory[serverIndex])); if (! extendedResult.getResultCode().equals(ResultCode.SUCCESS))