feat : 인그레스 적용을 위한 스웨거 주소 수정
This commit is contained in:
@@ -1,50 +1,49 @@
|
||||
package com.ktds.hi.store.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;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Analytics 서비스 보안 설정 클래스
|
||||
* 테스트를 위해 모든 엔드포인트를 인증 없이 접근 가능하도록 설정
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class SecurityConfig {
|
||||
|
||||
private final CorsConfigurationSource corsConfigurationSource;
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.cors(cors -> cors.configurationSource(corsConfigurationSource))
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
// Swagger 관련 경로 모두 허용
|
||||
.requestMatchers("/swagger-ui.html","/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();
|
||||
}
|
||||
}
|
||||
package com.ktds.hi.store.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;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Analytics 서비스 보안 설정 클래스
|
||||
* 테스트를 위해 모든 엔드포인트를 인증 없이 접근 가능하도록 설정
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class SecurityConfig {
|
||||
|
||||
private final CorsConfigurationSource corsConfigurationSource;
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.cors(cors -> cors.configurationSource(corsConfigurationSource))
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
// Swagger 관련 경로 모두 허용
|
||||
.requestMatchers("/docs/store/swagger-ui.html","/docs/store/swagger-ui/**").permitAll()
|
||||
.requestMatchers("/docs/store/api-docs/**").permitAll()
|
||||
.requestMatchers("/docs/store/swagger-resources/**", "/webjars/**").permitAll()
|
||||
|
||||
// Analytics API 모두 허용 (테스트용)
|
||||
.requestMatchers("/api/external/**").permitAll()
|
||||
|
||||
// Actuator 엔드포인트 허용
|
||||
.requestMatchers("/actuator/**").permitAll()
|
||||
|
||||
// 기타 모든 요청 허용 (테스트용)
|
||||
.anyRequest().permitAll()
|
||||
);
|
||||
|
||||
return http.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ktds.hi.store.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import io.swagger.v3.oas.models.Components;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI openAPI() {
|
||||
final String securitySchemeName = "Bearer Authentication";
|
||||
|
||||
return new OpenAPI()
|
||||
.addServersItem(new Server().url("/"))
|
||||
.info(new Info()
|
||||
.title("하이오더 매장 관리 서비스 API")
|
||||
.description("매장, 외부연동관련 API")
|
||||
.version("1.0.0"))
|
||||
.addSecurityItem(new SecurityRequirement()
|
||||
.addList(securitySchemeName))
|
||||
.components(new Components()
|
||||
.addSecuritySchemes(securitySchemeName, new SecurityScheme()
|
||||
.name(securitySchemeName)
|
||||
.type(SecurityScheme.Type.HTTP)
|
||||
.scheme("bearer")
|
||||
.bearerFormat("JWT")));
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,48 @@
|
||||
server:
|
||||
port: ${STORE_SERVICE_PORT:8082}
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: store-service
|
||||
|
||||
datasource:
|
||||
url: ${STORE_DB_URL:jdbc:postgresql://20.249.154.116:5432/hiorder_store}
|
||||
username: ${STORE_DB_USERNAME:hiorder_user}
|
||||
password: ${STORE_DB_PASSWORD:hiorder_pass}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
|
||||
external-api:
|
||||
naver:
|
||||
client-id: ${NAVER_CLIENT_ID:}
|
||||
client-secret: ${NAVER_CLIENT_SECRET:}
|
||||
base-url: https://openapi.naver.com
|
||||
kakao:
|
||||
api-key: ${KAKAO_API_KEY:}
|
||||
base-url: https://dapi.kakao.com
|
||||
google:
|
||||
api-key: ${GOOGLE_API_KEY:}
|
||||
base-url: https://maps.googleapis.com
|
||||
hiorder:
|
||||
api-key: ${HIORDER_API_KEY:}
|
||||
base-url: ${HIORDER_BASE_URL:https://api.hiorder.com}
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /api-docs
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
server:
|
||||
port: ${STORE_SERVICE_PORT:8082}
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: store-service
|
||||
|
||||
datasource:
|
||||
url: ${STORE_DB_URL:jdbc:postgresql://20.249.154.116:5432/hiorder_store}
|
||||
username: ${STORE_DB_USERNAME:hiorder_user}
|
||||
password: ${STORE_DB_PASSWORD:hiorder_pass}
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
dialect: org.hibernate.dialect.PostgreSQLDialect
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
|
||||
external-api:
|
||||
naver:
|
||||
client-id: ${NAVER_CLIENT_ID:}
|
||||
client-secret: ${NAVER_CLIENT_SECRET:}
|
||||
base-url: https://openapi.naver.com
|
||||
kakao:
|
||||
api-key: ${KAKAO_API_KEY:}
|
||||
base-url: https://dapi.kakao.com
|
||||
google:
|
||||
api-key: ${GOOGLE_API_KEY:}
|
||||
base-url: https://maps.googleapis.com
|
||||
hiorder:
|
||||
api-key: ${HIORDER_API_KEY:}
|
||||
base-url: ${HIORDER_BASE_URL:https://api.hiorder.com}
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
path: /docs/store/api-docs
|
||||
swagger-ui:
|
||||
path: /docs/store/swagger-ui.html
|
||||
|
||||
Reference in New Issue
Block a user