diff options
author | Johannes Schmitt <schmittjoh@gmail.com> | 2010-12-08 13:51:26 +0100 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2010-12-15 17:38:30 +0100 |
commit | a77e6b5f60bd1dac4d7ba19a900d72ae45d9fe26 (patch) | |
tree | a594a87afbc527dcc458d18558cf5bea3f08b1e9 /Authentication/Provider/UserAuthenticationProvider.php | |
parent | b8fc4a14f4cff6bb490cf04422716a2949b6f3bc (diff) | |
download | symfony-security-a77e6b5f60bd1dac4d7ba19a900d72ae45d9fe26.zip symfony-security-a77e6b5f60bd1dac4d7ba19a900d72ae45d9fe26.tar.gz symfony-security-a77e6b5f60bd1dac4d7ba19a900d72ae45d9fe26.tar.bz2 |
fixed user refreshing after unserialization
Diffstat (limited to 'Authentication/Provider/UserAuthenticationProvider.php')
-rw-r--r-- | Authentication/Provider/UserAuthenticationProvider.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Authentication/Provider/UserAuthenticationProvider.php b/Authentication/Provider/UserAuthenticationProvider.php index 60c58c1..f621e42 100644 --- a/Authentication/Provider/UserAuthenticationProvider.php +++ b/Authentication/Provider/UserAuthenticationProvider.php @@ -54,7 +54,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter $username = null === $token->getUser() ? 'NONE_PROVIDED' : (string) $token; try { - $user = $this->retrieveUser($username, $token); + $result = $this->retrieveUser($username, $token); } catch (UsernameNotFoundException $notFound) { if ($this->hideUserNotFoundExceptions) { throw new BadCredentialsException('Bad credentials', 0, $notFound); @@ -63,15 +63,16 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter throw $notFound; } - if (!$user instanceof AccountInterface) { - throw new AuthenticationServiceException('The retrieveUser() methods must return an AccountInterface object.'); + if (!is_array($result) || 2 !== count($result)) { + throw new AuthenticationServiceException('retrieveUser() did not return an array, or array had invalid format.'); } + list($user, $userProviderName) = $result; $this->accountChecker->checkPreAuth($user); $this->checkAuthentication($user, $token); $this->accountChecker->checkPostAuth($user); - return new UsernamePasswordToken($user, $token->getCredentials(), $user->getRoles()); + return new UsernamePasswordToken($user, $token->getCredentials(), $userProviderName, $user->getRoles()); } /** @@ -88,7 +89,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter * @param string $username The username to retrieve * @param UsernamePasswordToken $token The Token * - * @return AccountInterface The user + * @return array The user * * @throws AuthenticationException if the credentials could not be validated */ |