org.apache.directory.ldap.client.api.LdapConnection.unBind()方法的使用及代码示例

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

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

LdapConnection.unBind介绍

[英]UnBind from a server. This is a request which expects no response.
[中]从服务器解除绑定。这是一个不需要响应的请求。

代码示例

代码示例来源:origin: HubSpot/Singularity

@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);
}

代码示例来源:origin: HubSpot/Singularity

} finally {
 LOG.trace("Loaded {}'s user data in {}", user, JavaUtils.duration(startTime));
 connection.unBind();

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@inheritDoc}
 */
@Override
public void unBind() throws LdapException
{
  connection.unBind();
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@inheritDoc}
 */
@Override
public void unBind() throws LdapException
{
  connection.unBind();
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@inheritDoc}
 */
@Override
public void unBind() throws LdapException
{
  connection.unBind();
}

代码示例来源:origin: org.apache.directory.client.ldap/ldap-client-api

/**
 * {@inheritDoc}
 */
public void destroyObject( Object obj ) throws Exception
{
  LOG.debug( "destroying {}", obj );
  LdapConnection connection = ( LdapConnection ) obj;
  connection.unBind();
  connection.close();
}

代码示例来源:origin: com.floragunn/search-guard

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
  }
}

代码示例来源:origin: epam/DLab

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);
}

代码示例来源:origin: org.openengsb.infrastructure/org.openengsb.infrastructure.ldap

/**
 * 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);
  }
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * {@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() ) );
    }
  }
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

/**
 * {@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() ) );
    }
  }
}

代码示例来源:origin: org.apache.directory.api/api-all

/**
 * {@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() ) );
    }
  }
}

代码示例来源:origin: com.qwazr/qwazr-library-ldap

/**
 * 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;
}

代码示例来源:origin: com.hubspot/SingularityService

@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);
}

代码示例来源:origin: org.apache.directory.api/api-all

connection.unBind();
connectionFactory.bindConnection( connection );

代码示例来源:origin: org.apache.directory.api/api-ldap-client-api

connection.unBind();
connectionFactory.bindConnection( connection );

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

connection.unBind();
connectionFactory.bindConnection( connection );

代码示例来源:origin: com.hubspot/SingularityService

} finally {
 LOG.trace("Loaded {}'s user data in {}", user, JavaUtils.duration(startTime));
 connection.unBind();

代码示例来源:origin: org.apache.directory.api/api-all

connection.unBind();
break;

相关文章