/**
  * @test
  */
 public function constructorParsesArgumentsWithSpecialCharactersCorrectly()
 {
     $uriString = 'http://www.typo3.com/path1/?argumentäöü1=' . urlencode('valueåø€œ');
     $uri = new Uri($uriString);
     $check = $uri->getScheme() == 'http' && $uri->getHost() == 'www.typo3.com' && $uri->getPath() == '/path1/' && $uri->getQuery() == 'argumentäöü1=value%C3%A5%C3%B8%E2%82%AC%C5%93' && $uri->getArguments() == array('argumentäöü1' => 'valueåø€œ');
     $this->assertTrue($check, 'The URI with special arguments has not been correctly transformed to an URI object');
 }
 /**
  * Updates the authentication credentials, the authentication manager needs to authenticate this token.
  * This could be a username/password from a login controller.
  * This method is called while initializing the security context. By returning TRUE you
  * make sure that the authentication manager will (re-)authenticate the tokens with the current credentials.
  * Note: You should not persist the credentials!
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $request The current request instance
  * @return boolean TRUE if this token needs to be (re-)authenticated
  */
 public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
 {
     $httpRequest = $actionRequest->getHttpRequest();
     if ($httpRequest->getMethod() !== 'GET') {
         return;
     }
     // Check if we have a callback request
     $arguments = $httpRequest->getArguments();
     $accessTokenCipher = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($arguments, '__flowpack.singlesignon.accessToken');
     $signature = \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($arguments, '__flowpack.singlesignon.signature');
     if (!empty($accessTokenCipher) && !empty($signature)) {
         // Get callback parameters from request
         $this->credentials['accessToken'] = base64_decode($accessTokenCipher);
         $this->credentials['signature'] = base64_decode($signature);
         $this->callbackUri = $actionRequest->getHttpRequest()->getUri();
         $arguments = $this->callbackUri->getArguments();
         unset($arguments['__flowpack']);
         $this->callbackUri->setQuery(http_build_query($arguments));
         $this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
     }
 }
 /**
  * Creates a new Request object from the given data.
  *
  * @param Uri $uri The request URI
  * @param string $method Request method, for example "GET"
  * @param array $arguments Arguments to send in the request body
  * @param array $files
  * @param array $server
  * @return Request
  * @api
  */
 public static function create(Uri $uri, $method = 'GET', array $arguments = array(), array $files = array(), array $server = array())
 {
     $get = $uri->getArguments();
     $post = $arguments;
     $isDefaultPort = $uri->getScheme() === 'https' ? $uri->getPort() === 443 : $uri->getPort() === 80;
     $defaultServerEnvironment = array('HTTP_USER_AGENT' => 'Flow/' . FLOW_VERSION_BRANCH . '.x', 'HTTP_HOST' => $uri->getHost() . ($isDefaultPort !== true && $uri->getPort() !== null ? ':' . $uri->getPort() : ''), 'SERVER_NAME' => $uri->getHost(), 'SERVER_ADDR' => '127.0.0.1', 'SERVER_PORT' => $uri->getPort() ?: 80, 'REMOTE_ADDR' => '127.0.0.1', 'SCRIPT_FILENAME' => FLOW_PATH_WEB . 'index.php', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php');
     if ($uri->getScheme() === 'https') {
         $defaultServerEnvironment['HTTPS'] = 'on';
         $defaultServerEnvironment['SERVER_PORT'] = $uri->getPort() ?: 443;
     }
     if (in_array($method, array('POST', 'PUT', 'DELETE'))) {
         $defaultServerEnvironment['HTTP_CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
     }
     $query = (string) $uri->getQuery();
     $fragment = $uri->getFragment();
     $overrideValues = array('REQUEST_URI' => $uri->getPath() . ($query !== '' ? '?' . $query : '') . ($fragment !== '' ? '#' . $fragment : ''), 'REQUEST_METHOD' => $method, 'QUERY_STRING' => $query);
     $server = array_replace($defaultServerEnvironment, $server, $overrideValues);
     return new static($get, $post, $files, $server);
 }