mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-20 02:52:17 +00:00
SpringTestRule clears SecurityContext
Fixes: gh-5001
This commit is contained in:
parent
1efc7ef5d7
commit
73f5e89e4c
@ -19,6 +19,8 @@ package org.springframework.security.config.test;
|
|||||||
import org.junit.rules.MethodRule;
|
import org.junit.rules.MethodRule;
|
||||||
import org.junit.runners.model.FrameworkMethod;
|
import org.junit.runners.model.FrameworkMethod;
|
||||||
import org.junit.runners.model.Statement;
|
import org.junit.runners.model.Statement;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.test.context.TestSecurityContextHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rob Winch
|
* @author Rob Winch
|
||||||
@ -34,6 +36,7 @@ public class SpringTestRule extends SpringTestContext implements MethodRule {
|
|||||||
try {
|
try {
|
||||||
base.evaluate();
|
base.evaluate();
|
||||||
} finally {
|
} finally {
|
||||||
|
TestSecurityContextHolder.clearContext();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user