Compare commits

..

6 Commits

Author SHA1 Message Date
changhyuns
7606a65413 refactor: set ddl-auto: validate 2022-07-26 20:56:09 +09:00
changhyuns
2d0832b7b2 fix: 하단 공백 추가 2022-07-26 12:55:11 +09:00
changhyuns
f5555000bd add: redis host, port 2022-07-26 02:31:16 +09:00
changhyuns
f59402b8b1 add: Dockerfile 2022-07-26 02:26:34 +09:00
changhyuns
d2a1cecd1a add: application-prod.yml 2022-07-26 02:23:59 +09:00
changhyuns
3136ffa6fe add: pkcs12 ssl key 2022-07-26 01:23:46 +09:00
6 changed files with 47 additions and 13 deletions

12
server/Dockerfile Normal file
View 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"]

View File

@@ -28,9 +28,8 @@ public class RefreshToken {
this.token = token;
}
public RefreshToken changeToken(String token) {
public void changeToken(String token) {
this.token = token;
return this;
}
}

View File

@@ -27,7 +27,6 @@ public class JwtProvider {
private static final String AUTHORITIES_KEY = "auth";
private static final String AUTHORITIES_DELIMITER = ",";
private static final String ROLE = "ROLE_";
private final Key key;
private final String prefix;
@@ -90,7 +89,7 @@ public class JwtProvider {
}
private String makeRoleName(String role) {
return role.contains(ROLE) ? role.toUpperCase() : ROLE + role.toUpperCase();
return "ROLE_" + role.toUpperCase();
}
public Authentication getAuthentication(String token) {

View File

@@ -5,8 +5,8 @@ import com.ticketing.server.global.redis.RefreshRedisRepository;
import com.ticketing.server.global.redis.RefreshToken;
import com.ticketing.server.global.security.jwt.JwtProperties;
import com.ticketing.server.global.security.jwt.JwtProvider;
import com.ticketing.server.user.service.dto.DeleteRefreshTokenDTO;
import com.ticketing.server.user.service.dto.TokenDTO;
import com.ticketing.server.user.service.dto.DeleteRefreshTokenDTO;
import com.ticketing.server.user.service.interfaces.AuthenticationService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -40,14 +40,8 @@ public class AuthenticationServiceImpl implements AuthenticationService {
// refresh 토큰이 있으면 수정, 없으면 생성
refreshRedisRepository.findByEmail(email)
.ifPresentOrElse(
tokenEntity -> refreshRedisRepository.save(
tokenEntity.changeToken(
tokenDto.getRefreshToken()
)
),
() -> refreshRedisRepository.save(
new RefreshToken(email, tokenDto.getRefreshToken())
)
tokenEntity -> tokenEntity.changeToken(tokenDto.getRefreshToken()),
() -> refreshRedisRepository.save(new RefreshToken(email, tokenDto.getRefreshToken()))
);
return tokenDto;

View File

@@ -0,0 +1,30 @@
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

Binary file not shown.