From 996feaf0e7c622314394b54b73f233755119849e Mon Sep 17 00:00:00 2001 From: HoYeon Lee Date: Tue, 30 Jul 2024 16:02:44 +0900 Subject: [PATCH 1/2] =?UTF-8?q?DRAW-177=20fix:=20=EC=B6=A9=EB=8F=8C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/kotlin/com/xorker/draw/auth/dto/AuthTokenResponse.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/api/src/main/kotlin/com/xorker/draw/auth/dto/AuthTokenResponse.kt b/app/api/src/main/kotlin/com/xorker/draw/auth/dto/AuthTokenResponse.kt index cd8d4ed5..e154be99 100644 --- a/app/api/src/main/kotlin/com/xorker/draw/auth/dto/AuthTokenResponse.kt +++ b/app/api/src/main/kotlin/com/xorker/draw/auth/dto/AuthTokenResponse.kt @@ -6,8 +6,6 @@ import io.swagger.v3.oas.annotations.media.Schema @Schema(description = "Auth 공통 응답 DTO 입니다.") data class AuthTokenResponse( - @Schema(description = "할당된 유저 ID") - val userId: UserId, @Schema(description = "Access Token 입니다.") val accessToken: String, @Schema(description = "Refresh Token 입니다.") From 8838704e44d92b55c953e3164af0d20eeabe7f51 Mon Sep 17 00:00:00 2001 From: HoYeon Lee Date: Tue, 30 Jul 2024 16:24:43 +0900 Subject: [PATCH 2/2] =?UTF-8?q?DRAW-177=20fix:=20=EC=9D=B5=EB=AA=85=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xorker/draw/auth/token/AccessTokenAdapter.kt | 4 ++-- core/src/main/kotlin/com/xorker/draw/auth/AuthService.kt | 7 ++++--- .../com/xorker/draw/auth/token/AccessTokenRepository.kt | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/adapter/rdb/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenAdapter.kt b/adapter/rdb/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenAdapter.kt index 5a58472a..1ec18dfe 100644 --- a/adapter/rdb/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenAdapter.kt +++ b/adapter/rdb/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenAdapter.kt @@ -3,8 +3,8 @@ package com.xorker.draw.auth.token import com.xorker.draw.support.jwt.JwtProvider import com.xorker.draw.support.jwt.JwtSecretKey import com.xorker.draw.user.UserId -import java.time.Duration import java.time.LocalDateTime +import java.time.temporal.TemporalAmount import org.springframework.stereotype.Component @Component @@ -12,7 +12,7 @@ internal class AccessTokenAdapter( private val jwtProvider: JwtProvider, private val jwtSecretKey: JwtSecretKey, ) : AccessTokenRepository { - override fun createAccessToken(userId: UserId, expiredTime: Duration): String { + override fun createAccessToken(userId: UserId, expiredTime: TemporalAmount): String { val now = LocalDateTime.now() return jwtProvider.generate( id = userId.value.toString(), diff --git a/core/src/main/kotlin/com/xorker/draw/auth/AuthService.kt b/core/src/main/kotlin/com/xorker/draw/auth/AuthService.kt index 943651d2..8efe694e 100644 --- a/core/src/main/kotlin/com/xorker/draw/auth/AuthService.kt +++ b/core/src/main/kotlin/com/xorker/draw/auth/AuthService.kt @@ -7,7 +7,8 @@ import com.xorker.draw.user.User import com.xorker.draw.user.UserId import com.xorker.draw.user.UserRepository import java.time.Duration -import java.time.temporal.ChronoUnit +import java.time.Period +import java.time.temporal.TemporalAmount import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -29,7 +30,7 @@ internal class AuthService( override fun anonymousSignIn(): Token { val user = userRepository.createUser(""); // TODO 이름 정책 정해지면 변경 예정 - return createToken(user.id, Duration.of(100, ChronoUnit.YEARS)) + return createToken(user.id, Period.ofYears(100)) } override fun reissue(refreshToken: String): Token { @@ -50,7 +51,7 @@ internal class AuthService( return userRepository.createUser(authType.authPlatform, platformUserId, userName) } - private fun createToken(userId: UserId, expiredTime: Duration): Token { + private fun createToken(userId: UserId, expiredTime: TemporalAmount): Token { return Token( accessToken = accessTokenRepository.createAccessToken(userId, expiredTime), refreshToken = refreshTokenRepository.createRefreshToken(userId), diff --git a/domain/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenRepository.kt b/domain/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenRepository.kt index e354e49a..1bc0a4ba 100644 --- a/domain/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenRepository.kt +++ b/domain/src/main/kotlin/com/xorker/draw/auth/token/AccessTokenRepository.kt @@ -1,8 +1,8 @@ package com.xorker.draw.auth.token import com.xorker.draw.user.UserId -import java.time.Duration +import java.time.temporal.TemporalAmount interface AccessTokenRepository { - fun createAccessToken(userId: UserId, expiredTime: Duration): String + fun createAccessToken(userId: UserId, expiredTime: TemporalAmount): String }