/** * Starts the authentication: Redirect to login page * * @param \TYPO3\FLOW3\Http\Request $request The current request * @param \TYPO3\FLOW3\Http\Response $response The current response * @return void * @throws \TYPO3\FLOW3\Security\Exception\RequestTypeNotSupportedException * @throws \TYPO3\FLOW3\Security\Exception\MissingConfigurationException */ public function startAuthentication(Request $request, Response $response) { if (!isset($this->options['uri'])) { throw new \TYPO3\FLOW3\Security\Exception\MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing.', 1237282583); } $plainUri = strpos('://', $this->options['uri'] !== FALSE) ? $this->options['uri'] : $request->getBaseUri() . $this->options['uri']; $escapedUri = htmlentities($plainUri, ENT_QUOTES, 'utf-8'); $response->setContent('<html><head><meta http-equiv="refresh" content="0;url=' . $escapedUri . '"/></head></html>'); $response->setStatus(303); $response->setHeader('Location', $plainUri); }
/** * Returns the DOM crawler which can be used to interact with the web page * structure, submit forms, click links or fetch specific parts of the * website's contents. * * The returned DOM crawler is bound to the response of the last executed * request. * * @return \Symfony\Component\DomCrawler\Crawler * @api */ public function getCrawler() { $crawler = new Crawler(NULL, $this->lastRequest->getBaseUri()); $crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type')); return $crawler; }
/** * @test */ public function getBaseUriReturnsThePresetBaseUriIfItHasBeenSet() { $server = array('HTTP_HOST' => 'dev.blog.rob', 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php'); $settings = array('http' => array('baseUri' => 'http://prod.blog.rob/')); $request = new Request(array(), array(), array(), array(), $server); $request->injectSettings($settings); $this->assertEquals('http://prod.blog.rob/', (string) $request->getBaseUri()); }
/** * 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\FLOW3\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router. * @return \TYPO3\FLOW3\Mvc\ActionRequest */ public function route(\TYPO3\FLOW3\Http\Request $httpRequest) { $this->actionRequest = $httpRequest->createActionRequest(); $routePath = substr($httpRequest->getUri()->getPath(), strlen($httpRequest->getBaseUri()->getPath())); $matchResults = $this->findMatchResults($routePath); if ($matchResults !== NULL) { $requestArguments = $this->actionRequest->getArguments(); $mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults); $this->actionRequest->setArguments($mergedArguments); } $this->setDefaultControllerAndActionNameIfNoneSpecified(); return $this->actionRequest; }