Skip to content

Commit

Permalink
renamed reloadUserByAccount() to loadUserByAccount()
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Dec 18, 2010
1 parent df6ffbb commit b57411b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
Expand Up @@ -45,7 +45,7 @@ public function loadUserByUsername($username)
/**
* {@inheritDoc}
*/
public function reloadUserByAccount(AccountInterface $account)
public function loadUserByAccount(AccountInterface $account)
{
if (!$account instanceof $this->class) {
throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));
Expand Down
Expand Up @@ -45,7 +45,7 @@ public function loadUserByUsername($username)
/**
* {@inheritDoc}
*/
public function reloadUserByAccount(AccountInterface $account)
public function loadUserByAccount(AccountInterface $account)
{
if (!$account instanceof $this->class) {
throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));
Expand Down
Expand Up @@ -123,6 +123,7 @@ public function write(Event $event, Response $response)
* Refreshes the user by reloading it from the user provider
*
* @param TokenInterface $token
*
* @return TokenInterface|null
*/
protected function refreshUser(TokenInterface $token)
Expand All @@ -138,7 +139,7 @@ protected function refreshUser(TokenInterface $token)

foreach ($this->userProviders as $provider) {
try {
$cUser = $provider->reloadUserByAccount($user);
$cUser = $provider->loadUserByAccount($user);

$token->setRoles($cUser->getRoles());
$token->setUser($cUser);
Expand All @@ -149,12 +150,12 @@ protected function refreshUser(TokenInterface $token)

return $token;
} catch (UnsupportedAccountException $unsupported) {
// let's try the next user provider
} catch (UsernameNotFoundException $notFound) {

return null;
}
}

throw new \RuntimeException(sprintf('There is no user provider for user "%s".', get_class($user)));
}
}
}
Expand Up @@ -87,7 +87,7 @@ protected function retrieveUser($username, UsernamePasswordToken $token)
if (!$user instanceof AccountInterface) {
throw new AuthenticationServiceException('The user provider must return an AccountInterface object.');
}

return $user;
} catch (UsernameNotFoundException $notFound) {
throw $notFound;
Expand Down
Expand Up @@ -59,11 +59,11 @@ public function authenticate(TokenInterface $token)
if (!$user instanceof AccountInterface) {
throw new AuthenticationServiceException('retrieveUser() must return an AccountInterface.');
}

$this->accountChecker->checkPreAuth($user);
$this->checkAuthentication($user, $token);
$this->accountChecker->checkPostAuth($user);

return new UsernamePasswordToken($user, $token->getCredentials(), $user->getRoles());
} catch (UsernameNotFoundException $notFound) {
if ($this->hideUserNotFoundExceptions) {
Expand Down
Expand Up @@ -79,7 +79,7 @@ public function loadUserByUsername($username)
/**
* {@inheritDoc}
*/
public function reloadUserByAccount(AccountInterface $account)
public function loadUserByAccount(AccountInterface $account)
{
if (!$account instanceof User) {
throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));
Expand Down
8 changes: 5 additions & 3 deletions src/Symfony/Component/Security/User/UserProviderInterface.php
Expand Up @@ -27,20 +27,22 @@ interface UserProviderInterface
*
* @throws UsernameNotFoundException if the user is not found
* @param string $username The username
*
* @return AccountInterface
*/
function loadUserByUsername($username);

/**
* Loads the user for the account interface.
*
*
* It is up to the implementation if it decides to reload the user data
* from the database, or if it simply merges the passed User into the
* identity map of an entity manager.
*
*
* @throws UnsupportedAccountException if the account is not supported
* @param AccountInterface $user
*
* @return AccountInterface
*/
function reloadUserByAccount(AccountInterface $user);
function loadUserByAccount(AccountInterface $user);
}

0 comments on commit b57411b

Please sign in to comment.