SiteLog.php in Content-Security-Policy 8
File
src/Plugin/CspReportingHandler/SiteLog.php
View source
<?php
namespace Drupal\csp\Plugin\CspReportingHandler;
use Drupal\Core\Url;
use Drupal\csp\Csp;
use Drupal\csp\Plugin\ReportingHandlerBase;
class SiteLog extends ReportingHandlerBase {
public function alterPolicy(Csp $policy) {
$reportUri = Url::fromRoute('csp.reporturi', [
'type' => $this->configuration['type'] == 'enforce' ? 'enforce' : 'reportOnly',
], [
'absolute' => TRUE,
]);
$policy
->setDirective('report-uri', $reportUri
->toString());
}
}
Classes
Name |
Description |
SiteLog |
Csp Reporting Handler to use Drupal log. |