服务" security.authentication.manager"依赖于不存在的服务" security.user.provider.concrete.fos_userbundle"

时间:2011-11-21 16:30:50

标签: symfony

我尝试启用FOSUserBundle以及FOSFacebookBundle 任何网址都有例外。

任何想法的人?

ServiceNotFoundException:服务“security.authentication.manager”依赖于不存在的服务“security.user.provider.concrete.fos_userbundle”

config.yml

fos_user:
    db_driver: mongodb
    firewall_name: main
    user_class: Acme\AcmeBundle\Document\User
fos_twitter:
    file: %kernel.root_dir%/../vendor/twitteroauth/twitteroauth/twitteroauth.php
    consumer_key:    ''
    consumer_secret: ''
    callback_url: ''
fos_facebook:
    file:   %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
    alias:  facebook
    app_id: ''
    secret: ''
    cookie: true
    permissions: [email, user_birthday, user_location]
services:
    my.facebook.user:
        class: Acme\AcmeBundle\Security\FacebookProvider
        arguments:
            facebook: "@fos_facebook.api"
            userManager: "@fos_user.user_manager"
            validator: "@validator"
            container: "@service_container"





security:       
    factories:
      - "%kernel.root_dir%/../vendor/bundles/FOS/TwitterBundle/Resources/config/security_factories.xml"
      - "%kernel.root_dir%/../vendor/bundles/FOS/FacebookBundle/Resources/config/security_factories.xml"

    providers:
        my_fos_facebook_provider:
            id: my.facebook.user                     

    firewalls:       
        public:
          pattern:   ^/.*
          form_login:
            login_path: /login
            provider: fos_userbundle          
          fos_facebook:
            app_url: ""
            server_url: ""
            login_path: /login
            check_path: /login_check/facebook
            provider: my_fos_facebook_provider
          anonymous: true
          logout:    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 }

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]  

3 个答案:

答案 0 :(得分:30)

我将fos_userbundle id添加到providers部分,现在工作正常。

providers:
    my_fos_facebook_provider:
        id: my.facebook.user  
    fos_userbundle:
        id: fos_user.user_manager

答案 1 :(得分:1)

对于symfony3

MyUserControl

答案 2 :(得分:0)

我在stackoverflow中尝试了所有提供的解决方案,但没有一个对我有用 我的解决方案是将 fos_userbundle 重命名为 security:providers:部分和 security中的 fos_user :firewall:main:form_login:provider:
希望这可以帮助那些人。