Renamed SecurityTestUtil to SecurityTestUtils.
This commit is contained in:
@@ -25,7 +25,7 @@ import org.springframework.security.providers.UsernamePasswordAuthenticationToke
|
|||||||
/**
|
/**
|
||||||
* @author Jonas Partner
|
* @author Jonas Partner
|
||||||
*/
|
*/
|
||||||
public class SecurityTestUtil {
|
public class SecurityTestUtils {
|
||||||
|
|
||||||
public static SecurityContext createContext(String username, String password, String... roles) {
|
public static SecurityContext createContext(String username, String password, String... roles) {
|
||||||
SecurityContextImpl ctxImpl = new SecurityContextImpl();
|
SecurityContextImpl ctxImpl = new SecurityContextImpl();
|
||||||
@@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.integration.channel.MessageChannel;
|
import org.springframework.integration.channel.MessageChannel;
|
||||||
import org.springframework.integration.message.StringMessage;
|
import org.springframework.integration.message.StringMessage;
|
||||||
import org.springframework.integration.security.SecurityTestUtil;
|
import org.springframework.integration.security.SecurityTestUtils;
|
||||||
import org.springframework.security.AccessDeniedException;
|
import org.springframework.security.AccessDeniedException;
|
||||||
import org.springframework.security.AuthenticationException;
|
import org.springframework.security.AuthenticationException;
|
||||||
import org.springframework.security.context.SecurityContext;
|
import org.springframework.security.context.SecurityContext;
|
||||||
@@ -104,7 +104,7 @@ public class ChannelAdapterSecurityIntegrationTests extends AbstractJUnit4Spring
|
|||||||
|
|
||||||
|
|
||||||
private void login(String username, String password, String... roles) {
|
private void login(String username, String password, String... roles) {
|
||||||
SecurityContext context = SecurityTestUtil.createContext(username, password, roles);
|
SecurityContext context = SecurityTestUtils.createContext(username, password, roles);
|
||||||
SecurityContextHolder.setContext(context);
|
SecurityContextHolder.setContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.springframework.aop.framework.ProxyFactory;
|
|||||||
import org.springframework.integration.channel.MessageChannel;
|
import org.springframework.integration.channel.MessageChannel;
|
||||||
import org.springframework.integration.channel.QueueChannel;
|
import org.springframework.integration.channel.QueueChannel;
|
||||||
import org.springframework.integration.message.StringMessage;
|
import org.springframework.integration.message.StringMessage;
|
||||||
import org.springframework.integration.security.SecurityTestUtil;
|
import org.springframework.integration.security.SecurityTestUtils;
|
||||||
import org.springframework.security.AccessDeniedException;
|
import org.springframework.security.AccessDeniedException;
|
||||||
import org.springframework.security.AuthenticationException;
|
import org.springframework.security.AuthenticationException;
|
||||||
import org.springframework.security.MockAuthenticationManager;
|
import org.springframework.security.MockAuthenticationManager;
|
||||||
@@ -54,7 +54,7 @@ public class ChannelSecurityInterceptorTests {
|
|||||||
@Test(expected = AccessDeniedException.class)
|
@Test(expected = AccessDeniedException.class)
|
||||||
public void securedSendWithoutRole() throws Exception {
|
public void securedSendWithoutRole() throws Exception {
|
||||||
MessageChannel channel = getSecuredChannel("ROLE_ADMIN");
|
MessageChannel channel = getSecuredChannel("ROLE_ADMIN");
|
||||||
SecurityContext context = SecurityTestUtil.createContext("test", "pwd", "ROLE_USER");
|
SecurityContext context = SecurityTestUtils.createContext("test", "pwd", "ROLE_USER");
|
||||||
SecurityContextHolder.setContext(context);
|
SecurityContextHolder.setContext(context);
|
||||||
channel.send(new StringMessage("test"));
|
channel.send(new StringMessage("test"));
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public class ChannelSecurityInterceptorTests {
|
|||||||
@Test
|
@Test
|
||||||
public void securedSendWithRole() throws Exception {
|
public void securedSendWithRole() throws Exception {
|
||||||
MessageChannel channel = getSecuredChannel("ROLE_ADMIN");
|
MessageChannel channel = getSecuredChannel("ROLE_ADMIN");
|
||||||
SecurityContext context = SecurityTestUtil.createContext("test", "pwd", "ROLE_ADMIN");
|
SecurityContext context = SecurityTestUtils.createContext("test", "pwd", "ROLE_ADMIN");
|
||||||
SecurityContextHolder.setContext(context);
|
SecurityContextHolder.setContext(context);
|
||||||
channel.send(new StringMessage("test"));
|
channel.send(new StringMessage("test"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user