diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-06-03 21:24:11 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-06-03 21:24:11 +0200 |
commit | 3cf22a05416b9994aa458ea045d232264006e7cf (patch) | |
tree | f1ef00c22a8991b504d2f9d0813c823e9c98f7b1 /src/Wallabag/CoreBundle/Security | |
parent | 51d9699fa130a18a1c5cd09d1b03a382d73e91db (diff) | |
parent | 75e9d1df03831a3dc1f92b0ef713c5e2f90fa543 (diff) | |
download | wallabag-3cf22a05416b9994aa458ea045d232264006e7cf.tar.gz wallabag-3cf22a05416b9994aa458ea045d232264006e7cf.tar.zst wallabag-3cf22a05416b9994aa458ea045d232264006e7cf.zip |
Merge pull request #1206 from wallabag/sf-2.7
Upgrade to Symfony 2.7
Diffstat (limited to 'src/Wallabag/CoreBundle/Security')
-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.'); |