In Symfony 7.3 i wanted to make login form with security bundle, everything went right, except by default login path is accesable for everyone and i wanted authenticated users to get rediercted to homepage.
I didn’t want to make validation inside controller method like this
if($this->isGranted('ROLE_USER')){
return new RedirectResponse('/');
}
since as far as i know this isn’t good approach and validation should not be placed inside controller.
I found this
symfony – IS_AUTHENTICATED_ANONYMOUSLY not working
but when it didn’t worked i checked symfony docs for security-bundle and there is no mention of IS_AUTHENTICATED_ANONYMOUSLY and logical operators doesn’t work, so i suppose that this is no longer supported.
So my question is does anyone know is there a way to do it ‘correctly’ and to sepearte that validation logic from controller or mayby it is not a bad practice at all?