async function ldapCanBind(config) {
  if (!config.get('ldapAuthEnabled')) {
    return;
  }

  const bindDN = config.get('ldapBindDN');
  const bindCredentials = config.get('ldapPassword');

  // Establish LDAP client
  let client;
  let canBind = false;

  try {
    client = getClient(config);
    await bindClient(client, bindDN, bindCredentials);
    canBind = true;
  } catch (error) {
    appLog.error(error, 'Error binding ldap');
  }

  // try to unbind in case connected
  try {
    if (client) {
      client.unbind();
    }
  } catch (error) {
    // ignore error
  }

  return canBind;
}
Tries to bind and returns boolean.
Connection is immediately closed.
@param {import('./config/index')} config