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("");

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

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