diff --git a/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php b/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php index 97a74366de1e3a118789247142351aa122f06a4f..c15c3fc83a3a013e8c5e871b94f4c7c877f160c7 100644 --- a/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php +++ b/src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php @@ -12,11 +12,15 @@ use Zend\ServiceManager\ServiceLocatorInterface; */ class ChainServiceFactory implements FactoryInterface { - protected $storages = [ + private $mandatoryStorages = [ 200 => 'UnicaenAuth\Authentication\Storage\Ldap', 100 => 'UnicaenAuth\Authentication\Storage\Db', + 76 => 'UnicaenAuth\Authentication\Storage\ShibSimulatorStorage', + 75 => 'UnicaenAuth\Authentication\Storage\Shib', ]; + protected $storages = []; + /** * Create service * @@ -27,7 +31,10 @@ class ChainServiceFactory implements FactoryInterface { $chain = new Chain(); - foreach ($this->storages as $priority => $name) { + $storages = $this->mandatoryStorages + $this->storages; + krsort($storages); + + foreach ($storages as $priority => $name) { $storage = $serviceLocator->get($name); $chain->getEventManager()->attach('read', [$storage, 'read'], $priority); $chain->getEventManager()->attach('write', [$storage, 'write'], $priority);