Bonjour,

Je suis en train d'essayer de configurer FosUserBundle + SonataAdminBundle sous Symfony 2.5.2.

Lorsque je lance le projet dans un navigateur (url /app_dev.php) j'ai l'erreur suivante :

InvalidArgumentException: You should define a value for only one of 'csrf_provider' and 'csrf_token_generator' on a security firewall. Use 'csrf_token_generator' as this replaces 'csrf_provider'.
Voici mon fichier security.yml :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
security:
    encoders:
          Toto\UserBundle\Entity\User: sha512
 
    role_hierarchy:
        ROLE_ADMIN: ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
 
    providers:
        main:
            id: fos_user.user_provider.username
 
    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
 
        # Firewall pour FosUserBundle
        main:
            pattern: ^/
            anonymous: true
            provider: main
            form_login:
                login_path: fos_user_security_login
                check_path: fos_user_security_check
                csrf_provider: form.csrf_provider
            logout:
                path: fos_user_security_logout
                target: /
            remember_me:
                # %secret% est un paramètre de parameters.yml 
                key: %secret%   
 
         # Firewall pour la partie admin sous Sonata
        admin:
            pattern: /admin(.*)
            form_login:       
                provider: fos_userbundle
                login_path: /admin/login       
                use_forward: false
                check_path: /admin/login_check 
                failure_path: null
            logout:      
                path:/admin/logout
            anonymous: true      
 
    access_control:
        # URLs FOSUserBundle accessibles à tous les utilisateurs (rôle anonyme) :        
        - { path: ^/_wdt, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/_profiler, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
 
        # URLs du back-office, accessibles par le rôle admin :
        - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/login-check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        # -- fin
 
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
 
        # Secured part of the site
        # This config requires being logged for the whole site and having the admin role for the admin part.
        # Change these rules to adapt them to your needs
        - { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
Une idée du problème ? Je n'ai rien trouvé sur le web (du moins pas encore). 2 jours que je galère sur l'installation de FosUserBundle avec Sonata avec des erreurs dans tous les sens, vive Symfony2 !