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("액세스 토큰이 유효하지 않습니다."); 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;