我已经安装了fosoauthserverbundle,但是当我从https://github.com/复制代码时,CSRF_PROVIDER的配置似乎是错误的,我不知道该如何解决它。friendsofsymfony/fosoauthserververbundle/blob/master/resources/doc/index.md当我执行作曲家更新时,我有此错误
[RuntimeException]
An error occurred when executing the ""cache:clear --no-warmup"" command:
[SymfonyComponentConfigDefinitionExceptionInvalidConfigurationExcept
ion] Unrecognized option "csrf_provider" under "security.firewalls.main.form_login"
当我去Local主持人时,我遇到了这个致命的错误
Fatal error: Uncaught SymfonyComponentConfigDefinitionExceptionInvalidConfigurationException: Unrecognized option "csrf_provider" under "security.firewalls.main.form_login" in C:wamp64wwwMDSAPmdsap-apivendorsymfonysymfonysrcSymfonyComponentConfigDefinitionArrayNode.php on line 317
( ! ) SymfonyComponentConfigDefinitionExceptionInvalidConfigurationException: Unrecognized option "csrf_provider" under "security.firewalls.main.form_login" in C:wamp64wwwMDSAPmdsap-apivendorsymfonysymfonysrcSymfonyComponentConfigDefinitionArrayNode.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:
FOSUserBundleModelUserInterface: 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 ] }
不确定,但是您要做的就是在更新Composer之前启用CSRF Protaction。
config.yml
framework:
csrf_protection:
enabled: true