Closed
Closed
Copy link
Description
Symfony version(s) affected
6.x
Description
The attribute IsGranted
is ignored / not working when it is defined at the controller class level and when the controller service is lazy
Symfony doc about the feature at controller class level : https://symfony.com/doc/current/security.html#security-securing-controller-attributes
NB: at controller action level it works, this only happen when configured at the class level
How to reproduce
In this example, the attribute IsGranted doesn't deny the access to any user
use Symfony\Component\Security\Http\Attribute\IsGranted;
#[IsGranted('ROLE_ADMIN')]
class AdminController extends AbstractController
{
public function adminDashboard(): Response
{
...
}
}
App\Controller\:
resource: '../src/Controller/'
lazy: true
Possible Solution
No response
Additional Context
No response