Add Kotlin example for SecuritySocketAcceptorInterceptor of RSocket

Closes gh-10932
This commit is contained in:
Lijamaija 2022-03-05 17:09:24 +01:00 committed by Eleftheria Stein
parent 93d4fd3559
commit bc2bb8cb96

View File

@ -61,7 +61,9 @@ For Spring Security to work we need to apply `SecuritySocketAcceptorInterceptor`
This is what connects our `PayloadSocketAcceptorInterceptor` we created with the RSocket infrastructure.
In a Spring Boot application this is done automatically using `RSocketSecurityAutoConfiguration` with the following code.
[source,java]
====
.Java
[source,java,role="primary"]
----
@Bean
RSocketServerCustomizer springSecurityRSocketSecurity(SecuritySocketAcceptorInterceptor interceptor) {
@ -69,6 +71,20 @@ RSocketServerCustomizer springSecurityRSocketSecurity(SecuritySocketAcceptorInte
}
----
.Kotlin
[source,kotlin,role="secondary"]
----
@Bean
fun springSecurityRSocketSecurity(interceptor: SecuritySocketAcceptorInterceptor): RSocketServerCustomizer {
return RSocketServerCustomizer { server ->
server.interceptors { registry ->
registry.forSocketAcceptor(interceptor)
}
}
}
----
====
[[rsocket-authentication]]
== RSocket Authentication