Search in sources :

Example 1 with SecuritySocketAcceptorInterceptor

use of org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor in project spring-boot by spring-projects.

the class RSocketSecurityAutoConfigurationTests method autoConfigurationAddsCustomizerForServerRSocketFactory.

@Test
void autoConfigurationAddsCustomizerForServerRSocketFactory() {
    RSocketServer server = RSocketServer.create();
    this.contextRunner.run((context) -> {
        RSocketServerCustomizer customizer = context.getBean(RSocketServerCustomizer.class);
        customizer.customize(server);
        server.interceptors((registry) -> registry.forSocketAcceptor((interceptors) -> {
            assertThat(interceptors).isNotEmpty();
            assertThat(interceptors).anyMatch((interceptor) -> interceptor instanceof SecuritySocketAcceptorInterceptor);
        }));
    });
}
Also used : ReactiveUserDetailsServiceAutoConfiguration(org.springframework.boot.autoconfigure.security.reactive.ReactiveUserDetailsServiceAutoConfiguration) AutoConfigurations(org.springframework.boot.autoconfigure.AutoConfigurations) RSocketMessageHandler(org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler) RSocketServerCustomizer(org.springframework.boot.rsocket.server.RSocketServerCustomizer) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ApplicationContextRunner(org.springframework.boot.test.context.runner.ApplicationContextRunner) AuthenticationPrincipalArgumentResolver(org.springframework.security.messaging.handler.invocation.reactive.AuthenticationPrincipalArgumentResolver) SecuritySocketAcceptorInterceptor(org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor) RSocketServer(io.rsocket.core.RSocketServer) Test(org.junit.jupiter.api.Test) FilteredClassLoader(org.springframework.boot.test.context.FilteredClassLoader) RSocketSecurity(org.springframework.security.config.annotation.rsocket.RSocketSecurity) RSocketMessagingAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration) RSocketStrategiesAutoConfiguration(org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration) RSocketServer(io.rsocket.core.RSocketServer) SecuritySocketAcceptorInterceptor(org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor) RSocketServerCustomizer(org.springframework.boot.rsocket.server.RSocketServerCustomizer) Test(org.junit.jupiter.api.Test)

Aggregations

RSocketServer (io.rsocket.core.RSocketServer)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Test (org.junit.jupiter.api.Test)1 AutoConfigurations (org.springframework.boot.autoconfigure.AutoConfigurations)1 RSocketMessagingAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration)1 RSocketStrategiesAutoConfiguration (org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration)1 ReactiveUserDetailsServiceAutoConfiguration (org.springframework.boot.autoconfigure.security.reactive.ReactiveUserDetailsServiceAutoConfiguration)1 RSocketServerCustomizer (org.springframework.boot.rsocket.server.RSocketServerCustomizer)1 FilteredClassLoader (org.springframework.boot.test.context.FilteredClassLoader)1 ApplicationContextRunner (org.springframework.boot.test.context.runner.ApplicationContextRunner)1 RSocketMessageHandler (org.springframework.messaging.rsocket.annotation.support.RSocketMessageHandler)1 RSocketSecurity (org.springframework.security.config.annotation.rsocket.RSocketSecurity)1 AuthenticationPrincipalArgumentResolver (org.springframework.security.messaging.handler.invocation.reactive.AuthenticationPrincipalArgumentResolver)1 SecuritySocketAcceptorInterceptor (org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor)1