We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in result this doesn't work and information in $_SESSION is alive during all session lifetime
NOTE: in version for ZF2 it worked as expected using EventManager in both cases. for ZF3 method resetAdapters was refactored using broken logic.
resetAdapters
AdapterChainServiceFactory.php
class AdapterChainServiceFactory implements FactoryInterface { public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null) { $chain = new AdapterChain(); $chain->setEventManager($serviceLocator->get('EventManager')); $options = $this->getOptions($serviceLocator); //iterate and attach multiple adapters and events if offered foreach ($options->getAuthAdapters() as $priority => $adapterName) { $adapter = $serviceLocator->get($adapterName); if (is_callable(array($adapter, 'authenticate'))) { $chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate'), $priority); } if (is_callable(array($adapter, 'logout'))) { $chain->getEventManager()->attach('logout', array($adapter, 'logout'), $priority); } } return $chain; } ...
AdapterChain.php
public function resetAdapters() { $sharedManager = $this->getEventManager()->getSharedManager(); if ($sharedManager) { $listeners = $sharedManager->getListeners(['authenticate'], 'authenticate'); foreach ($listeners as $listener) { if (is_array($listener) && $listener[0] instanceof ChainableAdapter) { $listener[0]->getStorage()->clear(); } } } return $this; }
class AdapterChainServiceFactory implements FactoryInterface { /** * @var ModuleOptions */ protected $options; public function createService(ServiceLocatorInterface $serviceLocator) { $chain = new AdapterChain(); $options = $this->getOptions($serviceLocator); //iterate and attach multiple adapters and events if offered foreach ($options->getAuthAdapters() as $priority => $adapterName) { $adapter = $serviceLocator->get($adapterName); if (is_callable(array($adapter, 'authenticate'))) { $chain->getEventManager()->attach('authenticate', array($adapter, 'authenticate'), $priority); } if (is_callable(array($adapter, 'logout'))) { $chain->getEventManager()->attach('logout', array($adapter, 'logout'), $priority); } } return $chain; } ...
public function resetAdapters() { $listeners = $this->getEventManager()->getListeners('authenticate'); foreach ($listeners as $listener) { $listener = $listener->getCallback(); if (is_array($listener) && $listener[0] instanceof ChainableAdapter) { $listener[0]->getStorage()->clear(); } } return $this; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
in result this doesn't work and information in $_SESSION is alive during all session lifetime
NOTE: in version for ZF2 it worked as expected using EventManager in both cases.
for ZF3 method
resetAdapters
was refactored using broken logic.ZF3:
AdapterChainServiceFactory.php
AdapterChain.php
ZF2:
AdapterChainServiceFactory.php
AdapterChain.php
The text was updated successfully, but these errors were encountered: