首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >zfc-rbac identity_provider发行

zfc-rbac identity_provider发行
EN

Stack Overflow用户
提问于 2014-03-21 07:45:35
回答 1查看 594关注 0票数 0

我和zfcrbac有个问题,我搞不清楚。

我想我可能错过了一些配置上的东西,但我读了几遍文档,没有任何线索。

每当我试着用它的时候

“传递给ZfcRbac\Service\RoleService::__construct()的参数1必须是ZfcRbac\IdentityProviderInterface的实例,Zend\Authentication\AuthenticationService给定的实例”

我有过

'identity_provider' => 'AuthService',

AuthService是Zend\Authentication\AuthenticationService的别名

我把它配置成这样

代码语言:javascript
复制
'factories' => array(
            'Auth\Model\AuthStorage' => function($sm){
                return new \Auth\Model\AuthStorage('auth_user');  
            },

            'AuthService' => function($sm) {
                $dbAdapter      = $sm->get('Zend\Db\Adapter\Adapter');
                $dbTableAuthAdapter  = new DbTableAuthAdapter($dbAdapter, 'user','username','password', 'md5(concat("' . $staticSalt . '" ,?,passwordSalt)) and active=1');

                $authService = new AuthenticationService();
                $authService->setAdapter($dbTableAuthAdapter);
                $authService->setStorage($sm->get('Auth\Model\AuthStorage'));


                return $authService;
            },
        ),

所以我不知道我错过了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-24 15:49:48

正如在文档中所说的:rbac.global.php.dist#L28

identity_provider选项的服务名称必须返回一个实现ZfcRbac\Identity IdentityProviderInterface的实例。我们提供一个内置的使用AuthenticationService:rbac.global.php.dist#L31的内置程序。

我建议您保持默认状态。为了构造ZfcRbac\Identity\AuthenticationIdentityProvider,ZfcRbac从其工厂获取Zend\Authentication\AuthenticationService。因此,您实际上需要的是将配置中的AuthService替换为'Zend\Authentication\AuthenticationService‘。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22553015

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档