Class ContentSecurityPolicy
java.lang.Object
org.deltava.beans.system.ContentSecurityPolicy
A bean to store dynamic Content Security Policy data.
- Since:
- 12.0
- Version:
- 12.0
- Author:
- Luke
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContentSecurityPolicy
(boolean enforce) Creates the bean and populates default values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(ContentSecurity cs, String host) Adds an entry to this Security Policy.getData()
Generates the value to place into the Security Plicy HTTP header.Returns the name of the CSP response header, which varies depending on enfrocement mode.Generates the value to place into Reporting API header.boolean
Returns whether a Reporting API endpoint has been defined for this Security Policy.void
setReportURI
(String group, String url) Updates a Reporting API endpoint for this Security Policy.
-
Field Details
-
SELF
-
-
Constructor Details
-
ContentSecurityPolicy
public ContentSecurityPolicy(boolean enforce) Creates the bean and populates default values.- Parameters:
enforce
- TRUE if the CSP is enforced, otherwise FALSE for warn-only mode
-
-
Method Details
-
add
Adds an entry to this Security Policy.- Parameters:
cs
- a ContentSecurity typehost
- a permitted host
-
setReportURI
-
hasReportURI
public boolean hasReportURI()Returns whether a Reporting API endpoint has been defined for this Security Policy.- Returns:
- TRUE if a URI has been defined, otherwise FALSE
-
getHeader
Returns the name of the CSP response header, which varies depending on enfrocement mode.- Returns:
- the header name
-
getReportHeader
Generates the value to place into Reporting API header.- Returns:
- the Header value
-
getData
Generates the value to place into the Security Plicy HTTP header.- Returns:
- the Header value
-