In Java code a WebTestClient can be configured as follows
WebTestClient
.bindToApplicationContext(this.context)
// add Spring Security test Support
.apply(springSecurity())
.configureClient()
.filter(basicAuthentication())
.build();
In Kotlin, it is not currently possible to use the apply method.
See https://github.com/spring-projects/spring-framework/issues/20606 for more details and a workaround.
Once this issue is fixed, we should update the reference documentation to show the equivalent example in Kotlin.