Exemple #1
0
 /**
  * Test if set adds prefixed cookied value.
  */
 public function testSet()
 {
     $this->assertFalse($this->cookies->exists($this->request, 'new_cookie'));
     list($this->request, $this->response) = $this->cookies->set($this->request, $this->response, 'new_cookie', 'new_cookie_value');
     $this->assertTrue($this->cookies->exists($this->request, 'new_cookie'));
     $this->assertSame('new_cookie_value', $this->cookies->get($this->request, 'new_cookie'));
 }
 /**
  * {@inheritdoc}
  */
 public function initialize(ServerRequestInterface $request)
 {
     $session_id = $this->cookies->get($request, $this->session_cookie_name);
     if (!$session_id) {
         return null;
     }
     $session = $this->session_repository->getById($session_id);
     if ($session instanceof SessionInterface) {
         if ($user = $session->getAuthenticatedUser($this->user_repository)) {
             $this->session_repository->recordUsageBySession($session);
             return new AuthenticationTransport($this, $user, $session);
         }
     }
     return new CleanUpTransport($this);
 }