aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php')
-rw-r--r--src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php b/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php
index 5586f976..52062773 100644
--- a/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php
+++ b/src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php
@@ -3,7 +3,7 @@
3namespace Wallabag\CoreBundle\Security\Validator; 3namespace Wallabag\CoreBundle\Security\Validator;
4 4
5use Symfony\Component\Security\Core\User\UserInterface; 5use Symfony\Component\Security\Core\User\UserInterface;
6use Symfony\Component\Security\Core\SecurityContextInterface; 6use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
7use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; 7use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
8use Symfony\Component\Validator\Constraint; 8use Symfony\Component\Validator\Constraint;
9use Symfony\Component\Validator\ConstraintValidator; 9use Symfony\Component\Validator\ConstraintValidator;
@@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
11use Symfony\Component\Validator\Exception\UnexpectedTypeException; 11use Symfony\Component\Validator\Exception\UnexpectedTypeException;
12use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; 12use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
13 13
14/**
15 * @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator
16 */
14class WallabagUserPasswordValidator extends ConstraintValidator 17class WallabagUserPasswordValidator extends ConstraintValidator
15{ 18{
16 private $securityContext; 19 private $securityContext;
17 private $encoderFactory; 20 private $encoderFactory;
18 21
19 public function __construct(SecurityContextInterface $securityContext, EncoderFactoryInterface $encoderFactory) 22 public function __construct(TokenStorageInterface $tokenStorage, EncoderFactoryInterface $encoderFactory)
20 { 23 {
21 $this->securityContext = $securityContext; 24 $this->tokenStorage = $tokenStorage;
22 $this->encoderFactory = $encoderFactory; 25 $this->encoderFactory = $encoderFactory;
23 } 26 }
24 27
@@ -31,7 +34,7 @@ class WallabagUserPasswordValidator extends ConstraintValidator
31 throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword'); 34 throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UserPassword');
32 } 35 }
33 36
34 $user = $this->securityContext->getToken()->getUser(); 37 $user = $this->tokenStorage->getToken()->getUser();
35 38
36 if (!$user instanceof UserInterface) { 39 if (!$user instanceof UserInterface) {
37 throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.'); 40 throw new ConstraintDefinitionException('The User object must implement the UserInterface interface.');