Skip to content

Commit e9be173

Browse files
committed
bug symfony#48983 Fix BC user_identifier support after deprecation username (vtsykun)
This PR was merged into the 5.4 branch. Discussion ---------- Fix BC user_identifier support after deprecation username | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Starting from Symfony 6.2, the `{username}` string was deprecated in favor of `{user_identifier}` so here fixed BC support, like it was done for `LdapUserProvider` https://github.com/symfony/symfony/blob/fe23f0f3e4ebf8793b91a04225dcb6aeb80edbcf/src/Symfony/Component/Ldap/Security/LdapUserProvider.php#L80 Commits ------- adb9287 Fix user_identifier support after username has been deprecated in favor of it.
2 parents 9e65ee1 + adb9287 commit e9be173

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Ldap/Security/CheckLdapCredentialsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function onCheckPassport(CheckPassportEvent $event)
8585
}
8686
// @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0
8787
$username = $ldap->escape(method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(), '', LdapInterface::ESCAPE_FILTER);
88-
$query = str_replace('{username}', $username, $ldapBadge->getQueryString());
88+
$query = str_replace(['{username}', '{user_identifier}'], $username, $ldapBadge->getQueryString());
8989
$result = $ldap->query($ldapBadge->getDnString(), $query)->execute();
9090
if (1 !== $result->count()) {
9191
throw new BadCredentialsException('The presented username is invalid.');

0 commit comments

Comments
 (0)