File tree Expand file tree Collapse file tree 3 files changed +10
-14
lines changed
src/test/java/examples/java/springboot Expand file tree Collapse file tree 3 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ val kotlinVersion = "1.9.0"
13
13
val freemarkerVersion = " 2.3.32"
14
14
val kotestVersion = " 5.6.2"
15
15
val bouncyCastleVersion = " 1.70"
16
- val springBootVersion = " 2.7.13 "
16
+ val springBootVersion = " 3.1.1 "
17
17
val reactorTestVersion = " 3.4.24"
18
18
val ktorVersion = " 2.3.2"
19
19
Original file line number Diff line number Diff line change 18
18
19
19
import java .io .IOException ;
20
20
21
+ import static org .springframework .security .config .Customizer .withDefaults ;
22
+
21
23
@ SpringBootApplication
22
24
public class OAuth2LoginApp {
23
25
public static void main (String [] args ) throws IOException {
@@ -41,13 +43,9 @@ static class SecurityConfiguration {
41
43
42
44
@ Bean
43
45
public SecurityWebFilterChain securityWebFilterChain (ServerHttpSecurity http ) {
44
- return http
45
- .authorizeExchange ()
46
- .anyExchange ().authenticated ()
47
- .and ()
48
- .oauth2Login ()
49
- .and ()
50
- .build ();
46
+ return http .authorizeExchange (exchanges -> exchanges .anyExchange ().authenticated ())
47
+ .oauth2Login (withDefaults ())
48
+ .build ();
51
49
}
52
50
53
51
@ Bean
Original file line number Diff line number Diff line change 4
4
import org .springframework .boot .SpringApplication ;
5
5
import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
6
import org .springframework .context .annotation .Bean ;
7
+ import org .springframework .security .config .Customizer ;
7
8
import org .springframework .security .config .annotation .web .reactive .EnableWebFluxSecurity ;
8
9
import org .springframework .security .config .web .server .ServerHttpSecurity ;
9
10
import org .springframework .security .core .annotation .AuthenticationPrincipal ;
@@ -39,12 +40,9 @@ class SecurityConfiguration {
39
40
40
41
@ Bean
41
42
public SecurityWebFilterChain securityWebFilterChain (ServerHttpSecurity http ) {
42
- return http
43
- .authorizeExchange ()
44
- .anyExchange ().authenticated ()
45
- .and ()
46
- .oauth2ResourceServer (ServerHttpSecurity .OAuth2ResourceServerSpec ::jwt )
47
- .build ();
43
+ return http .authorizeExchange (exchanges -> exchanges .anyExchange ().authenticated ())
44
+ .oauth2ResourceServer (oauth2 -> oauth2 .jwt (Customizer .withDefaults ()))
45
+ .build ();
48
46
}
49
47
50
48
@ Bean
You can’t perform that action at this time.
0 commit comments