解决思路是将response的header中的X-Frame-Options项的值改为SAMEORIGIN

在Spring Boot中,可以直接改全局设置.and().headers().frameOptions().sameOrigin()

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
            .mvcMatchers("/").permitAll().anyRequest().authenticated()
            .antMatchers("/**").hasRole("LOGIN")
            .and()
            .formLogin().loginPage("/login").loginProcessingUrl("/login").permitAll()
            .and().headers().frameOptions().sameOrigin()
            .and().csrf().disable()
            ;
}


赞助本站,网站的持续发展离不开你们的支持!一分也是爱ヾ(◍°∇°◍)ノ゙
 本文链接: ,花了好多脑细胞写的,转载请注明链接喔~~
登陆
      正在加载评论