/**
  * @test
  */
 public function getValueReturnsTheSetValue()
 {
     $cookie = new Cookie('foo', 'bar');
     $this->assertEquals('bar', $cookie->getValue());
     $cookie = new Cookie('foo', 'bar');
     $cookie->setValue('baz');
     $this->assertEquals('baz', $cookie->getValue());
     $cookie = new Cookie('foo', TRUE);
     $this->assertSame(TRUE, $cookie->getValue());
     $uri = new Uri('http://localhost');
     $cookie = new Cookie('foo', $uri);
     $this->assertSame($uri, $cookie->getValue());
 }
 /**
  * Automatically expires the session if the user has been inactive for too long.
  *
  * @return boolean TRUE if the session expired, FALSE if not
  */
 protected function autoExpire()
 {
     $lastActivitySecondsAgo = $this->now - $this->lastActivityTimestamp;
     $expired = false;
     if ($this->inactivityTimeout !== 0 && $lastActivitySecondsAgo > $this->inactivityTimeout) {
         $this->started = true;
         $this->sessionIdentifier = $this->sessionCookie->getValue();
         $this->destroy(sprintf('Session %s was inactive for %s seconds, more than the configured timeout of %s seconds.', $this->sessionIdentifier, $lastActivitySecondsAgo, $this->inactivityTimeout));
         $expired = true;
     }
     return $expired;
 }
 /**
  * @param \TYPO3\Flow\Security\Account $account
  * @param \TYPO3\Flow\Http\Cookie $sessionCookie
  * @return \stdClass
  */
 protected function buildAccountDTO(\TYPO3\Flow\Security\Account $account, \TYPO3\Flow\Http\Cookie $sessionCookie = NULL)
 {
     $person = $this->partyService->getAssignedPartyOfAccount($account);
     $simpleAccount = new \stdClass();
     $simpleAccount->displayName = (string) $person->getName();
     if ($sessionCookie !== NULL) {
         $simpleAccount->sessionIdentifier = $sessionCookie->getValue();
     }
     $simpleAccount->profile = sprintf('//typo3.org/services/userimage.php?username=%s&size=big', $account->getAccountIdentifier());
     $simpleAccount->roles = [];
     foreach ($account->getRoles() as $role) {
         /** @var $role \TYPO3\Flow\Security\Policy\Role */
         $simpleAccount->roles[] = $role->getName();
     }
     return $simpleAccount;
 }