本文介绍了无法识别的选项“ csrf_provider”在“ security.firewalls.form_login”下的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据教程

在第7步时,我尝试为运行的ORM更新数据库架构

When I'm at the 7th step I try to update the database schema for ORM running

php应用程序/控制台学说:schema:update --force

但出现错误

InvalidConfigurationException: Unrecognized options "csrf_provider" under "security.firewalls.form_login"

这是我的防火墙:

firewalls:
        main:
        pattern: 
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
        logout:       true
        anonymous:    true

我该怎么办?我没有设置模式,因为如果我设置类似

What can I do? I don't set a pattern because, if I set something like

        pattern: ^/

会出现以下错误:

InvalidTypeException:路径 security的类型无效。 Firewalls.pattern。预期的数组,但是得到了字符串

InvalidTypeException: Invalid type for path "security.firewalls.pattern". Expected array, but got string

更新:

csrf_protection已启用,但是由于某种原因我不这样做不明白,没有用。我尝试重置,禁用和启用它,现在它可以工作了。
在我的项目中,我可以通过以下方式启用它

The csrf_protection was enable but, for some reason that I don't understand, didn't work. I tried to "reset" it, disabling and enabling, and now it works.In my project I enable it with

csrf_protection: ~


推荐答案

您需要启用csrf保护。
可以通过在config.yml中添加密钥来实现。

You need to enable csrf protection.You can do that by adding a key to the config.yml

framework:
    csrf_protection:
        enabled: true

这篇关于无法识别的选项“ csrf_provider”在“ security.firewalls.form_login”下的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:05