Skip to content

fix: google oauth login #15

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 1 commit into from
Jun 9, 2025
Merged

fix: google oauth login #15

merged 1 commit into from
Jun 9, 2025

Conversation

toychip
Copy link
Member

@toychip toychip commented Jun 9, 2025

요약(개요)

작업 내용

  • login path를 security public에 추가했습니다.
  • emailAndProvider 로 조회시 없도록 null 및 safe 하게 처리하여 반환합니다.

집중해서 리뷰해야 하는 부분

기타 전달 사항 및 참고 자료(선택)

Summary by CodeRabbit

  • 버그 수정

    • 로그인 API 경로가 인증 없이 접근 가능하도록 허용되었습니다.
    • 사용자를 제공자와 이메일로 조회할 때, 존재하지 않는 경우 예외 대신 null을 반환하도록 변경되었습니다.
  • 기타

    • JWT 라이브러리 관련 런타임 의존성이 추가되었습니다.

@toychip toychip requested a review from mkSpace as a code owner June 9, 2025 14:42
Copy link

coderabbitai bot commented Jun 9, 2025

Walkthrough

보안 설정에서 "/api/v1/login/**" 경로가 인증 없이 허용되는 경로에 추가되었습니다. core-domain 모듈의 빌드 설정에 JWT 관련 런타임 의존성이 추가되었습니다. UserRepository와 UserCoreRepository의 findUserByProviderAndEmail 메서드 반환 타입이 User에서 User?로 변경되어, 사용자를 찾지 못할 경우 null을 반환하도록 수정되었습니다.

Changes

파일/경로 변경 요약
.../core/api/config/SecurityConfig.kt "/api/v1/login/**" 경로를 인증 없이 허용되는 경로 목록에 추가
.../core-domain/build.gradle.kts JWT 관련 런타임 의존성(jjwt-impl, jjwt-jackson) 추가
.../core-domain/src/main/kotlin/noweekend/core/domain/user/UserRepository.kt findUserByProviderAndEmail 반환 타입을 User → User?로 변경
.../db-core/src/main/kotlin/noweekend/storage/db/core/user/UserCoreRepository.kt findUserByProviderAndEmail 반환 타입을 User → User?로 변경, 사용자를 찾지 못하면 null 반환하도록 수정

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant SecurityConfig

    Client->>SecurityConfig: /api/v1/login/** 요청
    SecurityConfig-->>Client: 인증 없이 접근 허용
Loading
sequenceDiagram
    participant Service
    participant UserRepository

    Service->>UserRepository: findUserByProviderAndEmail(providerType, email)
    alt 사용자를 찾은 경우
        UserRepository-->>Service: User 반환
    else 사용자를 찾지 못한 경우
        UserRepository-->>Service: null 반환
    end
Loading

📜 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 367c2c6 and 7eb2f9a.

📒 Files selected for processing (4)
  • noweekend-core/core-api/src/main/kotlin/noweekend/core/api/config/SecurityConfig.kt (2 hunks)
  • noweekend-core/core-domain/build.gradle.kts (1 hunks)
  • noweekend-core/core-domain/src/main/kotlin/noweekend/core/domain/user/UserRepository.kt (1 hunks)
  • noweekend-storage/db-core/src/main/kotlin/noweekend/storage/db/core/user/UserCoreRepository.kt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (5)
noweekend-core/core-domain/build.gradle.kts (1)

11-12: JWT 런타임 의존성 추가가 적절합니다.

JWT 라이브러리의 올바른 사용을 위해 런타임 의존성을 적절히 추가했습니다. API는 컴파일 타임에, 구현체와 Jackson 통합은 런타임에만 필요하므로 runtimeOnly로 선언한 것이 정확합니다.

noweekend-core/core-api/src/main/kotlin/noweekend/core/api/config/SecurityConfig.kt (2)

31-31: OAuth 로그인을 위한 public 경로 추가가 적절합니다.

Google OAuth 로그인 플로우에서 인증되지 않은 상태의 사용자도 접근할 수 있도록 /api/v1/login/** 경로를 허용 목록에 추가한 것이 올바릅니다.


43-43: 프로덕션 환경에서도 일관되게 로그인 경로가 허용됩니다.

개발 환경과 동일하게 프로덕션 환경에서도 로그인 경로를 허용하여 일관성을 유지했습니다.

noweekend-core/core-domain/src/main/kotlin/noweekend/core/domain/user/UserRepository.kt (1)

5-5:

❓ Verification inconclusive

메서드 시그니처 변경이 올바르지만 기존 호출 코드를 확인해야 합니다.

사용자를 찾지 못할 경우 예외 대신 null을 반환하도록 변경한 것은 더 안전한 처리 방식입니다. 하지만 이는 breaking change이므로 기존 호출자들이 null 체크를 올바르게 하고 있는지 확인이 필요합니다.

다음 스크립트로 메서드 호출자들이 null 처리를 올바르게 하고 있는지 확인해주세요:


🏁 Script executed:

#!/bin/bash
# Description: findUserByProviderAndEmail 메서드 호출자들의 null 처리 확인

# 메서드 호출 위치 찾기
rg -A 10 "findUserByProviderAndEmail" --type kotlin

# null 체크 패턴 확인
rg -A 5 -B 5 "findUserByProviderAndEmail.*\?" --type kotlin

Length of output: 8418


UserRepository 변경: findUserByProviderAndEmail 반환 타입 User? 확인 필요

메서드 시그니처를 User?로 변경한 것은 적절하지만, 이 메서드를 호출하는 하위 레이어에서 null 처리 로직이 구현되었는지 직접 검증해야 합니다.

점검 위치:

  • core-domain/src/main/kotlin/noweekend/core/domain/user/UserReader.kt
    findUserByProviderAndEmail 호출 후 그대로 반환 → 최종 호출자(Service/Controller)에서 null-safe 처리 필요
  • UserReader를 사용하는 모든 서비스·컨트롤러
    ‑ 결과가 null일 때 적절한 예외 처리 또는 기본값 설정 여부 확인
noweekend-storage/db-core/src/main/kotlin/noweekend/storage/db/core/user/UserCoreRepository.kt (1)

20-24: null 안전 처리가 올바르게 구현되었습니다.

사용자를 찾지 못할 경우 예외를 던지는 대신 null을 반환하도록 변경한 것이 OAuth 로그인 플로우에 적합합니다. Elvis 연산자를 사용한 early return 패턴으로 깔끔하게 구현되었고, 인터페이스 변경사항과도 일치합니다.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

@toychip toychip merged commit 2e4d420 into develop Jun 9, 2025
1 of 2 checks passed
@toychip toychip deleted the fix/login branch June 9, 2025 14:44
@toychip toychip added fix Fix bug 준형 labels Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant