Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Factory/
?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src
<?php
namespace Application\Factory;
use Psr\Container\ContainerInterface;
use Application\Middleware\AuthorizationMiddleware;
use Laminas\Authentication\AuthenticationService;
use Laminas\ServiceManager\Factory\FactoryInterface;
class AuthorizationMiddlewareFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$authService = $container->get(AuthenticationService::class);
$acl = $container->get('Acl'); // II init it in bootstrap(), could be improved
$response = $container->get('Response');
$baseUrl = $container->get('Request')->getBaseUrl();
$authorization = new AuthorizationMiddleware($authService, $acl, $response, $baseUrl);
return $authorization ;
}
}