Compare commits
5 Commits
feature/Ti
...
feature/ve
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a14020dfb5 | ||
|
|
975e03b7bd | ||
|
|
657c9e7f7d | ||
|
|
c5b779fda7 | ||
|
|
b7057cfc73 |
12
server/Dockerfile
Normal file
12
server/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM openjdk:11-jre-slim
|
||||||
|
|
||||||
|
ENV APP_HOME=/usr/app/
|
||||||
|
|
||||||
|
WORKDIR $APP_HOME
|
||||||
|
|
||||||
|
COPY build/libs/server-0.0.1-SNAPSHOT.jar application.jar
|
||||||
|
|
||||||
|
EXPOSE 8443
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["java", "-jar", "application.jar"]
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
|
import Dependencies.AnnotationProcessorLib
|
||||||
|
import Dependencies.DependencyManagementLib
|
||||||
|
import Dependencies.ModuleLib
|
||||||
|
import Dependencies.RuntimeOnlyLib
|
||||||
|
import Dependencies.TestLib
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
id("org.springframework.boot") version "2.6.7"
|
id("org.springframework.boot") version Versions.SPRING_BOOT_STARTER
|
||||||
id("io.spring.dependency-management") version "1.0.11.RELEASE"
|
id("io.spring.dependency-management") version Versions.SPRING_DEPENDENCY_MANAGEMENT
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.ticketing"
|
group = "com.ticketing"
|
||||||
@@ -23,48 +29,50 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
extra["springCloudVersion"] = "2021.0.3"
|
extra["springCloudVersion"] = Versions.SPRING_CLOUD
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
implementation(Dependencies.SPRING_BOOT_STARTER_DATA_JPA)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
implementation(Dependencies.SPRING_BOOT_STARTER_SECURITY)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-validation")
|
implementation(Dependencies.SPRING_BOOT_STARTER_VALIDATION)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
implementation(Dependencies.SPRING_BOOT_STARTER_WEB)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-actuator")
|
implementation(Dependencies.SPRING_BOOT_STARTER_ACTUATOR)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-log4j2")
|
implementation(Dependencies.SPRING_BOOT_STARTER_LOG4J2)
|
||||||
implementation("org.projectlombok:lombok:1.18.24")
|
implementation(Dependencies.LOMBOK)
|
||||||
implementation("io.springfox:springfox-boot-starter:3.0.0")
|
implementation(Dependencies.SPRING_FOX_STARTER)
|
||||||
implementation("io.springfox:springfox-swagger-ui:3.0.0")
|
implementation(Dependencies.SWAGGER)
|
||||||
implementation("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4")
|
implementation(Dependencies.JASYPT_SPRING_BOOT_STARTER)
|
||||||
implementation("com.lmax:disruptor:3.4.4")
|
implementation(Dependencies.DISRUPTOR)
|
||||||
implementation("io.jsonwebtoken:jjwt-api:0.11.5")
|
implementation(Dependencies.JJWT)
|
||||||
implementation("com.googlecode.json-simple:json-simple:1.1.1")
|
implementation(Dependencies.JSON_SIMPLE)
|
||||||
implementation("org.springframework.boot:spring-boot-starter-data-redis")
|
implementation(Dependencies.SPRING_BOOT_STARTER_REDIS)
|
||||||
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
implementation(Dependencies.JSR350)
|
||||||
implementation ("org.springframework.cloud:spring-cloud-starter-config")
|
implementation(Dependencies.SPRING_CLOUD_STARTER)
|
||||||
implementation("org.springframework.cloud:spring-cloud-starter-openfeign")
|
implementation(Dependencies.SPRING_CLOUD_FEIGN)
|
||||||
|
implementation(Dependencies.MICROMETER_CORE)
|
||||||
|
implementation(Dependencies.MICROMETER_REGISTRY_PROMETHEUS)
|
||||||
|
|
||||||
modules {
|
modules {
|
||||||
module("org.springframework.boot:spring-boot-starter-logging") {
|
module(ModuleLib.SPRING_BOOT_STARTER_LOGGING) {
|
||||||
replacedBy("org.springframework.boot:spring-boot-starter-log4j2", "Use Log4j2 instead of Logback")
|
replacedBy(ModuleLib.SPRING_BOOT_STARTER_LOG4J2, "Use Log4j2 instead of Logback")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok")
|
compileOnly(Dependencies.LOMBOK)
|
||||||
runtimeOnly("mysql:mysql-connector-java")
|
runtimeOnly(RuntimeOnlyLib.MYSQL)
|
||||||
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.11.5")
|
runtimeOnly(RuntimeOnlyLib.JJWT_IMPL)
|
||||||
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.11.5")
|
runtimeOnly(RuntimeOnlyLib.JJWT_JACKSON)
|
||||||
annotationProcessor("org.projectlombok:lombok")
|
annotationProcessor(Dependencies.LOMBOK)
|
||||||
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
|
annotationProcessor(AnnotationProcessorLib.SPRING_BOOT_PROCESSOR)
|
||||||
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.1")
|
testImplementation(TestLib.JUPITER)
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
testImplementation(TestLib.SPRING_BOOT_STARTER)
|
||||||
testImplementation("org.springframework.security:spring-security-test")
|
testImplementation(TestLib.SPRING_SECURITY)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyManagement {
|
dependencyManagement {
|
||||||
imports {
|
imports {
|
||||||
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
|
mavenBom(DependencyManagementLib.SPRING_CLOUD)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
server/buildSrc/build.gradle.kts
Normal file
8
server/buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
56
server/buildSrc/src/main/kotlin/Dependencies.kt
Normal file
56
server/buildSrc/src/main/kotlin/Dependencies.kt
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
object Dependencies {
|
||||||
|
|
||||||
|
const val SPRING_BOOT_STARTER_DATA_JPA = "org.springframework.boot:spring-boot-starter-data-jpa:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_SECURITY = "org.springframework.boot:spring-boot-starter-security:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_VALIDATION = "org.springframework.boot:spring-boot-starter-validation:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_WEB = "org.springframework.boot:spring-boot-starter-web:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_ACTUATOR = "org.springframework.boot:spring-boot-starter-actuator:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_LOG4J2 = "org.springframework.boot:spring-boot-starter-log4j2:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_BOOT_STARTER_REDIS = "org.springframework.boot:spring-boot-starter-data-redis:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
|
||||||
|
const val SPRING_CLOUD_STARTER = "org.springframework.cloud:spring-cloud-starter-config:${Versions.SPRING_CLOUD_STARTER}"
|
||||||
|
const val SPRING_CLOUD_FEIGN = "org.springframework.cloud:spring-cloud-starter-openfeign:${Versions.SPRING_CLOUD_STARTER}"
|
||||||
|
|
||||||
|
const val LOMBOK = "org.projectlombok:lombok:${Versions.LOMBOK}"
|
||||||
|
|
||||||
|
const val SPRING_FOX_STARTER = "io.springfox:springfox-boot-starter:${Versions.SPRING_FOX}"
|
||||||
|
const val SWAGGER = "io.springfox:springfox-swagger-ui:${Versions.SPRING_FOX}"
|
||||||
|
|
||||||
|
const val JASYPT_SPRING_BOOT_STARTER = "com.github.ulisesbocchio:jasypt-spring-boot-starter:${Versions.JASYPT}"
|
||||||
|
|
||||||
|
const val DISRUPTOR = "com.lmax:disruptor:${Versions.DISRUPTOR}"
|
||||||
|
|
||||||
|
const val JJWT = "io.jsonwebtoken:jjwt-api:${Versions.JJWT}"
|
||||||
|
const val JSON_SIMPLE = "com.googlecode.json-simple:json-simple:${Versions.JSON_SIMPLE}"
|
||||||
|
|
||||||
|
const val MICROMETER_CORE = "io.micrometer:micrometer-core:${Versions.MICROMETER}"
|
||||||
|
const val MICROMETER_REGISTRY_PROMETHEUS = "io.micrometer:micrometer-registry-prometheus:${Versions.MICROMETER}"
|
||||||
|
|
||||||
|
const val JSR350 = "com.google.code.findbugs:jsr305:${Versions.JSR350}"
|
||||||
|
|
||||||
|
object ModuleLib {
|
||||||
|
const val SPRING_BOOT_STARTER_LOGGING = "org.springframework.boot:spring-boot-starter-logging"
|
||||||
|
const val SPRING_BOOT_STARTER_LOG4J2 = "org.springframework.boot:spring-boot-starter-log4j2"
|
||||||
|
}
|
||||||
|
|
||||||
|
object RuntimeOnlyLib {
|
||||||
|
const val MYSQL = "mysql:mysql-connector-java:${Versions.MYSQL_CONNECTOR_JAVA}"
|
||||||
|
const val JJWT_IMPL = "io.jsonwebtoken:jjwt-impl:${Versions.JJWT}"
|
||||||
|
const val JJWT_JACKSON = "io.jsonwebtoken:jjwt-jackson:${Versions.JJWT}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object AnnotationProcessorLib {
|
||||||
|
const val SPRING_BOOT_PROCESSOR = "org.springframework.boot:spring-boot-configuration-processor:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object TestLib {
|
||||||
|
const val JUPITER = "org.junit.jupiter:junit-jupiter-api:${Versions.JUPITER}"
|
||||||
|
const val SPRING_BOOT_STARTER = "org.springframework.boot:spring-boot-starter-test:${Versions.SPRING_BOOT_STARTER}"
|
||||||
|
const val SPRING_SECURITY = "org.springframework.security:spring-security-test:${Versions.SECURITY}"
|
||||||
|
}
|
||||||
|
|
||||||
|
object DependencyManagementLib {
|
||||||
|
const val SPRING_CLOUD = "org.springframework.cloud:spring-cloud-dependencies:${Versions.SPRING_CLOUD}"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
server/buildSrc/src/main/kotlin/Versions.kt
Normal file
23
server/buildSrc/src/main/kotlin/Versions.kt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
object Versions {
|
||||||
|
|
||||||
|
const val SPRING_BOOT_STARTER = "2.6.7"
|
||||||
|
const val SPRING_DEPENDENCY_MANAGEMENT = "1.0.11.RELEASE"
|
||||||
|
|
||||||
|
const val SPRING_CLOUD_STARTER = "3.1.3"
|
||||||
|
const val SPRING_CLOUD = "2021.0.3"
|
||||||
|
|
||||||
|
const val MYSQL_CONNECTOR_JAVA = "8.0.28"
|
||||||
|
|
||||||
|
const val LOMBOK = "1.18.24"
|
||||||
|
const val SPRING_FOX = "3.0.0"
|
||||||
|
const val JASYPT = "3.0.4"
|
||||||
|
const val DISRUPTOR = "3.4.4"
|
||||||
|
const val JJWT = "0.11.5"
|
||||||
|
const val JSON_SIMPLE = "1.1.1"
|
||||||
|
const val MICROMETER = "1.8.5"
|
||||||
|
const val JSR350 = "3.0.2"
|
||||||
|
|
||||||
|
const val JUPITER = "5.8.1"
|
||||||
|
const val SECURITY = "5.6.3"
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,8 +28,9 @@ public class RefreshToken {
|
|||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeToken(String token) {
|
public RefreshToken changeToken(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class JwtProvider {
|
|||||||
|
|
||||||
private static final String AUTHORITIES_KEY = "auth";
|
private static final String AUTHORITIES_KEY = "auth";
|
||||||
private static final String AUTHORITIES_DELIMITER = ",";
|
private static final String AUTHORITIES_DELIMITER = ",";
|
||||||
|
private static final String ROLE = "ROLE_";
|
||||||
|
|
||||||
private final Key key;
|
private final Key key;
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
@@ -89,7 +90,7 @@ public class JwtProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String makeRoleName(String role) {
|
private String makeRoleName(String role) {
|
||||||
return "ROLE_" + role.toUpperCase();
|
return role.contains(ROLE) ? role.toUpperCase() : ROLE + role.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Authentication getAuthentication(String token) {
|
public Authentication getAuthentication(String token) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import com.ticketing.server.global.redis.RefreshRedisRepository;
|
|||||||
import com.ticketing.server.global.redis.RefreshToken;
|
import com.ticketing.server.global.redis.RefreshToken;
|
||||||
import com.ticketing.server.global.security.jwt.JwtProperties;
|
import com.ticketing.server.global.security.jwt.JwtProperties;
|
||||||
import com.ticketing.server.global.security.jwt.JwtProvider;
|
import com.ticketing.server.global.security.jwt.JwtProvider;
|
||||||
import com.ticketing.server.user.service.dto.TokenDTO;
|
|
||||||
import com.ticketing.server.user.service.dto.DeleteRefreshTokenDTO;
|
import com.ticketing.server.user.service.dto.DeleteRefreshTokenDTO;
|
||||||
|
import com.ticketing.server.user.service.dto.TokenDTO;
|
||||||
import com.ticketing.server.user.service.interfaces.AuthenticationService;
|
import com.ticketing.server.user.service.interfaces.AuthenticationService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
@@ -40,8 +40,14 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
|||||||
// refresh 토큰이 있으면 수정, 없으면 생성
|
// refresh 토큰이 있으면 수정, 없으면 생성
|
||||||
refreshRedisRepository.findByEmail(email)
|
refreshRedisRepository.findByEmail(email)
|
||||||
.ifPresentOrElse(
|
.ifPresentOrElse(
|
||||||
tokenEntity -> tokenEntity.changeToken(tokenDto.getRefreshToken()),
|
tokenEntity -> refreshRedisRepository.save(
|
||||||
() -> refreshRedisRepository.save(new RefreshToken(email, tokenDto.getRefreshToken()))
|
tokenEntity.changeToken(
|
||||||
|
tokenDto.getRefreshToken()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
() -> refreshRedisRepository.save(
|
||||||
|
new RefreshToken(email, tokenDto.getRefreshToken())
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return tokenDto;
|
return tokenDto;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
server:
|
||||||
|
port: 8443
|
||||||
|
address: 0.0.0.0
|
||||||
|
|
||||||
|
http:
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
ssl:
|
||||||
|
key-store: classpath:keystore/ticketing.p12
|
||||||
|
key-store-password: ENC(OMvGcpZLpggFTiGNkqNe66Zq/SmJXF6o)
|
||||||
|
key-store-type: PKCS12
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://ticketing-db/ticketing?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
|
||||||
|
username: ENC(LowN1n4w0Ep/DqLD8+q5Bq6AXM4b8e3V)
|
||||||
|
password: ENC(OMvGcpZLpggFTiGNkqNe66Zq/SmJXF6o)
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
jpa:
|
||||||
|
properties:
|
||||||
|
hibernate:
|
||||||
|
show_sql: true
|
||||||
|
format_sql: true
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: validate
|
||||||
|
|
||||||
|
redis:
|
||||||
|
host: 172.18.0.3
|
||||||
|
port: 6379
|
||||||
|
|
||||||
|
application:
|
||||||
|
name: monitoring
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,24 @@ spring:
|
|||||||
config:
|
config:
|
||||||
import: "optional:configserver:"
|
import: "optional:configserver:"
|
||||||
|
|
||||||
|
application:
|
||||||
|
name: monitoring
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoint:
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
prometheus:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: health, info, metrics, prometheus
|
||||||
|
|
||||||
|
metrics:
|
||||||
|
tags:
|
||||||
|
application: ${spring.application.name}
|
||||||
|
|
||||||
jasypt:
|
jasypt:
|
||||||
encryptor:
|
encryptor:
|
||||||
|
|||||||
BIN
server/src/main/resources/keystore/ticketing.p12
Normal file
BIN
server/src/main/resources/keystore/ticketing.p12
Normal file
Binary file not shown.
Reference in New Issue
Block a user