Ejemplo n.º 1
0
 /**
  * Starts the authentication: Redirect to login page
  *
  * @param \TYPO3\Flow\Http\Request $request The current request
  * @param \TYPO3\Flow\Http\Response $response The current response
  * @return void
  * @throws MissingConfigurationException
  */
 public function startAuthentication(Request $request, Response $response)
 {
     if (isset($this->options['routeValues'])) {
         $routeValues = $this->options['routeValues'];
         if (!is_array($routeValues)) {
             throw new MissingConfigurationException(sprintf('The configuration for the WebRedirect authentication entry point is incorrect. "routeValues" must be an array, got "%s".', gettype($routeValues)), 1345040415);
         }
         $actionRequest = $request->createActionRequest();
         $this->uriBuilder->setRequest($actionRequest);
         $actionName = $this->extractRouteValue($routeValues, '@action');
         $controllerName = $this->extractRouteValue($routeValues, '@controller');
         $packageKey = $this->extractRouteValue($routeValues, '@package');
         $subPackageKey = $this->extractRouteValue($routeValues, '@subpackage');
         $uri = $this->uriBuilder->setCreateAbsoluteUri(TRUE)->uriFor($actionName, $routeValues, $controllerName, $packageKey, $subPackageKey);
     } elseif (isset($this->options['uri'])) {
         $uri = strpos($this->options['uri'], '://') !== FALSE ? $this->options['uri'] : $request->getBaseUri() . $this->options['uri'];
     } else {
         throw new MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing. You need to specify either the target "uri" or "routeValues".', 1237282583);
     }
     $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="0;url=%s"/></head></html>', htmlentities($uri, ENT_QUOTES, 'utf-8')));
     $response->setStatus(303);
     $response->setHeader('Location', $uri);
 }
Ejemplo n.º 2
0
 /**
  * Routes the specified web request by setting the controller name, action and possible
  * parameters. If the request could not be routed, it will be left untouched.
  *
  * @param \TYPO3\Flow\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router.
  * @return \TYPO3\Flow\Mvc\ActionRequest
  */
 public function route(Request $httpRequest)
 {
     $this->actionRequest = $httpRequest->createActionRequest();
     $matchResults = $this->findMatchResults($httpRequest);
     if ($matchResults !== NULL) {
         $requestArguments = $this->actionRequest->getArguments();
         $mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
         $this->actionRequest->setArguments($mergedArguments);
     }
     $this->setDefaultControllerAndActionNameIfNoneSpecified();
     return $this->actionRequest;
 }