bind method

  1. @override
Future<LdapResult> bind({
  1. String? DN,
  2. String? password,
})
override

Performs an LDAP BIND operation.

Sends a bind request using the credentials that were set by the constructor or passed in via DN and password. If DN or password are provided, the values are saved for future bind operations.

Returns a Future containing the result of the BIND operation.

Implementation

@override
Future<LdapResult> bind({String? DN, String? password}) async {
  var c = await getConnection(bind: false);
  try {
    LdapResult result;
    if (DN != null && password != null) {
      loggerPool.finest(() => 'bind($DN)');
      result = await c.bind(DN: DN, password: password);
    } else {
      result = await c.bind();
    }
    loggerPool.finest(() => 'Bind result $result');
    return result;
  } on LdapException catch (e) {
    loggerPool.severe(e);
  } finally {
    await releaseConnection(c);
  }
  throw LdapPoolException('Could not bind');
}