[Security] Allow passing null as $filter in LdapUserProvider to get the default filter

This commit is contained in:
louhde 2018-07-05 12:12:34 +02:00
parent 7135aa4338
commit c6f87c6e3a
2 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@ CHANGELOG
custom anonymous and remember me token classes is deprecated. To
use custom tokens, extend the existing `Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`
or `Symfony\Component\Security\Core\Authentication\Token\RememberMeToken`.
* allow passing null as $filter in LdapUserProvider to get the default filter
4.1.0
-----

View File

@ -35,12 +35,16 @@ class LdapUserProvider implements UserProviderInterface
private $defaultSearch;
private $passwordAttribute;
public function __construct(LdapInterface $ldap, string $baseDn, string $searchDn = null, string $searchPassword = null, array $defaultRoles = array(), ?string $uidKey = 'sAMAccountName', string $filter = '({uid_key}={username})', string $passwordAttribute = null)
public function __construct(LdapInterface $ldap, string $baseDn, string $searchDn = null, string $searchPassword = null, array $defaultRoles = array(), string $uidKey = null, string $filter = null, string $passwordAttribute = null)
{
if (null === $uidKey) {
$uidKey = 'sAMAccountName';
}
if (null === $filter) {
$filter = '({uid_key}={username})';
}
$this->ldap = $ldap;
$this->baseDn = $baseDn;
$this->searchDn = $searchDn;