-
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.
fix: #11 kakao 일반적인 oauth 로그인/회원가입 시나리오 구현 [일반 로그인/회원가입 분기처리 미적용]
- Loading branch information
1 parent
fd00d56
commit c3e0e87
Showing
14 changed files
with
174 additions
and
47 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
3 changes: 1 addition & 2 deletions
3
src/main/java/com/kcy/fitapet/global/common/redis/oauth/OIDCToken.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
65 changes: 65 additions & 0 deletions
65
src/main/java/com/kcy/fitapet/global/common/redis/sms/SmsRedisHelper.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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.kcy.fitapet.global.common.redis.sms; | ||
|
||
import com.kcy.fitapet.global.common.redis.sms.service.SmsOauthService; | ||
import com.kcy.fitapet.global.common.redis.sms.service.SmsPasswordService; | ||
import com.kcy.fitapet.global.common.redis.sms.service.SmsRegisterService; | ||
import com.kcy.fitapet.global.common.redis.sms.service.SmsUidService; | ||
import com.kcy.fitapet.global.common.redis.sms.type.SmsPrefix; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class SmsRedisHelper { | ||
private final SmsOauthService smsOauthService; | ||
private final SmsRegisterService smsRegisterService; | ||
private final SmsPasswordService smsPasswordService; | ||
private final SmsUidService smsUidService; | ||
|
||
public void saveSmsAuthToken(String phone, String code, SmsPrefix prefix) { | ||
switch (prefix) { | ||
case OAUTH -> smsOauthService.save(phone, code, prefix); | ||
case REGISTER -> smsRegisterService.save(phone, code, prefix); | ||
case PASSWORD -> smsPasswordService.save(phone, code, prefix); | ||
case UID -> smsUidService.save(phone, code, prefix); | ||
} | ||
} | ||
|
||
public boolean isCorrectCode(String phone, String code, SmsPrefix prefix) { | ||
return switch (prefix) { | ||
case OAUTH -> smsOauthService.isCorrectCode(phone, code, prefix); | ||
case REGISTER -> smsRegisterService.isCorrectCode(phone, code, prefix); | ||
case PASSWORD -> smsPasswordService.isCorrectCode(phone, code, prefix); | ||
case UID -> smsUidService.isCorrectCode(phone, code, prefix); | ||
}; | ||
} | ||
|
||
public boolean isExistsCode(String phone, SmsPrefix prefix) { | ||
return switch (prefix) { | ||
case OAUTH -> smsOauthService.isExistsCode(phone, prefix); | ||
case REGISTER -> smsRegisterService.isExistsCode(phone, prefix); | ||
case PASSWORD -> smsPasswordService.isExistsCode(phone, prefix); | ||
case UID -> smsUidService.isExistsCode(phone, prefix); | ||
}; | ||
} | ||
|
||
public void removeCode(String phone, SmsPrefix prefix) { | ||
switch (prefix) { | ||
case OAUTH -> smsOauthService.removeCode(phone, prefix); | ||
case REGISTER -> smsRegisterService.removeCode(phone, prefix); | ||
case PASSWORD -> smsPasswordService.removeCode(phone, prefix); | ||
case UID -> smsUidService.removeCode(phone, prefix); | ||
}; | ||
} | ||
|
||
public LocalDateTime getExpiredTime(String phone, SmsPrefix prefix) { | ||
return switch (prefix) { | ||
case OAUTH -> smsOauthService.getExpiredTime(phone, prefix); | ||
case REGISTER -> smsRegisterService.getExpiredTime(phone, prefix); | ||
case PASSWORD -> smsPasswordService.getExpiredTime(phone, prefix); | ||
case UID -> smsUidService.getExpiredTime(phone, prefix); | ||
}; | ||
} | ||
} |
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
Oops, something went wrong.