This is the how to for redirection implementation by roles after login or logout in Symfony2
- Copy
AfterLoginRedirection.php
andAfterLogoutRedirection.php
to your bundle under the "Redirection" directory - Edit your
services.yml
file in your bundle and copy/paste the content ofservices.yml
- Edit your
security.yml
file... - ... add
success_handler: redirect.after.login
inform_login:
section - ... add
success_handler: redirect.after.logout
inlogout:
section
For more informations, you can read my explanation on my blog (in french only)
Symfony needs to update the docs to contain examples and information on how this works and how to do it.