Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to install the FOSUserBundle following the tutorial here

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

php app/console doctrine:schema:update --force

but appears the error

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

Here's my firewall:

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: ^/

the following error appears:

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

UPDATE:

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: ~
like image 723
Gianni Alessandro Avatar asked Dec 03 '13 11:12

Gianni Alessandro


2 Answers

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

framework:
    csrf_protection:
        enabled: true
like image 166
ghostika Avatar answered Nov 10 '22 20:11

ghostika


in security.yml

for sloving this problem you just need to comment this command :

csrf_token_generator: security.csrf.token_manager

and enable this comment instead :

csrf_provider: form.csrf_provider

like image 2
mohammadmahdi moqiseh Avatar answered Nov 10 '22 21:11

mohammadmahdi moqiseh