Class SecureHeadersGatewayFilterFactory
java.lang.Object
org.springframework.cloud.gateway.support.AbstractConfigurable<SecureHeadersGatewayFilterFactory.Config>
org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory<SecureHeadersGatewayFilterFactory.Config>
org.springframework.cloud.gateway.filter.factory.SecureHeadersGatewayFilterFactory
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, GatewayFilterFactory<SecureHeadersGatewayFilterFactory.Config>, Configurable<SecureHeadersGatewayFilterFactory.Config>, ShortcutConfigurable, org.springframework.context.ApplicationEventPublisherAware
public class SecureHeadersGatewayFilterFactory
extends AbstractGatewayFilterFactory<SecureHeadersGatewayFilterFactory.Config>
GatewayFilterFactory to provide a route filter that applies security headers to the
HTTP response. External configuration
SecureHeadersProperties provides
opinionated defaults. Following the recommendations made in Http-Security-Headers.
When opt-out headers are not disabled or explicitly configured, sensible defaults are
applied. Additionally, opt-in headers, such as Permissions-Policy, may be applied.- Author:
- Spencer Gibb, Thirunavukkarasu Ravichandran, Jörg Richter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPOJO forSecureHeadersGatewayFilterFactoryfilter configuration.Nested classes/interfaces inherited from class AbstractGatewayFilterFactory
AbstractGatewayFilterFactory.NameConfigNested classes/interfaces inherited from interface ShortcutConfigurable
ShortcutConfigurable.GatewayBeanFactoryResolver, ShortcutConfigurable.GatewayEvaluationContext, ShortcutConfigurable.RestrictivePropertyAccessor, ShortcutConfigurable.ShortcutType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringContent-Security Policy header name.static final StringReferrer Policy header name.static final StringStrict transport security header name.static final StringContent-Type Options header name.static final StringDownload Options header name.static final StringFrame options header name.static final StringPermitted Cross-Domain Policies header name.static final StringXss-Protection header name.Fields inherited from interface GatewayFilterFactory
NAME_KEY, VALUE_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(SecureHeadersGatewayFilterFactory.Config originalConfig) Returns a GatewayFilter that applies security headers to the HTTP response.Methods inherited from class AbstractGatewayFilterFactory
enableBodyCaching, getPublisher, setApplicationEventPublisherMethods inherited from class AbstractConfigurable
getConfigClass, newConfig, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface GatewayFilterFactory
apply, apply, apply, getConfigClass, name, newConfigMethods inherited from interface ShortcutConfigurable
shortcutFieldOrder, shortcutFieldPrefix, shortcutType
-
Field Details
-
X_XSS_PROTECTION_HEADER
-
STRICT_TRANSPORT_SECURITY_HEADER
Strict transport security header name.- See Also:
-
X_FRAME_OPTIONS_HEADER
-
X_CONTENT_TYPE_OPTIONS_HEADER
Content-Type Options header name.- See Also:
-
REFERRER_POLICY_HEADER
-
CONTENT_SECURITY_POLICY_HEADER
Content-Security Policy header name.- See Also:
-
X_DOWNLOAD_OPTIONS_HEADER
-
X_PERMITTED_CROSS_DOMAIN_POLICIES_HEADER
Permitted Cross-Domain Policies header name.- See Also:
-
-
Constructor Details
-
SecureHeadersGatewayFilterFactory
-
-
Method Details
-
apply
Returns a GatewayFilter that applies security headers to the HTTP response.- Parameters:
originalConfig- the original security configuration- Returns:
- a GatewayFilter instance that applies security headers to the HTTP response
-