<?php
namespace App\ApiBundle;
use App\ApiBundle\Security\HmacFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class ApiBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
parent::build($container);
// $hmacFactory should implement \Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface
// @see http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html#the-factory
$hmacFactory = new HmacFactory();
$extension = $container->getExtension('security');
$extension->addSecurityListenerFactory($hmacFactory);
}
}