bug #27847 [Security] Fix accepting null as $uidKey in LdapUserProvider (louhde)

This PR was merged into the 4.0 branch.

Discussion
----------

[Security] Fix accepting null as $uidKey in LdapUserProvider

| Q             | A
| ------------- | ---
| Branch?       | 4.0
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Fixing the hard BC break introduced in afeb89fa06 (diff-96df7b4cb1c79ec0877d79ae2b61899dL40)

Commits
-------

c776259 [Security] LdapUserProvider uidKey could be null
This commit is contained in:
Robin Chalas 2018-07-05 07:48:23 +02:00
commit 8a96fdcd5e

View File

@ -35,8 +35,12 @@ 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 = 'sAMAccountName', string $filter = '({uid_key}={username})', string $passwordAttribute = null)
{
if (null === $uidKey) {
$uidKey = 'sAMAccountName';
}
$this->ldap = $ldap;
$this->baseDn = $baseDn;
$this->searchDn = $searchDn;