Browse Source

Some additional tests on session creation.

3.0.x
Luke Taylor 17 years ago
parent
commit
b3ccee4dbc
  1. 21
      config/src/test/java/org/springframework/security/config/HttpSecurityBeanDefinitionParserTests.java

21
config/src/test/java/org/springframework/security/config/HttpSecurityBeanDefinitionParserTests.java

@ -763,8 +763,29 @@ public class HttpSecurityBeanDefinitionParserTests { @@ -763,8 +763,29 @@ public class HttpSecurityBeanDefinitionParserTests {
Object filter = appContext.getBean(BeanIds.SECURITY_CONTEXT_PERSISTENCE_FILTER);
assertEquals(Boolean.FALSE, FieldUtils.getFieldValue(filter, "forceEagerSessionCreation"));
assertEquals(Boolean.FALSE, FieldUtils.getFieldValue(filter, "repo.allowSessionCreation"));
// Check that an invocation doesn't create a session
FilterChainProxy fcp = (FilterChainProxy) appContext.getBean(BeanIds.FILTER_CHAIN_PROXY);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setServletPath("/anything");
fcp.doFilter(request, new MockHttpServletResponse(), new MockFilterChain());
assertNull(request.getSession(false));
}
@Test
public void settingCreateSessionToIfRequiredDoesntCreateASessionForPublicInvocation() throws Exception {
setContext("<http auto-config='true' create-session='ifRequired'/>" + AUTH_PROVIDER_XML);
Object filter = appContext.getBean(BeanIds.SECURITY_CONTEXT_PERSISTENCE_FILTER);
assertEquals(Boolean.FALSE, FieldUtils.getFieldValue(filter, "forceEagerSessionCreation"));
assertEquals(Boolean.TRUE, FieldUtils.getFieldValue(filter, "repo.allowSessionCreation"));
// Check that an invocation doesn't create a session
FilterChainProxy fcp = (FilterChainProxy) appContext.getBean(BeanIds.FILTER_CHAIN_PROXY);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setServletPath("/anything");
fcp.doFilter(request, new MockHttpServletResponse(), new MockFilterChain());
assertNull(request.getSession(false));
}
/* SEC-934 */
@Test
public void supportsTwoIdenticalInterceptUrls() {

Loading…
Cancel
Save