Skip to content

Conversation

@hknhj
Copy link
Contributor

@hknhj hknhj commented Aug 17, 2025

#️⃣연관된 이슈

#261

📝작업 내용

인터셉터, 어노테이션을 사용한 인증/인가 및 last opened 업데이트 자동화

🔎코드 설명(스크린샷(선택))

  • AuthMeeting, AuthSnsEvent, AuthMoodTracker에 AuthDocument 메타 어노테이션을 포함하여 상속하는 방식으로 사용중
  • 컨트롤러 인자에 AuthUser, AuthMeeting이 모두 붙은 어노테이션에 대하여 인터셉터에서 자동으로 user, meeting 유효성 및 인증/인가 자동화하여 해당 객체를 반환하도록 구현
  • 서비스 로직에서 user, meeting 검사하는 코드 삭제
  • DeleteDocument 어노테이션이 붙은 서비스 메서드에서는 해당 문서에 해당하는 튜플을 last opened 테이블에서 자동으로 삭제하도록 구현
  • UpdateDocumenTitle 어노테이션이 붙은 서비스 메서드에서는 해당 문서에 해당하는 튜플을 last opened 테이블에서 자동으로 문서의 제목을 수정하도록 구현

💬고민사항 및 리뷰 요구사항 (Optional)

X

비고 (Optional)

X

hknhj added 6 commits August 16, 2025 17:19
- 인터셉터에서 user, workspace 어노테이션이 모두 작성된 경우 유효성 및 인증/인가 검사 후, setAttribute를 사용하여 컨트롤러에 도달한 request에 검증된 isValidated, user, workspace 객체를 담도록 수정
- user, workspace 어노테이션에서는 isValidated가 true일 경우에는 넘겨받은 객체를 그대로 반환함
- isValidated가 false이거나 null인 경우에는 해당 user, workspcae를 repository에서 조회하여 반환하도록 구현
- meeting, sns event, mood tracker를 위한 메타 어노테이션인 AuthDocument 어노테이션 작성
- AuthMeeting이 AuthDocument 어노테이션을 포함
- document type, repository에서 튜플을 찾는 기능을 하는 DocumentFinder 인터페이스 작성
- DocumentFinder 인터페이스를 구현하는 MeetingFinder 구현
- DocumentMemberAuthInterceptor에서는 AuthUser와 AuthDocument를 사용하는 어노테이션이 파라미터에서 모두 감지된 경우, user와 document의 유효성 및 인증/인가를 한 후, request에 isValidated, validatedUser, validatedDocument 담도록 구현
- AuthDocumentArgumentResolver는 interceptor에서 validatedDocument를 넘겨받은 경우에는 해당 validatedDocument를 그대로 반환하고, 넘겨받은게 없는 경우 DocumentFinder를 사용하여 해당 튜플 탐색 후 반환
- Document 추상화에 의해 파라미터로 받은 Meeting, SnsEvent, MoodTracker에서 바로 workspaceId, title 조회 가능해짐
- meeting의 creator fetchType EAGER로 수정
- 문서 삭제 시, 자동으로 last opened에서 해당 documentId, documentType을 가진 튜플 삭제
@hknhj hknhj linked an issue Aug 17, 2025 that may be closed by this pull request
1 task
@hknhj hknhj self-assigned this Aug 17, 2025
@hknhj hknhj added the 🔨 Refactor 코드 리팩토링 label Aug 17, 2025
Copy link
Contributor

@Jinho622 Jinho622 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

@hknhj hknhj merged commit c6a6351 into dev Aug 18, 2025
1 check passed
@hknhj hknhj deleted the refactor/#261-auth-automation-using-annotation branch August 18, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: 어노테이션을 통한 meeting 인증/인가 방식 자동화

4 participants