summaryrefslogtreecommitdiffstats
path: root/Core/User
diff options
context:
space:
mode:
authorAbhoryo <zenyaku@free.fr>2011-08-14 00:00:10 +0300
committerAbhoryo <zenyaku@free.fr>2011-08-14 00:00:10 +0300
commitf65e28b6e57edd97e0639dd1686616da75fdf235 (patch)
treef855c49e964fa0b50df5bd48bbaf4912b08c50dd /Core/User
parentfa4b69a12979d49baeb177c81da1c318de361df2 (diff)
downloadsymfony-security-f65e28b6e57edd97e0639dd1686616da75fdf235.zip
symfony-security-f65e28b6e57edd97e0639dd1686616da75fdf235.tar.gz
symfony-security-f65e28b6e57edd97e0639dd1686616da75fdf235.tar.bz2
Search in others user providers when a user is not found in the first user provider and throws the right exception.
Diffstat (limited to 'Core/User')
-rw-r--r--Core/User/ChainUserProvider.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/Core/User/ChainUserProvider.php b/Core/User/ChainUserProvider.php
index e6aca32..84aa012 100644
--- a/Core/User/ChainUserProvider.php
+++ b/Core/User/ChainUserProvider.php
@@ -52,15 +52,23 @@ class ChainUserProvider implements UserProviderInterface
*/
public function refreshUser(UserInterface $user)
{
+ $supportedUserFound = false;
+
foreach ($this->providers as $provider) {
try {
return $provider->refreshUser($user);
} catch (UnsupportedUserException $unsupported) {
// try next one
+ } catch (UsernameNotFoundException $notFound) {
+ // try next one
+ $supportedUserFound = true;
}
}
-
- throw new UnsupportedUserException(sprintf('The account "%s" is not supported.', get_class($user)));
+
+ if ($supportedUserFound)
+ throw new UsernameNotFoundException(sprintf('There is no user with name "%s".', $user->getUsername()));
+ else
+ throw new UnsupportedUserException(sprintf('The account "%s" is not supported.', get_class($user)));
}
/**