Skip to content

Commit 878f476

Browse files
wouterjfabpot
authored andcommitted
[Security] Add missing NullToken vote
1 parent b0ca4c6 commit 878f476

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Authorization/Voter/AuthenticatedVoter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class AuthenticatedVoter implements VoterInterface
3232
const IS_ANONYMOUS = 'IS_ANONYMOUS';
3333
const IS_IMPERSONATOR = 'IS_IMPERSONATOR';
3434
const IS_REMEMBERED = 'IS_REMEMBERED';
35+
const PUBLIC_ACCESS = 'PUBLIC_ACCESS';
3536

3637
private $authenticationTrustResolver;
3738

@@ -45,6 +46,10 @@ public function __construct(AuthenticationTrustResolverInterface $authentication
4546
*/
4647
public function vote(TokenInterface $token, $subject, array $attributes)
4748
{
49+
if ($attributes === [self::PUBLIC_ACCESS]) {
50+
return VoterInterface::ACCESS_GRANTED;
51+
}
52+
4853
$result = VoterInterface::ACCESS_ABSTAIN;
4954
foreach ($attributes as $attribute) {
5055
if (null === $attribute || (self::IS_AUTHENTICATED_FULLY !== $attribute

0 commit comments

Comments
 (0)