mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-07 02:57:51 +00:00
test(auth): strengthen identity guardrail isolation
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
This commit is contained in:
parent
2978bee316
commit
ed170a8fef
2 changed files with 8 additions and 0 deletions
|
|
@ -11,8 +11,10 @@ import org.junit.jupiter.api.Test;
|
|||
class OAuthAdapterBoundaryTest {
|
||||
|
||||
private static final List<Class<?>> ADAPTERS = List.of(
|
||||
OAuthClaimsExtractor.class,
|
||||
GitHubClaimsExtractor.class,
|
||||
GitLabClaimsExtractor.class,
|
||||
CustomOAuth2UserService.class,
|
||||
CustomOidcUserService.class);
|
||||
|
||||
private static final List<String> FORBIDDEN_DEPENDENCIES = List.of(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.iflytek.skillhub.domain.user.UserAccount;
|
|||
import com.iflytek.skillhub.domain.user.UserAccountRepository;
|
||||
import com.iflytek.skillhub.domain.user.UserStatus;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.mock.web.MockFilterChain;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
|
@ -43,6 +44,11 @@ class ApiTokenAuthenticationFilterTest {
|
|||
scopeService
|
||||
);
|
||||
|
||||
@BeforeEach
|
||||
void initializeSecurityContext() {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void clearSecurityContext() {
|
||||
SecurityContextHolder.clearContext();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue