From e464ca28ad0ce6eaac15d3f095c7f3a4794d1c12 Mon Sep 17 00:00:00 2001 From: 1223v <1223v@naver.com> Date: Thu, 4 Apr 2024 13:23:29 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20=EB=B2=88=ED=98=B8=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=BD=94=EB=93=9C=20=EB=AC=B8=EC=9E=90=20->=206?= =?UTF-8?q?=EC=9E=90=EB=A6=AC=20=EC=88=AB=EC=9E=90=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/smsauthentication/VerificationService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/readyvery/readyverydemo/src/smsauthentication/VerificationService.java b/src/main/java/com/readyvery/readyverydemo/src/smsauthentication/VerificationService.java index d12df6f..68f2470 100644 --- a/src/main/java/com/readyvery/readyverydemo/src/smsauthentication/VerificationService.java +++ b/src/main/java/com/readyvery/readyverydemo/src/smsauthentication/VerificationService.java @@ -1,6 +1,5 @@ package com.readyvery.readyverydemo.src.smsauthentication; -import java.util.UUID; import java.util.concurrent.TimeUnit; import org.springframework.data.redis.core.RedisTemplate; @@ -15,7 +14,10 @@ public class VerificationService { private final RedisTemplate redisTemplate; public String createVerificationCode(String phoneNumber, boolean someBooleanValue) { - String code = UUID.randomUUID().toString().substring(0, 6); + //String code = UUID.randomUUID().toString().substring(0, 6); + int sixDigitNumber = (int)(Math.random() * 900000) + 100000; // 100000 ~ 999999 사이의 숫자 + String code = Integer.toString(sixDigitNumber); // 숫자를 문자열로 변환 + redisTemplate.opsForValue().set(phoneNumber + ":code", code, 3, TimeUnit.MINUTES); redisTemplate.opsForValue().set(phoneNumber + ":flag", String.valueOf(someBooleanValue), 3, TimeUnit.MINUTES); return code; From f5dc75066c2fecda28a70caa1138d96158fba1f1 Mon Sep 17 00:00:00 2001 From: 1223v <1223v@naver.com> Date: Thu, 4 Apr 2024 13:33:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=82=AC=20=EB=A1=9C=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../readyverydemo/security/jwt/service/JwtServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/readyvery/readyverydemo/security/jwt/service/JwtServiceImpl.java b/src/main/java/com/readyvery/readyverydemo/security/jwt/service/JwtServiceImpl.java index 62d7a64..9eadcf8 100644 --- a/src/main/java/com/readyvery/readyverydemo/security/jwt/service/JwtServiceImpl.java +++ b/src/main/java/com/readyvery/readyverydemo/security/jwt/service/JwtServiceImpl.java @@ -101,7 +101,7 @@ public Optional extractAccessToken(HttpServletRequest request) { public Optional extractEmail(String accessToken) { try { // 토큰 유효성 검사하는 데에 사용할 알고리즘이 있는 JWT verifier builder 반환 - log.info("액세스 토큰 유효성 검사"); + return jwtTokenizer.verifyAccessToken(accessToken); } catch (Exception e) { log.error("액세스 토큰이 유효하지 않습니다.");