问题描述
我使用 FOSUserBundle 启动了一个新的 Symfony 应用程序.我安装了它,加载了包并配置了它.这是我的 configuration.yml
:
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
和我的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 }
现在,当我转到 localhost/myapp/web/app_dev.php/login
时,尝试登录后出现以下错误 500(访问登录表单没有问题,这在我提交之后出现):
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):
您必须在安全防火墙配置中使用 form_login 配置要由防火墙处理的检查路径
在我看来,form_login
是在我的安全防火墙配置中配置的...我错过了什么?
It seems to me that form_login
is configured in my security firewall configuration... what am I missing?
推荐答案
我认为您没有导入 FOSUserBundle 的路由文件.是吗?
I am thinking that you didn't import FOSUserBundle's routing file. Did you?
万一这不是你做的:
除此之外,default
防火墙的目的是什么?当它试图找到要使用的正确防火墙"时,它可能会拦截安全组件.
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".
这篇关于Symfony2.5 + FOSUserBundle 检查路径显然没有找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!