diff --git a/build.gradle.kts b/build.gradle.kts index 18f9e787..f2c9e473 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ val kotlinVersion = "1.9.0" val freemarkerVersion = "2.3.32" val kotestVersion = "5.6.2" val bouncyCastleVersion = "1.70" -val springBootVersion = "2.7.13" +val springBootVersion = "3.1.1" val reactorTestVersion = "3.4.24" val ktorVersion = "2.3.2" diff --git a/src/test/java/examples/java/springboot/login/OAuth2LoginApp.java b/src/test/java/examples/java/springboot/login/OAuth2LoginApp.java index ec7dbccb..e79a0312 100644 --- a/src/test/java/examples/java/springboot/login/OAuth2LoginApp.java +++ b/src/test/java/examples/java/springboot/login/OAuth2LoginApp.java @@ -18,6 +18,8 @@ import java.io.IOException; +import static org.springframework.security.config.Customizer.withDefaults; + @SpringBootApplication public class OAuth2LoginApp { public static void main(String[] args) throws IOException { @@ -41,13 +43,9 @@ static class SecurityConfiguration { @Bean public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { - return http - .authorizeExchange() - .anyExchange().authenticated() - .and() - .oauth2Login() - .and() - .build(); + return http.authorizeExchange(exchanges -> exchanges.anyExchange().authenticated()) + .oauth2Login(withDefaults()) + .build(); } @Bean diff --git a/src/test/java/examples/java/springboot/resourceserver/OAuth2ResourceServerApp.java b/src/test/java/examples/java/springboot/resourceserver/OAuth2ResourceServerApp.java index cc6adcd1..3d857b1f 100644 --- a/src/test/java/examples/java/springboot/resourceserver/OAuth2ResourceServerApp.java +++ b/src/test/java/examples/java/springboot/resourceserver/OAuth2ResourceServerApp.java @@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; +import org.springframework.security.config.Customizer; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.core.annotation.AuthenticationPrincipal; @@ -39,12 +40,9 @@ class SecurityConfiguration { @Bean public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { - return http - .authorizeExchange() - .anyExchange().authenticated() - .and() - .oauth2ResourceServer(ServerHttpSecurity.OAuth2ResourceServerSpec::jwt) - .build(); + return http.authorizeExchange(exchanges -> exchanges.anyExchange().authenticated()) + .oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults())) + .build(); } @Bean