H2 Console 403

Hi,

I am using the starter project that you get from Create a new Vaadin app: configure views and theme
Vaadin Version 24.8
I have added spring.h2.console.enabled=true to my application.properties and when i start the application I can see:
o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at ‘/h2-console’. Database available at ‘jdbc:h2:mem:87027ad7-71b1-47f3-a919-79f7e2f29655’

I can then access http://localhost:8080/h2-console. But when i try to connect or test the connection I get a 403 error.

I found the following stackoverflow discussion: Spring Boot /h2-console throws 403 with Spring Security 1.5.2 - Stack Overflow
But that did not help.

What do I have to do to access the H2 Console?

Configuring your Spring Security with these snippets ought to get you forward:

        http.authorizeHttpRequests(h -> h.requestMatchers("/h2-console/**").permitAll());
        http.csrf(c -> c.ignoringRequestMatchers("/h2-console/**"));
        http.headers(h -> h
                .frameOptions(frame -> frame
                        .sameOrigin()
                )
        );