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

[feat] 웹소켓 연결 및 메시지 전송시 JWT 토큰 검증 과정 추가 #26

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

khee2
Copy link
Contributor

@khee2 khee2 commented Jun 11, 2024

PULL REQUEST

🔻관련 이슈

🎋 작업중인 브랜치

  • feature/add-security

📝 작업 내용

  • 채팅방 입장 시 입장 메시지 추가
  • 첫 메시지가 없는 채팅방은 상대방의 채팅 리스트에 표시되지 않도록 수정
  • WebSocket 메시지에 대한 JWT 토큰 검증 추가

🔑 주요 변경사항

  • 채팅방 생성 후 첫 메시지를 보내지 않으면 반대편 사용자에게 채팅방 리스트가 뜨지 않도록 수정
  • WebSocket 연결 시 ACCESS_TOKEN을 검증하기 위해 AuthChannelInterceptor 구현
  • @MessageMapping("/chat/message")에서 각 메시지에 대해 토큰 유효성 검증 추가
  • AuthChannelInterceptor를 사용하도록 WebSocketConfig에 보안 설정 구성

🏞 스크린샷(선택)

  • 메시지 전송시 토큰 검증
image
  • 웹 소켓 토큰 검증

image

image

💬리뷰 요구사항(선택)

  • 메시지 전송 api에서 refresh_token은 헤더에 달지 않았습니다.
  • 혹시 로그인에서 refresh_token을 처리하는 부분 추가되었으면 저도 추가하겠습니다 (코멘트 달아주세요!)
  • 웹소켓 연결과 메시지 전송 부분에서 JWT 토큰 검증이 잘 되어 있는지 확인 부탁드립니다
  • S3가 groshare-s3-bucket2로 변경되었는데, 이거 도커에서 바꿔야 하지 않는지 문의드립니다
  • MessageRoom에서 해당 채팅방에 보낸 메시지 있는지 확인하는 firstMessageSent 필드 추가했습니다.
    필드 추가 이유: 채팅방 생성후 아무런 메시지를 보내지 않았다면, 상대편 채팅리스트에는 보여지지 않는 걸 구현하기 위함
    스크린샷 2024-06-12 022540

khee2 added 3 commits June 11, 2024 04:11
- WebSocket 연결 시 ACCESS_TOKEN을 검증하기 위해 AuthChannelInterceptor 구현
- @MessageMapping("/chat/message")에서 각 메시지에 대해 토큰 유효성 검증 추가
- AuthChannelInterceptor를 사용하도록 WebSocketConfig에 보안 설정 구성
- 채팅방 생성 후 첫 메시지를 보내지 않으면 반대편 사용자에게 채팅방 리스트가 뜨지 않도록 수정
@khee2 khee2 requested a review from Yeon-chae June 11, 2024 17:31
@khee2 khee2 self-assigned this Jun 11, 2024
@khee2 khee2 added help wanted Extra attention is needed feat Add new Feature 💫 경희 💫 labels Jun 11, 2024
@Yeon-chae Yeon-chae merged commit 0d3f2d9 into main Jun 11, 2024
1 check passed
@Yeon-chae
Copy link
Member

refreshtoken 헤더에 안달아도 괜찮아요! 저는 혹시 나중에 재발급 우려해서 미리 다 달아둔건데 지금은 미구현 상태이니 안달아도 무방합니다!

khee2 pushed a commit that referenced this pull request Nov 19, 2024
[feat] 웹소켓 연결 및 메시지 전송시 JWT 토큰 검증 과정 추가
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Add new Feature help wanted Extra attention is needed 💫 경희 💫
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 채팅기능 보완
2 participants