I have having trouble getting user authentication working on symfony. I have the login_path
working properly, but check_path
is malfunctioning. The path that I have specified gives the famous Unable to find the controller for path "/login_check". Maybe you forgot to add the matching route in your routing configuration?
I've looked at the other posts, and they all seem to do what I am doing. I am very new to symfony and having trouble grasping the concepts, so I would greatly appreciate some help.
I am using Symfony 2.1, if that makes a difference.
I believe that I have everything configured properly:
security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Site\CommonBundle\Entity\User: plaintext
role_hierarchy:
ROLE_LIGHT: ROLE_LIGHT
ROLE_ADMIN: [ROLE_LIGHT, ROLE_USER]
ROLE_SUPER_ADMIN: [ROLE_LIGHT, ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
database:
entity: { class: SiteCommonBundle:User }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login_firewall:
pattern: ^/(login|logout|login_check)
anonymous: ~
secured:
pattern: ^/secured/
form_login:
login_path: /login
check_path: /login_check
logout:
path: /logout
target: /
access_control:
- { path: ^/secured/, roles:ROLE_LIGHT }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
routing.yml
common_login:
pattern: /login
defaults: { _controller: SiteCommonBundle:Default:login }
common_login_check:
pattern: /login_check