2016-11-22 142 views
0

我已经安装了FOSOauthServerBundle但似乎的配置是错误的csrf_provider,我不知道如何解决它,当我从https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Resources/doc/index.md 复制的代码,当我执行作曲家更新我有这样的错误捆绑FOSOAuthServerBundle安装错误

[RuntimeException] 
     An error occurred when executing the ""cache:clear --no-warmup"" command: 
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationExcept 
     ion] Unrecognized option "csrf_provider" under "security.firewalls.main.form_login" 

当我去到localhost我得到这个致命错误

Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized option "csrf_provider" under "security.firewalls.main.form_login" in C:\wamp64\www\MDSAP\mdsap-api\vendor\symfony\symfony\src\Symfony\Component\Config\Definition\ArrayNode.php on line 317 
    (!) Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized option "csrf_provider" under "security.firewalls.main.form_login" in C:\wamp64\www\MDSAP\mdsap-api\vendor\symfony\symfony\src\Symfony\Component\Config\Definition\ArrayNode.php on line 317 

这是security.yml

# To get started with security, check out the documentation: 
# http://symfony.com/doc/current/book/security.html 
security: 

    encoders: 
     FOS\UserBundle\Model\UserInterface: sha1 

    role_hierarchy: 
     ROLE_ADHERANT: ROLE_USER 
     ROLE_STAGIAIRE: ROLE_USER 
     ROLE_PARTENAIRE: ROLE_USER 
     ROLE_DUPPLESSIX: ROLE_USER 
     ROLE_ADMIN:  ROLE_USER 
     ROLE_SUPER_ADMIN: ROLE_ADMIN 
    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers 
    providers: 
     fos_userbundle: 
      id: fos_user.user_provider.username 

    firewalls: 
     oauth_token: 
      pattern: ^/oauth/v2/token 
      security: false 

     main: 
      pattern: ^/ 
      form_login: 
       provider: fos_userbundle 
       csrf_provider: form.csrf_provider 
      logout:  true 
      anonymous: true 
      # Add your favorite authentication process here 

     api: 
      pattern: ^/api 
      fos_oauth: true 
      stateless: true 
      anonymous: false # can be omitted as its default value 

     # disables authentication for assets and the profiler, adapt it according to your needs 
     dev: 
      pattern: ^/(_(profiler|wdt)|css|images|js)/ 
      security: false 

     main: 
      pattern: ^/ 
      form_login: 
       provider: fos_userbundle 
       csrf_token_generator: security.csrf.token_manager 
       # if you are using Symfony < 2.8, use the following config instead: 
       # csrf_provider: form.csrf_provider 

      logout:  true 
      anonymous: true 
      # activate different ways to authenticate 

      # http_basic: ~ 
      # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate 

      # form_login: ~ 
      # http://symfony.com/doc/current/cookbook/security/form_login_setup.html 
    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 } 
     - { path: ^/api, roles: [ IS_AUTHENTICATED_FULLY ] } 
+0

纠错上删除主部制成 –

回答

0

不确定,但您需要做的只是在更新composer之前启用csrf protaction。

config.yml

framework: 
    csrf_protection: 
     enabled: true