Spring Security X-frame DENY H2控制台

时间:2019-01-11 12:15:02

标签: spring-security

访问H2控制台时,出现X帧DENY错误,而单独加载时可以完全访问每个帧内容。 我试图禁用标头选项和csrf,但仍然没有成功。

以下是我的安全配置

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
        .sessionManagement()
        .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
        .and()
            .authorizeRequests()
            .antMatchers( "/h2-console/**").permitAll()
            .anyRequest().authenticated()
        .and()
            .httpBasic()
            .realmName(securityRealm)
        .and()
            .headers().frameOptions().disable()
        .and()
            .csrf().disable()

}

0 个答案:

没有答案