case class CSPConfig(reportOnly: Boolean = false, shouldFilterRequest: (RequestHeader) => Boolean = _ => true, nonce: CSPNonceConfig = CSPNonceConfig(), hashes: Seq[CSPHashConfig] = Seq.empty, directives: Seq[CSPDirective] = Seq.empty) extends Product with Serializable

CSP Configuration.

reportOnly

true if the header should be Content-Security-Policy-Report-Only.

shouldFilterRequest

A function that decides based on the headers of the request if a check is needed.

nonce

the CSP nonce configuration

hashes

a list of CSP hashes that can be added to the header

directives

the CSP directives configuration

Source
CSPConfig.scala
See also

Content Security Policy Level 3

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CSPConfig
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CSPConfig()

    Java Constructor

  2. new CSPConfig(reportOnly: Boolean = false, shouldFilterRequest: (RequestHeader) => Boolean = _ => true, nonce: CSPNonceConfig = CSPNonceConfig(), hashes: Seq[CSPHashConfig] = Seq.empty, directives: Seq[CSPDirective] = Seq.empty)

    reportOnly

    true if the header should be Content-Security-Policy-Report-Only.

    shouldFilterRequest

    A function that decides based on the headers of the request if a check is needed.

    nonce

    the CSP nonce configuration

    hashes

    a list of CSP hashes that can be added to the header

    directives

    the CSP directives configuration

Value Members

  1. val directives: Seq[CSPDirective]
  2. val hashes: Seq[CSPHashConfig]
  3. val nonce: CSPNonceConfig
  4. def productElementNames: Iterator[String]
    Definition Classes
    Product
  5. val reportOnly: Boolean
  6. val shouldFilterRequest: (RequestHeader) => Boolean
  7. def withDirectives(directives: List[CSPDirective]): CSPConfig
  8. def withHashes(hashes: List[CSPHashConfig]): CSPConfig
  9. def withNonce(nonce: CSPNonceConfig): CSPConfig
  10. def withReportOnly(reportOnly: Boolean): CSPConfig
  11. def withShouldProtect(shouldFilterRequest: Predicate[RequestHeader]): CSPConfig