Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix iframe issue #81

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}