问题
I started a new Symfony app on which I use the FOSUserBundle.
I installed it, loaded the bundle and configured it.
Here's my configuration.yml
:
fos_user:
db_driver: orm
firewall_name: main
user_class: Myapp\UserBundle\Entity\User
and my security.yml
:
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
in_memory:
memory: ~
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
default:
anonymous: ~
main:
pattern: ^/
form_login:
login_path: fos_user_security_login
check_path: fos_user_security_check
provider: fos_userbundle
csrf_provider: form.csrf_provider
default_target_path: /
logout: true
anonymous: true
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
Now, when I go to localhost/myapp/web/app_dev.php/login
, I get the following Error 500 after I try to login (I have no problem accessing the login form, this comes after I submit):
You must configure the check path to be handled by the firewall using form_login in your security firewall configuration
It seems to me that form_login
is configured in my security firewall configuration... what am I missing?
回答1:
I am thinking that you didn't import FOSUserBundle's routing file. Did you?
In case didn't this is how you do it:
http://symfony.com/doc/current/bundles/FOSUserBundle/index.html#step-6-import-fosuserbundle-routing-files
Other than that, what is the purpose of that default
firewall? It could be intercepting the security component when it tries to "find the correct firewall to use".
来源:https://stackoverflow.com/questions/24498442/symfony2-5-fosuserbundle-check-path-apparently-not-found