Align RSocket sample with new Spring Boot configuration

This commit is contained in:
Filip Hanik 2019-10-24 09:18:46 -07:00
parent bcaa8bc7e9
commit 5345aecd7f
2 changed files with 4 additions and 10 deletions

View File

@ -15,8 +15,6 @@
*/
package sample;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.rsocket.context.RSocketServerInitializedEvent;
import org.springframework.boot.test.context.SpringBootTest;
@ -27,6 +25,9 @@ import org.springframework.security.rsocket.metadata.BasicAuthenticationEncoder;
import org.springframework.security.rsocket.metadata.UsernamePasswordMetadata;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
@ -91,7 +92,7 @@ public class HelloRSocketApplicationITests {
@Override
public void onApplicationEvent(RSocketServerInitializedEvent event) {
this.port = event.getrSocketServer().address().getPort();
this.port = event.getServer().address().getPort();
}
}
}

View File

@ -16,14 +16,12 @@
package sample;
import org.springframework.boot.rsocket.server.ServerRSocketFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.rsocket.EnableRSocketSecurity;
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.rsocket.core.SecuritySocketAcceptorInterceptor;
/**
* @author Rob Winch
@ -43,9 +41,4 @@ public class HelloRSocketSecurityConfig {
return new MapReactiveUserDetailsService(user);
}
@Bean
ServerRSocketFactoryCustomizer springSecurityRSocketSecurity(
SecuritySocketAcceptorInterceptor interceptor) {
return builder -> builder.addSocketAcceptorPlugin(interceptor);
}
}