diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/in/auth/AuthController.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/in/auth/AuthController.java index 87d19d69..8efe1e16 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/in/auth/AuthController.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/adapter/in/auth/AuthController.java @@ -19,7 +19,6 @@ import com.gaebaljip.exceed.common.docs.auth.ReissueTokenExceptionDocs; import com.gaebaljip.exceed.common.dto.HttpRequestDTO; import com.gaebaljip.exceed.common.dto.TokenDTO; -import com.gaebaljip.exceed.common.dto.ReissueTokenDTO; import com.gaebaljip.exceed.common.exception.auth.NotFoundRefreshTokenException; import com.gaebaljip.exceed.common.security.AuthConstants; import com.gaebaljip.exceed.common.swagger.ApiErrorExceptionsExample; @@ -58,7 +57,7 @@ public ApiResponse> refresh( String refreshToken = getCookie(request.getCookies()).getValue(); HttpRequestDTO httpRequestDTO = HttpRequestDTO.of(request.getRequestURL().toString(), request.getMethod()); - ReissueTokenDTO reissueTokenDTO = + TokenDTO reissueTokenDTO = authUsecase.reIssueToken(accessToken, refreshToken, httpRequestDTO); response.setHeader(AuthConstants.AUTH_HEADER.getValue(), reissueTokenDTO.accessToken()); setCookie(response, reissueTokenDTO.refreshToken()); diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/port/in/auth/AuthUsecase.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/port/in/auth/AuthUsecase.java index a9ddd980..56e2134d 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/port/in/auth/AuthUsecase.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/port/in/auth/AuthUsecase.java @@ -5,12 +5,11 @@ import com.gaebaljip.exceed.adapter.in.auth.request.LoginRequest; import com.gaebaljip.exceed.common.dto.HttpRequestDTO; import com.gaebaljip.exceed.common.dto.TokenDTO; -import com.gaebaljip.exceed.common.dto.ReissueTokenDTO; @Component public interface AuthUsecase { TokenDTO execute(LoginRequest request); - ReissueTokenDTO reIssueToken( + TokenDTO reIssueToken( String accessToken, String refreshToken, HttpRequestDTO requestDTO); } diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java index 16665e5e..7eacc75d 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/application/service/auth/AuthService.java @@ -10,7 +10,6 @@ import com.gaebaljip.exceed.application.port.out.member.MemberPort; import com.gaebaljip.exceed.common.dto.HttpRequestDTO; import com.gaebaljip.exceed.common.dto.TokenDTO; -import com.gaebaljip.exceed.common.dto.ReissueTokenDTO; import com.gaebaljip.exceed.common.exception.auth.PasswordMismatchException; import com.gaebaljip.exceed.common.security.domain.JwtManager; import com.gaebaljip.exceed.common.security.exception.InvalidJwtException; @@ -42,7 +41,7 @@ public TokenDTO execute(LoginRequest request) { } @Override - public ReissueTokenDTO reIssueToken( + public TokenDTO reIssueToken( String accessToken, String refreshToken, HttpRequestDTO requestDTO) { if (jwtManager.validateRefreshToken(refreshToken, requestDTO)) { return jwtManager.reissueToken(accessToken); diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/dto/ReissueTokenDTO.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/common/dto/ReissueTokenDTO.java deleted file mode 100644 index bba6426c..00000000 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/dto/ReissueTokenDTO.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.gaebaljip.exceed.common.dto; - -import lombok.Builder; - -public record ReissueTokenDTO(String accessToken, String refreshToken) { - @Builder - public ReissueTokenDTO {} -} diff --git a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java b/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java index 65024d51..19325d23 100644 --- a/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java +++ b/BE/exceed/src/main/java/com/gaebaljip/exceed/common/security/domain/JwtManager.java @@ -6,13 +6,13 @@ import javax.servlet.http.HttpServletRequest; +import com.gaebaljip.exceed.common.dto.TokenDTO; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import com.gaebaljip.exceed.adapter.out.redis.RedisAdapter; import com.gaebaljip.exceed.common.dto.HttpRequestDTO; -import com.gaebaljip.exceed.common.dto.ReissueTokenDTO; import com.gaebaljip.exceed.common.exception.auth.NotFoundRefreshTokenException; import com.gaebaljip.exceed.common.security.exception.ExpiredJwtException; import com.gaebaljip.exceed.common.security.exception.InvalidJwtException; @@ -171,7 +171,7 @@ public Claims parseClaims(String Token) { } } - public ReissueTokenDTO reissueToken(String accessToken) { + public TokenDTO reissueToken(String accessToken) { String accessTokenMemberId = parseClaims(accessToken).getSubject(); String refreshToken = redisAdapter @@ -180,7 +180,7 @@ public ReissueTokenDTO reissueToken(String accessToken) { String refreshTokenMemberId = parseClaims(refreshToken).getSubject(); if (accessTokenMemberId.equals(refreshTokenMemberId)) { - return ReissueTokenDTO.builder() + return TokenDTO.builder() .accessToken(generateAccessToken(Long.parseLong(accessTokenMemberId))) .refreshToken(generateRefreshToken(Long.parseLong(refreshTokenMemberId))) .build();