Ejemplo n.º 1
0
 /**
  * Starts the authentication: Redirect to login page
  *
  * @param \F3\FLOW3\MVC\RequestInterface $request The current request
  * @param \F3\FLOW3\MVC\ResponseInterface $response The current response
  * @return void
  */
 public function startAuthentication(\F3\FLOW3\MVC\RequestInterface $request, \F3\FLOW3\MVC\ResponseInterface $response)
 {
     if (!$this->canForward($request)) {
         throw new \F3\FLOW3\Security\Exception\RequestTypeNotSupportedException('Unsupported request type for authentication entry point given.', 1237282462);
     }
     if (!is_array($this->options) || !isset($this->options['uri'])) {
         throw new \F3\FLOW3\Security\Exception\MissingConfigurationException('The configuration for the WebRedirect authentication entry point is incorrect or missing.', 1237282583);
     }
     $escapedUri = htmlentities($this->options['uri'], ENT_QUOTES, 'utf-8');
     $response->setContent('<html><head><meta http-equiv="refresh" content="0;url=' . $escapedUri . '"/></head></html>');
     $response->setStatus(303);
     $response->setHeader('Location', (string) $this->options['uri']);
 }
 /**
  * Sends the specified HTTP status immediately.
  *
  * NOTE: This method only supports web requests and will throw an exception if used with other request types.
  *
  * @param integer $statusCode The HTTP status code
  * @param string $statusMessage A custom HTTP status message
  * @param string $content Body content which further explains the status
  * @throws \F3\FLOW3\MVC\Exception\UnsupportedRequestTypeException If the request is not a web request
  * @throws \F3\FLOW3\MVC\Exception\StopActionException
  * @author Robert Lemke <*****@*****.**>
  * @api
  */
 protected function throwStatus($statusCode, $statusMessage = NULL, $content = NULL)
 {
     if (!$this->request instanceof \F3\FLOW3\MVC\Web\Request) {
         throw new \F3\FLOW3\MVC\Exception\UnsupportedRequestTypeException('throwStatus() only supports web requests.', 1220539739);
     }
     $this->response->setStatus($statusCode, $statusMessage);
     if ($content === NULL) {
         $content = $this->response->getStatus();
     }
     $this->response->setContent($content);
     throw new \F3\FLOW3\MVC\Exception\StopActionException();
 }