HeadersDsl

A Kotlin DSL to configure HttpSecurity headers using idiomatic Kotlin code.

Author

Eleftheria Stein

Since

5.3

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

whether all of the default headers should be included in the response

Functions

Link copied to clipboard
fun addHeaderWriter(headerWriter: HeaderWriter)

Adds a HeaderWriter instance.

Link copied to clipboard
fun cacheControl(cacheControlConfig: CacheControlDsl.() -> Unit)

Allows customizing the CacheControlHeadersWriter. Specifically it adds the following headers:

Link copied to clipboard
fun contentSecurityPolicy(contentSecurityPolicyConfig: ContentSecurityPolicyDsl.() -> Unit)

Allows configuration for Content Security Policy (CSP) Level 2.

Link copied to clipboard
fun contentTypeOptions(contentTypeOptionsConfig: ContentTypeOptionsDsl.() -> Unit)

Configures the XContentTypeOptionsHeaderWriter which inserts the

Link copied to clipboard
fun crossOriginEmbedderPolicy(crossOriginEmbedderPolicyConfig: CrossOriginEmbedderPolicyDsl.() -> Unit)

Allows configuration for Cross-Origin-Embedder-Policy header.

Link copied to clipboard
fun crossOriginOpenerPolicy(crossOriginOpenerPolicyConfig: CrossOriginOpenerPolicyDsl.() -> Unit)

Allows configuration for Cross-Origin-Opener-Policy header.

Link copied to clipboard
fun crossOriginResourcePolicy(crossOriginResourcePolicyConfig: CrossOriginResourcePolicyDsl.() -> Unit)

Configures the Cross-Origin-Resource-Policy header.

Link copied to clipboard
fun disable()

Disable all HTTP security headers.

Link copied to clipboard
fun featurePolicy(policyDirectives: String)

Allows configuration for Feature Policy.

Link copied to clipboard
fun frameOptions(frameOptionsConfig: FrameOptionsDsl.() -> Unit)

Allows customizing the XFrameOptionsHeaderWriter which add the X-Frame-Options header.

Link copied to clipboard

Allows customizing the HpkpHeaderWriter which provides support for HTTP Public Key Pinning (HPKP).

Link copied to clipboard

Allows customizing the HstsHeaderWriter which provides support for HTTP Strict Transport Security (HSTS).

Link copied to clipboard
fun permissionsPolicy(permissionsPolicyConfig: PermissionsPolicyDsl.() -> Unit)

Allows configuration for Permissions Policy.

Link copied to clipboard
fun referrerPolicy(referrerPolicyConfig: ReferrerPolicyDsl.() -> Unit)

Allows configuration for Referrer Policy.

Link copied to clipboard
fun xssProtection(xssProtectionConfig: XssProtectionConfigDsl.() -> Unit)

Note this is not comprehensive XSS protection!