|
@@ -48,6 +48,7 @@ import org.springframework.messaging.handler.invocation.HandlerMethodArgumentRes
|
|
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
|
|
import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
|
|
import org.springframework.messaging.simp.SimpMessageType;
|
|
import org.springframework.messaging.simp.SimpMessageType;
|
|
import org.springframework.messaging.support.ChannelInterceptor;
|
|
import org.springframework.messaging.support.ChannelInterceptor;
|
|
|
|
+import org.springframework.messaging.support.ExecutorSubscribableChannel;
|
|
import org.springframework.messaging.support.GenericMessage;
|
|
import org.springframework.messaging.support.GenericMessage;
|
|
import org.springframework.security.access.AccessDeniedException;
|
|
import org.springframework.security.access.AccessDeniedException;
|
|
import org.springframework.security.access.expression.SecurityExpressionOperations;
|
|
import org.springframework.security.access.expression.SecurityExpressionOperations;
|
|
@@ -521,6 +522,16 @@ public class WebSocketMessageBrokerConfigTests {
|
|
verify(authorizationManager).check(any(), any());
|
|
verify(authorizationManager).check(any(), any());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void configureWhenCsrfChannelInterceptorBeanThenUses() {
|
|
|
|
+ this.spring.configLocations(xml("CustomCsrfInterceptor")).autowire();
|
|
|
|
+ ExecutorSubscribableChannel channel = this.spring.getContext()
|
|
|
|
+ .getBean("clientInboundChannel", ExecutorSubscribableChannel.class);
|
|
|
|
+ ChannelInterceptor interceptor = this.spring.getContext()
|
|
|
|
+ .getBean("csrfChannelInterceptor", ChannelInterceptor.class);
|
|
|
|
+ assertThat(channel.getInterceptors()).contains(interceptor);
|
|
|
|
+ }
|
|
|
|
+
|
|
private String xml(String configName) {
|
|
private String xml(String configName) {
|
|
return CONFIG_LOCATION_PREFIX + "-" + configName + ".xml";
|
|
return CONFIG_LOCATION_PREFIX + "-" + configName + ".xml";
|
|
}
|
|
}
|