小编Fab*_*ius的帖子

将FOSUserBundle与Symfony 3.3一起使用时出现YAML错误

在Symfony中设置FOSUserBundle时,我遇到了一个奇怪的错误.我收到此错误消息:

A colon cannot be used in an unquoted mapping value at line 30 (near " csrf_token_generator: security.csrf.token_manager").
Run Code Online (Sandbox Code Playgroud)

这是我的security.yml,谁能告诉我我做错了什么?

# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
#        in_memory:
#            memory: ~
    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
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: …
Run Code Online (Sandbox Code Playgroud)

yaml symfony fosuserbundle

2
推荐指数
1
解决办法
6126
查看次数

标签 统计

fosuserbundle ×1

symfony ×1

yaml ×1