Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public class AuthValueConfig {
@Value("${jwt.secret}")
private String JWT_SECRET;

public static final Long ACCESS_TOKEN_EXPIRATION_TIME = 1000 * 60 * 60 * 24 * 14L; // TODO: 2주, 임시 기간이므로 추후 변경 필요
@Value("${jwt.access-token-expiration}")
private Long accessTokenExpirationTime;

// public static final Long ACCESS_TOKEN_EXPIRATION_TIME = 1000 * 60 * 60 * 24 * 14L;
public static final Long REFRESH_TOKEN_EXPIRATION_TIME = 1000 * 60 * 60 * 24 * 14L; // 2주

@PostConstruct
Expand Down
7 changes: 5 additions & 2 deletions layer-api/src/main/java/org/layer/jwt/service/JwtService.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.layer.config.AuthValueConfig;
import org.layer.jwt.JwtProvider;
import org.layer.jwt.JwtToken;
import org.layer.jwt.JwtValidator;
Expand All @@ -14,7 +16,6 @@
import java.time.Duration;
import java.util.List;

import static org.layer.config.AuthValueConfig.ACCESS_TOKEN_EXPIRATION_TIME;
import static org.layer.config.AuthValueConfig.REFRESH_TOKEN_EXPIRATION_TIME;
import static org.layer.global.exception.ApiTokenExceptionType.*;

Expand All @@ -26,8 +27,10 @@ public class JwtService {
private final JwtValidator jwtValidator;
private final RedisTemplate<String, String> redisTemplate;

private final AuthValueConfig authValueConfig;

public JwtToken issueToken(Long memberId, MemberRole memberRole) {
String accessToken = jwtProvider.createToken(MemberAuthentication.create(memberId, memberRole), ACCESS_TOKEN_EXPIRATION_TIME);
String accessToken = jwtProvider.createToken(MemberAuthentication.create(memberId, memberRole), authValueConfig.getAccessTokenExpirationTime());
String refreshToken = jwtProvider.createToken(MemberAuthentication.create(memberId, memberRole), REFRESH_TOKEN_EXPIRATION_TIME);

saveRefreshTokenToRedis(memberId, refreshToken);
Expand Down
1 change: 1 addition & 0 deletions layer-api/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spring:

jwt:
secret: ${DEV_JWT_SECRET}
access-token-expiration: 60000

apple:
login:
Expand Down
1 change: 1 addition & 0 deletions layer-api/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spring:

jwt:
secret: ${DEV_JWT_SECRET}
access-token-expiration: 60000

apple:
login:
Expand Down
1 change: 1 addition & 0 deletions layer-api/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ spring:

jwt:
secret: ${PROD_JWT_SECRET}
access-token-expiration: 1209600000

apple:
login:
Expand Down
1 change: 1 addition & 0 deletions layer-api/src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spring:

jwt:
secret: ${DEV_JWT_SECRET}
access-token-expiration: 1209600000

apple:
login:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class RetrospectScheduler {
* @note: 1시간마다 실행된다.
*/
@Scheduled(cron = "0 0 * * * *")
@Transactional
public void updateRetrospectStatusToDone() {
log.info("Batch Module: Batch Start : updateRetrospectStatusToDone");

Expand Down
Loading