|
@@ -34,18 +34,20 @@ abstract class AuthController extends Controller
|
|
|
$this->logger->error('The LDAP extension is not loaded.');
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
+ // Building LDAP URI
|
|
|
$ldapSchema=array_key_exists('schema', $this->config['ldap']) ?
|
|
|
strtolower($this->config['ldap']['schema']) : 'ldap';
|
|
|
$ldapURI="$ldapSchema://".$this->config['ldap']['host'].':'.$this->config['ldap']['port'];
|
|
|
+
|
|
|
+ // Connecting to LDAP server
|
|
|
$server = ldap_connect($ldapURI);
|
|
|
-
|
|
|
if ($server) {
|
|
|
ldap_set_option($server, LDAP_OPT_PROTOCOL_VERSION, 3);
|
|
|
ldap_set_option($server, LDAP_OPT_REFERRALS, 0);
|
|
|
ldap_set_option($server, LDAP_OPT_NETWORK_TIMEOUT, 10);
|
|
|
}
|
|
|
|
|
|
+ // Authenticating LDAP service account
|
|
|
$serviceAccountFQDN= (array_key_exists('service_account_dn', $this->config['ldap'])) ?
|
|
|
$this->config['ldap']['service_account_dn'] : null;
|
|
|
if (is_string($serviceAccountFQDN)) {
|