csrf错误FOSUserBundle

问题描述 投票:1回答:1

即时通讯使用symfony 3.4.4我试图按照FOSUser文档安装fosuserbundle:https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

当我执行命令时:

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

阳明海运安全

安全性:编码器: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 }
php symfony fosuserbundle
1个回答
1
投票
framework:
    csrf_protection: ~

该页面上的文档已过时。这个问题很快就会在symfony/symfony #25808修复

有关此错误的更多信息:https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2705

© www.soinside.com 2019 - 2024. All rights reserved.