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

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

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

LdapConnection.isAuthenticated介绍

[英]Check if the connection is authenticated.
[中]检查连接是否经过身份验证。

代码示例

代码示例来源: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

checkState(connection.isAuthenticated(), "not authenticated");
connection.bind();

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

/**
 * {@inheritDoc}
 */
@Override
public boolean isAuthenticated()
{
  return connection.isAuthenticated();
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean isAuthenticated()
{
  return connection.isAuthenticated();
}

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

/**
 * {@inheritDoc}
 */
@Override
public boolean isAuthenticated()
{
  return connection.isAuthenticated();
}

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

/**
   * Returns true if <code>connection</code> is connected, and authenticated.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    return connection.isConnected() && connection.isAuthenticated();
  }
}

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

/**
   * Returns true if <code>connection</code> is connected, and authenticated.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    return connection.isConnected() && connection.isAuthenticated();
  }
}

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

/**
   * Returns true if <code>connection</code> is connected, and authenticated.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    return connection.isConnected() && connection.isAuthenticated();
  }
}

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

/**
 * Creates a new instance of NetworkSchemaLoader.
 *
 * @param connection the LDAP connection
 * @param subschemaSubentryDn The SubschemaSubentry
 * @throws LdapException if the connection is not authenticated or if there are any problems
 *                   while loading the schema entries
 */
public DefaultSchemaLoader( LdapConnection connection, Dn subschemaSubentryDn ) throws LdapException
{
  if ( !connection.isAuthenticated() )
  {
    throw new IllegalArgumentException( I18n.err( I18n.ERR_04105_CONNECTION_NOT_AUTHENTICATED ) );
  }
  this.connection = connection;
  this.subschemaSubentryDn = subschemaSubentryDn;
  loadSchemas();
}

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

/**
 * Creates a new instance of NetworkSchemaLoader.
 *
 * @param connection the LDAP connection
 * @param subschemaSubentryDn The SubschemaSubentry
 * @throws LdapException if the connection is not authenticated or if there are any problems
 *                   while loading the schema entries
 */
public DefaultSchemaLoader( LdapConnection connection, Dn subschemaSubentryDn ) throws LdapException
{
  if ( !connection.isAuthenticated() )
  {
    throw new IllegalArgumentException( I18n.err( I18n.ERR_04105_CONNECTION_NOT_AUTHENTICATED ) );
  }
  this.connection = connection;
  this.subschemaSubentryDn = subschemaSubentryDn;
  loadSchemas();
}

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

/**
 * Creates a new instance of NetworkSchemaLoader.
 *
 * @param connection the LDAP connection
 * @param subschemaSubentryDn The SubschemaSubentry
 * @throws LdapException if the connection is not authenticated or if there are any problems
 *                   while loading the schema entries
 */
public DefaultSchemaLoader( LdapConnection connection, Dn subschemaSubentryDn ) throws LdapException
{
  if ( !connection.isAuthenticated() )
  {
    throw new IllegalArgumentException( I18n.err( I18n.ERR_04105_CONNECTION_NOT_AUTHENTICATED ) );
  }
  this.connection = connection;
  this.subschemaSubentryDn = subschemaSubentryDn;
  loadSchemas();
}

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

/**
   * Returns true if <code>connection</code> is connected, authenticated, and
   * a lookup on the rootDSE returns a non-null response.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    try
    {
      return connection.isConnected()
        && connection.isAuthenticated()
        && ( connection.lookup( Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE ) != null );
    }
    catch ( LdapException e )
    {
      return false;
    }
  }
}

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

/**
   * Returns true if <code>connection</code> is connected, authenticated, and
   * a lookup on the rootDSE returns a non-null response.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    try
    {
      return connection.isConnected()
        && connection.isAuthenticated()
        && ( connection.lookup( Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE ) != null );
    }
    catch ( LdapException e )
    {
      return false;
    }
  }
}

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

/**
   * Returns true if <code>connection</code> is connected, authenticated, and
   * a lookup on the rootDSE returns a non-null response.
   * 
   * @param connection The connection to validate
   * @return True, if the connection is still valid
   */
  @Override
  public boolean validate( LdapConnection connection )
  {
    try
    {
      return connection.isConnected()
        && connection.isAuthenticated()
        && ( connection.lookup( Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE ) != null );
    }
    catch ( LdapException e )
    {
      return false;
    }
  }
}

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

/**
 * {@inheritDoc}
 * 
 * There is nothing to do to activate a connection.
 */
@Override
public void activateObject( PooledObject<LdapConnection> connection ) throws LdapException
{
  if ( LOG.isDebugEnabled() )
  {
    LOG.debug( I18n.msg( I18n.MSG_04146_ACTIVATING, connection ) );
  }
  
  if ( !connection.getObject().isConnected() || !connection.getObject().isAuthenticated() )
  {
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_04147_REBIND_CONNECTION_DROPPED, connection ) );
    }
    
    connectionFactory.bindConnection( connection.getObject() );
  }
}

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

/**
 * {@inheritDoc}
 * 
 * There is nothing to do to activate a connection.
 */
@Override
public void activateObject( PooledObject<LdapConnection> connection ) throws LdapException
{
  if ( LOG.isDebugEnabled() )
  {
    LOG.debug( I18n.msg( I18n.MSG_04146_ACTIVATING, connection ) );
  }
  
  if ( !connection.getObject().isConnected() || !connection.getObject().isAuthenticated() )
  {
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_04147_REBIND_CONNECTION_DROPPED, connection ) );
    }
    
    connectionFactory.bindConnection( connection.getObject() );
  }
}

代码示例来源: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-ldap-client-all

/**
 * {@inheritDoc}
 * 
 * There is nothing to do to activate a connection.
 */
@Override
public void activateObject( PooledObject<LdapConnection> connection ) throws LdapException
{
  if ( LOG.isDebugEnabled() )
  {
    LOG.debug( I18n.msg( I18n.MSG_04146_ACTIVATING, connection ) );
  }
  
  if ( !connection.getObject().isConnected() || !connection.getObject().isAuthenticated() )
  {
    if ( LOG.isDebugEnabled() )
    {
      LOG.debug( I18n.msg( I18n.MSG_04147_REBIND_CONNECTION_DROPPED, connection ) );
    }
    
    connectionFactory.bindConnection( connection.getObject() );
  }
}

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

if ( !connection.isConnected() || !connection.isAuthenticated()
  || ( ( MonitoringLdapConnection ) connection ).bindCalled() )

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

if ( !connection.isConnected() || !connection.isAuthenticated()
  || ( ( MonitoringLdapConnection ) connection ).bindCalled() )

相关文章