changed the Firewall to be a proper subscriber

This commit is contained in:
Fabien Potencier 2012-11-06 11:06:32 +01:00
parent 02bd35905e
commit af87c2b00b
2 changed files with 9 additions and 2 deletions

View File

@ -106,7 +106,7 @@
<!-- Firewall related services --> <!-- Firewall related services -->
<service id="security.firewall" class="%security.firewall.class%"> <service id="security.firewall" class="%security.firewall.class%">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="8" /> <tag name="kernel.event_subscriber" />
<argument type="service" id="security.firewall.map" /> <argument type="service" id="security.firewall.map" />
<argument type="service" id="event_dispatcher" /> <argument type="service" id="event_dispatcher" />
</service> </service>

View File

@ -12,8 +12,10 @@
namespace Symfony\Component\Security\Http; namespace Symfony\Component\Security\Http;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/** /**
* Firewall uses a FirewallMap to register security listeners for the given * Firewall uses a FirewallMap to register security listeners for the given
@ -25,7 +27,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */
class Firewall class Firewall implements EventSubscriberInterface
{ {
private $map; private $map;
private $dispatcher; private $dispatcher;
@ -68,4 +70,9 @@ class Firewall
} }
} }
} }
public static function getSubscribedEvents()
{
return array(KernelEvents::REQUEST => array('onKernelRequest', 8));
}
} }