Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Service/Factory/
?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src/Service
<?php
namespace Application\Service\Factory;
use Psr\Container\ContainerInterface;
use Laminas\Authentication\AuthenticationService;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\Session\SessionManager;
use Laminas\Authentication\Storage\Session as SessionStorage;
use Application\Service\AuthAdapter;
/**
* The factory responsible for creating of authentication service.
*/
class AuthenticationServiceFactory
{
/**
* This method creates the Laminas\Authentication\AuthenticationService service
* and returns its instance.
*/
public function __invoke(ContainerInterface $container,
$requestedName, array $options = null)
{
$sessionManager = $container->get(SessionManager::class);
$authStorage = new SessionStorage('Zend_Auth', 'session', $sessionManager);
$authAdapter = $container->get(AuthAdapter::class);
// Create the service and inject dependencies into its constructor.
return new AuthenticationService($authStorage, $authAdapter);
}
}