Class ServerHttpSecurity.HeaderSpec
java.lang.Object
org.springframework.security.config.web.server.ServerHttpSecurity.HeaderSpec
- Enclosing class:
- ServerHttpSecurity
Configures HTTP Response Headers.
- Since:
- 5.0
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionfinal classConfigures cache control headersfinal classConfiguresContent-Security-Policyresponse header.final classThe content type headersfinal classConfigures the Cross-Origin-Embedder-Policy headerfinal classConfigures the Cross-Origin-Opener-Policy headerfinal classConfigures the Cross-Origin-Resource-Policy headerfinal classConfiguresFeature-Policyresponse header.final classConfigures frame options response headerfinal classConfigures Strict Transport Security response headerfinal classConfiguresPermissions-Policyresponse header.final classConfiguresReferrer-Policyresponse header.final classConfigures x-xss-protection response header
- 
Method SummaryModifier and TypeMethodDescriptionand()Allows method chaining to continue configuring theServerHttpSecuritycache()Configures cache control headerscache(Customizer<ServerHttpSecurity.HeaderSpec.CacheSpec> cacheCustomizer) Configures cache control headersprotected voidconfigure(ServerHttpSecurity http) contentSecurityPolicy(String policyDirectives) ConfiguresContent-Security-Policyresponse header.contentSecurityPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec> contentSecurityPolicyCustomizer) ConfiguresContent-Security-Policyresponse header.Configures content type response headerscontentTypeOptions(Customizer<ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec> contentTypeOptionsCustomizer) Configures content type response headersConfigures the Cross-Origin-Embedder-Policy header.crossOriginEmbedderPolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginEmbedderPolicySpec> crossOriginEmbedderPolicyCustomizer) Configures the Cross-Origin-Embedder-Policy header.Configures the Cross-Origin-Opener-Policy header.crossOriginOpenerPolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginOpenerPolicySpec> crossOriginOpenerPolicyCustomizer) Configures the Cross-Origin-Opener-Policy header.Configures the Cross-Origin-Resource-Policy header.crossOriginResourcePolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginResourcePolicySpec> crossOriginResourcePolicyCustomizer) Configures the Cross-Origin-Resource-Policy header.disable()Disables http response headersfeaturePolicy(String policyDirectives) Deprecated.Configures frame options response headersframeOptions(Customizer<ServerHttpSecurity.HeaderSpec.FrameOptionsSpec> frameOptionsCustomizer) Configures frame options response headershsts()Configures the Strict Transport Security response headershsts(Customizer<ServerHttpSecurity.HeaderSpec.HstsSpec> hstsCustomizer) Configures the Strict Transport Security response headersConfiguresPermissions-Policyresponse header.permissionsPolicy(Customizer<ServerHttpSecurity.HeaderSpec.PermissionsPolicySpec> permissionsPolicyCustomizer) ConfiguresPermissions-Policyresponse header.ConfiguresReferrer-Policyresponse header.referrerPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec> referrerPolicyCustomizer) ConfiguresReferrer-Policyresponse header.referrerPolicy(ReferrerPolicyServerHttpHeadersWriter.ReferrerPolicy referrerPolicy) ConfiguresReferrer-Policyresponse header.writer(ServerHttpHeadersWriter serverHttpHeadersWriter) Configures custom headers writerConfigures x-xss-protection response header.xssProtection(Customizer<ServerHttpSecurity.HeaderSpec.XssProtectionSpec> xssProtectionCustomizer) Configures x-xss-protection response header.
- 
Method Details- 
andAllows method chaining to continue configuring theServerHttpSecurity- Returns:
- the ServerHttpSecurityto continue configuring
 
- 
disableDisables http response headers- Returns:
- the ServerHttpSecurityto continue configuring
 
- 
cacheConfigures cache control headers- Returns:
- the ServerHttpSecurity.HeaderSpec.CacheSpecto configure
 
- 
cachepublic ServerHttpSecurity.HeaderSpec cache(Customizer<ServerHttpSecurity.HeaderSpec.CacheSpec> cacheCustomizer) Configures cache control headers- Parameters:
- cacheCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.CacheSpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
contentTypeOptionsConfigures content type response headers- Returns:
- the ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpecto configure
 
- 
contentTypeOptionspublic ServerHttpSecurity.HeaderSpec contentTypeOptions(Customizer<ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec> contentTypeOptionsCustomizer) Configures content type response headers- Parameters:
- contentTypeOptionsCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.ContentTypeOptionsSpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
frameOptionsConfigures frame options response headers- Returns:
- the ServerHttpSecurity.HeaderSpec.FrameOptionsSpecto configure
 
- 
frameOptionspublic ServerHttpSecurity.HeaderSpec frameOptions(Customizer<ServerHttpSecurity.HeaderSpec.FrameOptionsSpec> frameOptionsCustomizer) Configures frame options response headers- Parameters:
- frameOptionsCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.FrameOptionsSpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
writerConfigures custom headers writer- Parameters:
- serverHttpHeadersWriter- the- ServerHttpHeadersWriterto provide custom headers writer
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
- Since:
- 5.3.0
 
- 
hstsConfigures the Strict Transport Security response headers- Returns:
- the ServerHttpSecurity.HeaderSpec.HstsSpecto configure
 
- 
hstspublic ServerHttpSecurity.HeaderSpec hsts(Customizer<ServerHttpSecurity.HeaderSpec.HstsSpec> hstsCustomizer) Configures the Strict Transport Security response headers- Parameters:
- hstsCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.HstsSpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
configure
- 
xssProtectionConfigures x-xss-protection response header.- Returns:
- the ServerHttpSecurity.HeaderSpec.XssProtectionSpecto configure
 
- 
xssProtectionpublic ServerHttpSecurity.HeaderSpec xssProtection(Customizer<ServerHttpSecurity.HeaderSpec.XssProtectionSpec> xssProtectionCustomizer) Configures x-xss-protection response header.- Parameters:
- xssProtectionCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.XssProtectionSpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
contentSecurityPolicypublic ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec contentSecurityPolicy(String policyDirectives) ConfiguresContent-Security-Policyresponse header.- Parameters:
- policyDirectives- the policy directive(s)
- Returns:
- the ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpecto configure
 
- 
contentSecurityPolicypublic ServerHttpSecurity.HeaderSpec contentSecurityPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec> contentSecurityPolicyCustomizer) ConfiguresContent-Security-Policyresponse header.- Parameters:
- contentSecurityPolicyCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.ContentSecurityPolicySpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
featurePolicy@Deprecated public ServerHttpSecurity.HeaderSpec.FeaturePolicySpec featurePolicy(String policyDirectives) Deprecated.UsepermissionsPolicy(Customizer)instead.ConfiguresFeature-Policyresponse header.- Parameters:
- policyDirectives- the policy
- Returns:
- the ServerHttpSecurity.HeaderSpec.FeaturePolicySpecto configure
 
- 
permissionsPolicyConfiguresPermissions-Policyresponse header.- Returns:
- the ServerHttpSecurity.HeaderSpec.PermissionsPolicySpecto configure
 
- 
permissionsPolicypublic ServerHttpSecurity.HeaderSpec permissionsPolicy(Customizer<ServerHttpSecurity.HeaderSpec.PermissionsPolicySpec> permissionsPolicyCustomizer) ConfiguresPermissions-Policyresponse header.- Parameters:
- permissionsPolicyCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.PermissionsPolicySpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
referrerPolicypublic ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec referrerPolicy(ReferrerPolicyServerHttpHeadersWriter.ReferrerPolicy referrerPolicy) ConfiguresReferrer-Policyresponse header.- Parameters:
- referrerPolicy- the policy to use
- Returns:
- the ServerHttpSecurity.HeaderSpec.ReferrerPolicySpecto configure
 
- 
referrerPolicyConfiguresReferrer-Policyresponse header.- Returns:
- the ServerHttpSecurity.HeaderSpec.ReferrerPolicySpecto configure
 
- 
referrerPolicypublic ServerHttpSecurity.HeaderSpec referrerPolicy(Customizer<ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec> referrerPolicyCustomizer) ConfiguresReferrer-Policyresponse header.- Parameters:
- referrerPolicyCustomizer- the- Customizerto provide more options for the- ServerHttpSecurity.HeaderSpec.ReferrerPolicySpec
- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
 
- 
crossOriginOpenerPolicyConfigures the Cross-Origin-Opener-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpec.CrossOriginOpenerPolicySpecto configure
- Since:
- 5.7
- See Also:
 
- 
crossOriginOpenerPolicypublic ServerHttpSecurity.HeaderSpec crossOriginOpenerPolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginOpenerPolicySpec> crossOriginOpenerPolicyCustomizer) Configures the Cross-Origin-Opener-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
- Since:
- 5.7
- See Also:
 
- 
crossOriginEmbedderPolicyConfigures the Cross-Origin-Embedder-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpec.CrossOriginEmbedderPolicySpecto configure
- Since:
- 5.7
- See Also:
 
- 
crossOriginEmbedderPolicypublic ServerHttpSecurity.HeaderSpec crossOriginEmbedderPolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginEmbedderPolicySpec> crossOriginEmbedderPolicyCustomizer) Configures the Cross-Origin-Embedder-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
- Since:
- 5.7
- See Also:
 
- 
crossOriginResourcePolicyConfigures the Cross-Origin-Resource-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpec.CrossOriginResourcePolicySpecto configure
- Since:
- 5.7
- See Also:
 
- 
crossOriginResourcePolicypublic ServerHttpSecurity.HeaderSpec crossOriginResourcePolicy(Customizer<ServerHttpSecurity.HeaderSpec.CrossOriginResourcePolicySpec> crossOriginResourcePolicyCustomizer) Configures the Cross-Origin-Resource-Policy header.- Returns:
- the ServerHttpSecurity.HeaderSpecto customize
- Since:
- 5.7
- See Also:
 
 
- 
permissionsPolicy(Customizer)instead.