/**
  * Handle logout process
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     if ($this->logout->matches($event->getRequest())) {
         $this->authentication->clearIdentity();
         if ($this->target) {
             // Target can be null for user defined controller behaviour
             $event->setResponse(new RedirectResponse((string) $this->target));
         }
     }
 }
 /**
  * Check if request need to be processed
  *
  * @param  Request $request
  * @return bool
  */
 protected function isRequestNeedProcessing(Request $request)
 {
     if (!$this->pattern->matches($request)) {
         return false;
     }
     foreach ($this->whitelist as $whitelist) {
         if ($whitelist->matches($request)) {
             return false;
         }
     }
     return true;
 }
Example #3
0
 public function testAbsoluteUriMatch()
 {
     $request = Request::create('http://example.com/login');
     $uri = Uri::factory('http://example.com/login');
     static::assertTrue($uri->matches($request));
 }
 /**
  * Normalize uri option
  *
  * @param  Options      $options
  * @param  array|string $value
  * @return array|Uri
  */
 public function normalizeUri(Options $options, $value)
 {
     if (is_string($value)) {
         return Uri::factory($value);
     } else {
         if (is_array($value)) {
             return array_map(function ($uri) {
                 return Uri::factory($uri);
             }, $value);
         }
     }
     return $value;
 }