Whenever I go to /admin/logout, I'm correctly redirected to the root of my project but still logged in when I visit /admin/ as I'm not prompted for credentials.
Here is my configuration:
security.yml
security:
firewalls:
admin_area:
pattern: ^/admin
http_basic: ~
stateless: true
switch_user: { role: ROLE_SUPER_ADMIN, parameter: _want_to_be_this_user }
logout: { path: /admin/logout, target: / }
AdminBundle/Resources/config/routing.yml
logout:
pattern: /logout
app/config/routing.yml
admin:
resource: "@AdminBundle/Resources/config/routing.yml"
prefix: /admin
The authorization is still in place as the headers state Authorization:Basic YWRtaW46cEAkJHcwUmQh so I guess credentials are still provided to the application during the request.
I know there is no proper way to logout from a HTTP Basic Auth as per this question but maybe Symfony2 allows it?
/admin/logoutso it is under a firewall also you can check if you havent checkedremember me- try to remove cookies then login and logout/admin/logoutas I'm correctly redirected. Also, I haven't implemented the optionremember_me(yet).routing.ymlis not under the firewall. try to change that and then istead of patterns in yoursecurity.ymltry to use route names aslogout: path: logout....routing.ymlfile is under theAdminBundlebundle which has its routes imported inapp/config/routing.ymllike soadmin: resource: "@AdminBundle/Resources/config/routing.yml" prefix: /adminso the pattern of the route is/admin/logoutso under the firewall. Changing the pattern insecurity.ymlfor the name of the route did nothing unfortunately (still logged in). Thanks for your help.