Zend framework zfc rbac身份验证提供程序问题
我与zfcrbac有一个问题,我无法解决 我想我可能在配置中遗漏了一些东西,但我已经阅读了几次文档,没有任何线索 每当我试着用这个的时候,我就会 传递给ZfcRbac\Service\RoleService::\uu construct()的参数1必须是ZfcRbac\Identity\Identity ProviderInterface的实例,Zend\Authentication\AuthenticationService的实例 我有Zend framework zfc rbac身份验证提供程序问题,zend-framework,zfc-rbac,Zend Framework,Zfc Rbac,我与zfcrbac有一个问题,我无法解决 我想我可能在配置中遗漏了一些东西,但我已经阅读了几次文档,没有任何线索 每当我试着用这个的时候,我就会 传递给ZfcRbac\Service\RoleService::\uu construct()的参数1必须是ZfcRbac\Identity\Identity ProviderInterface的实例,Zend\Authentication\AuthenticationService的实例 我有 'identity\u provider'=>'Auth
'identity\u provider'=>'AuthService',
其中AuthService是Zend\Authentication\AuthenticationService的别名
我把它配置成这样
'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;
},
),
所以我不知道我错过了什么?正如文件中所说:
identity\u提供程序
选项的服务名称必须返回实现ZfcRbac\identity\IdentityProviderInterface的实例。我们提供了一个使用AuthenticationService的内置服务:
我建议您使用默认设置。要构造ZfcRbac\Identity\AuthenticationIdentityProvider
,ZfcRbac从其工厂获取Zend\Authentication\AuthenticationService
。因此,您实际上需要将配置中的AuthService替换为“Zend\Authentication\AuthenticationService”。如文档中所述:
identity\u提供程序
选项的服务名称必须返回实现ZfcRbac\identity\IdentityProviderInterface的实例。我们提供了一个使用AuthenticationService的内置服务:
我建议您使用默认设置。要构造ZfcRbac\Identity\AuthenticationIdentityProvider
,ZfcRbac从其工厂获取Zend\Authentication\AuthenticationService
。因此,您实际上需要将配置中的AuthService替换为“Zend\Authentication\AuthenticationService”。如文档中所述:
identity\u提供程序
选项的服务名称必须返回实现ZfcRbac\identity\IdentityProviderInterface的实例。我们提供了一个使用AuthenticationService的内置服务:
我建议您使用默认设置。要构造ZfcRbac\Identity\AuthenticationIdentityProvider
,ZfcRbac从其工厂获取Zend\Authentication\AuthenticationService
。因此,您实际上需要将配置中的AuthService替换为“Zend\Authentication\AuthenticationService”。如文档中所述:
identity\u提供程序
选项的服务名称必须返回实现ZfcRbac\identity\IdentityProviderInterface的实例。我们提供了一个使用AuthenticationService的内置服务:
我建议您使用默认设置。要构造
ZfcRbac\Identity\AuthenticationIdentityProvider
,ZfcRbac从其工厂获取Zend\Authentication\AuthenticationService
。因此,您实际上需要将配置中的AuthService替换为“Zend\Authentication\AuthenticationService”。好的,我将'identity\U provider'=>'AuthService'
更改为'identity\U provider'=>'ZfcRbac\identity\AuthenticationIdentityProvider'
并将此'AuthService'=>函数转换为($sm){
用于'Zend\Authentication\AuthenticationService'=>函数($sm){
我现在没有收到错误,但是如果我启用了guards,它不尊重角色,有没有办法打印出角色和权限,这样我就可以知道该用户有哪些权限?不尊重角色是什么意思?您是否正确配置了角色提供程序?关于打印角色和权限,您应该安装ZendDeveloperTools,它为ZfcRbac:)提供了内置调试工具。哦,太棒了!我最初禁用了ZendeDeveloperTools,因为我遇到了一些问题,但现在它工作正常了,非常感谢,我为ZfcRbac\identity\AuthenticationIdentity\IdentityPro更改了'identity\U provider'=>'AuthService'
为'Zend\Authentication\AuthenticationService'=>函数($sm){
{我现在没有收到错误,但是如果我启用了guards,它不尊重角色,有没有办法打印出角色和权限,这样我就可以知道该用户有哪些权限?不尊重角色是什么意思?您是否正确配置了角色提供程序?关于打印角色和权限,您应该安装ZendDeveloperTools,它为ZfcRbac:)提供了内置调试工具。哦,太棒了!我最初禁用了ZendeDeveloperTools,因为我遇到了一些问题,但现在它工作正常了,非常感谢,我为ZfcRbac\identity\AuthenticationIdentity\IdentityPro更改了'identity\U provider'=>'AuthService'
为'Zend\Authentication\AuthenticationService'=>函数($sm){
{我现在没有收到错误,但是如果我启用了guards,它不尊重角色,有没有办法打印出角色和权限,这样我就可以知道该用户有哪些权限?不尊重角色是什么意思?您是否正确配置了角色提供程序?关于打印角色和权限,您应该安装ZendDeveloperTools,它为ZfcRbac:)提供了内置调试工具。哦,太棒了!我最初禁用了ZendeDeveloperTools,因为我遇到了一些问题,但现在它工作正常了,非常感谢,我为ZfcRbac\identity\AuthenticationIdentity\IdentityPro更改了'identity\U provider'=>'AuthService'
为'Zend\Authentication\AuthenticationService'=>函数($sm){
创建了这个'authorservice'=>函数($sm){
我现在没有收到错误,但是如果我启用了警卫,这是不尊重角色的,有没有办法打印出角色和权限,这样我就可以知道什么权限了