c2fc408fcc
- 스팟별 채팅방(/topic/spots/{id}), 전송 /app/spots/{id}/chat, 엔드포인트 /ws
- STOMP CONNECT Bearer 토큰 인증(ChannelInterceptor) → 미인증 전송 무시
- ChatRoom/ChatMessage 도메인, 방 없으면 최초 메시지 시 생성, 발신자 닉네임 포함
- GET /api/chat/spots/{id}/messages 히스토리(보호), 전역 WebSocket 브로커(인메모리)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
17 lines
369 B
Java
17 lines
369 B
Java
package com.dog.dognation.chat;
|
|
|
|
import java.security.Principal;
|
|
|
|
/** WebSocket 세션의 인증 주체. name 에 userId 문자열을 담는다. */
|
|
public record StompPrincipal(String name, String role) implements Principal {
|
|
|
|
@Override
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public Long userId() {
|
|
return Long.valueOf(name);
|
|
}
|
|
}
|