Search in sources :

Example 1 with CsrfChannelInterceptor

use of org.springframework.security.messaging.web.csrf.CsrfChannelInterceptor in project spring-security by spring-projects.

the class AbstractSecurityWebSocketMessageBrokerConfigurerTests method csrfProtectionDefinedByBean.

@Test
public void csrfProtectionDefinedByBean() {
    loadConfig(SockJsProxylessSecurityConfig.class);
    MessageChannel messageChannel = clientInboundChannel();
    CsrfChannelInterceptor csrfChannelInterceptor = this.context.getBean(CsrfChannelInterceptor.class);
    assertThat(((AbstractMessageChannel) messageChannel).getInterceptors()).contains(csrfChannelInterceptor);
}
Also used : MessageChannel(org.springframework.messaging.MessageChannel) AbstractMessageChannel(org.springframework.messaging.support.AbstractMessageChannel) AbstractMessageChannel(org.springframework.messaging.support.AbstractMessageChannel) CsrfChannelInterceptor(org.springframework.security.messaging.web.csrf.CsrfChannelInterceptor) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 MessageChannel (org.springframework.messaging.MessageChannel)1 AbstractMessageChannel (org.springframework.messaging.support.AbstractMessageChannel)1 CsrfChannelInterceptor (org.springframework.security.messaging.web.csrf.CsrfChannelInterceptor)1