class SiteLog in Content-Security-Policy 8
Csp Reporting Handler to use Drupal log.
Plugin annotation
@CspReportingHandler(
id = "sitelog",
label = @Translation("Site Log"),
description = @Translation("Reports will be added to the site log."),
)
Hierarchy
- class \Drupal\csp\Plugin\ReportingHandlerBase implements ReportingHandlerInterface
- class \Drupal\csp\Plugin\CspReportingHandler\SiteLog
Expanded class hierarchy of SiteLog
File
- src/
Plugin/ CspReportingHandler/ SiteLog.php, line 18
Namespace
Drupal\csp\Plugin\CspReportingHandlerView source
class SiteLog extends ReportingHandlerBase {
/**
* {@inheritdoc}
*/
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());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ReportingHandlerBase:: |
protected | property | The Plugin Configuration. | |
ReportingHandlerBase:: |
protected | property | The Plugin Definition. | |
ReportingHandlerBase:: |
protected | property | The Plugin ID. | |
ReportingHandlerBase:: |
public | function |
Get the form fields for configuring this reporting handler. Overrides ReportingHandlerInterface:: |
2 |
ReportingHandlerBase:: |
public | function |
Validate the form fields of this report handler. Overrides ReportingHandlerInterface:: |
2 |
ReportingHandlerBase:: |
public | function | Reporting Handler plugin constructor. | |
SiteLog:: |
public | function |
Alter the provided policy according to the plugin settings. Overrides ReportingHandlerBase:: |