Sfoglia il codice sorgente

Add Kotlin example for SecuritySocketAcceptorInterceptor of RSocket

Closes gh-10932
Lijamaija 3 anni fa
parent
commit
660da6f4a0
1 ha cambiato i file con 15 aggiunte e 1 eliminazioni
  1. 15 1
      docs/modules/ROOT/pages/reactive/integrations/rsocket.adoc

+ 15 - 1
docs/modules/ROOT/pages/reactive/integrations/rsocket.adoc

@@ -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:
 
 ====
-[source,java]
+.Java
+[source,java,role="primary"]
 ----
 @Bean
 RSocketServerCustomizer springSecurityRSocketSecurity(SecuritySocketAcceptorInterceptor 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]]