Skip to content

Commit b575ddc

Browse files
authored
Merge pull request #6 from mapbender/fix/user-exception
Fix/user exception
2 parents 60705b2 + 9cfa093 commit b575ddc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v2.0.2
2+
* Replace UsernameNotFoundException with new UserNotFoundException
3+
14
## v2.0.1
25
* Change to ldap_search function instead of ldap_list
36

Security/LdapUserProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Ldap\Adapter\QueryInterface;
66
use Symfony\Component\Ldap\Entry;
77
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
8-
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
8+
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
99
use Symfony\Component\Security\Core\User\UserInterface;
1010
use Symfony\Component\Security\Core\User\UserProviderInterface;
1111
use Mapbender\LDAPBundle\Security\LdapClient;
@@ -65,7 +65,7 @@ public function loadUserByIdentifier(string $username): UserInterface
6565
// skips to the next provider, if any
6666
/** @see \Symfony\Component\Security\Core\User\ChainUserProvider::loadUserByUsername() */
6767
if (!$this->client->getHost()) {
68-
throw new UsernameNotFoundException('LDAP lookup disabled with empty host configuration', 0);
68+
throw new UserNotFoundException('LDAP lookup disabled with empty host configuration', 0);
6969
}
7070

7171
$this->client->bind();
@@ -76,7 +76,7 @@ public function loadUserByIdentifier(string $username): UserInterface
7676
$roles = $this->findLdapUserRoles($results[0]);
7777
return new LdapUser($username, $roles);
7878
} else {
79-
throw new UsernameNotFoundException(sprintf('User "%s" could not be fetched from LDAP.', $username), 0);
79+
throw new UserNotFoundException(sprintf('User "%s" could not be fetched from LDAP.', $username), 0);
8080
}
8181
}
8282

0 commit comments

Comments
 (0)