Call SecurityContextHolder.clearContext() in tear down of HttpSessionSecurityContextRepositoryTests
This commit is contained in:
parent
5d94cd5e13
commit
22225effcc
|
@ -6,6 +6,7 @@ import static org.springframework.security.web.context.HttpSessionSecurityContex
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
import org.springframework.mock.web.MockHttpServletResponse;
|
import org.springframework.mock.web.MockHttpServletResponse;
|
||||||
|
@ -18,6 +19,11 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
public class HttpSessionSecurityContextRepositoryTests {
|
public class HttpSessionSecurityContextRepositoryTests {
|
||||||
private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");
|
private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SecurityContextHolder.clearContext();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sessionIsntCreatedIfContextDoesntChange() throws Exception {
|
public void sessionIsntCreatedIfContextDoesntChange() throws Exception {
|
||||||
HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
|
HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
|
||||||
|
|
Loading…
Reference in New Issue