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"
1313val freemarkerVersion = " 2.3.32"
1414val kotestVersion = " 5.6.2"
1515val bouncyCastleVersion = " 1.70"
16- val springBootVersion = " 2.7.13 "
16+ val springBootVersion = " 3.1.1 "
1717val reactorTestVersion = " 3.4.24"
1818val ktorVersion = " 2.3.2"
1919
Original file line number Diff line number Diff line change 1818
1919import java .io .IOException ;
2020
21+ import static org .springframework .security .config .Customizer .withDefaults ;
22+
2123@ SpringBootApplication
2224public class OAuth2LoginApp {
2325 public static void main (String [] args ) throws IOException {
@@ -41,13 +43,9 @@ static class SecurityConfiguration {
4143
4244 @ Bean
4345 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 ();
5149 }
5250
5351 @ Bean
Original file line number Diff line number Diff line change 44import org .springframework .boot .SpringApplication ;
55import org .springframework .boot .autoconfigure .SpringBootApplication ;
66import org .springframework .context .annotation .Bean ;
7+ import org .springframework .security .config .Customizer ;
78import org .springframework .security .config .annotation .web .reactive .EnableWebFluxSecurity ;
89import org .springframework .security .config .web .server .ServerHttpSecurity ;
910import org .springframework .security .core .annotation .AuthenticationPrincipal ;
@@ -39,12 +40,9 @@ class SecurityConfiguration {
3940
4041 @ Bean
4142 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 ();
4846 }
4947
5048 @ Bean
You can’t perform that action at this time.
0 commit comments