服务“security.authentication.manager”依赖于一个不存在的服务“security.user.provider.concrete.fos_userbundle”
The service “security.authentication.manager” has a dependency on a non-existent service “security.user.provider.concrete.fos_userbundle”
我遇到了一个非常令人沮丧的问题,甚至不知道在哪里进行故障排除,因为 Symfony 没有提到违规者。
我需要构建一个 OAUTH 服务器,以便在已经拥有完美运行的 Sonata User Admin/FOSUser 捆绑包的应用程序上对移动用户进行身份验证。
我选择安装我之前使用过的FOSOAuthServerBundle,没有太多麻烦。然而今天,我不断收到以下错误:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.user_provider".
这是我的相关文件:
config.yml
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Application\Sonata\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
service:
user_manager: sonata.user.orm.user_manager
fos_oauth_server:
db_driver: orm
client_class: AppBundle\Entity\Client
access_token_class: AppBundle\Entity\AccessToken
refresh_token_class: AppBundle\Entity\RefreshToken
auth_code_class: AppBundle\Entity\AuthCode
service:
user_provider: sonata.user.orm.user_manager
options:
supported_scopes: user
security.yml
providers:
fos_userbundle:
id: fos_user.user_manager
encoders:
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
dev:
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
security: false
oauth_token:
pattern: ^/oauth/v2/token
security: false
admin:
pattern: /admin(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
logout:
path: /admin/logout
anonymous: true
oauth_authorize:
pattern: ^/oauth/v2/auth
form_login:
provider: user_provider
check_path: _security_check
login_path: _demo_login
anonymous: true
api:
pattern: ^/api
fos_oauth: true
stateless: true
main:
pattern: .*
context: user
form_login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
logout: true
anonymous: true
这里有一个几乎类似的问题 The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.fos_userbundle" 但他的问题是由于省略了提供者下的 fos_userbundle id 引起的,我的情况就是这种情况。
请有人协助阐明一些问题
你的错误一定是在这里:
oauth_authorize:
pattern: ^/oauth/v2/auth
form_login:
provider: user_provider #where is this provider? shouldnt it be fos_userbundle
check_path: _security_check
login_path: _demo_login
anonymous: true
我遇到了一个非常令人沮丧的问题,甚至不知道在哪里进行故障排除,因为 Symfony 没有提到违规者。
我需要构建一个 OAUTH 服务器,以便在已经拥有完美运行的 Sonata User Admin/FOSUser 捆绑包的应用程序上对移动用户进行身份验证。
我选择安装我之前使用过的FOSOAuthServerBundle,没有太多麻烦。然而今天,我不断收到以下错误:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.user_provider".
这是我的相关文件:
config.yml
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: Application\Sonata\UserBundle\Entity\User
group:
group_class: Application\Sonata\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
service:
user_manager: sonata.user.orm.user_manager
fos_oauth_server:
db_driver: orm
client_class: AppBundle\Entity\Client
access_token_class: AppBundle\Entity\AccessToken
refresh_token_class: AppBundle\Entity\RefreshToken
auth_code_class: AppBundle\Entity\AuthCode
service:
user_provider: sonata.user.orm.user_manager
options:
supported_scopes: user
security.yml
providers:
fos_userbundle:
id: fos_user.user_manager
encoders:
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
dev:
pattern: ^/(_(profiler|wdt|error)|css|images|js)/
security: false
oauth_token:
pattern: ^/oauth/v2/token
security: false
admin:
pattern: /admin(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
logout:
path: /admin/logout
anonymous: true
oauth_authorize:
pattern: ^/oauth/v2/auth
form_login:
provider: user_provider
check_path: _security_check
login_path: _demo_login
anonymous: true
api:
pattern: ^/api
fos_oauth: true
stateless: true
main:
pattern: .*
context: user
form_login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
logout: true
anonymous: true
这里有一个几乎类似的问题 The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.fos_userbundle" 但他的问题是由于省略了提供者下的 fos_userbundle id 引起的,我的情况就是这种情况。
请有人协助阐明一些问题
你的错误一定是在这里:
oauth_authorize:
pattern: ^/oauth/v2/auth
form_login:
provider: user_provider #where is this provider? shouldnt it be fos_userbundle
check_path: _security_check
login_path: _demo_login
anonymous: true