]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php
Update to Symfony 2.7
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Security / Validator / WallabagUserPasswordValidator.php
index 5586f9762da5325235fbe98be1041be7da35c54e..5206277373e6a6659c11d1990e5fcdf739f6a9ff 100644 (file)
@@ -3,7 +3,7 @@
 namespace Wallabag\CoreBundle\Security\Validator;
 
 use Symfony\Component\Security\Core\User\UserInterface;
-use Symfony\Component\Security\Core\SecurityContextInterface;
+use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
 use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
 use Symfony\Component\Validator\Constraint;
 use Symfony\Component\Validator\ConstraintValidator;
@@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
 use Symfony\Component\Validator\Exception\UnexpectedTypeException;
 use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
 
+/**
+ * @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator
+ */
 class WallabagUserPasswordValidator extends ConstraintValidator
 {
     private $securityContext;
     private $encoderFactory;
 
-    public function __construct(SecurityContextInterface $securityContext, EncoderFactoryInterface $encoderFactory)
+    public function __construct(TokenStorageInterface $tokenStorage, EncoderFactoryInterface $encoderFactory)
     {
-        $this->securityContext = $securityContext;
+        $this->tokenStorage = $tokenStorage;
         $this->encoderFactory = $encoderFactory;
     }
 
@@ -31,7 +34,7 @@ class WallabagUserPasswordValidator extends ConstraintValidator
             throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword');
         }
 
-        $user = $this->securityContext->getToken()->getUser();
+        $user = $this->tokenStorage->getToken()->getUser();
 
         if (!$user instanceof UserInterface) {
             throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.');