Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

관련 이슈

작업 내용

OAuth 서비스들에 전략 패턴을 적용했습니다.
"전략 패턴" 학습에 도움되시라고 자료 첨부합니다 🔽

image

https://refactoring.guru/ko/design-patterns/strategy

최종적으로, auth 패키지 개정안에서 말씀드린 것처럼 아래의 형태를 띄게 되었습니다!
image
https://blushing-skiff-598.notion.site/auth-23b4947284a480ba9ca4e8a27b9295b7?pvs=74

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Walkthrough

  1. OAuth 클라이언트 구조 통합 및 리팩토링
     - AppleOAuthClient와 KakaoOAuthClient가 OAuthClient 인터페이스를 구현하도록 변경되었습니다.
     - 각 클라이언트의 getUserInfo 메서드는 OAuthUserInfoDto를 반환하며, getAuthType 메서드가 추가되었습니다.
     - AppleOAuthClient의 requestIdToken 메서드는 public에서 private으로 변경되었습니다.

  2. OAuth 서비스 계층 통합
     - AppleOAuthService와 KakaoOAuthService 클래스가 완전히 삭제되었습니다.
     - OAuthService가 추상 클래스에서 구체적인 @service 클래스로 변경되어, 여러 OAuth 공급자를 하나의 서비스에서 처리하도록 리팩토링되었습니다.
     - OAuthService는 OAuthClientMap을 통해 AuthType에 따라 적절한 OAuthClient를 선택해 동작합니다.
     - processOAuth 메서드가 AuthType을 명시적으로 받도록 변경되었고, 기존 추상 메서드들은 제거되었습니다.

  3. OAuthClientMap 도입
     - 새로운 OAuthClientMap 컴포넌트가 추가되어, AuthType에 따라 OAuthClient를 매핑 및 조회할 수 있게 되었습니다.
     - 매칭되는 클라이언트가 없을 경우 CustomException을 발생시킵니다.

  4. AuthController 개선
     - AuthController의 서비스 의존성이 Apple, Kakao 개별 서비스에서 통합 OAuthService로 변경되었습니다.
     - processAppleOAuth, processKakaoOAuth 메서드는 각각 AuthType을 명시적으로 전달하여 OAuthService의 processOAuth를 호출합니다.
     - HttpServletResponse 및 쿠키 처리 로직은 기존과 동일하게 유지되었습니다.

  5. 테스트 코드 추가 및 개선
     - OAuthClientMap과 OAuthService에 대한 단위 테스트가 새롭게 추가되어, 클라이언트 매핑 및 OAuth 인증 플로우(기존 회원/신규 회원)에 대한 검증이 이루어집니다.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

  • 복수의 핵심 서비스 및 클라이언트 구조의 대대적인 리팩토링과 신규 컴포넌트, 테스트 코드 추가가 포함되어 있습니다.
  • OAuth 인증 플로우 전반에 영향을 주는 변경이므로, 설계 및 동작 검증에 시간이 소요될 것으로 예상됩니다.

Suggested reviewers

  • wibaek
  • lsy1307
  • Gyuhyeok99

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36fb4d8 and 8c1713d.

📒 Files selected for processing (5)
  • src/main/java/com/example/solidconnection/auth/controller/AuthController.java (4 hunks)
  • src/main/java/com/example/solidconnection/auth/service/oauth/AppleOAuthService.java (0 hunks)
  • src/main/java/com/example/solidconnection/auth/service/oauth/KakaoOAuthService.java (0 hunks)
  • src/test/java/com/example/solidconnection/auth/service/oauth/OAuthClientMapTest.java (1 hunks)
  • src/test/java/com/example/solidconnection/auth/service/oauth/OAuthServiceTest.java (1 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/com/example/solidconnection/auth/service/oauth/KakaoOAuthService.java
  • src/main/java/com/example/solidconnection/auth/service/oauth/AppleOAuthService.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/java/com/example/solidconnection/auth/controller/AuthController.java
  • src/test/java/com/example/solidconnection/auth/service/oauth/OAuthServiceTest.java
  • src/test/java/com/example/solidconnection/auth/service/oauth/OAuthClientMapTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nayonsoso nayonsoso force-pushed the refactor/431-adjust-strategy-pattern-oauth branch from 36fb4d8 to 8c1713d Compare August 8, 2025 22:17
Comment on lines -28 to -32
protected OAuthService(OAuthSignUpTokenProvider OAuthSignUpTokenProvider, SiteUserRepository siteUserRepository, SignInService signInService) {
this.OAuthSignUpTokenProvider = OAuthSignUpTokenProvider;
this.siteUserRepository = siteUserRepository;
this.signInService = signInService;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

자식이 부모의 의존성을 주입하는 코드가 없어졌습니다🎉

Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

전략 패턴을 실제로 구현하는 코드는 처음 봤는데, 잘 구현된 것 같습니다 ~ 사진과 함께 봐서 이해가 더 잘 되었습니다 ~!

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

@nayonsoso nayonsoso merged commit 1e230e4 into solid-connection:develop Aug 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: OAuth 클래스들에 전략 패턴 적용

3 participants