Symfony2.5 + FOSUserBundle 检查路径显然没有找到 [英] Symfony2.5 + FOSUserBundle check path apparently not found

查看:26
本文介绍了Symfony2.5 + FOSUserBundle 检查路径显然没有找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 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 配置要由防火墙处理的检查路径

You must configure the check path to be handled by the firewall using form_login in your security firewall configuration

在我看来,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?

万一这不是你做的:

http:///symfony.com/doc/current/bundles/FOSUserBundle/index.html#step-6-import-fosuserbundle-routing-files

除此之外,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 检查路径显然没有找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆