use of org.springframework.security.web.access.channel.SecureChannelProcessor in project spring-security by spring-projects.
the class SecureChannelProcessorTests method testDecideDetectsAcceptableChannel.
// ~ Methods
// ========================================================================================================
@Test
public void testDecideDetectsAcceptableChannel() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setQueryString("info=true");
request.setServerName("localhost");
request.setContextPath("/bigapp");
request.setServletPath("/servlet");
request.setScheme("https");
request.setSecure(true);
request.setServerPort(8443);
MockHttpServletResponse response = new MockHttpServletResponse();
FilterInvocation fi = new FilterInvocation(request, response, mock(FilterChain.class));
SecureChannelProcessor processor = new SecureChannelProcessor();
processor.decide(fi, SecurityConfig.createList("SOME_IGNORED_ATTRIBUTE", "REQUIRES_SECURE_CHANNEL"));
assertThat(fi.getResponse().isCommitted()).isFalse();
}
use of org.springframework.security.web.access.channel.SecureChannelProcessor in project spring-security by spring-projects.
the class SecureChannelProcessorTests method testDecideRejectsNulls.
@Test
public void testDecideRejectsNulls() throws Exception {
SecureChannelProcessor processor = new SecureChannelProcessor();
processor.afterPropertiesSet();
try {
processor.decide(null, null);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException expected) {
}
}
use of org.springframework.security.web.access.channel.SecureChannelProcessor in project spring-security by spring-projects.
the class SecureChannelProcessorTests method testGettersSetters.
@Test
public void testGettersSetters() {
SecureChannelProcessor processor = new SecureChannelProcessor();
assertThat(processor.getSecureKeyword()).isEqualTo("REQUIRES_SECURE_CHANNEL");
processor.setSecureKeyword("X");
assertThat(processor.getSecureKeyword()).isEqualTo("X");
assertThat(processor.getEntryPoint() != null).isTrue();
processor.setEntryPoint(null);
assertThat(processor.getEntryPoint() == null).isTrue();
}
Aggregations