1+ package me .oldboy .config .test_security_config ;
2+ 3+ import lombok .SneakyThrows ;
4+ import lombok .extern .slf4j .Slf4j ;
5+ import me .oldboy .config .security_config .FilterChainConfig ;
6+ import org .springframework .beans .factory .annotation .Autowired ;
7+ import org .springframework .context .annotation .Bean ;
8+ import org .springframework .context .annotation .ComponentScan ;
9+ import org .springframework .context .annotation .Configuration ;
10+ import org .springframework .security .config .annotation .method .configuration .EnableMethodSecurity ;
11+ import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
12+ import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
13+ import org .springframework .security .oauth2 .jwt .JwtDecoder ;
14+ import org .springframework .security .oauth2 .server .resource .authentication .JwtAuthenticationConverter ;
15+ import org .springframework .security .web .SecurityFilterChain ;
16+ 17+ @ Slf4j
18+ @ Configuration
19+ @ EnableWebSecurity (debug = true )
20+ @ EnableMethodSecurity (prePostEnabled = true , securedEnabled = true , jsr250Enabled = true )
21+ @ ComponentScan ("me.oldboy.config.test_main" )
22+ public class TestSecurityConfig {
23+ 24+ @ Autowired
25+ private JwtDecoder jwtDecoder ;
26+ @ Autowired
27+ private JwtAuthenticationConverter jwtAuthenticationConverter ;
28+ 29+ @ Bean
30+ @ SneakyThrows
31+ public SecurityFilterChain filterChain (HttpSecurity httpSecurity ) {
32+ return FilterChainConfig .getSecurityFilterChain (httpSecurity , jwtDecoder , jwtAuthenticationConverter );
33+ }
34+ }
0 commit comments