Fix : common
This commit is contained in:
parent
2078a31051
commit
4f00e5eea8
@ -8,6 +8,8 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
implementation 'org.springframework.boot:spring-boot-starter-cache'
|
||||||
|
|
||||||
|
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
|
||||||
|
|
||||||
// Azure Event Hub
|
// Azure Event Hub
|
||||||
implementation 'com.azure:azure-messaging-eventhubs:5.15.0'
|
implementation 'com.azure:azure-messaging-eventhubs:5.15.0'
|
||||||
implementation 'com.azure:azure-messaging-eventhubs-checkpointstore-blob:1.16.0'
|
implementation 'com.azure:azure-messaging-eventhubs-checkpointstore-blob:1.16.0'
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ktds.hi;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Analytics 서비스 메인 애플리케이션 클래스
|
* Analytics 서비스 메인 애플리케이션 클래스
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.ktds.hi.analytics.infra.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.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Analytics 서비스 보안 설정 클래스
|
||||||
|
* 테스트를 위해 모든 엔드포인트를 인증 없이 접근 가능하도록 설정
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableWebSecurity
|
||||||
|
public class SecurityConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||||
|
http
|
||||||
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
|
.authorizeHttpRequests(auth -> auth
|
||||||
|
// Swagger 관련 경로 모두 허용
|
||||||
|
.requestMatchers("/swagger-ui/**", "/swagger-ui.html").permitAll()
|
||||||
|
.requestMatchers("/api-docs/**", "/v3/api-docs/**").permitAll()
|
||||||
|
.requestMatchers("/swagger-resources/**", "/webjars/**").permitAll()
|
||||||
|
|
||||||
|
// Analytics API 모두 허용 (테스트용)
|
||||||
|
.requestMatchers("/api/analytics/**").permitAll()
|
||||||
|
.requestMatchers("/api/action-plans/**").permitAll()
|
||||||
|
|
||||||
|
// Actuator 엔드포인트 허용
|
||||||
|
.requestMatchers("/actuator/**").permitAll()
|
||||||
|
|
||||||
|
// 기타 모든 요청 허용 (테스트용)
|
||||||
|
.anyRequest().permitAll()
|
||||||
|
);
|
||||||
|
|
||||||
|
return http.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -21,13 +21,7 @@ public class SwaggerConfig {
|
|||||||
.info(new Info()
|
.info(new Info()
|
||||||
.title("Analytics Service API")
|
.title("Analytics Service API")
|
||||||
.description("하이오더 분석 서비스 API 문서")
|
.description("하이오더 분석 서비스 API 문서")
|
||||||
.version("1.0.0"))
|
.version("1.0.0"));
|
||||||
.addSecurityItem(new SecurityRequirement().addList("Bearer Authentication"))
|
|
||||||
.components(new Components()
|
|
||||||
.addSecuritySchemes("Bearer Authentication",
|
|
||||||
new SecurityScheme()
|
|
||||||
.type(SecurityScheme.Type.HTTP)
|
|
||||||
.scheme("bearer")
|
|
||||||
.bearerFormat("JWT")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.ktds.hi.analytics.infra.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
// Swagger UI 리소스 핸들러 추가
|
||||||
|
registry.addResourceHandler("/swagger-ui/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/")
|
||||||
|
.resourceChain(false);
|
||||||
|
|
||||||
|
registry.addResourceHandler("/webjars/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/")
|
||||||
|
.resourceChain(false);
|
||||||
|
|
||||||
|
// 기본 정적 리소스 핸들러
|
||||||
|
registry.addResourceHandler("/**")
|
||||||
|
.addResourceLocations("classpath:/static/", "classpath:/public/")
|
||||||
|
.resourceChain(false);
|
||||||
|
|
||||||
|
// favicon.ico 처리
|
||||||
|
registry.addResourceHandler("/favicon.ico")
|
||||||
|
.addResourceLocations("classpath:/static/favicon.ico")
|
||||||
|
.resourceChain(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,11 @@
|
|||||||
server:
|
server:
|
||||||
port: ${ANALYTICS_SERVICE_PORT:8084}
|
port: ${ANALYTICS_SERVICE_PORT:8084}
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
org.springframework.web.servlet.resource.ResourceHttpRequestHandler: ERROR
|
||||||
|
org.springframework.web.servlet.DispatcherServlet: WARN
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: analytics-service
|
name: analytics-service
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user