|
@@ -48,8 +48,6 @@ import org.springframework.security.web.header.writers.frameoptions.XFrameOption
|
|
|
import org.springframework.security.web.util.matcher.RequestMatcher;
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
-import static org.springframework.security.config.Customizer.withDefaults;
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* Adds the Security HTTP headers to the response. Security HTTP headers is activated by
|
|
@@ -129,26 +127,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Configures the {@link XContentTypeOptionsHeaderWriter} which inserts the
|
|
|
- * <a href= "https://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx"
|
|
|
- * >X-Content-Type-Options</a>:
|
|
|
- *
|
|
|
- * <pre>
|
|
|
- * X-Content-Type-Options: nosniff
|
|
|
- * </pre>
|
|
|
- * @return the {@link ContentTypeOptionsConfig} for additional customizations
|
|
|
- * @deprecated For removal in 7.0. Use {@link #contentTypeOptions(Customizer)} or
|
|
|
- * {@code contentTypeOptions(Customizer.withDefaults())} to stick with defaults. See
|
|
|
- * the <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public ContentTypeOptionsConfig contentTypeOptions() {
|
|
|
- return this.contentTypeOptions.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Configures the {@link XContentTypeOptionsHeaderWriter} which inserts the
|
|
|
* <a href= "https://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx"
|
|
@@ -166,26 +144,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * <strong>Note this is not comprehensive XSS protection!</strong>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Allows customizing the {@link XXssProtectionHeaderWriter} which adds the <a href=
|
|
|
- * "https://web.archive.org/web/20160201174302/https://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx"
|
|
|
- * >X-XSS-Protection header</a>
|
|
|
- * </p>
|
|
|
- * @return the {@link XXssConfig} for additional customizations
|
|
|
- * @deprecated For removal in 7.0. Use {@link #xssProtection(Customizer)} or
|
|
|
- * {@code xssProtection(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public XXssConfig xssProtection() {
|
|
|
- return this.xssProtection.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* <strong>Note this is not comprehensive XSS protection!</strong>
|
|
|
*
|
|
@@ -203,26 +161,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows customizing the {@link CacheControlHeadersWriter}. Specifically it adds the
|
|
|
- * following headers:
|
|
|
- * <ul>
|
|
|
- * <li>Cache-Control: no-cache, no-store, max-age=0, must-revalidate</li>
|
|
|
- * <li>Pragma: no-cache</li>
|
|
|
- * <li>Expires: 0</li>
|
|
|
- * </ul>
|
|
|
- * @return the {@link CacheControlConfig} for additional customizations
|
|
|
- * @deprecated For removal in 7.0. Use {@link #cacheControl(Customizer)} or
|
|
|
- * {@code cacheControl(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public CacheControlConfig cacheControl() {
|
|
|
- return this.cacheControl.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows customizing the {@link CacheControlHeadersWriter}. Specifically it adds the
|
|
|
* following headers:
|
|
@@ -240,19 +178,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows customizing the {@link HstsHeaderWriter} which provides support for
|
|
|
- * <a href="https://tools.ietf.org/html/rfc6797">HTTP Strict Transport Security
|
|
|
- * (HSTS)</a>.
|
|
|
- * @return the {@link HstsConfig} for additional customizations
|
|
|
- * @deprecated For removal in 7.0. Use
|
|
|
- * {@link #httpStrictTransportSecurity(Customizer)} instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HstsConfig httpStrictTransportSecurity() {
|
|
|
- return this.hsts.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows customizing the {@link HstsHeaderWriter} which provides support for
|
|
|
* <a href="https://tools.ietf.org/html/rfc6797">HTTP Strict Transport Security
|
|
@@ -266,20 +191,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows customizing the {@link XFrameOptionsHeaderWriter}.
|
|
|
- * @return the {@link FrameOptionsConfig} for additional customizations
|
|
|
- * @deprecated For removal in 7.0. Use {@link #frameOptions(Customizer)} or
|
|
|
- * {@code frameOptions(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public FrameOptionsConfig frameOptions() {
|
|
|
- return this.frameOptions.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows customizing the {@link XFrameOptionsHeaderWriter}.
|
|
|
* @param frameOptionsCustomizer the {@link Customizer} to provide more options for
|
|
@@ -291,21 +202,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows customizing the {@link HpkpHeaderWriter} which provides support for
|
|
|
- * <a href="https://tools.ietf.org/html/rfc7469">HTTP Public Key Pinning (HPKP)</a>.
|
|
|
- * @return the {@link HpkpConfig} for additional customizations
|
|
|
- *
|
|
|
- * @since 4.1
|
|
|
- * @deprecated see <a href=
|
|
|
- * "https://owasp.org/www-community/controls/Certificate_and_Public_Key_Pinning">Certificate
|
|
|
- * and Public Key Pinning</a> for more context
|
|
|
- */
|
|
|
- @Deprecated
|
|
|
- public HpkpConfig httpPublicKeyPinning() {
|
|
|
- return this.hpkp.enable();
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows customizing the {@link HpkpHeaderWriter} which provides support for
|
|
|
* <a href="https://tools.ietf.org/html/rfc7469">HTTP Public Key Pinning (HPKP)</a>.
|
|
@@ -322,39 +218,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * <p>
|
|
|
- * Allows configuration for <a href="https://www.w3.org/TR/CSP2/">Content Security
|
|
|
- * Policy (CSP) Level 2</a>.
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Calling this method automatically enables (includes) the Content-Security-Policy
|
|
|
- * header in the response using the supplied security policy directive(s).
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link ContentSecurityPolicyHeaderWriter} which
|
|
|
- * supports the writing of the two headers as detailed in the W3C Candidate
|
|
|
- * Recommendation:
|
|
|
- * </p>
|
|
|
- * <ul>
|
|
|
- * <li>Content-Security-Policy</li>
|
|
|
- * <li>Content-Security-Policy-Report-Only</li>
|
|
|
- * </ul>
|
|
|
- * @return the {@link ContentSecurityPolicyConfig} for additional configuration
|
|
|
- * @throws IllegalArgumentException if policyDirectives is null or empty
|
|
|
- * @since 4.1
|
|
|
- * @deprecated For removal in 7.0. Use {@link #contentSecurityPolicy(Customizer)}
|
|
|
- * instead
|
|
|
- * @see ContentSecurityPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public ContentSecurityPolicyConfig contentSecurityPolicy(String policyDirectives) {
|
|
|
- this.contentSecurityPolicy.writer = new ContentSecurityPolicyHeaderWriter(policyDirectives);
|
|
|
- return this.contentSecurityPolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* Allows configuration for <a href="https://www.w3.org/TR/CSP2/">Content Security
|
|
@@ -456,71 +319,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * <p>
|
|
|
- * Allows configuration for <a href="https://www.w3.org/TR/referrer-policy/">Referrer
|
|
|
- * Policy</a>.
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link ReferrerPolicyHeaderWriter} which support
|
|
|
- * the writing of the header as detailed in the W3C Technical Report:
|
|
|
- * </p>
|
|
|
- * <ul>
|
|
|
- * <li>Referrer-Policy</li>
|
|
|
- * </ul>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Default value is:
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <pre>
|
|
|
- * Referrer-Policy: no-referrer
|
|
|
- * </pre>
|
|
|
- * @return the {@link ReferrerPolicyConfig} for additional configuration
|
|
|
- * @since 4.2
|
|
|
- * @deprecated For removal in 7.0. Use {@link #referrerPolicy(Customizer)} or
|
|
|
- * {@code referrerPolicy(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- * @see ReferrerPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public ReferrerPolicyConfig referrerPolicy() {
|
|
|
- this.referrerPolicy.writer = new ReferrerPolicyHeaderWriter();
|
|
|
- return this.referrerPolicy;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * <p>
|
|
|
- * Allows configuration for <a href="https://www.w3.org/TR/referrer-policy/">Referrer
|
|
|
- * Policy</a>.
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link ReferrerPolicyHeaderWriter} which support
|
|
|
- * the writing of the header as detailed in the W3C Technical Report:
|
|
|
- * </p>
|
|
|
- * <ul>
|
|
|
- * <li>Referrer-Policy</li>
|
|
|
- * </ul>
|
|
|
- * @return the {@link ReferrerPolicyConfig} for additional configuration
|
|
|
- * @throws IllegalArgumentException if policy is null or empty
|
|
|
- * @since 4.2
|
|
|
- * @deprecated For removal in 7.0. Use {@link #referrerPolicy(Customizer)} or
|
|
|
- * {@code referrerPolicy(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- * @see ReferrerPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public ReferrerPolicyConfig referrerPolicy(ReferrerPolicy policy) {
|
|
|
- this.referrerPolicy.writer = new ReferrerPolicyHeaderWriter(policy);
|
|
|
- return this.referrerPolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* Allows configuration for <a href="https://www.w3.org/TR/referrer-policy/">Referrer
|
|
@@ -570,35 +368,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this.featurePolicy;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * <p>
|
|
|
- * Allows configuration for
|
|
|
- * <a href="https://w3c.github.io/webappsec-permissions-policy/">Permissions
|
|
|
- * Policy</a>.
|
|
|
- * </p>
|
|
|
- *
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link PermissionsPolicyHeaderWriter} which
|
|
|
- * support the writing of the header as detailed in the W3C Technical Report:
|
|
|
- * </p>
|
|
|
- * <ul>
|
|
|
- * <li>Permissions-Policy</li>
|
|
|
- * </ul>
|
|
|
- * @return the {@link PermissionsPolicyConfig} for additional configuration
|
|
|
- * @since 5.5
|
|
|
- * @deprecated For removal in 7.0. Use {@link #permissionsPolicyHeader(Customizer)} or
|
|
|
- * {@code permissionsPolicy(Customizer.withDefaults())} to stick with defaults. See
|
|
|
- * the <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- * @see PermissionsPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public PermissionsPolicyConfig permissionsPolicy() {
|
|
|
- this.permissionsPolicy.writer = new PermissionsPolicyHeaderWriter();
|
|
|
- return this.permissionsPolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows configuration for
|
|
|
* <a href="https://w3c.github.io/webappsec-permissions-policy/"> Permissions
|
|
@@ -645,26 +414,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows configuration for <a href=
|
|
|
- * "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy">
|
|
|
- * Cross-Origin-Opener-Policy</a> header.
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link CrossOriginOpenerPolicyHeaderWriter} which
|
|
|
- * responsible for writing the header.
|
|
|
- * </p>
|
|
|
- * @return the {@link CrossOriginOpenerPolicyConfig} for additional confniguration
|
|
|
- * @since 5.7
|
|
|
- * @deprecated For removal in 7.0. Use {@link #crossOriginOpenerPolicy(Customizer)}
|
|
|
- * instead
|
|
|
- * @see CrossOriginOpenerPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public CrossOriginOpenerPolicyConfig crossOriginOpenerPolicy() {
|
|
|
- this.crossOriginOpenerPolicy.writer = new CrossOriginOpenerPolicyHeaderWriter();
|
|
|
- return this.crossOriginOpenerPolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows configuration for <a href=
|
|
|
* "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy">
|
|
@@ -689,26 +438,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows configuration for <a href=
|
|
|
- * "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy">
|
|
|
- * Cross-Origin-Embedder-Policy</a> header.
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link CrossOriginEmbedderPolicyHeaderWriter}
|
|
|
- * which is responsible for writing the header.
|
|
|
- * </p>
|
|
|
- * @return the {@link CrossOriginEmbedderPolicyConfig} for additional customizations
|
|
|
- * @since 5.7
|
|
|
- * @deprecated For removal in 7.0. Use {@link #crossOriginEmbedderPolicy(Customizer)}
|
|
|
- * instead
|
|
|
- * @see CrossOriginEmbedderPolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public CrossOriginEmbedderPolicyConfig crossOriginEmbedderPolicy() {
|
|
|
- this.crossOriginEmbedderPolicy.writer = new CrossOriginEmbedderPolicyHeaderWriter();
|
|
|
- return this.crossOriginEmbedderPolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows configuration for <a href=
|
|
|
* "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy">
|
|
@@ -733,26 +462,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows configuration for <a href=
|
|
|
- * "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy">
|
|
|
- * Cross-Origin-Resource-Policy</a> header.
|
|
|
- * <p>
|
|
|
- * Configuration is provided to the {@link CrossOriginResourcePolicyHeaderWriter}
|
|
|
- * which is responsible for writing the header:
|
|
|
- * </p>
|
|
|
- * @return the {@link HeadersConfigurer} for additional customizations
|
|
|
- * @since 5.7
|
|
|
- * @deprecated For removal in 7.0. Use {@link #crossOriginResourcePolicy(Customizer)}
|
|
|
- * instead
|
|
|
- * @see CrossOriginResourcePolicyHeaderWriter
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public CrossOriginResourcePolicyConfig crossOriginResourcePolicy() {
|
|
|
- this.crossOriginResourcePolicy.writer = new CrossOriginResourcePolicyHeaderWriter();
|
|
|
- return this.crossOriginResourcePolicy;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Allows configuration for <a href=
|
|
|
* "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy">
|
|
@@ -791,17 +500,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
*/
|
|
|
public HeadersConfigurer<H> disable() {
|
|
|
this.writer = null;
|
|
|
- return and();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Allows customizing the {@link HeadersConfigurer}
|
|
|
- * @return the {@link HeadersConfigurer} for additional customization
|
|
|
- * @deprecated For removal in 7.0. Use {@link #contentTypeOptions(Customizer)}
|
|
|
- * instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
@@ -866,21 +564,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
*/
|
|
|
public HeadersConfigurer<H> disable() {
|
|
|
this.writer = null;
|
|
|
- return and();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Allows completing configuration of X-XSS-Protection and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use {@link #xssProtection(Customizer)} or
|
|
|
- * {@code xssProtection(Customizer.withDefaults())} to stick with defaults. See
|
|
|
- * the <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
@@ -914,21 +597,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Cache Control and continuing configuration
|
|
|
- * of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use {@link #cacheControl(Customizer)} or
|
|
|
- * {@code cacheControl(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Ensures the Cache Control headers are enabled if they are not already.
|
|
|
* @return the {@link CacheControlConfig} for additional customization
|
|
@@ -1026,18 +694,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Strict Transport Security and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use
|
|
|
- * {@link #httpStrictTransportSecurity(Customizer)} instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Ensures that Strict-Transport-Security is enabled if it is not already
|
|
|
* @return the {@link HstsConfig} for additional customization
|
|
@@ -1065,7 +721,7 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
*/
|
|
|
public HeadersConfigurer<H> deny() {
|
|
|
this.writer = new XFrameOptionsHeaderWriter(XFrameOptionsMode.DENY);
|
|
|
- return and();
|
|
|
+ return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1079,7 +735,7 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
*/
|
|
|
public HeadersConfigurer<H> sameOrigin() {
|
|
|
this.writer = new XFrameOptionsHeaderWriter(XFrameOptionsMode.SAMEORIGIN);
|
|
|
- return and();
|
|
|
+ return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1088,20 +744,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
*/
|
|
|
public HeadersConfigurer<H> disable() {
|
|
|
this.writer = null;
|
|
|
- return and();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Allows continuing customizing the headers configuration.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use {@link #frameOptions(Customizer)} or
|
|
|
- * {@code frameOptions(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
- * <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
return HeadersConfigurer.this;
|
|
|
}
|
|
|
|
|
@@ -1319,18 +961,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Content Security Policy and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use {@link #contentSecurityPolicy(Customizer)}
|
|
|
- * instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public final class ReferrerPolicyConfig {
|
|
@@ -1351,18 +981,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @deprecated For removal in 7.0. Use {@link #referrerPolicy(Customizer)} or
|
|
|
- * {@code referrerPolicy(Customizer.withDefaults())} to stick with defaults. See
|
|
|
- * the <a href=
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
- * for more details.
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public final class FeaturePolicyConfig {
|
|
@@ -1401,18 +1019,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Permissions Policy and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use {@link #permissionsPolicy(Customizer)}
|
|
|
- * instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public final class CrossOriginOpenerPolicyConfig {
|
|
@@ -1434,18 +1040,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Cross Origin Opener Policy and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use
|
|
|
- * {@link #crossOriginOpenerPolicy(Customizer)} instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public final class CrossOriginEmbedderPolicyConfig {
|
|
@@ -1468,18 +1062,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Cross-Origin-Embedder-Policy and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use
|
|
|
- * {@link #crossOriginEmbedderPolicy(Customizer)} instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public final class CrossOriginResourcePolicyConfig {
|
|
@@ -1502,18 +1084,6 @@ public class HeadersConfigurer<H extends HttpSecurityBuilder<H>>
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Allows completing configuration of Cross-Origin-Resource-Policy and continuing
|
|
|
- * configuration of headers.
|
|
|
- * @return the {@link HeadersConfigurer} for additional configuration
|
|
|
- * @deprecated For removal in 7.0. Use
|
|
|
- * {@link #crossOriginResourcePolicy(Customizer)} instead
|
|
|
- */
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
- public HeadersConfigurer<H> and() {
|
|
|
- return HeadersConfigurer.this;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|