Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion samples/bookshop/srv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* © 2024 SAP SE or an SAP affiliate company and cds-feature-attachments contributors.
*/
package customer.bookshop;

import org.h2.server.web.JakartaWebServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.firewall.HttpFirewall;
import org.springframework.security.web.firewall.StrictHttpFirewall;

@Configuration
public class SecurityConfig {

@Bean
public HttpFirewall allowSemicolonHttpFirewall() {
StrictHttpFirewall firewall = new StrictHttpFirewall();
firewall.setAllowSemicolon(true);
return firewall;
}

@Bean
public ServletRegistrationBean<JakartaWebServlet> h2ServletRegistration() {
ServletRegistrationBean<JakartaWebServlet> registration =
new ServletRegistrationBean<>(new JakartaWebServlet(), "/h2-console/*");
registration.addInitParameter("-webAllowOthers", "");
return registration;
}

}
10 changes: 10 additions & 0 deletions samples/bookshop/srv/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ spring:
sql:
init:
platform: h2
h2:
console:
enabled: true
path: /h2-console
settings:
web-allow-others: true
security:
ignored: /h2-console/**
cds:
security:
mock:
Expand All @@ -17,6 +25,8 @@ cds:
- admin
user:
password: user
open-paths:
- /h2-console/**
data-source:
auto-config:
enabled: false
Expand Down