From f00eda741dd315ee3893eb687f6d1667dc07f8d6 Mon Sep 17 00:00:00 2001 From: westzeroright Date: Wed, 25 Sep 2024 04:58:13 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=EB=A7=8C=EC=9D=84=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ordertogether/team14_be/auth/JwtUtil.java | 26 ------------------- .../auth/application/service/AuthService.java | 4 +-- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 src/main/java/com/ordertogether/team14_be/auth/JwtUtil.java diff --git a/src/main/java/com/ordertogether/team14_be/auth/JwtUtil.java b/src/main/java/com/ordertogether/team14_be/auth/JwtUtil.java deleted file mode 100644 index 5793f82f..00000000 --- a/src/main/java/com/ordertogether/team14_be/auth/JwtUtil.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ordertogether.team14_be.auth; - -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.security.Keys; -import java.time.Duration; -import java.util.Date; -import javax.crypto.SecretKey; -import org.springframework.stereotype.Component; - -@Component -public class JwtUtil { - private static final SecretKey key = Keys.secretKeyFor(io.jsonwebtoken.SignatureAlgorithm.HS256); - private static final int EXPIRE_TIME = 1; - - public static String generateToken(String email) { - Date now = new Date(); - Date exp = new Date(now.getTime() + Duration.ofHours(EXPIRE_TIME).toMillis()); - - return Jwts.builder() - .setSubject(email) - .setIssuedAt(now) - .setExpiration(exp) - .signWith(key) - .compact(); - } -} diff --git a/src/main/java/com/ordertogether/team14_be/auth/application/service/AuthService.java b/src/main/java/com/ordertogether/team14_be/auth/application/service/AuthService.java index b94808cd..92b183e1 100644 --- a/src/main/java/com/ordertogether/team14_be/auth/application/service/AuthService.java +++ b/src/main/java/com/ordertogether/team14_be/auth/application/service/AuthService.java @@ -1,6 +1,5 @@ package com.ordertogether.team14_be.auth.application.service; -import com.ordertogether.team14_be.auth.JwtUtil; import com.ordertogether.team14_be.auth.application.dto.KakaoUserInfo; import com.ordertogether.team14_be.auth.presentation.KakaoClient; import com.ordertogether.team14_be.memebr.application.service.MemberService; @@ -19,8 +18,7 @@ public String kakaoLogin(String authorizationCode) { KakaoUserInfo kakaoUserInfo = kakaoClient.getUserInfo((kakaoToken)); String userKakaoEmail = kakaoUserInfo.kakaoAccount().email(); memberService.findOrCreateMember(userKakaoEmail); - String serviceToken = JwtUtil.generateToken(userKakaoEmail); - return serviceToken; + return kakaoToken; } }