Fast Bind

The fast bind extended operation allows an Active Directory server to process concurrent bind requests on the same connection. Successful binds do not perform authorization steps and the connection remains authorized as an anonymous user. Once the fast bind operation is performed it cannot be disabled and the operation must be performed before any other bind is attempted. Only simple binds are supported.

// use a format dn resolver
FormatDnResolver dnResolver = new FormatDnResolver("%s@ldaptive.org");

// use a pooled bind authentication handler
ConnectionConfig handlerConfig = new ConnectionConfig("ldap://directory.ldaptive.org");
handlerConfig.setUseStartTLS(true);
handlerConfig.setConnectionInitializer(new FastBindOperation.FastBindConnectionInitializer());
BlockingConnectionPool handlerPool = new BlockingConnectionPool(new DefaultConnectionFactory(handlerConfig));
handlerPool.initialize();

PooledBindAuthenticationHandler authHandler = new PooledBindAuthenticationHandler(new PooledConnectionFactory(handlerPool));

Authenticator auth = new Authenticator(dnResolver, authHandler);
AuthenticationResponse response = auth.authenticate(
  new AuthenticationRequest("dfisher", new Credential("password")));
if (response.getResult()) { // authentication succeeded

} else { // authentication failed
  String msg = response.getMessage(); // read the failure message
}