Skip to content

Commit

Permalink
allow Request as type as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Apr 19, 2024
1 parent 2fa85af commit 79d6236
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Scheb\TwoFactorBundle\Security\Authorization\Voter;

use Scheb\TwoFactorBundle\Security\Authentication\Token\TwoFactorTokenInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
use Symfony\Component\Security\Core\Authorization\Voter\CacheableVoterInterface;
Expand Down Expand Up @@ -46,6 +47,6 @@ public function supportsAttribute(string $attribute): bool

public function supportsType(string $subjectType): bool
{
return $subjectType === 'null';
return $subjectType === 'null' || $subjectType === Request::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Scheb\TwoFactorBundle\Security\Authentication\Token\TwoFactorTokenInterface;
use Scheb\TwoFactorBundle\Security\Authorization\Voter\TwoFactorInProgressVoter;
use Scheb\TwoFactorBundle\Tests\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
Expand Down Expand Up @@ -82,6 +83,7 @@ public static function provideTypesForSupportCheck(): array
['array', false],
['string', false],
['null', true],
[Request::class, true],
];
}

Expand Down

0 comments on commit 79d6236

Please sign in to comment.