with

fun <C : SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity>> with(configurer: C, configuration: C.() -> Unit = { }): HttpSecurity?

Applies a SecurityConfigurerAdapter to this HttpSecurity

Example:

@Configuration
@EnableWebSecurity
class SecurityConfig {

@Bean
fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
with(CustomSecurityConfigurer<HttpSecurity>()) {
customProperty = "..."
}
}
return http.build()
}
}

Since

6.2

Parameters

configurer

the HttpSecurity for further customizations