Creates a Content Security Policy object.
More...
|
| __construct (?bool $reportOnly=null) |
| ContentSecurity constructor.
|
|
| addPolicy (string $directive, string ... $values) |
| Adds new values to a directive.
|
|
| removePolicy (string $directive, string ... $values) |
|
| addPolicyDefault (string $directive, string ... $values) |
| Adds new values to a directive, re-using default-src actual values.
|
|
| addNonce (string $nonce, string ... $directives) |
| Adds a nonce to the directives.
|
|
| addHash (string $hash, string ... $directives) |
| Adds a hash to the directives.
|
|
| addNonceDefault (string $nonce, string ... $directives) |
| Adds a nonce to a directive, re-using default-src actual values.
|
|
| addHashDefault (string $hash, string ... $directives) |
| Adds a hash to a directive, re-using default-src actual values.
|
|
| setDefaultSrc (string ... $policies) |
| Defines the policies for default-src directive.
|
|
| generate () |
| Generates the header string.
|
|
| display (callable $directiveCall, callable $policyCall) |
| Display a ContentSecurity object.
|
|
| reportOnly (?bool $reportOnly=true) |
| Sets reportOnly.
|
|
| addHeaderToResponse (?bool $reportOnly=null) |
| Adds headers to the response.
|
|
| getPolicies () |
| Returns the actual policies.
|
|
|
static | nonce ($nonce, string ... $directives) |
| Creates a nonce and add it to some directives.
|
|
static | all () |
| Creates a new ContentSecurity object, with self in default-src.
|
|
static | defaultUbiquity () |
| Creates a new ContentSecurity object for Ubiquity Webtools.
|
|
static | defaultUbiquityDebug (string $livereloadServer='127.0.0.1:35729') |
| Creates a new ContentSecurity object for Ubiquity Webtools in debug mode.
|
|
|
const | HEADER = 'Content-Security-Policy' |
|
const | DEBUG_HEADER = 'Content-Security-Policy-Report-Only' |
|
Creates a Content Security Policy object.
Ubiquity\security\csp$ContentSecurity This class is part of Ubiquity
- Author
- jc
- Version
- 1.0.0
Definition at line 16 of file ContentSecurity.php.
◆ __construct()
__construct |
( |
?bool |
$reportOnly = null | ) |
|
◆ addHash()
addHash |
( |
string |
$hash, |
|
|
string ... |
$directives |
|
) |
| |
Adds a hash to the directives.
- Parameters
-
string | $hash | |
| string | ...$directives |
- Returns
- $this
Definition at line 104 of file ContentSecurity.php.
◆ addHashDefault()
addHashDefault |
( |
string |
$hash, |
|
|
string ... |
$directives |
|
) |
| |
Adds a hash to a directive, re-using default-src actual values.
- Parameters
-
string | $hash | |
| string | ...$directives |
- Returns
- $this
Definition at line 132 of file ContentSecurity.php.
◆ addHeaderToResponse()
addHeaderToResponse |
( |
?bool |
$reportOnly = null | ) |
|
◆ addNonce()
addNonce |
( |
string |
$nonce, |
|
|
string ... |
$directives |
|
) |
| |
Adds a nonce to the directives.
- Parameters
-
string | $nonce | |
| string | ...$directives |
- Returns
- $this
Definition at line 90 of file ContentSecurity.php.
◆ addNonceDefault()
addNonceDefault |
( |
string |
$nonce, |
|
|
string ... |
$directives |
|
) |
| |
Adds a nonce to a directive, re-using default-src actual values.
- Parameters
-
string | $nonce | |
| string | ...$directives |
- Returns
- $this
Definition at line 118 of file ContentSecurity.php.
◆ addPolicy()
addPolicy |
( |
string |
$directive, |
|
|
string ... |
$values |
|
) |
| |
Adds new values to a directive.
- Parameters
-
string | $directive | |
| string | ...$values |
- Returns
- $this
Definition at line 44 of file ContentSecurity.php.
◆ addPolicyDefault()
addPolicyDefault |
( |
string |
$directive, |
|
|
string ... |
$values |
|
) |
| |
Adds new values to a directive, re-using default-src actual values.
- Parameters
-
string | $directive | |
| string | ...$values |
- Returns
- $this
Definition at line 76 of file ContentSecurity.php.
◆ all()
Creates a new ContentSecurity object, with self in default-src.
- Returns
- ContentSecurity
Definition at line 222 of file ContentSecurity.php.
◆ defaultUbiquity()
static defaultUbiquity |
( |
| ) |
|
|
static |
◆ defaultUbiquityDebug()
static defaultUbiquityDebug |
( |
string |
$livereloadServer = '127.0.0.1:35729' | ) |
|
|
static |
Creates a new ContentSecurity object for Ubiquity Webtools in debug mode.
- Parameters
-
- Returns
- ContentSecurity
Definition at line 254 of file ContentSecurity.php.
◆ display()
display |
( |
callable |
$directiveCall, |
|
|
callable |
$policyCall |
|
) |
| |
Display a ContentSecurity object.
- Parameters
-
callable | $directiveCall | |
callable | $policyCall | |
- Returns
- string
Definition at line 170 of file ContentSecurity.php.
◆ generate()
◆ getPolicies()
◆ nonce()
static nonce |
( |
|
$nonce, |
|
|
string ... |
$directives |
|
) |
| |
|
static |
Creates a nonce and add it to some directives.
- Parameters
-
$nonce | |
string | ...$directives |
- Returns
- ContentSecurity
Definition at line 212 of file ContentSecurity.php.
◆ removePolicy()
removePolicy |
( |
string |
$directive, |
|
|
string ... |
$values |
|
) |
| |
◆ reportOnly()
reportOnly |
( |
?bool |
$reportOnly = true | ) |
|
◆ setDefaultSrc()
setDefaultSrc |
( |
string ... |
$policies | ) |
|
Defines the policies for default-src directive.
- Parameters
-
- Returns
- $this
Definition at line 145 of file ContentSecurity.php.
◆ $header
◆ $policies
◆ DEBUG_HEADER
const DEBUG_HEADER = 'Content-Security-Policy-Report-Only' |
◆ HEADER
const HEADER = 'Content-Security-Policy' |
The documentation for this class was generated from the following file:
- C:/Users/myadd/Documents/GitHub/ubiquity-doc-api/vendor/phpmv/ubiquity-security/src/Ubiquity/security/csp/ContentSecurity.php