Update LdapBindAuthenticationProvider.php

This commit is contained in:
stoccc 2020-04-19 23:34:01 +02:00 committed by GitHub
parent 62565a1b66
commit 4bda68a9a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,9 +87,8 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
}
try {
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
if ($this->queryString) {
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
$query = str_replace('{username}', $username, $this->queryString);
$result = $this->ldap->query($this->dnString, $query)->execute();
if (1 !== $result->count()) {
@ -98,6 +97,7 @@ class LdapBindAuthenticationProvider extends UserAuthenticationProvider
$dn = $result[0]->getDn();
} else {
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
$dn = str_replace('{username}', $username, $this->dnString);
}