Skip to content

Commit

Permalink
Merge pull request #81 from hyun357123/main
Browse files Browse the repository at this point in the history
fix iframe issue
  • Loading branch information
hyun357123 authored Oct 14, 2024
2 parents b2e0c13 + d3b336f commit 5899282
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions src/main/java/kr/co/mcmp/config/WebSecurityConfigurer.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
package kr.co.mcmp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.SecurityFilterChain;


@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
// @EnableGlobalMethodSecurity(prePostEnabled = true)
public class WebSecurityConfigurer {


@Override
public void configure(WebSecurity webSecurity) throws Exception {
webSecurity.ignoring().antMatchers("/resources/**", "/h2-console/**");
}
// @Override
// public void configure(WebSecurity webSecurity) throws Exception {
// webSecurity.ignoring().antMatchers("/resources/**", "/h2-console/**");
// }

@Override
public void configure(HttpSecurity https) throws Exception {
https.authorizeRequests().antMatchers("/**").permitAll();
https.csrf().disable();
}
// @Override
// public void configure(HttpSecurity https) throws Exception {
// https.authorizeRequests().antMatchers("/**").permitAll();
// https.csrf().disable();
// }
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.headers(headers -> headers
.frameOptions().disable() // X-Frame-Options 비활성화
)
.cors().and()
.csrf().disable()
.authorizeHttpRequests(authz -> authz
.anyRequest().permitAll()
);
return http.build();
}
}

0 comments on commit 5899282

Please sign in to comment.