diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Security/Validator')
-rw-r--r-- | src/Wallabag/CoreBundle/Security/Validator/WallabagUserPasswordValidator.php | 11 |
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 @@ | |||
3 | namespace Wallabag\CoreBundle\Security\Validator; | 3 | namespace Wallabag\CoreBundle\Security\Validator; |
4 | 4 | ||
5 | use Symfony\Component\Security\Core\User\UserInterface; | 5 | use Symfony\Component\Security\Core\User\UserInterface; |
6 | use Symfony\Component\Security\Core\SecurityContextInterface; | 6 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
7 | use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; | 7 | use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface; |
8 | use Symfony\Component\Validator\Constraint; | 8 | use Symfony\Component\Validator\Constraint; |
9 | use Symfony\Component\Validator\ConstraintValidator; | 9 | use Symfony\Component\Validator\ConstraintValidator; |
@@ -11,14 +11,17 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException; | |||
11 | use Symfony\Component\Validator\Exception\UnexpectedTypeException; | 11 | use Symfony\Component\Validator\Exception\UnexpectedTypeException; |
12 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; | 12 | use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; |
13 | 13 | ||
14 | /** | ||
15 | * @see Symfony\Component\Security\Core\Validator\Constraints\UserPasswordValidator | ||
16 | */ | ||
14 | class WallabagUserPasswordValidator extends ConstraintValidator | 17 | class 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.'); |