Search in sources :

Example 1 with AbstractMessageChannel

use of org.springframework.messaging.support.AbstractMessageChannel in project spring-security by spring-projects.

the class AbstractSecurityWebSocketMessageBrokerConfigurerTests method securityContextChannelInterceptorDefinedByBean.

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

Example 2 with AbstractMessageChannel

use of org.springframework.messaging.support.AbstractMessageChannel in project spring-security by spring-projects.

the class AbstractSecurityWebSocketMessageBrokerConfigurerTests method inboundChannelSecurityDefinedByBean.

@Test
public void inboundChannelSecurityDefinedByBean() {
    loadConfig(SockJsProxylessSecurityConfig.class);
    MessageChannel messageChannel = clientInboundChannel();
    ChannelSecurityInterceptor inboundChannelSecurity = this.context.getBean(ChannelSecurityInterceptor.class);
    assertThat(((AbstractMessageChannel) messageChannel).getInterceptors()).contains(inboundChannelSecurity);
}
Also used : MessageChannel(org.springframework.messaging.MessageChannel) AbstractMessageChannel(org.springframework.messaging.support.AbstractMessageChannel) AbstractMessageChannel(org.springframework.messaging.support.AbstractMessageChannel) ChannelSecurityInterceptor(org.springframework.security.messaging.access.intercept.ChannelSecurityInterceptor) Test(org.junit.jupiter.api.Test)

Example 3 with AbstractMessageChannel

use of org.springframework.messaging.support.AbstractMessageChannel 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)3 MessageChannel (org.springframework.messaging.MessageChannel)3 AbstractMessageChannel (org.springframework.messaging.support.AbstractMessageChannel)3 ChannelSecurityInterceptor (org.springframework.security.messaging.access.intercept.ChannelSecurityInterceptor)1 SecurityContextChannelInterceptor (org.springframework.security.messaging.context.SecurityContextChannelInterceptor)1 CsrfChannelInterceptor (org.springframework.security.messaging.web.csrf.CsrfChannelInterceptor)1