Skip to content

Instantly share code, notes, and snippets.

@igorw
Last active June 5, 2018 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorw/7735946 to your computer and use it in GitHub Desktop.
Save igorw/7735946 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class Csp implements HttpKernelInterface
{
private $app;
private $options;
public function __construct(HttpKernelInterface $app, array $options)
{
$this->app = $app;
$this->options = $options;
}
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
// validate incoming headers on $request
...
$response = $this->app->handle($request, $type, $catch);
// set correct headers on $response
...
return $response
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment