-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 소셜 로그인으로 회원 가입 지원 및 계정 연결 해제 구현 #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9434adc
feat: 소셜 회원가입을 위한 User 도메인 수정
ysw789 8e6a0b7
feat: 소셜 회원가입 UseCase 구현
ysw789 9da77cc
feat: 소셜 회원가입 API 엔드포인트 추가
ysw789 37bc253
test: CreateUserWithSocialUseCase 테스트 추가
ysw789 f477180
feat: 소셜 회원가입 시 이메일 인증 제거 및 소셜 계정 이메일 자동 사용
ysw789 2afec7f
feat: 소셜 계정 연동 해제 UseCase 구현
ysw789 ed3f6c4
feat: 로그인 상태 비밀번호 변경 UseCase 구현
ysw789 03ca57d
refactor: 소셜 계정 연동 해제 API 경로 파라미터 방식으로 변경
ysw789 f8bbb9b
feat: 비밀번호 검증 강화 - 소셜 회원가입 사용자 지원
ysw789 78b5014
feat: 소셜 회원가입 세션 캐시 관리용 Repository 구성
ysw789 e461bbc
test: 패키지 참조 이슈 해결
ysw789 259c7f2
refactor: Redis 캐시 리포지토리에서 불필요한 어노테이션 제거
ysw789 b2b993c
feat: 회원가입 세션 정리를 이벤트 기반 아키텍처로 변경
ysw789 f8761ed
test: CreateUserWithSocial 테스트 - ApplicationEventPublisher 모킹 및 검증 추가
ysw789 bb6006e
refactor: 회원가입 세션 상수를 별도 파일로 추출
ysw789 3dc9557
refactor: 회원가입 트랜잭션 분리 및 이벤트 기반 세션 처리 제거
ysw789 7c2b546
feat: 회원가입 트랜잭션 로직을 CreateUserTx로 분리
ysw789 d7ed838
refactor: 일부 구조 개선
ysw789 636ff5c
refactor: CreateUser에서 트랜잭션 로직을 CreateUserTx로 분리 및 캐시 추상화 통일
ysw789 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
72 changes: 72 additions & 0 deletions
72
.../com/dreamteam/alter/adapter/inbound/general/user/dto/CreateUserWithSocialRequestDto.java
This file contains hidden or 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,72 @@ | ||
| package com.dreamteam.alter.adapter.inbound.general.user.dto; | ||
|
|
||
| import com.dreamteam.alter.domain.user.type.PlatformType; | ||
| import com.dreamteam.alter.domain.user.type.SocialProvider; | ||
| import com.dreamteam.alter.domain.user.type.UserGender; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.AssertTrue; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Schema(description = "소셜 회원가입 요청 DTO") | ||
| public class CreateUserWithSocialRequestDto { | ||
|
|
||
| @NotBlank | ||
| @Size(max = 64) | ||
| @Schema(description = "회원가입 세션 ID", example = "UUID") | ||
| private String signupSessionId; | ||
|
|
||
| @NotNull | ||
| @Schema(description = "소셜 로그인 플랫폼", example = "KAKAO") | ||
| private SocialProvider provider; | ||
|
|
||
| @Valid | ||
| @Schema(description = "OAuth 토큰") | ||
| private OauthLoginTokenDto oauthToken; | ||
|
|
||
| @Schema(description = "OAuth 인가 코드", example = "authorizationCode") | ||
| private String authorizationCode; | ||
|
|
||
| @NotNull | ||
| @Schema(description = "플랫폼 타입", example = "WEB / NATIVE") | ||
| private PlatformType platformType; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| @NotBlank | ||
| @Size(max = 12) | ||
| @Schema(description = "성명", example = "김철수") | ||
| private String name; | ||
|
|
||
| @NotBlank | ||
| @Size(max = 64) | ||
| @Schema(description = "닉네임", example = "유땡땡") | ||
| private String nickname; | ||
|
|
||
| @NotNull | ||
| @Schema(description = "성별", example = "GENDER_MALE") | ||
| private UserGender gender; | ||
|
|
||
| @NotBlank | ||
| @Size(min = 8, max = 8) | ||
| @Schema(description = "생년월일", example = "YYYYMMDD") | ||
| private String birthday; | ||
|
|
||
| @AssertTrue(message = "WEB 플랫폼은 authorizationCode가 필수입니다") | ||
| private boolean isWebPlatformValid() { | ||
| if (platformType != PlatformType.WEB) return true; | ||
| return authorizationCode != null && !authorizationCode.isBlank(); | ||
| } | ||
|
|
||
| @AssertTrue(message = "NATIVE 플랫폼은 oauthToken이 필수입니다") | ||
| private boolean isNativePlatformValid() { | ||
| if (platformType != PlatformType.NATIVE) return true; | ||
| return oauthToken != null; | ||
| } | ||
| } | ||
19 changes: 19 additions & 0 deletions
19
...a/com/dreamteam/alter/adapter/inbound/general/user/dto/UnlinkSocialAccountRequestDto.java
This file contains hidden or 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,19 @@ | ||
| package com.dreamteam.alter.adapter.inbound.general.user.dto; | ||
|
|
||
| import com.dreamteam.alter.domain.user.type.SocialProvider; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Schema(description = "소셜 계정 연동 해제 요청 DTO") | ||
| public class UnlinkSocialAccountRequestDto { | ||
|
|
||
| @NotNull | ||
| @Schema(description = "해제할 소셜 플랫폼", example = "KAKAO") | ||
| private SocialProvider provider; | ||
| } |
30 changes: 30 additions & 0 deletions
30
...n/java/com/dreamteam/alter/adapter/inbound/general/user/dto/UpdatePasswordRequestDto.java
This file contains hidden or 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,30 @@ | ||
| package com.dreamteam.alter.adapter.inbound.general.user.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.AssertTrue; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| @Schema(description = "비밀번호 변경 요청 DTO") | ||
| public class UpdatePasswordRequestDto { | ||
|
|
||
| @Schema(description = "현재 비밀번호 (비밀번호가 설정된 사용자는 필수, 소셜 전용 사용자는 생략 가능)", example = "currentPass1!") | ||
| private String currentPassword; | ||
|
|
||
| @NotBlank | ||
| @Size(min = 8, max = 16) | ||
| @Schema(description = "새 비밀번호 (8~16자, 영문·숫자·특수문자 각 1개 이상)", example = "newPass1!") | ||
| private String newPassword; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| @AssertTrue(message = "새 비밀번호는 현재 비밀번호와 달라야 합니다") | ||
| private boolean isNewPasswordDifferent() { | ||
| if (currentPassword == null || newPassword == null) return true; | ||
| return !currentPassword.equals(newPassword); | ||
| } | ||
| } | ||
32 changes: 32 additions & 0 deletions
32
...a/com/dreamteam/alter/adapter/outbound/user/persistence/SignupSessionCacheRepository.java
This file contains hidden or 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,32 @@ | ||
| package com.dreamteam.alter.adapter.outbound.user.persistence; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.redis.core.StringRedisTemplate; | ||
| import org.springframework.stereotype.Repository; | ||
| import java.time.Duration; | ||
| import java.util.List; | ||
|
|
||
| @Repository | ||
| @RequiredArgsConstructor | ||
| public class SignupSessionCacheRepository { | ||
|
ysw789 marked this conversation as resolved.
|
||
|
|
||
| private final StringRedisTemplate redisTemplate; | ||
|
|
||
| public void save(String key, String value, Duration ttl) { | ||
| redisTemplate.opsForValue().set(key, value, ttl); | ||
| } | ||
|
|
||
| public String get(String key) { | ||
| return redisTemplate.opsForValue().get(key); | ||
| } | ||
|
|
||
| public void delete(String key) { | ||
| redisTemplate.delete(key); | ||
| } | ||
|
|
||
| public void deleteAll(List<String> keys) { | ||
| if (!keys.isEmpty()) { | ||
| redisTemplate.delete(keys); | ||
| } | ||
| } | ||
|
ysw789 marked this conversation as resolved.
|
||
| } | ||
7 changes: 7 additions & 0 deletions
7
...n/java/com/dreamteam/alter/adapter/outbound/user/persistence/UserSocialJpaRepository.java
This file contains hidden or 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,7 @@ | ||
| package com.dreamteam.alter.adapter.outbound.user.persistence; | ||
|
|
||
| import com.dreamteam.alter.domain.user.entity.UserSocial; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface UserSocialJpaRepository extends JpaRepository<UserSocial, Long> { | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.