Class ContentSecurityPolicy
java.lang.Object
org.deltava.beans.system.ContentSecurityPolicy
A bean to store dynamic Content Security Policy data.
- Since:
- 12.0
- Version:
- 12.4
- Author:
- Luke
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionContentSecurityPolicy(boolean enforce, String nonce) Creates the bean and populates default values. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(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.getNonce()Returns the nonce used for inline script/style blocks.Generates the value to place into Reporting API header.booleanReturns whether a Reporting API endpoint has been defined for this Security Policy.voidsetReportURI(String group, String url) Updates a Reporting API endpoint for this Security Policy.
-
Field Details
-
SELF
-
NONE
-
-
Constructor Details
-
ContentSecurityPolicy
Creates the bean and populates default values.- Parameters:
enforce- TRUE if the CSP is enforced, otherwise FALSE for warn-only modenonce- a nonce for inline script/style elements
-
-
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
-
getNonce
Returns the nonce used for inline script/style blocks.- Returns:
- the nonce, or null if none
-
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
-