-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 이메일 인증을 완료한 사용자의 인증 상태를 변경하는 기능을 추가합니다. (#120)
* release : 유저 서비스 내 이메일 중복 검증, 임시 회원가입, 회원가입 기능 추가 (#87) * feat: init project * fix: add multi platform (#39) * feat : 회원가입 API를 추가합니다. (회원가입에 요구되는 서브 태스크인 이메일 중복확인 API도 함께 추가) (#60) * feat : 유저 도메인 정의 * feat : 유저 서비스 내 글로벌 예외처리 추가 * refactor : 이메일 중복 DTO 수정 * feat : 인수/통합 테스트 템플릿 추가 * refactor : NoArgsConstructor 접근 제어자 변경 * refactor : 회원가입 쓰기 작업 시 Transactional 옵션 변경 * test : 회원가입 성공 인수 테스트 작성 * feat: set gradle project * feat: create createUser interface * feat: add generated ignore * feat: set gRPC settings * feat: add ports setting * feat: create gRPC client method * refactor : VO를 class에서 record로 변경 * refactor : create_social_user.proto 필드 네이밍 수정 * refactor : send_email_auth.proto 생성 * refactor : UserApi 엔드포인트 및 네이밍 변경 * refactor : 불필요한 파일 제거 * feat : 공통 환경 설정 및 패스워드 인코더 추가 * refactor : dto 패키지 변경 * feat : PasswordEncoder 인터페이스 추가 * feat : gRPC Client, Eureka 연동 * feat : 유저 임시 가입 유스케이스, 비즈니스 로직 추가 * refactor : 정적 컨텐츠 VO 래핑 추가 * refactor : 불필요한 테스트 제거 * fix : grpc import syntax in build.gradle * refactor : 주석 제거 * refactor : GRPC -> Grpc 네이밍 변경 * refactor : application.yml 환경변수화 * refactor : User DDL 수정 * refactor : JoinRequest내 불필요한 필드 제거 * refactor : EurekaServiceName Enum 필드 Getter 추가 * refactor : User Entity Role 기본 값 추가 * refactor : Eureka Client defaultZone 수정 * refactor : Clean Broken Code * fix: add builder (#86) * feat: add envs (#91) * fix : build.gradle (#92) * refactor : build script (#94) * feat: send_email_auth.proto, update_user_auth-status.proto * refactor : GUpdateUserAuthStatusRequest 필드 수정 * refactor : GSendEmailAuthRequest Protobuf 필드 수정 * refactor : ExceptionType 수정 * refactor : gRPC Client AUTH-SERVICE 추가 * feat : AuthService -> UserService 인증상태 변경 기능 추가 * refactor : gRPC통신 간 예외처리 추가 * refactor : gRPC Client, Server 네이밍 변경 * refactor : gRPC Server 반환 구문 추가 * refactor : private method 래핑 해제 * refactor : 톰캣 및 gRPC서버 포트 변경 * refactor : typo * refactor : broken typo and transactional * refactor : eureka url * refactor : 유레카 유틸라이저 제거 * refactor : 조건절 분기문 리팩터링 * refactor : 패스워드 유틸라이저
- Loading branch information
Showing
17 changed files
with
142 additions
and
91 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
16 changes: 16 additions & 0 deletions
16
src/common-module/src/main/proto/update_user_auth-status.proto
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,16 @@ | ||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "org.palette.grpc"; | ||
|
||
service GUserService { | ||
rpc updateUserAuthStatus (GUpdateUserAuthStatusRequest) returns (GUpdateUserAuthStatusResponse) {} | ||
} | ||
|
||
message GUpdateUserAuthStatusRequest { | ||
string email = 1; | ||
} | ||
|
||
message GUpdateUserAuthStatusResponse { | ||
bool message = 1; | ||
} |
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
16 changes: 16 additions & 0 deletions
16
src/user-service/src/main/java/org/palette/easeluserservice/common/PasswordUtilizer.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,16 @@ | ||
package org.palette.easeluserservice.common; | ||
|
||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
|
||
public class PasswordUtilizer { | ||
|
||
private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); | ||
|
||
public static String hashPassword(String password) { | ||
return encoder.encode(password); | ||
} | ||
|
||
public static boolean checkPassword(String rawPassword, String encodedPassword) { | ||
return encoder.matches(rawPassword, encodedPassword); | ||
} | ||
} |
7 changes: 1 addition & 6 deletions
7
src/user-service/src/main/java/org/palette/easeluserservice/config/ApplicationConfig.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,18 +1,13 @@ | ||
package org.palette.easeluserservice.config; | ||
|
||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
|
||
@EnableDiscoveryClient | ||
@EnableJpaAuditing | ||
@EnableAsync | ||
public class ApplicationConfig { | ||
|
||
@Bean | ||
public static BCryptPasswordEncoder bCryptPasswordEncoder() { | ||
return new BCryptPasswordEncoder(); | ||
} | ||
|
||
} |
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
17 changes: 6 additions & 11 deletions
17
...e/easeluserservice/external/GrpcAuth.java → ...luserservice/external/GrpcAuthClient.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,34 +1,29 @@ | ||
package org.palette.easeluserservice.external; | ||
|
||
import io.grpc.StatusRuntimeException; | ||
import lombok.RequiredArgsConstructor; | ||
import net.devh.boot.grpc.client.inject.GrpcClient; | ||
import org.palette.easeluserservice.exception.BaseException; | ||
import org.palette.easeluserservice.exception.ExceptionType; | ||
import org.palette.easeluserservice.persistence.User; | ||
import org.palette.grpc.GAuthServiceGrpc; | ||
import org.palette.grpc.GSendEmailAuthRequest; | ||
import org.palette.grpc.GSendEmailAuthResponse; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class GrpcAuth { | ||
public class GrpcAuthClient { | ||
|
||
@GrpcClient("auth-service") | ||
private GAuthServiceGrpc.GAuthServiceBlockingStub gAuthServiceBlockingStub; | ||
|
||
public GSendEmailAuthResponse sendEmailAuth(User user) { | ||
// TODO: 매개변수 및 반환값 변경, 예외처리 | ||
public void sendEmailAuth(User user) { | ||
try { | ||
return gAuthServiceBlockingStub.sendEmailAuth( | ||
gAuthServiceBlockingStub.sendEmailAuth( | ||
GSendEmailAuthRequest.newBuilder() | ||
.setId(user.getId()) | ||
.setEmail(user.getEmail()) | ||
.setNickname(user.getProfile().nickname()) | ||
.build() | ||
); | ||
} catch (final StatusRuntimeException e) { | ||
System.out.println(e.getMessage()); | ||
return null; | ||
throw new BaseException(ExceptionType.USER_500_000001); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...-service/src/main/java/org/palette/easeluserservice/external/GrpcServerByAuthService.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,35 @@ | ||
package org.palette.easeluserservice.external; | ||
|
||
import io.grpc.stub.StreamObserver; | ||
import lombok.RequiredArgsConstructor; | ||
import net.devh.boot.grpc.server.service.GrpcService; | ||
import org.palette.easeluserservice.persistence.User; | ||
import org.palette.easeluserservice.service.UserService; | ||
import org.palette.grpc.GUpdateUserAuthStatusRequest; | ||
import org.palette.grpc.GUpdateUserAuthStatusResponse; | ||
import org.palette.grpc.GUserServiceGrpc; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@GrpcService | ||
@RequiredArgsConstructor | ||
public class GrpcServerByAuthService extends GUserServiceGrpc.GUserServiceImplBase { | ||
|
||
private final UserService userService; | ||
|
||
@Transactional | ||
@Override | ||
public void updateUserAuthStatus( | ||
GUpdateUserAuthStatusRequest request, | ||
StreamObserver<GUpdateUserAuthStatusResponse> responseObserver | ||
) { | ||
User user = userService.loadByEmail(request.getEmail()); | ||
|
||
userService.updateUserAuthStatus(user); | ||
|
||
GUpdateUserAuthStatusResponse response = GUpdateUserAuthStatusResponse.newBuilder() | ||
.setMessage(true) | ||
.build(); | ||
responseObserver.onNext(response); | ||
responseObserver.onCompleted(); | ||
} | ||
} |
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
Oops, something went wrong.