Skip to content

Commit d8d0624

Browse files
authored
Update LdapBindAuthenticationProvider.php
1 parent c36e6b3 commit d8d0624

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Authentication/Provider/LdapBindAuthenticationProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
8787
}
8888

8989
try {
90-
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
91-
9290
if ($this->queryString) {
91+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_FILTER);
9392
$query = str_replace('{username}', $username, $this->queryString);
9493
$result = $this->ldap->query($this->dnString, $query)->execute();
9594
if (1 !== $result->count()) {
@@ -98,6 +97,7 @@ protected function checkAuthentication(UserInterface $user, UsernamePasswordToke
9897

9998
$dn = $result[0]->getDn();
10099
} else {
100+
$username = $this->ldap->escape($username, '', LdapInterface::ESCAPE_DN);
101101
$dn = str_replace('{username}', $username, $this->dnString);
102102
}
103103

0 commit comments

Comments
 (0)