Call SecurityContextHolder.clearContext() in tear down of HttpSessionSecurityContextRepositoryTests

This commit is contained in:
Rob Winch 2011-12-30 14:30:17 -06:00
parent 5d94cd5e13
commit 22225effcc
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import static org.springframework.security.web.context.HttpSessionSecurityContex
import javax.servlet.http.HttpSession;
import org.junit.After;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
@ -18,6 +19,11 @@ import org.springframework.security.core.context.SecurityContextHolder;
public class HttpSessionSecurityContextRepositoryTests {
private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");
@After
public void tearDown() {
SecurityContextHolder.clearContext();
}
@Test
public void sessionIsntCreatedIfContextDoesntChange() throws Exception {
HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();