Files
specialsource-homepage-backend/src/main/java/company/specialsource/config/WebMvcConfig.java
T
sungjin.choi 03cb0064dd
SpecialSource Backend CI/CD / build-and-deploy (push) Successful in 55s
feat - 인가 url 추가
2026-07-20 14:56:13 +09:00

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();
}
}