|
<?php |
|
|
|
namespace Kanboard\Middleware; |
|
|
|
use Kanboard\Core\Controller\BaseMiddleware; |
|
use Symfony\Contracts\EventDispatcher\Event; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BootstrapMiddleware extends BaseMiddleware |
|
{ |
|
|
|
|
|
|
|
public function execute() |
|
{ |
|
$this->sessionManager->open(); |
|
$this->dispatcher->dispatch(new Event, 'app.bootstrap'); |
|
$this->sendHeaders(); |
|
$this->next(); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
private function sendHeaders() |
|
{ |
|
$this->response->withContentSecurityPolicy($this->container['cspRules']); |
|
$this->response->withSecurityHeaders(); |
|
$this->response->withP3P(); |
|
|
|
if (ENABLE_XFRAME) { |
|
$this->response->withXframe(); |
|
} |
|
|
|
if (ENABLE_HSTS) { |
|
$this->response->withStrictTransportSecurity(); |
|
} |
|
} |
|
} |
|
|