public function ReportUri::alterPolicy in Content-Security-Policy 8
Alter the provided policy according to the plugin settings.
Parameters
\Drupal\csp\Csp $policy: The policy to alter.
Overrides ReportingHandlerBase::alterPolicy
File
- src/
Plugin/ CspReportingHandler/ ReportUri.php, line 75
Class
- ReportUri
- CSP Reporting Plugin for ReportURI service.
Namespace
Drupal\csp\Plugin\CspReportingHandlerCode
public function alterPolicy(Csp $policy) {
$type = 'enforce';
if ($this->configuration['type'] == 'report-only') {
$type = empty($this->configuration['wizard']) ? 'reportOnly' : 'wizard';
}
$policy
->setDirective('report-uri', 'https://' . $this->configuration['subdomain'] . '.report-uri.com/r/d/csp/' . $type);
}