Merge pull request #8371 from snipe/bushelpowered-develop
Fixed #7919 - LDAP Logins + query filters
This commit is contained in:
commit
5abd85003c
1 changed files with 4 additions and 5 deletions
|
@ -63,6 +63,8 @@ class LdapAd extends LdapAdConfiguration
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
if($this->isLdapEnabled()) {
|
if($this->isLdapEnabled()) {
|
||||||
|
$this->ldapConfig['account_prefix'] = $this->ldapSettings['ldap_auth_filter_query'];
|
||||||
|
$this->ldapConfig['account_suffix'] = ','.$this->ldapConfig['base_dn'];
|
||||||
$this->ldap = new Adldap();
|
$this->ldap = new Adldap();
|
||||||
$this->ldap->addProvider($this->ldapConfig);
|
$this->ldap->addProvider($this->ldapConfig);
|
||||||
return true;
|
return true;
|
||||||
|
@ -90,12 +92,9 @@ class LdapAd extends LdapAdConfiguration
|
||||||
$username .= '@' . $this->ldapSettings['ad_domain'];
|
$username .= '@' . $this->ldapSettings['ad_domain'];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->ldap->auth()->attempt($username, $password, true) === false) {
|
||||||
$this->ldap->auth()->attempt($username, $password);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
throw new Exception('Unable to validate user credentials!');
|
throw new Exception('Unable to validate user credentials!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should we sync the logged in user
|
// Should we sync the logged in user
|
||||||
Log::debug('Attempting to find user in LDAP directory');
|
Log::debug('Attempting to find user in LDAP directory');
|
||||||
|
|
Loading…
Add table
Reference in a new issue