Skip to content

[♻️ Refactor] STOMP 채팅 권한 검증 로직 정리 (#36) - #38

Open
dlwldn30 wants to merge 1 commit into
mainfrom
feat/36-stomp-redis-chat
Open

[♻️ Refactor] STOMP 채팅 권한 검증 로직 정리 (#36)#38
dlwldn30 wants to merge 1 commit into
mainfrom
feat/36-stomp-redis-chat

Conversation

@dlwldn30

Copy link
Copy Markdown
Collaborator

연관 이슈

변경 요약

  • STOMP 채팅 연결/구독 과정의 권한 검증 로직을 정리했습니다.
  • 채팅방 멤버십, 활성 사용자 상태, 차단 관계를 기준으로 구독 및 메시지 접근을 검증하도록 맞췄습니다.
  • Redis 채팅방 구독 관리를 이벤트 전파 방식에서 세션 기반 구독 수 관리 방식으로 변경했습니다.

구현 상세

  • JwtProvider

    • access token 만료 시각 조회 로직을 추가해 STOMP 세션 검증에 사용하도록 했습니다.
  • StompAuthChannelInterceptor

    • CONNECT 시 Bearer access token 검증
    • 세션에 memberId 및 access token 만료 시각 저장
    • SUBSCRIBE 시 채팅방 존재 여부, 멤버십, 차단 상태 검증
    • DISCONNECT / UNSUBSCRIBE 시 세션별 구독 정보 정리
  • ChatRoomService

    • 채팅방 목록 조회 시 차단 관계가 있는 방을 필터링
    • 그룹 채팅방 생성 및 DM 생성 시 활성 사용자/차단 상태를 검증
  • ChatService

    • 메시지 전송, 입장, 퇴장, 히스토리 조회 시 활성 사용자/채팅방 멤버십/차단 상태를 검증
    • 방 메시지 접근을 멤버십 중심으로 정리
  • ChatRedisSubscriptionService

    • 세션별 subscription 추적
    • room 단위 subscriber count 관리
    • 첫 구독 시에만 Redis listener 등록, 마지막 구독 해제 시 listener 제거
  • 제거한 구성

    • ChatSubscriptionInitializer
    • ChatSystemSubscriber
    • ChatRoomSubscribedEvent
    • ChatRoomUnsubscribedEvent

테스트 결과

  • 실행 명령어:

    • ./gradlew compileJava --no-daemon
  • 결과 요약:

    • compileJava 성공

체크리스트

  • PR 본문에 Closes #36 또는 Fixes #36를 포함했습니다.
  • 주요 구현 내용(특히 API/DB 변경 사항)을 본문에 작성했습니다.
  • 로컬 검증 명령을 실행했고 결과를 본문에 작성했습니다.

Copilot AI review requested due to automatic review settings June 26, 2026 12:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] STOMP + Redis 기반 실시간 채팅 구현

2 participants