package headers
- Alphabetic
- Public
- All
Type Members
-
trait
SecurityHeadersComponents extends AnyRef
The security headers components.
-
case class
SecurityHeadersConfig(frameOptions: Option[String] = Some("DENY"), xssProtection: Option[String] = Some("1; mode=block"), contentTypeOptions: Option[String] = Some("nosniff"), permittedCrossDomainPolicies: Option[String] = Some("master-only"), contentSecurityPolicy: Option[String] = None, referrerPolicy: Option[String] = ..., allowActionSpecificHeaders: Boolean = false) extends Product with Serializable
A type safe configuration object for setting security headers.
A type safe configuration object for setting security headers.
- frameOptions
"X-Frame-Options":
- xssProtection
"X-XSS-Protection":
- contentTypeOptions
"X-Content-Type-Options"
- permittedCrossDomainPolicies
"X-Permitted-Cross-Domain-Policies"
- contentSecurityPolicy
"Content-Security-Policy" - this is deprecated in favor of the dedicated CSPFilter.
- referrerPolicy
"Referrer-Policy"
- allowActionSpecificHeaders
Allows specific headers
-
class
SecurityHeadersConfigProvider extends Provider[SecurityHeadersConfig]
Provider for security headers configuration.
Provider for security headers configuration.
- Annotations
- @Singleton()
-
class
SecurityHeadersFilter extends EssentialFilter
The case class that implements the filter.
The case class that implements the filter. This gives you the most control, but you may want to use the apply() method on the companion singleton for convenience.
- Annotations
- @Singleton()
-
class
SecurityHeadersModule extends SimpleModule
The security headers module.
Value Members
-
object
SecurityHeadersConfig extends Serializable
Parses out a SecurityHeadersConfig from play.api.Configuration (usually this means application.conf).
-
object
SecurityHeadersFilter
This class sets a number of common security headers on the HTTP request.
This class sets a number of common security headers on the HTTP request.
NOTE: Because these are security headers, they are "secure by default." If the filter is applied, but these fields are NOT defined in Configuration, the defaults on the filter are NOT omitted, but are instead set to the strictest possible value.
- {{play.filters.headers.frameOptions}} - sets frameOptions. Some("DENY") by default.
- {{play.filters.headers.xssProtection}} - sets xssProtection. Some("1; mode=block") by default.
- {{play.filters.headers.contentTypeOptions}} - sets contentTypeOptions. Some("nosniff") by default.
- {{play.filters.headers.permittedCrossDomainPolicies}} - sets permittedCrossDomainPolicies. Some("master-only") by default.
- {{play.filters.headers.contentSecurityPolicy}} - sets contentSecurityPolicy. Some("default-src 'self'") by default.
- {{play.filters.headers.referrerPolicy}} - sets referrerPolicy. Some("origin-when-cross-origin, strict-origin-when-cross-origin") by default.
- {{play.filters.headers.allowActionSpecificHeaders}} - sets whether .withHeaders may be used to provide page-specific overrides. False by default.