SEC-1186: Tidying up changes to http parsing

This commit is contained in:
Luke Taylor
2009-07-08 16:19:26 +00:00
parent df7c734450
commit b3366a1646
9 changed files with 31 additions and 413 deletions

View File

@@ -8,6 +8,8 @@ import static org.springframework.security.config.HttpSecurityBeanDefinitionPars
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import javax.servlet.Filter;
@@ -336,7 +338,7 @@ public class HttpSecurityBeanDefinitionParserTests {
" </port-mappings>" +
" </http>" + AUTH_PROVIDER_XML);
PortMapperImpl pm = (PortMapperImpl) appContext.getBean(BeanIds.PORT_MAPPER);
PortMapperImpl pm = getPortMapper();
assertEquals(1, pm.getTranslatedPortMappings().size());
assertEquals(Integer.valueOf(9080), pm.lookupHttpPort(9443));
assertEquals(Integer.valueOf(9443), pm.lookupHttpsPort(9080));
@@ -354,12 +356,17 @@ public class HttpSecurityBeanDefinitionParserTests {
" </port-mappings>" +
" </http>" + AUTH_PROVIDER_XML);
PortMapperImpl pm = (PortMapperImpl) appContext.getBean(BeanIds.PORT_MAPPER);
PortMapperImpl pm = getPortMapper();
assertEquals(1, pm.getTranslatedPortMappings().size());
assertEquals(Integer.valueOf(9080), pm.lookupHttpPort(9443));
assertEquals(Integer.valueOf(9443), pm.lookupHttpsPort(9080));
}
private PortMapperImpl getPortMapper() {
Map<String,PortMapperImpl> beans = appContext.getBeansOfType(PortMapperImpl.class);
return new ArrayList<PortMapperImpl>(beans.values()).get(0);
}
@Test
public void accessDeniedPageWorkWithPlaceholders() throws Exception {
System.setProperty("accessDenied", "/go-away");