Skip to content

Commit

Permalink
Minor cleanups after CAP Java 3.0 (#1120)
Browse files Browse the repository at this point in the history
* Minor cleanups after CAP Java 3.0

* Add security config for /actuator/health
  • Loading branch information
beckermarc authored Jul 18, 2024
1 parent 487b696 commit bf303b0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<!-- DEPENDENCIES VERSION -->
<jdk.version>21</jdk.version>
<cds.services.version>3.0.0</cds.services.version>
<cdsdk.version>^7</cdsdk.version>
<cdsdk.version>^8</cdsdk.version>
</properties>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion srv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</goals>
<configuration>
<commands>
<command>build --for java --opts contentLocalizedEdmx=false</command>
<command>build --for java</command>
<command>deploy --to h2 --dry &gt;
"${project.basedir}/src/main/resources/schema.sql"</command>
</commands>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.sap.cap.sflight.security;

import static org.springframework.security.web.util.matcher.AntPathRequestMatcher.antMatcher;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
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
@ConditionalOnWebApplication
@EnableWebSecurity
@Order(1)
public class WebSecurityConfig {

@Bean
public SecurityFilterChain configure(HttpSecurity http) throws Exception {
return http.securityMatchers(s -> s.requestMatchers(antMatcher("/actuator/health"))) //
.csrf(c -> c.disable()).authorizeHttpRequests(a -> a.anyRequest().permitAll())
.build();
}

}
6 changes: 2 additions & 4 deletions srv/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ management:
include: "*"

cds:
sql.hana:
optimizationMode: hex
search:
sql.hana.search:
fuzzy: true
fuzzinessThreshold: 0.9
security.mock.users:
Expand All @@ -30,7 +28,7 @@ cds:
---
spring:
config.activate.on-profile: default

server:
port: 4004

Expand Down

0 comments on commit bf303b0

Please sign in to comment.