Php csrf错误FOSUserBundle
im使用symfony 3.4.4我尝试按照FOSUser文档安装fosuserbundle: 当我执行命令时:Php csrf错误FOSUserBundle,php,symfony,fosuserbundle,Php,Symfony,Fosuserbundle,im使用symfony 3.4.4我尝试按照FOSUser文档安装fosuserbundle: 当我执行命令时: bin/console doctrine:schema:update --force 我收到了这个错误: The service "security.authentication.listener.form.main" has a dependency on a non-existent service "security.csrf.token_manager" 有什么解决办法吗
bin/console doctrine:schema:update --force
我收到了这个错误:
The service "security.authentication.listener.form.main" has a dependency on a non-existent service "security.csrf.token_manager"
有什么解决办法吗
配置yml
framework:
csrf_protection: ~
#esi: ~
translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
router:
resource: '%kernel.project_dir%/app/config/routing.yml'
strict_requirements: ~
form: { enabled: false }
csrf_protection: { enabled: false }
validation: { enable_annotations: true }
serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
trusted_hosts: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
fragments: { enabled: false }
http_method_override: true
assets: ~
php_errors:
log: true
安全yml
安全:
编码器:
FOS\UserBundle\Model\UserInterface:bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
anonymous: true
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 }
那页上的文件已经过时了。这个问题将很快在年内解决
有关此错误的详细信息:@MajdiAllagui您将其放置在哪里?你能显示你的
app/config.yml
和app/security.yml
吗?检查我添加的config.yml和security.ymlYou添加的csrf\u保护:~
但是你有csrf\u保护:{enabled:false}
吹到那里,这覆盖了我的建议。所以只需删除csrf\u保护:{enabled:false}
。
The service "security.authentication.listener.form.main" has a dependency on a non-existent service "security.csrf.token_manager"