Tweaks thanks to Wouter

This commit is contained in:
Ryan Weaver 2015-09-20 19:51:09 -04:00
parent c9d9430913
commit 396a1622dc
2 changed files with 3 additions and 6 deletions

View File

@ -114,24 +114,21 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface
if (!$user instanceof UserInterface) {
throw new \UnexpectedValueException(sprintf(
'The %s::getUser method must return a UserInterface. You returned %s.',
'The %s::getUser() method must return a UserInterface. You returned %s.',
get_class($guardAuthenticator),
is_object($user) ? get_class($user) : gettype($user)
));
}
// check the preAuth UserChecker
$this->userChecker->checkPreAuth($user);
// check the credentials
$guardAuthenticator->checkCredentials($token->getCredentials(), $user);
// check the postAuth UserChecker
$this->userChecker->checkPostAuth($user);
// turn the UserInterface into a TokenInterface
$authenticatedToken = $guardAuthenticator->createAuthenticatedToken($user, $this->providerKey);
if (!$authenticatedToken instanceof TokenInterface) {
throw new \UnexpectedValueException(sprintf(
'The %s::createAuthenticatedToken method must return a TokenInterface. You returned %s.',
'The %s::createAuthenticatedToken() method must return a TokenInterface. You returned %s.',
get_class($guardAuthenticator),
is_object($authenticatedToken) ? get_class($authenticatedToken) : gettype($authenticatedToken)
));

View File

@ -60,6 +60,6 @@ class PreAuthenticationGuardToken extends AbstractToken implements GuardTokenInt
public function setAuthenticated($authenticated)
{
throw new \LogicException('The PreAuthenticationGuardToken is *always* not authenticated.');
throw new \LogicException('The PreAuthenticationGuardToken is *never* authenticated.');
}
}