Skip to content

Commit

Permalink
Remove webFlux
Browse files Browse the repository at this point in the history
  • Loading branch information
zechmeister committed Sep 22, 2024
1 parent bae3fe1 commit 085a7c1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ testlogger { theme = ThemeType.MOCHA }
dependencies {
implementation(libs.spring.boot.starter.actuator)
implementation(libs.spring.boot.starter.security)
implementation(libs.spring.boot.starter.webflux)
implementation(libs.spring.boot.starter.web)

compileOnly(libs.lombok)

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ reactor-test = { module = "io.projectreactor:reactor-test" }
spring-boot-devtools = { module = "org.springframework.boot:spring-boot-devtools" }
spring-boot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator" }
spring-boot-starter-security = { module = "org.springframework.boot:spring-boot-starter-security" }
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test" }
spring-boot-starter-webflux = { module = "org.springframework.boot:spring-boot-starter-webflux" }
spring-security-test = { module = "org.springframework.security:spring-security-test" }

[plugins]
Expand Down
28 changes: 13 additions & 15 deletions src/main/java/de/bund/digitalservice/a2j/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
@EnableWebFluxSecurity
@EnableWebSecurity
public class SecurityConfig {

@Bean
public SecurityWebFilterChain springSecurityWebFilterChain(ServerHttpSecurity http) {
return http.authorizeExchange(
exchanges ->
exchanges
.pathMatchers("/.well-known/security.txt")
.permitAll()
.pathMatchers("/actuator/health")
.permitAll()
.anyExchange()
.denyAll())
.build();
public SecurityFilterChain springSecurityWebFilterChain(HttpSecurity http) throws Exception {
return http
.csrf(csrf -> csrf.ignoringRequestMatchers("/api/sender/submit"))
.authorizeHttpRequests(requests -> requests
.requestMatchers("/.well-known/security.txt").permitAll()
.requestMatchers("/actuator/health").permitAll()
.requestMatchers("/api/sender/**").permitAll()
.anyRequest().denyAll()
).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void setUp() {
classes =
new ClassFileImporter()
.withImportOption(Predefined.DO_NOT_INCLUDE_TESTS)
.importPackages("de.bund.digitalservice.template");
.importPackages("de.bund.digitalservice.a2j");
}

@Test
Expand Down

0 comments on commit 085a7c1

Please sign in to comment.