@Override public com.google.common.base.Optional<Boolean> isHealthy() { try { final LdapConnection connection = connectionPool.getConnection(); try { if (connection.isConnected() && connection.isAuthenticated()) { connection.bind(); try { return com.google.common.base.Optional.of(true); } finally { connection.unBind(); } } } finally { connectionPool.releaseConnection(connection); } } catch (LdapException e) { LOG.warn("LdapException caught when checking health", e); exceptionNotifier.notify(String.format("LdapException caught when checking health (%s)", e.getMessage()), e); } return com.google.common.base.Optional.of(false); }
} finally { LOG.trace("Loaded {}'s user data in {}", user, JavaUtils.duration(startTime)); connection.unBind();
/** * {@inheritDoc} */ @Override public void unBind() throws LdapException { connection.unBind(); }
/** * {@inheritDoc} */ @Override public void unBind() throws LdapException { connection.unBind(); }
/** * {@inheritDoc} */ @Override public void unBind() throws LdapException { connection.unBind(); }
/** * {@inheritDoc} */ public void destroyObject( Object obj ) throws Exception { LOG.debug( "destroying {}", obj ); LdapConnection connection = ( LdapConnection ) obj; connection.unBind(); connection.close(); }
public static void unbindAndCloseSilently(final LdapConnection connection) { if (connection == null) { return; } try { connection.unBind(); } catch (final Exception e) { //ignore } try { connection.close(); } catch (final Exception e) { //ignore } }
private void bindUser(String username, String password, String cn, LdapConnection userCon, String dn) throws LdapException { userCon.bind(getBind(cn, dn), password); userCon.unBind(); log.debug("User '{}' identified.", username); }
/** * Closes the dao's connection. {@link LdapDaoException} is thrown in case of IO error. * */ public void disconnect() { try { connection.unBind(); connection.close(); } catch (Exception e) { throw new LdapDaoException(e); } }
/** * {@inheritDoc} * * Destroying a connection will unbind it which will result on a shutdown * of teh underlying protocol. */ @Override public void destroyObject( PooledObject<LdapConnection> connection ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04148_DESTROYING, connection ) ); } try { // https://tools.ietf.org/html/rfc2251#section-4.3 // unbind closes the connection so no need to close connection.getObject().unBind(); } catch ( LdapException e ) { LOG.error( I18n.err( I18n.ERR_04100_UNABLE_TO_UNBIND, e.getMessage() ) ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04149_UNABLE_TO_UNBIND, e.getMessage() ) ); } } }
/** * {@inheritDoc} * * Destroying a connection will unbind it which will result on a shutdown * of teh underlying protocol. */ @Override public void destroyObject( PooledObject<LdapConnection> connection ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04148_DESTROYING, connection ) ); } try { // https://tools.ietf.org/html/rfc2251#section-4.3 // unbind closes the connection so no need to close connection.getObject().unBind(); } catch ( LdapException e ) { LOG.error( I18n.err( I18n.ERR_04100_UNABLE_TO_UNBIND, e.getMessage() ) ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04149_UNABLE_TO_UNBIND, e.getMessage() ) ); } } }
/** * {@inheritDoc} * * Destroying a connection will unbind it which will result on a shutdown * of teh underlying protocol. */ @Override public void destroyObject( PooledObject<LdapConnection> connection ) throws LdapException { if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04148_DESTROYING, connection ) ); } try { // https://tools.ietf.org/html/rfc2251#section-4.3 // unbind closes the connection so no need to close connection.getObject().unBind(); } catch ( LdapException e ) { LOG.error( I18n.err( I18n.ERR_04100_UNABLE_TO_UNBIND, e.getMessage() ) ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_04149_UNABLE_TO_UNBIND, e.getMessage() ) ); } } }
/** * Check the user password, and reconnect using its credential * * @param connection the ldap connection * @param userFilter the user ldap filter * @param password the password * @return the find entry or null * @throws LdapException if any LDAP error occurs * @throws CursorException if any cursor error occurs * @throws IOException if any I/O error occurs */ public Entry auth(final LdapConnection connection, final String userFilter, final String password) throws LdapException, CursorException, IOException { final Entry entry = getEntry(connection, userFilter); if (entry == null) return null; final Dn userDN = entry.getDn(); connection.unBind(); connection.bind(userDN, password); return entry; }
@Override public com.google.common.base.Optional<Boolean> isHealthy() { try { final LdapConnection connection = connectionPool.getConnection(); try { if (connection.isConnected() && connection.isAuthenticated()) { connection.bind(); try { return com.google.common.base.Optional.of(true); } finally { connection.unBind(); } } } finally { connectionPool.releaseConnection(connection); } } catch (LdapException e) { LOG.warn("LdapException caught when checking health", e); exceptionNotifier.notify(String.format("LdapException caught when checking health (%s)", e.getMessage()), e); } return com.google.common.base.Optional.of(false); }
connection.unBind(); connectionFactory.bindConnection( connection );
connection.unBind(); connectionFactory.bindConnection( connection );
connection.unBind(); connectionFactory.bindConnection( connection );
} finally { LOG.trace("Loaded {}'s user data in {}", user, JavaUtils.duration(startTime)); connection.unBind();
connection.unBind(); break;