Class CSPResources

java.lang.Object
org.graylog2.shared.rest.resources.csp.CSPResources

public class CSPResources extends Object
A Content Security Policy header consists of a list of policy directives, each of which consists of a directive and one or more values:
 
 <CSP> ::= Content-Security-Policy: <csp-list>
 <csp-list> :: = <policy-directive>{;<policy-directive>}
 <policy-directive> ::= <directive> <value>{ <value>}
 <directive> ::= default-src | script-src | ...
 <value> ::= Strings that do not contain any white space
 
 
See https://content-security-policy.com/
  • Constructor Details

    • CSPResources

      public CSPResources()
    • CSPResources

      public CSPResources(String resourceName)
  • Method Details

    • cspString

      public String cspString(String group)
      Return csp-list as a single string, based on all the properties with the specified group name
      Parameters:
      group -
      Returns:
      CSP string
    • updateAll

      public void updateAll(String directive, String value)
      Update all existing groups (rows) in the table with the specified value. Duplicated values are ignored; but substrings are tolerated e.g. test.com test.com:9999 Thread-safety needs to be enforced by the caller (i.e. CSPService).
      Parameters:
      directive -
      value - a directive value, consisting of one or more entries separated by blanks