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 ] }
糾錯上刪除主部製成 –