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

[YS-131] refact: WebSecurityConfig 우선순위 수정 및 memberId 삽입 위치 변경 #25

Merged
merged 7 commits into from
Jan 11, 2025

Conversation

Ji-soo708
Copy link
Member

@Ji-soo708 Ji-soo708 commented Jan 11, 2025

💡 작업 내용

  • 특정 URI에 대해 인증을 생략하도록 WebSecurityConfig 우선순위 수정
  • 클린아키텍처 원칙에 맞도록 memberId 삽입 위치를 변경
  • 도메인 별로 패키지 분리

✅ 셀프 체크리스트

  • PR 제목을 형식에 맞게 작성했나요?
  • 브랜치 전략에 맞는 브랜치에 PR을 올리고 있나요?
  • 테스트는 잘 통과했나요?
  • 빌드에 성공했나요?
  • 본인을 assign 해주세요.
  • 해당 PR에 맞는 label을 붙여주세요.

🙋🏻‍ 확인해주세요

  • 처음에 논의한 ArgumentResolver로 자동 주입하는 방식보다는 클린 아키텍처 원칙에 위배되지 않도록 memberId를 삽입하는 방식이 더 깔끔할 것 같아 해당 PR에서 이와 같이 적용했습니다. 괜찮은지 확인 부탁드립니다~
  • 패키지를 분리해서 변경된 파일이 많습니다. 커밋별로 봐주시면 좋을 거 같아요~

🔗 Jira 티켓


https://yappsocks.atlassian.net/browse/YS-131

@github-actions github-actions bot changed the title refact: WebSecurityConfig 우선순위 수정 및 memberId 삽입 위치 변경 [YS-131] refact: WebSecurityConfig 우선순위 수정 및 memberId 삽입 위치 변경 Jan 11, 2025
Copy link
Member Author

Choose a reason for hiding this comment

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

WebSecurityConfig에서 먼저 인증 생략해야 하는 URI를 적용하고 나머지 URI에 대해 인증을 수행하도록 우선순위를 수정했습니다. 테스트 했을 때, 정상적으로 동작했습니다.

object ExperimentPostMapper {
fun toCreatePostUseCaseInput(request: CreateExperimentPostRequest): CreateExperimentPostUseCase.Input {
return CreateExperimentPostUseCase.Input(
memberId = getCurrentMemberId(),
Copy link
Member Author

Choose a reason for hiding this comment

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

클린아키텍처에 위배되지 않도록 memberId를 주입시키기 위해, 서버 회의에서 ArgumentResolver를 도입하기로 했습니다.

하지만 생각해보니 presentation 계층에서 Input에 memberId를 주입시키면 클린아키텍처 원칙을 위배하지 않고 ArgumentResolver를 이용해 주입시키는 방식보다는 오히려 더 효율적일 거라 생각해 위와 같이 처리했습니다.

혹시 이렇게 처리하는거에 대해 어떻게 생각하시나요?

import java.time.LocalDate

class CreatePostUseCase(
class CreateExperimentPostUseCase(
Copy link
Member Author

Choose a reason for hiding this comment

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

확장성을 고려하여, Post보다는 더 구체적인 이름을 사용하는 것이 좋다고 판단했습니다. 그래서 모든 파일명을 ExperimentPost로 변경하였는데, 이 방식이 괜찮을지 의견 부탁드립니다.

Copy link
Member

Choose a reason for hiding this comment

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

네 저도 아까 네이밍 통일을 하면 좋을지 의견 여쭙고 싶었던 거라, 통일하면 좋을 것 같습니다!

@Ji-soo708 Ji-soo708 self-assigned this Jan 11, 2025
@Ji-soo708 Ji-soo708 added the ♻️ REFACTORING 리팩토링 label Jan 11, 2025
@Ji-soo708 Ji-soo708 requested a review from chock-cho January 11, 2025 13:07
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
18.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link
Member

@chock-cho chock-cho left a comment

Choose a reason for hiding this comment

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

LGTM!
저번 PR에서 사소하게 위배된 클린 아키텍처 원칙을 잘 반영해주신 것 같아요!!😊😊
수고 많으셨습니다 💪

Copy link
Member

Choose a reason for hiding this comment

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

이메일 인증 로직까지 헤더에 토큰 필요하지 않은 부분 작업 깔끔하게 잘해주신 것 같아요 💪💪

Copy link
Member

Choose a reason for hiding this comment

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

저번 PR에서 제가 놓친 부분이었네요!

@Ji-soo708 Ji-soo708 merged commit 4855c21 into dev Jan 11, 2025
2 of 3 checks passed
@Ji-soo708 Ji-soo708 deleted the feat/YS-131 branch January 11, 2025 14:35
Ji-soo708 added a commit that referenced this pull request Jan 26, 2025
* refact: refactor security filter chains to ensure proper order and access control for auth

* refact: delete path condition in JwtAuthenticationFilter

* refact: remove AuthenticationUtils and use getCurrentMemberId directly

* refact: inject memberId in mapper instead of use case

* refact: rename file name related to ExperimentPost

* refact: organize packages by domain

* refact: rename request file
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.

2 participants