swagger ui 추가.
This commit is contained in:
parent
a742f34e8a
commit
a822fa3e0b
6
pom.xml
6
pom.xml
@ -92,6 +92,12 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.6.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.interplug.qcast;
|
package com.interplug.qcast;
|
||||||
|
|
||||||
import com.interplug.qcast.config.jasypt.JasyptConfig;
|
|
||||||
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.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||||
@Import({JasyptConfig.class})
|
|
||||||
public class QCastApplication {
|
public class QCastApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import org.jasypt.encryption.StringEncryptor;
|
|||||||
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
|
||||||
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||||
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
|
||||||
import org.springframework.beans.factory.annotation.Configurable;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -16,7 +16,7 @@ import org.springframework.context.annotation.Bean;
|
|||||||
*
|
*
|
||||||
* @author KimYoungHyun (youngh.kim@kt.com)
|
* @author KimYoungHyun (youngh.kim@kt.com)
|
||||||
*/
|
*/
|
||||||
@Configurable
|
@Configuration
|
||||||
public class JasyptConfig {
|
public class JasyptConfig {
|
||||||
|
|
||||||
private static final String KEY = "qcast_jasypt_key";
|
private static final String KEY = "qcast_jasypt_key";
|
||||||
|
|||||||
@ -14,7 +14,9 @@ import org.springframework.security.web.SecurityFilterChain;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
public class SecurityConfig {
|
public class SecurityConfig {
|
||||||
private static final String[] WHITELIST = {"/api/login/**", "/act/**"};
|
private static final String[] WHITELIST = {
|
||||||
|
"/api/login/**", "/swagger-ui/**", "/v3/api-docs/**", "/actuator/**"
|
||||||
|
};
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AuthenticationManager authenticationManager(
|
public AuthenticationManager authenticationManager(
|
||||||
@ -31,11 +33,7 @@ public class SecurityConfig {
|
|||||||
.cors(Customizer.withDefaults())
|
.cors(Customizer.withDefaults())
|
||||||
.authorizeHttpRequests(
|
.authorizeHttpRequests(
|
||||||
authorize ->
|
authorize ->
|
||||||
authorize
|
authorize.requestMatchers(WHITELIST).permitAll().anyRequest().authenticated());
|
||||||
.requestMatchers("/api/login/**", "/act/**")
|
|
||||||
.permitAll()
|
|
||||||
.anyRequest()
|
|
||||||
.authenticated());
|
|
||||||
|
|
||||||
return httpSecurity.build();
|
return httpSecurity.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.interplug.qcast.config.swagger;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springdoc.core.models.GroupedOpenApi;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class SwaggerConfig {
|
||||||
|
|
||||||
|
@Autowired Environment env;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI baseApi() {
|
||||||
|
String activeProfile = env.getProperty("spring.profiles.active");
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Active profile: {}", activeProfile);
|
||||||
|
}
|
||||||
|
OpenAPI openAPI = new OpenAPI();
|
||||||
|
openAPI.info(
|
||||||
|
new Info().title("QCast API").version("1.0").description("QCast API Documentation"));
|
||||||
|
return openAPI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi allApi() {
|
||||||
|
return GroupedOpenApi.builder().group("ALL").packagesToScan("com.interplug.qcast.biz").build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,6 +28,8 @@ spring:
|
|||||||
maximum-pool-size: 4
|
maximum-pool-size: 4
|
||||||
pool-name: Read-HikariPool
|
pool-name: Read-HikariPool
|
||||||
# connection-test-query: SELECT 2
|
# connection-test-query: SELECT 2
|
||||||
|
jackson:
|
||||||
|
time-zone: Asia/Seoul
|
||||||
|
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
@ -37,14 +39,9 @@ management:
|
|||||||
exclude:
|
exclude:
|
||||||
- "*"
|
- "*"
|
||||||
web:
|
web:
|
||||||
base-path: /act
|
|
||||||
exposure:
|
exposure:
|
||||||
include:
|
include: "*"
|
||||||
- info
|
exclude: "env,beans"
|
||||||
- health
|
|
||||||
exclude:
|
|
||||||
- env
|
|
||||||
- beans
|
|
||||||
endpoint:
|
endpoint:
|
||||||
info:
|
info:
|
||||||
enabled: true
|
enabled: true
|
||||||
@ -54,3 +51,7 @@ management:
|
|||||||
# log
|
# log
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback/logback-${spring.profiles.active:local}.xml
|
config: classpath:logback/logback-${spring.profiles.active:local}.xml
|
||||||
|
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
operations-sorter: alpha
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user