Class HttpsRedirectWebFilter
- java.lang.Object
-
- org.springframework.security.web.server.transport.HttpsRedirectWebFilter
-
- All Implemented Interfaces:
org.springframework.web.server.WebFilter
public final class HttpsRedirectWebFilter extends java.lang.Object implements org.springframework.web.server.WebFilter
Redirects any non-HTTPS request to its HTTPS equivalent. Can be configured to use aServerWebExchangeMatcher
to narrow which requests get redirected. Can also be configured for custom ports usingPortMapper
.- Since:
- 5.1
-
-
Constructor Summary
Constructors Constructor Description HttpsRedirectWebFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<java.lang.Void>
filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)
void
setPortMapper(PortMapper portMapper)
Use thisPortMapper
for mapping custom portsvoid
setRequiresHttpsRedirectMatcher(ServerWebExchangeMatcher requiresHttpsRedirectMatcher)
Use thisServerWebExchangeMatcher
to narrow which requests are redirected to HTTPS.
-
-
-
Method Detail
-
filter
public reactor.core.publisher.Mono<java.lang.Void> filter(org.springframework.web.server.ServerWebExchange exchange, org.springframework.web.server.WebFilterChain chain)
- Specified by:
filter
in interfaceorg.springframework.web.server.WebFilter
-
setPortMapper
public void setPortMapper(PortMapper portMapper)
Use thisPortMapper
for mapping custom ports- Parameters:
portMapper
- thePortMapper
to use
-
setRequiresHttpsRedirectMatcher
public void setRequiresHttpsRedirectMatcher(ServerWebExchangeMatcher requiresHttpsRedirectMatcher)
Use thisServerWebExchangeMatcher
to narrow which requests are redirected to HTTPS. The filter already first checks for HTTPS in the uri scheme, so it is not necessary to include that check in this matcher.- Parameters:
requiresHttpsRedirectMatcher
- theServerWebExchangeMatcher
to use
-
-