Skip to content

Commit 061a203

Browse files
committed
spring boot 2 -> 3
1 parent eacba37 commit 061a203

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ val kotlinVersion = "1.9.0"
1313
val freemarkerVersion = "2.3.32"
1414
val kotestVersion = "5.6.2"
1515
val bouncyCastleVersion = "1.70"
16-
val springBootVersion = "2.7.13"
16+
val springBootVersion = "3.1.1"
1717
val reactorTestVersion = "3.4.24"
1818
val ktorVersion = "2.3.2"
1919

src/test/java/examples/java/springboot/login/OAuth2LoginApp.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.io.IOException;
2020

21+
import static org.springframework.security.config.Customizer.withDefaults;
22+
2123
@SpringBootApplication
2224
public 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

src/test/java/examples/java/springboot/resourceserver/OAuth2ResourceServerApp.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.springframework.boot.SpringApplication;
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66
import org.springframework.context.annotation.Bean;
7+
import org.springframework.security.config.Customizer;
78
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
89
import org.springframework.security.config.web.server.ServerHttpSecurity;
910
import 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

0 commit comments

Comments
 (0)