Example #1
0
    public function __construct(SecurityContext $context, array $userProviders, $contextKey, LoggerInterface $logger = null, EventDispatcherInterface $eventDispatcher = null)
    {
        if (empty($contextKey)) {
            throw new \InvalidArgumentException('$contextKey must not be empty.');
        }

        $this->context = $context;
        $this->userProviders = $userProviders;
        $this->contextKey = $contextKey;

        if (null !== $eventDispatcher) {
            $eventDispatcher->connect('core.response', array($this, 'write'), 0);
        }
    }
 /**
  * Registers a core.exception listener to take care of security exceptions.
  *
  * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
  * @param integer                  $priority   The priority
  */
 public function register(EventDispatcherInterface $dispatcher)
 {
     $dispatcher->connect('core.exception', array($this, 'handleException'), 0);
 }
 /**
  * Listen to core.security, and core.response event
  *
  * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
  * @param integer         $priority   The priority
  */
 public function register(EventDispatcherInterface $dispatcher)
 {
     $dispatcher->connect('core.security', array($this, 'checkCookies'), 0);
     $dispatcher->connect('core.response', array($this, 'updateCookies'), 0);
     $this->eventDispatcher = $dispatcher;
 }
 /**
  * Subscribe to the core.security event
  *
  * @param EventDispatcher $dispatcher An EventDispatcher instance
  * @param integer         $priority   The priority
  */
 public function register(EventDispatcherInterface $dispatcher)
 {
     $dispatcher->connect('core.security', array($this, 'handle'), 0);
     $this->eventDispatcher = $dispatcher;
 }
 /**
  * Registers a core.security listener to load the SecurityContext from the
  * session.
  *
  * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
  * @param integer                  $priority   The priority
  */
 public function register(EventDispatcherInterface $dispatcher)
 {
     $dispatcher->connect('core.security', array($this, 'read'), 0);
     $dispatcher->connect('core.response', array($this, 'write'), 0);
 }