diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2010-10-21 18:14:32 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2010-10-21 18:14:32 +0200 |
commit | d29781e4c86406cb7d9baf037289bf308f27d843 (patch) | |
tree | 8c9ca9e3f9948f6ba67b5fa9c2e6ad0e398a0d94 | |
parent | 5c7ea242ef1b78dcc59740c66a467bd9b5b9215f (diff) | |
download | symfony-security-d29781e4c86406cb7d9baf037289bf308f27d843.zip symfony-security-d29781e4c86406cb7d9baf037289bf308f27d843.tar.gz symfony-security-d29781e4c86406cb7d9baf037289bf308f27d843.tar.bz2 |
[Security] added some unit tests (WIP)
-rw-r--r-- | Authorization/Voter/AuthenticatedVoter.php | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/Authorization/Voter/AuthenticatedVoter.php b/Authorization/Voter/AuthenticatedVoter.php index feaea05..9144c1c 100644 --- a/Authorization/Voter/AuthenticatedVoter.php +++ b/Authorization/Voter/AuthenticatedVoter.php @@ -53,24 +53,15 @@ class AuthenticatedVoter implements VoterInterface $result = VoterInterface::ACCESS_DENIED; - if (self::IS_AUTHENTICATED_FULLY === $attribute) { - if ($this->isFullyAuthenticated($token)) { - return VoterInterface::ACCESS_GRANTED; - } + if (self::IS_AUTHENTICATED_FULLY === $attribute && !$token instanceof AnonymousToken) { + return VoterInterface::ACCESS_GRANTED; } if (self::IS_AUTHENTICATED_ANONYMOUSLY === $attribute) { - if (null === $token || $token instanceof AnonymousToken || $this->isFullyAuthenticated($token)) { - return VoterInterface::ACCESS_GRANTED; - } + return VoterInterface::ACCESS_GRANTED; } } return $result; } - - protected function isFullyAuthenticated(TokenInterface $token) - { - return null !== $token && !$token instanceof AnonymousToken; - } } |