summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Acl/Dbal/AclProvider.php7
-rw-r--r--Acl/Domain/Acl.php3
-rw-r--r--Acl/Domain/Entry.php1
-rw-r--r--Acl/Domain/PermissionGrantingStrategy.php1
-rw-r--r--Acl/Domain/SecurityIdentityRetrievalStrategy.php1
-rw-r--r--Acl/Domain/UserSecurityIdentity.php2
-rw-r--r--Acl/Voter/AclVoter.php4
-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.php2
-rw-r--r--Core/Authentication/RememberMe/TokenProviderInterface.php11
-rw-r--r--Core/Authentication/Token/AnonymousToken.php1
-rw-r--r--Core/Authentication/Token/RememberMeToken.php3
-rw-r--r--Core/Authorization/Voter/VoterInterface.php2
-rw-r--r--Core/Encoder/EncoderFactory.php1
-rw-r--r--Core/Encoder/EncoderFactoryInterface.php3
-rw-r--r--Core/Exception/NonceExpiredException.php3
-rw-r--r--Core/SecurityContext.php10
-rw-r--r--Core/SecurityContextInterface.php2
-rw-r--r--Core/User/ChainUserProvider.php2
-rw-r--r--Core/User/UserCheckerInterface.php4
-rw-r--r--Core/User/UserInterface.php1
-rw-r--r--Http/EntryPoint/RetryAuthenticationEntryPoint.php1
-rw-r--r--Http/Firewall.php1
-rw-r--r--Http/Firewall/ContextListener.php5
-rw-r--r--Http/Firewall/ExceptionListener.php9
-rw-r--r--Http/Firewall/ListenerInterface.php1
-rw-r--r--Http/Firewall/LogoutListener.php2
-rw-r--r--Http/Firewall/RememberMeListener.php5
-rw-r--r--Http/Firewall/SwitchUserListener.php1
-rw-r--r--Http/FirewallMapInterface.php1
-rw-r--r--Http/HttpUtils.php8
-rw-r--r--Http/Logout/CookieClearingLogoutHandler.php4
-rw-r--r--Http/Logout/LogoutHandlerInterface.php1
-rw-r--r--Http/Logout/LogoutSuccessHandlerInterface.php2
-rw-r--r--Http/Logout/SessionLogoutHandler.php1
-rw-r--r--Http/RememberMe/AbstractRememberMeServices.php14
-rw-r--r--Http/RememberMe/PersistentTokenBasedRememberMeServices.php2
-rw-r--r--Http/RememberMe/RememberMeServicesInterface.php3
-rw-r--r--Http/RememberMe/TokenBasedRememberMeServices.php3
-rw-r--r--composer.json22
42 files changed, 91 insertions, 64 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php
index 143dee6..4a8619d 100644
--- a/Acl/Dbal/AclProvider.php
+++ b/Acl/Dbal/AclProvider.php
@@ -375,6 +375,7 @@ QUERY;
* including the ids of parent ACLs.
*
* @param array $batch
+ *
* @return array
*/
private function getAncestorIds(array $batch)
@@ -395,7 +396,8 @@ QUERY;
* Does either overwrite the passed ACE, or saves it in the global identity
* map to ensure every ACE only gets instantiated once.
*
- * @param array $aces
+ * @param array &$aces
+ *
* @return void
*/
private function doUpdateAceIdentityMap(array &$aces)
@@ -447,7 +449,8 @@ QUERY;
* @throws \RuntimeException
* @return \SplObjectStorage
*/
- private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, array $sids) {
+ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, array $sids)
+ {
$parentIdToFill = new \SplObjectStorage();
$acls = $aces = $emptyArray = array();
$oidCache = $oidLookup;
diff --git a/Acl/Domain/Acl.php b/Acl/Domain/Acl.php
index 661b892..bb088f8 100644
--- a/Acl/Domain/Acl.php
+++ b/Acl/Domain/Acl.php
@@ -15,7 +15,6 @@ use Doctrine\Common\PropertyChangedListener;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\AuditableAclInterface;
use Symfony\Component\Security\Acl\Model\EntryInterface;
-use Symfony\Component\Security\Acl\Model\MutableAclInterface;
use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
use Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface;
use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
@@ -588,7 +587,7 @@ class Acl implements AuditableAclInterface, NotifyPropertyChanged
/**
* Updates auditing for an ACE
*
- * @param array $aces
+ * @param array &$aces
* @param integer $index
* @param Boolean $auditSuccess
* @param Boolean $auditFailure
diff --git a/Acl/Domain/Entry.php b/Acl/Domain/Entry.php
index c5226a4..9a4f560 100644
--- a/Acl/Domain/Entry.php
+++ b/Acl/Domain/Entry.php
@@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Acl\Domain;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\AuditableEntryInterface;
-use Symfony\Component\Security\Acl\Model\EntryInterface;
use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
/**
diff --git a/Acl/Domain/PermissionGrantingStrategy.php b/Acl/Domain/PermissionGrantingStrategy.php
index 2cc23bd..c37ce29 100644
--- a/Acl/Domain/PermissionGrantingStrategy.php
+++ b/Acl/Domain/PermissionGrantingStrategy.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Acl\Domain;
use Symfony\Component\Security\Acl\Exception\NoAceFoundException;
-use Symfony\Component\Security\Acl\Exception\SidNotLoadedException;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\AuditLoggerInterface;
use Symfony\Component\Security\Acl\Model\EntryInterface;
diff --git a/Acl/Domain/SecurityIdentityRetrievalStrategy.php b/Acl/Domain/SecurityIdentityRetrievalStrategy.php
index d9e118b..4c16a50 100644
--- a/Acl/Domain/SecurityIdentityRetrievalStrategy.php
+++ b/Acl/Domain/SecurityIdentityRetrievalStrategy.php
@@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Acl\Domain;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
-use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Acl\Model\SecurityIdentityRetrievalStrategyInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver;
diff --git a/Acl/Domain/UserSecurityIdentity.php b/Acl/Domain/UserSecurityIdentity.php
index b6cae4a..df2be38 100644
--- a/Acl/Domain/UserSecurityIdentity.php
+++ b/Acl/Domain/UserSecurityIdentity.php
@@ -45,7 +45,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
}
/**
- * Creates a user security identity from an UserInterface
+ * Creates a user security identity from a UserInterface
*
* @param UserInterface $user
* @return UserSecurityIdentity
diff --git a/Acl/Voter/AclVoter.php b/Acl/Voter/AclVoter.php
index 7dd80f1..d9e8c03 100644
--- a/Acl/Voter/AclVoter.php
+++ b/Acl/Voter/AclVoter.php
@@ -12,9 +12,6 @@
namespace Symfony\Component\Security\Acl\Voter;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
-use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
-use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
-use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Exception\NoAceFoundException;
use Symfony\Component\Security\Acl\Exception\AclNotFoundException;
use Symfony\Component\Security\Acl\Model\AclProviderInterface;
@@ -24,7 +21,6 @@ use Symfony\Component\Security\Acl\Model\SecurityIdentityRetrievalStrategyInterf
use Symfony\Component\Security\Acl\Model\ObjectIdentityRetrievalStrategyInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
-use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
/**
* This voter can be used as a base class for implementing your own permissions.
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..ce78df6 100644
--- a/Core/Authentication/Provider/UserAuthenticationProvider.php
+++ b/Core/Authentication/Provider/UserAuthenticationProvider.php
@@ -67,7 +67,7 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
$user = $this->retrieveUser($username, $token);
if (!$user instanceof UserInterface) {
- throw new AuthenticationServiceException('retrieveUser() must return an UserInterface.');
+ throw new AuthenticationServiceException('retrieveUser() must return a UserInterface.');
}
$this->userChecker->checkPreAuth($user);
diff --git a/Core/Authentication/RememberMe/TokenProviderInterface.php b/Core/Authentication/RememberMe/TokenProviderInterface.php
index b48bd4d..7f86e4e 100644
--- a/Core/Authentication/RememberMe/TokenProviderInterface.php
+++ b/Core/Authentication/RememberMe/TokenProviderInterface.php
@@ -19,23 +19,25 @@ namespace Symfony\Component\Security\Core\Authentication\RememberMe;
interface TokenProviderInterface
{
/**
- * Loads the active token for the given series
+ * Loads the active token for the given series.
*
* @throws TokenNotFoundException if the token is not found
*
* @param string $series
+ *
* @return PersistentTokenInterface
*/
function loadTokenBySeries($series);
/**
- * Deletes all tokens belonging to series
+ * Deletes all tokens belonging to series.
+ *
* @param string $series
*/
function deleteTokenBySeries($series);
/**
- * Updates the token according to this data
+ * Updates the token according to this data.
*
* @param string $series
* @param string $tokenValue
@@ -44,7 +46,8 @@ interface TokenProviderInterface
function updateToken($series, $tokenValue, \DateTime $lastUsed);
/**
- * Creates a new token
+ * Creates a new token.
+ *
* @param PersistentTokenInterface $token
*/
function createNewToken(PersistentTokenInterface $token);
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..7ac9e1c 100644
--- a/Core/Authentication/Token/RememberMeToken.php
+++ b/Core/Authentication/Token/RememberMeToken.php
@@ -30,7 +30,8 @@ class RememberMeToken extends AbstractToken
* @param string $providerKey
* @param string $key
*/
- public function __construct(UserInterface $user, $providerKey, $key) {
+ public function __construct(UserInterface $user, $providerKey, $key)
+ {
parent::__construct($user->getRoles());
if (empty($key)) {
diff --git a/Core/Authorization/Voter/VoterInterface.php b/Core/Authorization/Voter/VoterInterface.php
index b37880f..41d9e64 100644
--- a/Core/Authorization/Voter/VoterInterface.php
+++ b/Core/Authorization/Voter/VoterInterface.php
@@ -45,7 +45,7 @@ interface VoterInterface
/**
* Returns the vote for the given parameters.
*
- * This method must return one of the following constant:
+ * This method must return one of the following constants:
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
*
* @param TokenInterface $token A TokenInterface instance
diff --git a/Core/Encoder/EncoderFactory.php b/Core/Encoder/EncoderFactory.php
index d7ae32d..738706a 100644
--- a/Core/Encoder/EncoderFactory.php
+++ b/Core/Encoder/EncoderFactory.php
@@ -51,6 +51,7 @@ class EncoderFactory implements EncoderFactoryInterface
* Creates the actual encoder instance
*
* @param array $config
+ *
* @return PasswordEncoderInterface
*/
private function createEncoder(array $config)
diff --git a/Core/Encoder/EncoderFactoryInterface.php b/Core/Encoder/EncoderFactoryInterface.php
index 811c262..3ae07e6 100644
--- a/Core/Encoder/EncoderFactoryInterface.php
+++ b/Core/Encoder/EncoderFactoryInterface.php
@@ -21,9 +21,10 @@ use Symfony\Component\Security\Core\User\UserInterface;
interface EncoderFactoryInterface
{
/**
- * Returns the password encoder to use for the given account
+ * Returns the password encoder to use for the given account.
*
* @param UserInterface $user
+ *
* @return PasswordEncoderInterface never null
*/
function getEncoder(UserInterface $user);
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..0623140 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.
@@ -51,8 +49,10 @@ class SecurityContext implements SecurityContextInterface
* Checks if the attributes are granted against the current token.
*
* @throws AuthenticationCredentialsNotFoundException when the security context has no authentication token.
+ *
* @param mixed $attributes
* @param mixed|null $object
+ *
* @return Boolean
*/
public final function isGranted($attributes, $object = null)
@@ -65,7 +65,11 @@ class SecurityContext implements SecurityContextInterface
$this->token = $this->authenticationManager->authenticate($this->token);
}
- return $this->accessDecisionManager->decide($this->token, (array) $attributes, $object);
+ if (!is_array($attributes)) {
+ $attributes = array($attributes);
+ }
+
+ return $this->accessDecisionManager->decide($this->token, $attributes, $object);
}
/**
diff --git a/Core/SecurityContextInterface.php b/Core/SecurityContextInterface.php
index d57c409..46b2cc4 100644
--- a/Core/SecurityContextInterface.php
+++ b/Core/SecurityContextInterface.php
@@ -35,6 +35,7 @@ interface SecurityContextInterface
* Sets the authentication token.
*
* @param TokenInterface $token
+ *
* @return void
*/
function setToken(TokenInterface $token = null);
@@ -44,6 +45,7 @@ interface SecurityContextInterface
*
* @param array $attributes
* @param mixed $object
+ *
* @return Boolean
*/
function isGranted($attributes, $object = 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..3b66956 100644
--- a/Core/User/UserInterface.php
+++ b/Core/User/UserInterface.php
@@ -61,6 +61,7 @@ interface UserInterface
* are relevant for assessing whether re-authentication is required.
*
* @param UserInterface $user
+ *
* @return Boolean
*/
function equals(UserInterface $user);
diff --git a/Http/EntryPoint/RetryAuthenticationEntryPoint.php b/Http/EntryPoint/RetryAuthenticationEntryPoint.php
index 12ba538..532601a 100644
--- a/Http/EntryPoint/RetryAuthenticationEntryPoint.php
+++ b/Http/EntryPoint/RetryAuthenticationEntryPoint.php
@@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http\EntryPoint;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
-use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
diff --git a/Http/Firewall.php b/Http/Firewall.php
index 9d05f86..91eb6a9 100644
--- a/Http/Firewall.php
+++ b/Http/Firewall.php
@@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
diff --git a/Http/Firewall/ContextListener.php b/Http/Firewall/ContextListener.php
index 6fb77e9..d282452 100644
--- a/Http/Firewall/ContextListener.php
+++ b/Http/Firewall/ContextListener.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Http\Firewall;
-use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -93,6 +92,10 @@ class ContextListener implements ListenerInterface
return;
}
+ if (!$event->getRequest()->hasSession()) {
+ return;
+ }
+
if (null === $token = $this->context->getToken()) {
return;
}
diff --git a/Http/Firewall/ExceptionListener.php b/Http/Firewall/ExceptionListener.php
index 9bbccca..1535b9b 100644
--- a/Http/Firewall/ExceptionListener.php
+++ b/Http/Firewall/ExceptionListener.php
@@ -15,10 +15,11 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface;
+use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
+use Symfony\Component\Security\Core\Exception\AccountStatusException;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
-use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
use Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException;
use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\HttpFoundation\Request;
@@ -159,6 +160,12 @@ class ExceptionListener
$this->setTargetPath($request);
+ if ($authException instanceof AccountStatusException && ($token = $this->context->getToken()) instanceof UsernamePasswordToken) {
+ // remove the security token to prevent infinite redirect loops
+ $this->context->setToken(null);
+ $request->getSession()->remove('_security_' . $token->getProviderKey());
+ }
+
return $this->authenticationEntryPoint->start($request, $authException);
}
diff --git a/Http/Firewall/ListenerInterface.php b/Http/Firewall/ListenerInterface.php
index 822f641..ccde86e 100644
--- a/Http/Firewall/ListenerInterface.php
+++ b/Http/Firewall/ListenerInterface.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Firewall;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Interface that must be implemented by firewall listeners
diff --git a/Http/Firewall/LogoutListener.php b/Http/Firewall/LogoutListener.php
index 06454a3..4bfa7e1 100644
--- a/Http/Firewall/LogoutListener.php
+++ b/Http/Firewall/LogoutListener.php
@@ -17,7 +17,6 @@ use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
/**
@@ -57,6 +56,7 @@ class LogoutListener implements ListenerInterface
* Adds a logout handler
*
* @param LogoutHandlerInterface $handler
+ *
* @return void
*/
public function addHandler(LogoutHandlerInterface $handler)
diff --git a/Http/Firewall/RememberMeListener.php b/Http/Firewall/RememberMeListener.php
index 0b3bc78..5531012 100644
--- a/Http/Firewall/RememberMeListener.php
+++ b/Http/Firewall/RememberMeListener.php
@@ -2,15 +2,10 @@
namespace Symfony\Component\Security\Http\Firewall;
-use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
-use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
-use Symfony\Component\Security\Core\Exception\CookieTheftException;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
diff --git a/Http/Firewall/SwitchUserListener.php b/Http/Firewall/SwitchUserListener.php
index 8e45508..9780860 100644
--- a/Http/Firewall/SwitchUserListener.php
+++ b/Http/Firewall/SwitchUserListener.php
@@ -19,7 +19,6 @@ use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
-use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\SwitchUserRole;
diff --git a/Http/FirewallMapInterface.php b/Http/FirewallMapInterface.php
index 99bac06..0630a86 100644
--- a/Http/FirewallMapInterface.php
+++ b/Http/FirewallMapInterface.php
@@ -31,6 +31,7 @@ interface FirewallMapInterface
* must be null.
*
* @param Request $request
+ *
* @return array of the format array(array(AuthenticationListener), ExceptionListener)
*/
function getListeners(Request $request);
diff --git a/Http/HttpUtils.php b/Http/HttpUtils.php
index a26b1bd..cac130e 100644
--- a/Http/HttpUtils.php
+++ b/Http/HttpUtils.php
@@ -16,6 +16,8 @@ use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\RouterInterface;
+use Symfony\Component\Routing\Exception\MethodNotAllowedException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/**
* Encapsulates the logic needed to create sub-requests, redirect the user, and match URLs.
@@ -97,7 +99,7 @@ class HttpUtils
* Checks that a given path matches the Request.
*
* @param Request $request A Request instance
- * @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo))
+ * @param string $path A path (an absolute path (/foo) or a route name (foo))
*
* @return Boolean true if the path is the same as the one from the Request, false otherwise
*/
@@ -108,7 +110,9 @@ class HttpUtils
$parameters = $this->router->match($request->getPathInfo());
return $path === $parameters['_route'];
- } catch (\Exception $e) {
+ } catch (MethodNotAllowedException $e) {
+ return false;
+ } catch (ResourceNotFoundException $e) {
return false;
}
}
diff --git a/Http/Logout/CookieClearingLogoutHandler.php b/Http/Logout/CookieClearingLogoutHandler.php
index 65b45f2..ddb24e3 100644
--- a/Http/Logout/CookieClearingLogoutHandler.php
+++ b/Http/Logout/CookieClearingLogoutHandler.php
@@ -25,7 +25,8 @@ class CookieClearingLogoutHandler implements LogoutHandlerInterface
private $cookies;
/**
- * Constructor
+ * Constructor.
+ *
* @param array $cookies An array of cookie names to unset
*/
public function __construct(array $cookies)
@@ -39,6 +40,7 @@ class CookieClearingLogoutHandler implements LogoutHandlerInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
public function logout(Request $request, Response $response, TokenInterface $token)
diff --git a/Http/Logout/LogoutHandlerInterface.php b/Http/Logout/LogoutHandlerInterface.php
index 6d5c519..079cc00 100644
--- a/Http/Logout/LogoutHandlerInterface.php
+++ b/Http/Logout/LogoutHandlerInterface.php
@@ -30,6 +30,7 @@ interface LogoutHandlerInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
function logout(Request $request, Response $response, TokenInterface $token);
diff --git a/Http/Logout/LogoutSuccessHandlerInterface.php b/Http/Logout/LogoutSuccessHandlerInterface.php
index 5592771..5c6c2b6 100644
--- a/Http/Logout/LogoutSuccessHandlerInterface.php
+++ b/Http/Logout/LogoutSuccessHandlerInterface.php
@@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\Logout;
use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpKernel\Event\GetResponseEvent;
/**
* LogoutSuccesshandlerInterface.
@@ -31,6 +30,7 @@ interface LogoutSuccessHandlerInterface
* Creates a Response object to send upon a successful logout.
*
* @param Request $request
+ *
* @return Response never null
*/
function onLogoutSuccess(Request $request);
diff --git a/Http/Logout/SessionLogoutHandler.php b/Http/Logout/SessionLogoutHandler.php
index 9fd49d1..0a7e5cd 100644
--- a/Http/Logout/SessionLogoutHandler.php
+++ b/Http/Logout/SessionLogoutHandler.php
@@ -28,6 +28,7 @@ class SessionLogoutHandler implements LogoutHandlerInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
public function logout(Request $request, Response $response, TokenInterface $token)
diff --git a/Http/RememberMe/AbstractRememberMeServices.php b/Http/RememberMe/AbstractRememberMeServices.php
index 2118a86..94f8830 100644
--- a/Http/RememberMe/AbstractRememberMeServices.php
+++ b/Http/RememberMe/AbstractRememberMeServices.php
@@ -10,8 +10,6 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\CookieTheftException;
-use Symfony\Component\Security\Core\User\UserProviderInterface;
-use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Cookie;
@@ -90,6 +88,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* cookie was set, decodes it, and hands it to subclasses for further processing.
*
* @param Request $request
+ *
* @return TokenInterface
*/
public final function autoLogin(Request $request)
@@ -145,6 +144,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
public function logout(Request $request, Response $response, TokenInterface $token)
@@ -157,6 +157,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* an attempted authentication fails.
*
* @param Request $request
+ *
* @return void
*/
public final function loginFail(Request $request)
@@ -172,13 +173,14 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token The token that resulted in a successful authentication
+ *
* @return void
*/
public final function loginSuccess(Request $request, Response $response, TokenInterface $token)
{
if (!$token->getUser() instanceof UserInterface) {
if (null !== $this->logger) {
- $this->logger->debug('Remember-me ignores token since it does not contain an UserInterface implementation.');
+ $this->logger->debug('Remember-me ignores token since it does not contain a UserInterface implementation.');
}
return;
@@ -205,6 +207,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
*
* @param array $cookieParts
* @param Request $request
+ *
* @return TokenInterface
*/
abstract protected function processAutoLoginCookie(array $cookieParts, Request $request);
@@ -221,6 +224,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token);
@@ -240,6 +244,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* Decodes the raw cookie value
*
* @param string $rawCookie
+ *
* @return array
*/
protected function decodeCookie($rawCookie)
@@ -251,6 +256,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* Encodes the cookie parts
*
* @param array $cookieParts
+ *
* @return string
*/
protected function encodeCookie(array $cookieParts)
@@ -262,6 +268,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* Deletes the remember-me cookie
*
* @param Request $request
+ *
* @return void
*/
protected function cancelCookie(Request $request)
@@ -277,6 +284,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
* Checks whether remember-me capabilities where requested
*
* @param Request $request
+ *
* @return Boolean
*/
protected function isRememberMeRequested(Request $request)
diff --git a/Http/RememberMe/PersistentTokenBasedRememberMeServices.php b/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
index eb622a4..e9d22ba 100644
--- a/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
+++ b/Http/RememberMe/PersistentTokenBasedRememberMeServices.php
@@ -10,7 +10,6 @@ use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\CookieTheftException;
use Symfony\Component\Security\Core\Authentication\RememberMe\PersistentToken;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
-use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
/*
* This file is part of the Symfony package.
@@ -36,6 +35,7 @@ class PersistentTokenBasedRememberMeServices extends AbstractRememberMeServices
* Sets the token provider
*
* @param TokenProviderInterface $tokenProvider
+ *
* @return void
*/
public function setTokenProvider(TokenProviderInterface $tokenProvider)
diff --git a/Http/RememberMe/RememberMeServicesInterface.php b/Http/RememberMe/RememberMeServicesInterface.php
index c6b0ada..b824538 100644
--- a/Http/RememberMe/RememberMeServicesInterface.php
+++ b/Http/RememberMe/RememberMeServicesInterface.php
@@ -48,6 +48,7 @@ interface RememberMeServicesInterface
* result in a call to loginFail() and therefore an invalidation of the cookie.
*
* @param Request $request
+ *
* @return TokenInterface
*/
function autoLogin(Request $request);
@@ -59,6 +60,7 @@ interface RememberMeServicesInterface
* This method needs to take care of invalidating the cookie.
*
* @param Request $request
+ *
* @return void
*/
function loginFail(Request $request);
@@ -77,6 +79,7 @@ interface RememberMeServicesInterface
* @param Request $request
* @param Response $response
* @param TokenInterface $token
+ *
* @return void
*/
function loginSuccess(Request $request, Response $response, TokenInterface $token);
diff --git a/Http/RememberMe/TokenBasedRememberMeServices.php b/Http/RememberMe/TokenBasedRememberMeServices.php
index 0fd5c41..44140f7 100644
--- a/Http/RememberMe/TokenBasedRememberMeServices.php
+++ b/Http/RememberMe/TokenBasedRememberMeServices.php
@@ -6,7 +6,6 @@ use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
-use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -141,7 +140,9 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
* @param string $username The username
* @param integer $expires The unixtime when the cookie expires
* @param string $password The encoded password
+ *
* @throws \RuntimeException when the private key is empty
+ *
* @return string
*/
protected function generateCookieHash($class, $username, $expires, $password)
diff --git a/composer.json b/composer.json
index a65fe43..34bd1dd 100644
--- a/composer.json
+++ b/composer.json
@@ -4,7 +4,7 @@
"description": "Symfony Security Component",
"keywords": [],
"homepage": "http://symfony.com",
- "version": "2.0.4",
+ "version": "2.0.7",
"license": "MIT",
"authors": [
{
@@ -18,14 +18,18 @@
],
"require": {
"php": ">=5.3.2",
- "symfony/event-dispatcher": ">=2.0",
- "symfony/http-foundation": ">=2.0",
- "symfony/http-kernel": ">=2.0"
+ "symfony/event-dispatcher": "self.version",
+ "symfony/http-foundation": "self.version",
+ "symfony/http-kernel": "self.version"
},
"suggest": {
- "symfony/class-loader": ">=2.0",
- "symfony/finder": ">=2.0",
- "symfony/form": ">=2.0",
- "symfony/routing": ">=2.0"
- }
+ "symfony/class-loader": "self.version",
+ "symfony/finder": "self.version",
+ "symfony/form": "self.version",
+ "symfony/routing": "self.version"
+ },
+ "autoload": {
+ "psr-0": { "Symfony\\Component\\Security": "" }
+ },
+ "target-dir": "Symfony/Component/Security"
}