Expected Behavior
``` @Bean fun authSecurityFilterChain(http: HttpSecurity): SecurityFilterChain { http { csrf { disable() } cors { disable() } apply(LoginFilterSecurityConfigurer()) { jwtLogin {
}
}
}
return http.build()
}
**Current Behavior**
```
@Bean
fun authSecurityFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
csrf {
disable()
}
cors {
disable()
}
http.apply(LoginFilterSecurityConfigurer()).jwtLogin {
}
}
return http.build()
}
The apply keyword will conflict with Kotlin fun
public inline fun <T> T.apply(block: T.() -> Unit): T {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
block()
return this
}
Comment From: sjohnr
@hanrw thanks for the suggestion!
The apply keyword will conflict with Kotlin fun
I'm not 100% sure but it seems like it will take different method parameters so it shouldn't conflict, right?
I think this would be a nice addition, so we don't need to mix a Java and Kotlin approach when using the DSL. Would you like to submit a PR?
Comment From: rishiraj88
Is 'apply' onsidered a keyword here?
Comment From: hanrw
@hanrw thanks for the suggestion!
The apply keyword will conflict with Kotlin fun
I'm not 100% sure but it seems like it will take different method parameters so it shouldn't conflict, right?
I think this would be a nice addition, so we don't need to mix a Java and Kotlin approach when using the DSL. Would you like to submit a PR? The solution could be add apply function in HttpSecurityDsl
fun <C : SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity>> apply(configurer: C): C {
return this.http.apply(configurer)
}
Any suggestion?
Comment From: sjohnr
Hi @hanrw!
Any suggestion?
I think that looks like a good start. Just a heads up that if you do submit a PR, we may take a pause on merging it as most new enhancements that will make it into the next release are already scheduled.
Is 'apply' onsidered a keyword here?
I don't believe so, @rishiraj88. I tried something like what @hanrw provided above and it compiles fine as far as I can tell. It would just be an overloaded version of the apply method since it takes different parameters.