summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2012-11-06 15:23:29 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2012-11-06 15:23:29 +0100
commit831661567b7e762fba3d89ea4e3d7cea6a34abb2 (patch)
tree4f4ededf545f71a25fdad067183a266efd30fc1c
parent4b9269629672a1f6794d0a06f64e4415b0a027a8 (diff)
parented7bf27ba7381a7f96c8616385e4815f17468d35 (diff)
downloadsymfony-security-831661567b7e762fba3d89ea4e3d7cea6a34abb2.zip
symfony-security-831661567b7e762fba3d89ea4e3d7cea6a34abb2.tar.gz
symfony-security-831661567b7e762fba3d89ea4e3d7cea6a34abb2.tar.bz2
merged branch fabpot/subscribers (PR #5919)
This PR was merged into the master branch. Commits ------- af87c2b changed the Firewall to be a proper subscriber 02bd359 changed the remember-me listener to be a proper subscriber Discussion ---------- Changed some security classes to implement the EventSubscriberInterface interface --------------------------------------------------------------------------- by fabpot at 2012-11-06T10:11:28Z That could also be done in 2.1. What do you think?
-rw-r--r--Http/Firewall.php9
-rw-r--r--Http/RememberMe/ResponseListener.php9
2 files changed, 16 insertions, 2 deletions
diff --git a/Http/Firewall.php b/Http/Firewall.php
index a590fd9..e083fdb 100644
--- a/Http/Firewall.php
+++ b/Http/Firewall.php
@@ -12,8 +12,10 @@
namespace Symfony\Component\Security\Http;
use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* 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>
*/
-class Firewall
+class Firewall implements EventSubscriberInterface
{
private $map;
private $dispatcher;
@@ -68,4 +70,9 @@ class Firewall
}
}
}
+
+ public static function getSubscribedEvents()
+ {
+ return array(KernelEvents::REQUEST => array('onKernelRequest', 8));
+ }
}
diff --git a/Http/RememberMe/ResponseListener.php b/Http/RememberMe/ResponseListener.php
index 6cbdcb3..03c71c7 100644
--- a/Http/RememberMe/ResponseListener.php
+++ b/Http/RememberMe/ResponseListener.php
@@ -12,13 +12,15 @@
namespace Symfony\Component\Security\Http\RememberMe;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
+use Symfony\Component\HttpKernel\KernelEvents;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Adds remember-me cookies to the Response.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
-class ResponseListener
+class ResponseListener implements EventSubscriberInterface
{
public function onKernelResponse(FilterResponseEvent $event)
{
@@ -29,4 +31,9 @@ class ResponseListener
$response->headers->setCookie($request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME));
}
}
+
+ public static function getSubscribedEvents()
+ {
+ return array(KernelEvents::RESPONSE => 'onKernelResponse');
+ }
}