2

我尝试了 10 次以找出如何安装 HWIOAuthBundle 但没有足够的文档,我安装了 Bundle 并完全按照Git中的文档进行操作,但它向我显示了这个错误:

InvalidConfigurationException: Unrecognized options "anonymous" under "security.firewalls.secured_area.oauth"

不知何故,我不明白 A 部分)“有一个实现的用户提供程序”。我该怎么办?或者我在哪里可以找到简单的文档

A) Have a user provider that implements OAuthAwareUserProviderInterface

The bundle needs a service that is able to load users based on the user response of the oauth endpoint. If you have a custom service it should implement the interface: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface.

The HWIOAuthBundle also ships with three default implementations:

    OAuthUserProvider (service name: hwi_oauth.user.provider) - doesn't persist users
    EntityUserProvider (service name: hwi_oauth.user.provider.entity) - loads users from a database
    FOSUserBundle integration (service name: hwi_oauth.user.provider.fosub_bridge). Checkout the documentation for integrating HWIOAuthBundle with FOSUserBundle for more information: (todo)

我应该在这里做什么?

4

3 回答 3

1

您应该替换/注释掉服务行:

oauth_user_provider:
    service: my.oauth_aware.user_provider.service

然后替换为:

oauth_user_provider:
    oauth: ~

来源:https ://github.com/hwi/HWIOAuthBundle/issues/72

更进一步:

于 2014-06-04T21:19:41.850 回答
0

啊,这似乎是文档中的一个错字,你能把这anonymous4 个空格移到下面的位置吗:

# app/config/security.yml
security:
    firewalls:
        secured_area:
            anonymous: ~
            oauth:
                resource_owners:
                    facebook:      "/login/check-facebook"
                login_path:        /login
                failure_path:      /login

                oauth_user_provider:
                    service: my.oauth_aware.user_provider.service
于 2013-09-12T11:28:54.027 回答
0

简单的解决方法是定义这样的服务:

在 security.yml 中保留这个:

oauth_user_provider:
                service: my.oauth_aware.user_provider.service

在 services.yml 中输入:

services:
my.oauth_aware.user_provider.service:
        class: HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider
        arguments:
            userManager: "@fos_user.user_manager"
            properties: ["pass properties as array"]

而已 !

于 2014-12-20T11:37:35.080 回答