Added LDAP Service account support for LDAP server that don't allow anon

This commit is contained in:
Ben Tyger 2021-05-18 14:26:52 -04:00
parent 7e0e0db384
commit 8b333c935d

View file

@ -46,6 +46,16 @@ abstract class AuthController extends Controller
ldap_set_option($server, LDAP_OPT_NETWORK_TIMEOUT, 10);
}
$serviceAccountFQDN= (array_key_exists('service_account_dn', $this->config['ldap'])) ?
$this->config['ldap']['service_account_dn'] : null;
if (is_string($serviceAccountFQDN)) {
if (ldap_bind($server,$serviceAccountFQDN,$this->config['ldap']['service_account_password']) === false) {
$this->logger->error("Bind with service account ($serviceAccountFQDN) failed.");
return false;
}
}
return $server;
}