addFilterBefore

fun addFilterBefore(webFilter: WebFilter, order: SecurityWebFiltersOrder)

Adds a WebFilter before specific position.

Example:

@Configuration
@EnableWebFluxSecurity
class SecurityConfig {

@Bean
fun springWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
return http {
addFilterBefore(CustomWebFilter(), SecurityWebFiltersOrder.SECURITY_CONTEXT_SERVER_WEB_EXCHANGE)
}
}
}

Parameters

webFilter

the WebFilter to add

order

the place before which to insert the WebFilter