diff --git a/sandbox/itest/context/src/test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java b/sandbox/itest/context/src/test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java new file mode 100644 index 0000000000..c2b470ff7f --- /dev/null +++ b/sandbox/itest/context/src/test/java/org/springframework/security/integration/SEC936ApplicationContextTests.java @@ -0,0 +1,26 @@ +package org.springframework.security.integration; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.AccessDeniedException; +import org.springframework.security.concurrent.SessionRegistry; +import org.springframework.security.context.SecurityContextHolder; +import org.springframework.security.providers.UsernamePasswordAuthenticationToken; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@ContextConfiguration(locations={"/sec-936-app-context.xml"}) +@RunWith(SpringJUnit4ClassRunner.class) +public class SEC936ApplicationContextTests { + @Autowired + /** SessionRegistry is used as the test service interface (nothing to do with the test) */ + private SessionRegistry sessionRegistry; + + @Test(expected=AccessDeniedException.class) + public void securityInterceptorHandlesCallWithNoTargetObject() { + SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("bob","bobspassword")); + sessionRegistry.getAllPrincipals(); + } + +} diff --git a/sandbox/itest/context/src/test/resources/sec-936-app-context.xml b/sandbox/itest/context/src/test/resources/sec-936-app-context.xml new file mode 100755 index 0000000000..1f84f2904f --- /dev/null +++ b/sandbox/itest/context/src/test/resources/sec-936-app-context.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + org.springframework.security.concurrent.SessionRegistry.get*=ROLE_C + + + + + + + + securityInterceptor + httpInvokerClientInterceptor + + + + + + + + +