diff --git a/src/bundle/Security/Authorization/Voter/TwoFactorInProgressVoter.php b/src/bundle/Security/Authorization/Voter/TwoFactorInProgressVoter.php index 1329194f..0302dc82 100644 --- a/src/bundle/Security/Authorization/Voter/TwoFactorInProgressVoter.php +++ b/src/bundle/Security/Authorization/Voter/TwoFactorInProgressVoter.php @@ -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; @@ -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; } } diff --git a/tests/Security/Authorization/Voter/TwoFactorInProgressVoterTest.php b/tests/Security/Authorization/Voter/TwoFactorInProgressVoterTest.php index e031e07f..3943a34e 100644 --- a/tests/Security/Authorization/Voter/TwoFactorInProgressVoterTest.php +++ b/tests/Security/Authorization/Voter/TwoFactorInProgressVoterTest.php @@ -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; @@ -82,6 +83,7 @@ public static function provideTypesForSupportCheck(): array ['array', false], ['string', false], ['null', true], + [Request::class, true], ]; }