dongyao2022 2016-04-13 10:03
浏览 61
已采纳

麻烦在Symfony 3.0.4中安装FOSUserBundle

I get this error when installing FOSUserBundle on Symfony3.

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.fos_userbundle". Here is my security.yml

security:

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
    in_memory:
        memory: ~
encoders:
    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:
    # disables authentication for assets and the profiler, adapt it according to your needs
    #dev:
    #    pattern: ^/(_(profiler|wdt)|css|images|js)/
    #    security: false

    main:
        anonymous: true
        pattern: ^/
        form_login:
            provider: fos_userbundle
            login_path: /login
            check_path: fos_user_security_check
            # 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: ^/chat, role: ROLE_ADMIN }
  • 写回答

1条回答 默认 最新

  • dongyan7876 2016-04-14 09:44
    关注

    You have two providers keys in your security.yml file which means that the second one is never loaded (as specified by the YAML specs). Thus, your application doesn't know anything about the FOSUserBundle user provider, but only knows your in-memory user provider.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动