summaryrefslogtreecommitdiffstats
path: root/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Core')
-rw-r--r--Core/Authentication/AuthenticationTrustResolver.php2
-rw-r--r--Core/Authentication/Provider/DaoAuthenticationProvider.php3
-rw-r--r--Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php1
-rw-r--r--Core/Authentication/Provider/RememberMeAuthenticationProvider.php1
-rw-r--r--Core/Authentication/Provider/UserAuthenticationProvider.php30
-rw-r--r--Core/Authentication/Token/AnonymousToken.php1
-rw-r--r--Core/Authentication/Token/RememberMeToken.php2
-rw-r--r--Core/Authorization/Voter/AuthenticatedVoter.php2
-rw-r--r--Core/Exception/NonceExpiredException.php3
-rw-r--r--Core/SecurityContext.php2
-rw-r--r--Core/SecurityContextInterface.php1
-rw-r--r--Core/User/ChainUserProvider.php2
-rw-r--r--Core/User/UserCheckerInterface.php4
-rw-r--r--Core/User/UserInterface.php2
14 files changed, 24 insertions, 32 deletions
diff --git a/Core/Authentication/AuthenticationTrustResolver.php b/Core/Authentication/AuthenticationTrustResolver.php
index 8ca28fb..9b3ff3d 100644
--- a/Core/Authentication/AuthenticationTrustResolver.php
+++ b/Core/Authentication/AuthenticationTrustResolver.php
@@ -28,8 +28,6 @@ class AuthenticationTrustResolver implements AuthenticationTrustResolverInterfac
*
* @param string $anonymousClass
* @param string $rememberMeClass
- *
- * @return void
*/
public function __construct($anonymousClass, $rememberMeClass)
{
diff --git a/Core/Authentication/Provider/DaoAuthenticationProvider.php b/Core/Authentication/Provider/DaoAuthenticationProvider.php
index f9e8b38..f17eaa4 100644
--- a/Core/Authentication/Provider/DaoAuthenticationProvider.php
+++ b/Core/Authentication/Provider/DaoAuthenticationProvider.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Authentication\Provider;
-use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
@@ -84,7 +83,7 @@ class DaoAuthenticationProvider extends UserAuthenticationProvider
$user = $this->userProvider->loadUserByUsername($username);
if (!$user instanceof UserInterface) {
- throw new AuthenticationServiceException('The user provider must return an UserInterface object.');
+ throw new AuthenticationServiceException('The user provider must return a UserInterface object.');
}
return $user;
diff --git a/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php b/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
index e4bf963..3affd78 100644
--- a/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
+++ b/Core/Authentication/Provider/PreAuthenticatedAuthenticationProvider.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Authentication\Provider;
-use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
diff --git a/Core/Authentication/Provider/RememberMeAuthenticationProvider.php b/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
index fb687b2..b7f3125 100644
--- a/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
+++ b/Core/Authentication/Provider/RememberMeAuthenticationProvider.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Core\Authentication\Provider;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
-use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
diff --git a/Core/Authentication/Provider/UserAuthenticationProvider.php b/Core/Authentication/Provider/UserAuthenticationProvider.php
index 8183c62..f0463ea 100644
--- a/Core/Authentication/Provider/UserAuthenticationProvider.php
+++ b/Core/Authentication/Provider/UserAuthenticationProvider.php
@@ -65,26 +65,34 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
try {
$user = $this->retrieveUser($username, $token);
-
- if (!$user instanceof UserInterface) {
- throw new AuthenticationServiceException('retrieveUser() must return an UserInterface.');
+ } catch (UsernameNotFoundException $notFound) {
+ if ($this->hideUserNotFoundExceptions) {
+ throw new BadCredentialsException('Bad credentials', 0, $notFound);
}
+ throw $notFound;
+ }
+
+ if (!$user instanceof UserInterface) {
+ throw new AuthenticationServiceException('retrieveUser() must return a UserInterface.');
+ }
+
+ try {
$this->userChecker->checkPreAuth($user);
$this->checkAuthentication($user, $token);
$this->userChecker->checkPostAuth($user);
-
- $authenticatedToken = new UsernamePasswordToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
- $authenticatedToken->setAttributes($token->getAttributes());
-
- return $authenticatedToken;
- } catch (UsernameNotFoundException $notFound) {
+ } catch (BadCredentialsException $e) {
if ($this->hideUserNotFoundExceptions) {
- throw new BadCredentialsException('Bad credentials', 0, $notFound);
+ throw new BadCredentialsException('Bad credentials', 0, $e);
}
- throw $notFound;
+ throw $e;
}
+
+ $authenticatedToken = new UsernamePasswordToken($user, $token->getCredentials(), $this->providerKey, $user->getRoles());
+ $authenticatedToken->setAttributes($token->getAttributes());
+
+ return $authenticatedToken;
}
/**
diff --git a/Core/Authentication/Token/AnonymousToken.php b/Core/Authentication/Token/AnonymousToken.php
index 92d95de..ecdd4cc 100644
--- a/Core/Authentication/Token/AnonymousToken.php
+++ b/Core/Authentication/Token/AnonymousToken.php
@@ -16,7 +16,6 @@ namespace Symfony\Component\Security\Core\Authentication\Token;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
-use Symfony\Component\Security\Core\User\UserInterface;
class AnonymousToken extends AbstractToken
{
diff --git a/Core/Authentication/Token/RememberMeToken.php b/Core/Authentication/Token/RememberMeToken.php
index 81ab1c2..fe30c21 100644
--- a/Core/Authentication/Token/RememberMeToken.php
+++ b/Core/Authentication/Token/RememberMeToken.php
@@ -51,7 +51,7 @@ class RememberMeToken extends AbstractToken
public function setAuthenticated($authenticated)
{
if ($authenticated) {
- throw new \RuntimeException('You cannot set this token to authenticated after creation.');
+ throw new \LogicException('You cannot set this token to authenticated after creation.');
}
parent::setAuthenticated(false);
diff --git a/Core/Authorization/Voter/AuthenticatedVoter.php b/Core/Authorization/Voter/AuthenticatedVoter.php
index d750e33..5847e0d 100644
--- a/Core/Authorization/Voter/AuthenticatedVoter.php
+++ b/Core/Authorization/Voter/AuthenticatedVoter.php
@@ -35,8 +35,6 @@ class AuthenticatedVoter implements VoterInterface
* Constructor.
*
* @param AuthenticationTrustResolverInterface $authenticationTrustResolver
- *
- * @return void
*/
public function __construct(AuthenticationTrustResolverInterface $authenticationTrustResolver)
{
diff --git a/Core/Exception/NonceExpiredException.php b/Core/Exception/NonceExpiredException.php
index 72b6d57..6a6a781 100644
--- a/Core/Exception/NonceExpiredException.php
+++ b/Core/Exception/NonceExpiredException.php
@@ -12,9 +12,6 @@
namespace Symfony\Component\Security\Core\Exception;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
-use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\Log\LoggerInterface;
/**
* NonceExpiredException is thrown when an authentication is rejected because
diff --git a/Core/SecurityContext.php b/Core/SecurityContext.php
index c492339..1065163 100644
--- a/Core/SecurityContext.php
+++ b/Core/SecurityContext.php
@@ -11,12 +11,10 @@
namespace Symfony\Component\Security\Core;
-use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
-use Symfony\Component\Security\Acl\Voter\FieldVote;
/**
* SecurityContext is the main entry point of the Security component.
diff --git a/Core/SecurityContextInterface.php b/Core/SecurityContextInterface.php
index d57c409..d0c7214 100644
--- a/Core/SecurityContextInterface.php
+++ b/Core/SecurityContextInterface.php
@@ -35,7 +35,6 @@ interface SecurityContextInterface
* Sets the authentication token.
*
* @param TokenInterface $token
- * @return void
*/
function setToken(TokenInterface $token = null);
diff --git a/Core/User/ChainUserProvider.php b/Core/User/ChainUserProvider.php
index b0556f7..14a0dec 100644
--- a/Core/User/ChainUserProvider.php
+++ b/Core/User/ChainUserProvider.php
@@ -64,7 +64,7 @@ class ChainUserProvider implements UserProviderInterface
// try next one
}
}
-
+
if ($supportedUserFound) {
throw new UsernameNotFoundException(sprintf('There is no user with name "%s".', $user->getUsername()));
} else {
diff --git a/Core/User/UserCheckerInterface.php b/Core/User/UserCheckerInterface.php
index 25de94a..61f0f6e 100644
--- a/Core/User/UserCheckerInterface.php
+++ b/Core/User/UserCheckerInterface.php
@@ -23,14 +23,14 @@ interface UserCheckerInterface
/**
* Checks the user account before authentication.
*
- * @param UserInterface $user An UserInterface instance
+ * @param UserInterface $user a UserInterface instance
*/
function checkPreAuth(UserInterface $user);
/**
* Checks the user account after authentication.
*
- * @param UserInterface $user An UserInterface instance
+ * @param UserInterface $user a UserInterface instance
*/
function checkPostAuth(UserInterface $user);
}
diff --git a/Core/User/UserInterface.php b/Core/User/UserInterface.php
index 9091bfc..f6356fe 100644
--- a/Core/User/UserInterface.php
+++ b/Core/User/UserInterface.php
@@ -48,8 +48,6 @@ interface UserInterface
/**
* Removes sensitive data from the user.
- *
- * @return void
*/
function eraseCredentials();