Hello,
can any one please help answering this question?
http://stackoverflow.com/questions/16497449/zfcrbac-can-not-get-identity-from-an-mvc-event
I have a ZF2 application that uses ZfcRbac, and it is integrated with an
old existing application, and so I need to get the authentication from the
other application, and I do get the identity from the old system by a
function as the following:
$em->attach(\Zend\Mvc\MvcEvent::EVENT_ROUTE, array($this,
'checkAuthentication'), 100);
and in ZfcRbac configuration I changed the identity provider and I get and
identity for ZfcRbac as the following:
'service_manager' => array(
'factories' => array(
'standard_identity' => function ($sm) {
$someIdentity = $sm->get('SomeAuthService')->getIdentity();
$roles = $someIdentity->getRoles();
$identity = new \ZfcRbac\Identity\StandardIdentity($roles);
return $identity;
},
)
)
but the problem is that the first time I request the page I can not get the
identity from the authentication service since the 'standard_identity' will
execute the code in the "onBootStrap" and it will find the session storage
empty and so I will always get 'unauthorized' access. I want the standard
identity to execute somehow after the event route because then I will have
the identity saved. any one can help with that?
Best Regards,