swagger ui 추가.
This commit is contained in:
parent
a742f34e8a
commit
a822fa3e0b
6
pom.xml
6
pom.xml
@ -92,6 +92,12 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
package com.interplug.qcast;
|
||||
|
||||
import com.interplug.qcast.config.jasypt.JasyptConfig;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
@Import({JasyptConfig.class})
|
||||
public class QCastApplication {
|
||||
|
||||
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.StandardPBEStringEncryptor;
|
||||
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.Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -16,7 +16,7 @@ import org.springframework.context.annotation.Bean;
|
||||
*
|
||||
* @author KimYoungHyun (youngh.kim@kt.com)
|
||||
*/
|
||||
@Configurable
|
||||
@Configuration
|
||||
public class JasyptConfig {
|
||||
|
||||
private static final String KEY = "qcast_jasypt_key";
|
||||
|
||||
@ -14,7 +14,9 @@ import org.springframework.security.web.SecurityFilterChain;
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
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
|
||||
public AuthenticationManager authenticationManager(
|
||||
@ -31,11 +33,7 @@ public class SecurityConfig {
|
||||
.cors(Customizer.withDefaults())
|
||||
.authorizeHttpRequests(
|
||||
authorize ->
|
||||
authorize
|
||||
.requestMatchers("/api/login/**", "/act/**")
|
||||
.permitAll()
|
||||
.anyRequest()
|
||||
.authenticated());
|
||||
authorize.requestMatchers(WHITELIST).permitAll().anyRequest().authenticated());
|
||||
|
||||
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
|
||||
pool-name: Read-HikariPool
|
||||
# connection-test-query: SELECT 2
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
@ -37,14 +39,9 @@ management:
|
||||
exclude:
|
||||
- "*"
|
||||
web:
|
||||
base-path: /act
|
||||
exposure:
|
||||
include:
|
||||
- info
|
||||
- health
|
||||
exclude:
|
||||
- env
|
||||
- beans
|
||||
include: "*"
|
||||
exclude: "env,beans"
|
||||
endpoint:
|
||||
info:
|
||||
enabled: true
|
||||
@ -53,4 +50,8 @@ management:
|
||||
|
||||
# log
|
||||
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