Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6f87c6

Browse files
author
louhde
committed
[Security] Allow passing null as $filter in LdapUserProvider to get the default filter
1 parent 7135aa4 commit c6f87c6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Symfony/Component/Security/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CHANGELOG
1111
custom anonymous and remember me token classes is deprecated. To
1212
use custom tokens, extend the existing `Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`
1313
or `Symfony\Component\Security\Core\Authentication\Token\RememberMeToken`.
14+
* allow passing null as $filter in LdapUserProvider to get the default filter
1415

1516
4.1.0
1617
-----

src/Symfony/Component/Security/Core/User/LdapUserProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ class LdapUserProvider implements UserProviderInterface
3535
private $defaultSearch;
3636
private $passwordAttribute;
3737

38-
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)
38+
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)
3939
{
4040
if (null === $uidKey) {
4141
$uidKey = 'sAMAccountName';
4242
}
4343

44+
if (null === $filter) {
45+
$filter = '({uid_key}={username})';
46+
}
47+
4448
$this->ldap = $ldap;
4549
$this->baseDn = $baseDn;
4650
$this->searchDn = $searchDn;

0 commit comments

Comments
 (0)