|
|
|
|
@ -17,6 +17,9 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
|
|
import org.springframework.security.web.SecurityFilterChain;
|
|
|
|
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
|
|
|
|
import org.springframework.web.cors.CorsConfiguration;
|
|
|
|
|
import org.springframework.web.cors.CorsConfigurationSource;
|
|
|
|
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|
|
|
|
|
|
|
|
|
import kr.re.etri.autoflow.security.jwt.AuthEntryPointJwt;
|
|
|
|
|
import kr.re.etri.autoflow.security.jwt.AuthTokenFilter;
|
|
|
|
|
@ -103,15 +106,15 @@ public class WebSecurityConfig { // extends WebSecurityConfigurerAdapter {
|
|
|
|
|
// return http.build();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 임시 설정
|
|
|
|
|
@Bean
|
|
|
|
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
|
|
|
|
http.csrf(AbstractHttpConfigurer::disable)
|
|
|
|
|
.cors(cors -> cors.configurationSource(corsConfigurationSource())) // CORS 설정 추가
|
|
|
|
|
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
|
|
|
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
|
|
|
|
.authorizeHttpRequests(auth ->
|
|
|
|
|
auth.requestMatchers("/actuator/**").permitAll() // Actuator endpoints
|
|
|
|
|
.anyRequest().permitAll() // 모든 요청 허용
|
|
|
|
|
auth.requestMatchers("/actuator/**").permitAll()
|
|
|
|
|
.anyRequest().permitAll()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -120,4 +123,20 @@ public class WebSecurityConfig { // extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
|
|
|
|
return http.build();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
public CorsConfigurationSource corsConfigurationSource() {
|
|
|
|
|
CorsConfiguration configuration = new CorsConfiguration();
|
|
|
|
|
configuration.setAllowCredentials(true);
|
|
|
|
|
configuration.addAllowedOrigin("http://localhost:3000");
|
|
|
|
|
configuration.addAllowedOrigin("http://10.10.11.144");
|
|
|
|
|
configuration.addAllowedOrigin("http://cuuva.com:2481");
|
|
|
|
|
configuration.addAllowedOrigin("http://210.217.121.58:2481");
|
|
|
|
|
configuration.addAllowedOrigin("http://172.28.248.98:30819");
|
|
|
|
|
configuration.addAllowedHeader("*");
|
|
|
|
|
configuration.addAllowedMethod("*");
|
|
|
|
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
|
|
|
|
source.registerCorsConfiguration("/**", configuration);
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|