mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-01 09:42:13 +00:00
Add Kotlin example for SecuritySocketAcceptorInterceptor of RSocket
Closes gh-10932
This commit is contained in:
parent
5f37ee2f64
commit
660da6f4a0
@ -62,13 +62,27 @@ Doing so connects our `PayloadSocketAcceptorInterceptor` with the RSocket infras
|
|||||||
In a Spring Boot application, you can do this automatically by using `RSocketSecurityAutoConfiguration` with the following code:
|
In a Spring Boot application, you can do this automatically by using `RSocketSecurityAutoConfiguration` with the following code:
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,java]
|
.Java
|
||||||
|
[source,java,role="primary"]
|
||||||
----
|
----
|
||||||
@Bean
|
@Bean
|
||||||
RSocketServerCustomizer springSecurityRSocketSecurity(SecuritySocketAcceptorInterceptor interceptor) {
|
RSocketServerCustomizer springSecurityRSocketSecurity(SecuritySocketAcceptorInterceptor interceptor) {
|
||||||
return (server) -> server.interceptors((registry) -> registry.forSocketAcceptor(interceptor));
|
return (server) -> server.interceptors((registry) -> registry.forSocketAcceptor(interceptor));
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
.Kotlin
|
||||||
|
[source,kotlin,role="secondary"]
|
||||||
|
----
|
||||||
|
@Bean
|
||||||
|
fun springSecurityRSocketSecurity(interceptor: SecuritySocketAcceptorInterceptor): RSocketServerCustomizer {
|
||||||
|
return RSocketServerCustomizer { server ->
|
||||||
|
server.interceptors { registry ->
|
||||||
|
registry.forSocketAcceptor(interceptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
[[rsocket-authentication]]
|
[[rsocket-authentication]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user