fix h2-console
This commit is contained in:
parent
58490ded0f
commit
b6280d4fe5
@ -6,8 +6,10 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.config.Customizer;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
|
||||||
import org.springframework.security.config.ldap.LdapBindAuthenticationManagerFactory;
|
import org.springframework.security.config.ldap.LdapBindAuthenticationManagerFactory;
|
||||||
import org.springframework.security.ldap.DefaultSpringSecurityContextSource;
|
import org.springframework.security.ldap.DefaultSpringSecurityContextSource;
|
||||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||||
@ -19,8 +21,14 @@ public class SecurityConfig extends VaadinWebSecurity {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
http.authorizeHttpRequests(auth ->
|
http.authorizeHttpRequests(auth ->
|
||||||
auth.requestMatchers(
|
auth
|
||||||
AntPathRequestMatcher.antMatcher(HttpMethod.GET, "/images/*.png")).permitAll());
|
.requestMatchers(AntPathRequestMatcher.antMatcher("/h2-console/**")).permitAll()
|
||||||
|
.requestMatchers(
|
||||||
|
AntPathRequestMatcher.antMatcher(HttpMethod.GET, "/images/*.png")).permitAll())
|
||||||
|
.headers(headers -> headers.frameOptions(frameOptionsConfig -> {
|
||||||
|
//no-op
|
||||||
|
}).disable())
|
||||||
|
.csrf(csrf -> csrf.ignoringRequestMatchers(AntPathRequestMatcher.antMatcher("/h2-console/**")));
|
||||||
super.configure(http);
|
super.configure(http);
|
||||||
setLoginView(http, LoginView.class);
|
setLoginView(http, LoginView.class);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user