AuthFactory.php 669 Bytes
Newer Older
1
2
3
4
5
6
<?php

namespace UnicaenAuth\Authentication\Storage;

use Interop\Container\ContainerInterface;
use Zend\Authentication\Storage\Session;
7
use Zend\Session\SessionManager;
8
9
10
11
12
13
14
15
16
17

class AuthFactory
{
    /**
     * @param ContainerInterface $container
     * @param string $requestedName
     * @return Auth
     */
    public function __invoke(ContainerInterface $container, string $requestedName): Auth
    {
18
19
20
        /** @var SessionManager $sessionManager */
        $sessionManager = $container->get(SessionManager::class);

21
        $storage = new Auth();
22
        $storage->setStorage(new Session(Usurpation::class, null, $sessionManager));
23
24
25
26

        return $storage;
    }
}