Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a38a33f

Browse files
Security_part_11_3: add TestSecurityConfig.java
1 parent 3268747 commit a38a33f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /