I am having problems with the security in Symfony 2.1.
I have a firewall setup:
firewall:
main:
pattern: ^/
anonymous: ~
query_string: ~
access_denied_url: /register
access_control:
- { path: ^/, roles: ROLE_USER }
- { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
I was hoping this would redirect users to the /register page, but instead any secured route still tells me that Full authentication is required to access this resource..
Could anyone steer me in the correct solution here?
I’m doing this, but have not used
access_denied_url. I think that’s why you’re getting the harsh denied page.Using
form_login– unauthenticated users will be directed to your/loginroute. You could render or link to a register form there, or change theform_login: login_pathto/registerhttp://symfony.com/doc/2.0/cookbook/security/form_login.html