From 4481057bae4c29fef4dd10857e0ea801fbfbb6c0 Mon Sep 17 00:00:00 2001 From: msk226 Date: Thu, 29 Jan 2026 16:50:46 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Feature]=20=EC=86=8C=EC=85=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=84=B1=EA=B3=B5=20=EC=8B=9C,=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20ID=20=ED=95=A8=EA=BB=98=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kr/spot/infrastructure/jwt/JwtTokenProvider.java | 4 ++-- .../java/kr/spot/presentation/OAuthController.java | 11 +++++------ .../kr/spot/presentation/command/dto/TokenDTO.java | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/modules/auth/src/main/java/kr/spot/infrastructure/jwt/JwtTokenProvider.java b/modules/auth/src/main/java/kr/spot/infrastructure/jwt/JwtTokenProvider.java index de57d347..85768450 100644 --- a/modules/auth/src/main/java/kr/spot/infrastructure/jwt/JwtTokenProvider.java +++ b/modules/auth/src/main/java/kr/spot/infrastructure/jwt/JwtTokenProvider.java @@ -49,7 +49,7 @@ public TokenDTO createToken(final Long memberId) { REFRESH); // 리프레시 토큰 생성 // 토큰 DTO 반환 - return TokenDTO.of(accessToken, refreshToken); + return TokenDTO.of(memberId, accessToken, refreshToken); } private String generateToken(final Long memberId, Date now, final long expirationTime, @@ -92,7 +92,7 @@ public TokenDTO createTestToken(final Long memberId) { long oneYearInMillis = 365L * 24 * 60 * 60 * 1000; String accessToken = generateToken(memberId, now, oneYearInMillis, ACCESS); String refreshToken = generateToken(memberId, now, oneYearInMillis, REFRESH); - return TokenDTO.of(accessToken, refreshToken); + return TokenDTO.of(memberId, accessToken, refreshToken); } private Claims getClaims(final String token) { diff --git a/modules/auth/src/main/java/kr/spot/presentation/OAuthController.java b/modules/auth/src/main/java/kr/spot/presentation/OAuthController.java index da718df0..90ad95ed 100644 --- a/modules/auth/src/main/java/kr/spot/presentation/OAuthController.java +++ b/modules/auth/src/main/java/kr/spot/presentation/OAuthController.java @@ -25,7 +25,7 @@ @RequiredArgsConstructor @RequestMapping("/api/oauth") public class OAuthController { - + private final OAuthService oAuthService; @Operation(summary = "소셜 로그인 리다이렉트 URL 반환", @@ -39,8 +39,8 @@ public class OAuthController { }) @GetMapping("/redirect-url/{type}") public ResponseEntity> getRedirectUrl( - @Parameter(description = "소셜 로그인 타입(naver, kakao)", required = true) - @PathVariable("type") String type) { + @PathVariable @Parameter(description = + "소셜 로그인 타입(naver, kakao)", required = true) String type) { return ResponseEntity.ok(ApiResponse.onSuccess(SuccessStatus._OK, oAuthService.redirectURL(LoginType.valueOf(type.toUpperCase())))); } @@ -58,8 +58,7 @@ public ResponseEntity> getRedirectUrl( }) @GetMapping("/callback/{type}") public ResponseEntity> socialLoginCallback( - @Parameter(description = "소셜 로그인 타입(naver, kakao)", required = true) - @PathVariable("type") String type, + @PathVariable @Parameter(description = "소셜 로그인 타입(naver, kakao)", required = true) String type, @Parameter(description = "소셜 로그인 후 발급받은 code", required = true) @RequestParam("code") String code) { @@ -72,7 +71,7 @@ public ResponseEntity> socialLoginCallback( "예: /api/oauth/client/kakao?accessToken=YOUR_ACCESS_TOKEN") @GetMapping("/client/{type}") public ResponseEntity> socialLoginForClient( - @PathVariable("type") String type, + @PathVariable String type, @RequestParam("accessToken") String accessToken ) { return ResponseEntity.ok(ApiResponse.onSuccess(SuccessStatus._OK, diff --git a/modules/auth/src/main/java/kr/spot/presentation/command/dto/TokenDTO.java b/modules/auth/src/main/java/kr/spot/presentation/command/dto/TokenDTO.java index 43c40f89..13450e1c 100644 --- a/modules/auth/src/main/java/kr/spot/presentation/command/dto/TokenDTO.java +++ b/modules/auth/src/main/java/kr/spot/presentation/command/dto/TokenDTO.java @@ -1,8 +1,8 @@ package kr.spot.presentation.command.dto; -public record TokenDTO(String accessToken, String refreshToken) { +public record TokenDTO(Long id, String accessToken, String refreshToken) { - public static TokenDTO of(String accessToken, String refreshToken) { - return new TokenDTO(accessToken, refreshToken); + public static TokenDTO of(Long id, String accessToken, String refreshToken) { + return new TokenDTO(id, accessToken, refreshToken); } } From b69f2ef34e1cbe08cfa269e3d0abf5dc797099ee Mon Sep 17 00:00:00 2001 From: msk226 Date: Thu, 29 Jan 2026 16:54:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[Feature]=20=EB=B3=80=EA=B2=BD=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20fixture=EC=97=90?= =?UTF-8?q?=EB=8F=84=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/auth/src/test/java/kr/spot/common/AuthFixture.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/auth/src/test/java/kr/spot/common/AuthFixture.java b/modules/auth/src/test/java/kr/spot/common/AuthFixture.java index 5ba3303a..4cdaa6c6 100644 --- a/modules/auth/src/test/java/kr/spot/common/AuthFixture.java +++ b/modules/auth/src/test/java/kr/spot/common/AuthFixture.java @@ -19,6 +19,6 @@ public static RefreshToken mismatchedRefreshToken(Long id) { } public static TokenDTO newTokenDTO() { - return new TokenDTO(NEW_ACCESS, NEW_REFRESH); + return new TokenDTO(MEMBER_ID, NEW_ACCESS, NEW_REFRESH); } }