From ee5b6aa0c81e4fa74ccdbef73e34642eb4d848af Mon Sep 17 00:00:00 2001 From: PhilVanB Date: Mon, 8 Jul 2024 13:30:08 +0200 Subject: [PATCH 1/2] Fix UserNotFoundException --- Security/LdapUserProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Security/LdapUserProvider.php b/Security/LdapUserProvider.php index cc4c76d..1f5dbb3 100644 --- a/Security/LdapUserProvider.php +++ b/Security/LdapUserProvider.php @@ -5,7 +5,7 @@ use Symfony\Component\Ldap\Adapter\QueryInterface; use Symfony\Component\Ldap\Entry; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; +use Symfony\Component\Security\Core\Exception\UserNotFoundException; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserProviderInterface; use Mapbender\LDAPBundle\Security\LdapClient; @@ -65,7 +65,7 @@ public function loadUserByIdentifier(string $username): UserInterface // skips to the next provider, if any /** @see \Symfony\Component\Security\Core\User\ChainUserProvider::loadUserByUsername() */ if (!$this->client->getHost()) { - throw new UsernameNotFoundException('LDAP lookup disabled with empty host configuration', 0); + throw new UserNotFoundException('LDAP lookup disabled with empty host configuration', 0); } $this->client->bind(); @@ -76,7 +76,7 @@ public function loadUserByIdentifier(string $username): UserInterface $roles = $this->findLdapUserRoles($results[0]); return new LdapUser($username, $roles); } else { - throw new UsernameNotFoundException(sprintf('User "%s" could not be fetched from LDAP.', $username), 0); + throw new UserNotFoundException(sprintf('User "%s" could not be fetched from LDAP.', $username), 0); } } From 9cfa093186d3dbe013bcbae3c5d1ac7de1f49f73 Mon Sep 17 00:00:00 2001 From: PhilVanB Date: Mon, 8 Jul 2024 13:32:54 +0200 Subject: [PATCH 2/2] Update Changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa53b46..3a31e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v2.0.2 +* Replace UsernameNotFoundException with new UserNotFoundException + ## v2.0.1 * Change to ldap_search function instead of ldap_list