Skip to content
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

Feat#3: 카카오로그인 구현 #4

Merged
merged 14 commits into from
Oct 9, 2024
Merged

Feat#3: 카카오로그인 구현 #4

merged 14 commits into from
Oct 9, 2024

Conversation

pkl0912
Copy link
Contributor

@pkl0912 pkl0912 commented Oct 7, 2024

Resolves #3

Issue Define

  • 카카오 로그인 구현... branch 명 따라하다보니 번호가 틀렸네요ㅜㅜ 앞으로 주의하겠습니다..

Summary of resolutions or improvements

image
회원가입 시 "회원가입에 성공했습니다" , isNewUser = True
image
header 에는 Bearer + (한칸 공백) + 인가코드
origin 넣어야 됨

image
redis 에 userId 1 키 에 값으로 refresh token 저장

Note

  • 레포지토리 추상화를 어디까지 해야할 지 몰라서 아직 안했습니다..!
  • userId 추가했습니당

@pkl0912 pkl0912 self-assigned this Oct 7, 2024
@pkl0912 pkl0912 requested a review from yeonjookang as a code owner October 7, 2024 11:32
@yeonjookang yeonjookang changed the title Feat/1 kakao login Feat#1: 카카오로그인 구현 Oct 7, 2024
@yeonjookang yeonjookang changed the title Feat#1: 카카오로그인 구현 Feat#3: 카카오로그인 구현 Oct 7, 2024
Copy link
Contributor

@yeonjookang yeonjookang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requestDTO는 Controller가 관리하니까, api>request>requestDTO.java, application>response>responseDTO.java로 관리하는 게 어떨까요?

Copy link
Contributor

@yeonjookang yeonjookang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

@Getter
@SuperBuilder
@Inheritance(strategy = InheritanceType.JOINED)
@NoArgsConstructor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoArgsConstructor는 JPA가 DB에 저장할 때 외에는 막아두는 건 어떨까요? 'accessLevel=Protected' 로요!

@Entity
@Getter
@SuperBuilder
@Inheritance(strategy = InheritanceType.JOINED)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 어노테이션의 사용 이유는 뭔가요? User 도메인이 상속관계로 이루어져 있나요?


@Entity
@Getter
@SuperBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@builder 대신 @SuperBuilder를 사용한 이유는 뭔가요?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필드는 DB 설계서를 보고 수정 부탁드립니다!

@PostMapping("/login")
public BaseResponse<LoginResponseDto> login(
@KakaoCode String kakaoCode,
HttpServletRequest request) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것도 @kakaocode 처럼 Resolver를 활용해서 request에서 Origin만 뽑아내는 건 어떨까요? 그리고 origin의 쓰임이 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 목적은 cors 에러라고 하는데 사실 kakao 에서 유저정보를 빼올떄 redirect uri 만드는 용도로 매개변수 느낌으로 쓰는 거 같습니다! header 에서 값만 받는게 resolver 쓰는거보다 간단할 거 같은데 어떤가요?

String kakaoId = info.kakaoId();
String name = info.nickname();
Optional<User> user = userRepository.findByKakaoId(kakaoId);
if (user.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createNewUserResponse() 로 리팩토링 하는 게 좋아보여요!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UserCreateResponse가 Global에 있는 이유가 뭔가요? Auth 도메인에 있는 게 맞지 않을까요?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Token,Redis 관련은 global과 같은 계층의 infrastructure에 따로 넣어두는 건 어떨까요?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JpaRepository는 infrastructure 계층에 가야할 것 같아요! 도메인에 repository를 두고자 한다면, 도메인에는 인터페이스 repository만 두고, JpaRepository가 해당 인터페이스를 상속받는걸로 진행하면 되지 않을까 싶습니다!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 Response 클래스들도 Builder 패턴을 사용하는 건 어떨까요? Builder 패턴은 인자를 넘길 때 직관적으로 어떤 필드인지 알 수 있다는 장점이 있습니다!

Copy link
Contributor

@yeonjookang yeonjookang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pkl0912 pkl0912 merged commit a02e70b into dev Oct 9, 2024
1 check passed
@pkl0912 pkl0912 deleted the feat/1-kakao-login branch October 9, 2024 04:04
@yeonjookang yeonjookang added feature feat 기능 개발 labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: 카카오로그인 구현
2 participants