Commit 7ffe2396 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'usurpation'

parents 32ed5e04 84a4f297
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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);