mirror of
https://github.com/headporter81/specialsource-homepage-backend.git
synced 2026-08-08 15:41:11 +09:00
28 lines
1.1 KiB
Java
28 lines
1.1 KiB
Java
package company.specialsource.config;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
import org.springframework.security.web.SecurityFilterChain;
|
|
|
|
@Configuration
|
|
@EnableWebSecurity
|
|
public class WebMvcConfig {
|
|
|
|
@Bean
|
|
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
|
http
|
|
// 1. 🟢 외부 매크로의 POST 요청이 통과할 수 있도록 CSRF 보호 대상에서 업로드 API를 제외합니다.
|
|
.csrf(csrf -> csrf
|
|
.ignoringRequestMatchers("/api/sync/upload")
|
|
)
|
|
// 2. 🟢 로그인이나 별도의 인증 토큰 없이도 접근할 수 있도록 허용합니다.
|
|
.authorizeHttpRequests(auth -> auth
|
|
.requestMatchers("/api/sync/upload").permitAll()
|
|
.anyRequest().authenticated()
|
|
);
|
|
|
|
return http.build();
|
|
}
|
|
} |