The logout process is handled by logout
section in security.yml
logout:
path: /logout
target: /
where target
option defines where the user shoud be redirected to after logout.
The question is: Is possible to customize this behaviour (like in form_login
section where setting use_referer: true
allowes to be redirected to the referer page) ?
What I need: I need to stay on the same page where "logout" has been clicked since, of course, it does not require to be authenticated with a role.
I didn't find any solution without re-implementing whole logout process.
It is possible to configure custom logout handler. In that handler you can override the default Symfony behaviour.
secured_area:
#.....
logout:
path: /logout
success_handler: some.service.id
#......
This answer can give you a good idea on how to implement it Symfony logout handler