-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from YAPP-Github/refactor/PC-425-common-module…
…-split [PC-425] Common 모듈 분리
- Loading branch information
Showing
160 changed files
with
1,614 additions
and
2,064 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
admin/src/main/java/org/yapp/user/presentation/response/UserProfileDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
admin/src/main/java/org/yapp/user/presentation/response/UserProfileDetailResponses.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
package org.yapp; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
|
||
@EnableScheduling | ||
@SpringBootApplication | ||
public class ApiApplication { | ||
private final TestBean testBean; | ||
|
||
@Autowired | ||
public ApiApplication(TestBean testBean) { | ||
this.testBean = testBean; | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(ApiApplication.class, args); | ||
} | ||
|
||
@PostConstruct | ||
public void dependencyTest() { | ||
testBean.dependencyTest(); | ||
} | ||
public static void main(String[] args) { | ||
SpringApplication.run(ApiApplication.class, args); | ||
} | ||
} |
75 changes: 38 additions & 37 deletions
75
api/src/main/java/org/yapp/domain/auth/application/authorization/SmsAuthService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,54 @@ | ||
package org.yapp.domain.auth.application.authorization; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.yapp.error.code.auth.SmsAuthErrorCode; | ||
import org.yapp.error.exception.ApplicationException; | ||
import org.yapp.global.application.RedisService; | ||
import org.yapp.core.exception.ApplicationException; | ||
import org.yapp.core.exception.error.code.SmsAuthErrorCode; | ||
import org.yapp.global.application.SmsSenderService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.yapp.infra.redis.application.RedisService; | ||
|
||
/** | ||
* SMS 인증 서비스 | ||
*/ | ||
@Service | ||
@RequiredArgsConstructor | ||
public class SmsAuthService { | ||
private static final long AUTH_CODE_EXPIRE_TIME = 300000; | ||
private static final String AUTH_CODE_KEY_PREFIX = "authcode:"; | ||
private static final String AUTH_CODE_FORMAT = "[PIECE] 인증 번호는 %06d 입니다."; | ||
private final AuthCodeGenerator authCodeGenerator; | ||
private final SmsSenderService smsSenderService; | ||
private final RedisService redisService; | ||
|
||
/** | ||
* 인증번호 전송 | ||
* | ||
* @param phoneNumber 인증 번호를 받을 핸드폰 번호 | ||
*/ | ||
public void sendAuthCodeTo(String phoneNumber) { | ||
int authCode = authCodeGenerator.generate(); | ||
redisService.setKeyWithExpiration(AUTH_CODE_KEY_PREFIX + phoneNumber, String.valueOf(authCode), | ||
AUTH_CODE_EXPIRE_TIME); | ||
String authCodeMessage = String.format(AUTH_CODE_FORMAT, authCode); | ||
smsSenderService.sendSMS(phoneNumber, authCodeMessage); | ||
} | ||
private static final long AUTH_CODE_EXPIRE_TIME = 300000; | ||
private static final String AUTH_CODE_KEY_PREFIX = "authcode:"; | ||
private static final String AUTH_CODE_FORMAT = "[PIECE] 인증 번호는 %06d 입니다."; | ||
private final AuthCodeGenerator authCodeGenerator; | ||
private final SmsSenderService smsSenderService; | ||
private final RedisService redisService; | ||
|
||
/** | ||
* 인증번호 인증 | ||
* | ||
* @param phoneNumber 핸드폰번호 | ||
* @param code 인증 번호 | ||
* @return 인증번호 일치 여부 | ||
*/ | ||
public void verifySmsAuthCode(String phoneNumber, String code) { | ||
String expectedCode = redisService.getValue(AUTH_CODE_KEY_PREFIX + phoneNumber); | ||
if (expectedCode == null) { | ||
throw new ApplicationException(SmsAuthErrorCode.CODE_NOT_EXIST); | ||
/** | ||
* 인증번호 전송 | ||
* | ||
* @param phoneNumber 인증 번호를 받을 핸드폰 번호 | ||
*/ | ||
public void sendAuthCodeTo(String phoneNumber) { | ||
int authCode = authCodeGenerator.generate(); | ||
redisService.setKeyWithExpiration(AUTH_CODE_KEY_PREFIX + phoneNumber, | ||
String.valueOf(authCode), | ||
AUTH_CODE_EXPIRE_TIME); | ||
String authCodeMessage = String.format(AUTH_CODE_FORMAT, authCode); | ||
smsSenderService.sendSMS(phoneNumber, authCodeMessage); | ||
} | ||
if (!expectedCode.equals(code)) { | ||
throw new ApplicationException(SmsAuthErrorCode.CODE_NOT_CORRECT); | ||
|
||
/** | ||
* 인증번호 인증 | ||
* | ||
* @param phoneNumber 핸드폰번호 | ||
* @param code 인증 번호 | ||
* @return 인증번호 일치 여부 | ||
*/ | ||
public void verifySmsAuthCode(String phoneNumber, String code) { | ||
String expectedCode = redisService.getValue(AUTH_CODE_KEY_PREFIX + phoneNumber); | ||
if (expectedCode == null) { | ||
throw new ApplicationException(SmsAuthErrorCode.CODE_NOT_EXIST); | ||
} | ||
if (!expectedCode.equals(code)) { | ||
throw new ApplicationException(SmsAuthErrorCode.CODE_NOT_CORRECT); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.