SpringTestRule clears SecurityContext

Fixes: gh-5001
This commit is contained in:
Rob Winch 2018-02-06 11:54:26 -06:00
parent 1efc7ef5d7
commit 73f5e89e4c
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,8 @@ package org.springframework.security.config.test;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.test.context.TestSecurityContextHolder;
/**
* @author Rob Winch
@ -34,6 +36,7 @@ public class SpringTestRule extends SpringTestContext implements MethodRule {
try {
base.evaluate();
} finally {
TestSecurityContextHolder.clearContext();
close();
}
}