Class ServerHttpSecurity.HeaderSpec
- java.lang.Object
 - 
- org.springframework.security.config.web.server.ServerHttpSecurity.HeaderSpec
 
 
- 
- Enclosing class:
 - ServerHttpSecurity
 
public final class ServerHttpSecurity.HeaderSpec extends java.lang.ObjectConfigures HTTP Response Headers.- Since:
 - 5.0
 - See Also:
 ServerHttpSecurity.headers()
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description classServerHttpSecurity.HeaderSpec.CacheSpecConfigures cache control headersclassServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpecConfiguresContent-Security-Policyresponse header.classServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpecThe content type headersclassServerHttpSecurity.HeaderSpec.FeaturePolicySpecConfiguresFeature-Policyresponse header.classServerHttpSecurity.HeaderSpec.FrameOptionsSpecConfigures frame options response headerclassServerHttpSecurity.HeaderSpec.HstsSpecConfigures Strict Transport Security response headerclassServerHttpSecurity.HeaderSpec.PermissionsPolicySpecConfiguresPermissions-Policyresponse header.classServerHttpSecurity.HeaderSpec.ReferrerPolicySpecConfiguresReferrer-Policyresponse header.classServerHttpSecurity.HeaderSpec.XssProtectionSpecConfigures x-xss-protection response header 
- 
Method Summary
 
 - 
 
- 
- 
Method Detail
- 
and
public ServerHttpSecurity and()
Allows method chaining to continue configuring theServerHttpSecurity- Returns:
 - the 
ServerHttpSecurityto continue configuring 
 
- 
disable
public ServerHttpSecurity disable()
Disables http response headers- Returns:
 - the 
ServerHttpSecurityto continue configuring 
 
- 
cache
public ServerHttpSecurity.HeaderSpec.CacheSpec cache()
Configures cache control headers- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.CacheSpecto configure 
 
- 
cache
public ServerHttpSecurity.HeaderSpec cache(Customizer<ServerHttpSecurity.HeaderSpec.CacheSpec> cacheCustomizer)
Configures cache control headers- Parameters:
 cacheCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.CacheSpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
contentTypeOptions
public ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec contentTypeOptions()
Configures content type response headers- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpecto configure 
 
- 
contentTypeOptions
public ServerHttpSecurity.HeaderSpec contentTypeOptions(Customizer<ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec> contentTypeOptionsCustomizer)
Configures content type response headers- Parameters:
 contentTypeOptionsCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
frameOptions
public ServerHttpSecurity.HeaderSpec.FrameOptionsSpec frameOptions()
Configures frame options response headers- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.FrameOptionsSpecto configure 
 
- 
frameOptions
public ServerHttpSecurity.HeaderSpec frameOptions(Customizer<ServerHttpSecurity.HeaderSpec.FrameOptionsSpec> frameOptionsCustomizer)
Configures frame options response headers- Parameters:
 frameOptionsCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.FrameOptionsSpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
writer
public ServerHttpSecurity.HeaderSpec writer(ServerHttpHeadersWriter serverHttpHeadersWriter)
Configures custom headers writer- Parameters:
 serverHttpHeadersWriter- theServerHttpHeadersWriterto provide custom headers writer- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize - Since:
 - 5.3.0
 
 
- 
hsts
public ServerHttpSecurity.HeaderSpec.HstsSpec hsts()
Configures the Strict Transport Security response headers- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.HstsSpecto configure 
 
- 
hsts
public ServerHttpSecurity.HeaderSpec hsts(Customizer<ServerHttpSecurity.HeaderSpec.HstsSpec> hstsCustomizer)
Configures the Strict Transport Security response headers- Parameters:
 hstsCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.HstsSpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
configure
protected void configure(ServerHttpSecurity http)
 
- 
xssProtection
public ServerHttpSecurity.HeaderSpec.XssProtectionSpec xssProtection()
Configures x-xss-protection response header.- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.XssProtectionSpecto configure 
 
- 
xssProtection
public ServerHttpSecurity.HeaderSpec xssProtection(Customizer<ServerHttpSecurity.HeaderSpec.XssProtectionSpec> xssProtectionCustomizer)
Configures x-xss-protection response header.- Parameters:
 xssProtectionCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.XssProtectionSpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
contentSecurityPolicy
public ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec contentSecurityPolicy(java.lang.String policyDirectives)
ConfiguresContent-Security-Policyresponse header.- Parameters:
 policyDirectives- the policy directive(s)- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpecto configure 
 
- 
contentSecurityPolicy
public ServerHttpSecurity.HeaderSpec contentSecurityPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec> contentSecurityPolicyCustomizer)
ConfiguresContent-Security-Policyresponse header.- Parameters:
 contentSecurityPolicyCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
featurePolicy
@Deprecated public ServerHttpSecurity.HeaderSpec.FeaturePolicySpec featurePolicy(java.lang.String policyDirectives)
Deprecated.UsepermissionsPolicy(Customizer)instead.ConfiguresFeature-Policyresponse header.- Parameters:
 policyDirectives- the policy- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.FeaturePolicySpecto configure 
 
- 
permissionsPolicy
public ServerHttpSecurity.HeaderSpec.PermissionsPolicySpec permissionsPolicy()
ConfiguresPermissions-Policyresponse header.- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.PermissionsPolicySpecto configure 
 
- 
permissionsPolicy
public ServerHttpSecurity.HeaderSpec permissionsPolicy(Customizer<ServerHttpSecurity.HeaderSpec.PermissionsPolicySpec> permissionsPolicyCustomizer)
ConfiguresPermissions-Policyresponse header.- Parameters:
 permissionsPolicyCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.PermissionsPolicySpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
- 
referrerPolicy
public ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec referrerPolicy(ReferrerPolicyServerHttpHeadersWriter.ReferrerPolicy referrerPolicy)
ConfiguresReferrer-Policyresponse header.- Parameters:
 referrerPolicy- the policy to use- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.ReferrerPolicySpecto configure 
 
- 
referrerPolicy
public ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec referrerPolicy()
ConfiguresReferrer-Policyresponse header.- Returns:
 - the 
ServerHttpSecurity.HeaderSpec.ReferrerPolicySpecto configure 
 
- 
referrerPolicy
public ServerHttpSecurity.HeaderSpec referrerPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec> referrerPolicyCustomizer)
ConfiguresReferrer-Policyresponse header.- Parameters:
 referrerPolicyCustomizer- theCustomizerto provide more options for theServerHttpSecurity.HeaderSpec.ReferrerPolicySpec- Returns:
 - the 
ServerHttpSecurity.HeaderSpecto customize 
 
 - 
 
 -