Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aea5f02
feat: workflow에 EC2 자동 배포 추가 (#78)
chw0912 Jul 18, 2025
4d341f8
feat: 발표방 캐싱 및 인덱싱 적용 feat 새로운 기능 추가 (#80)
rjswjddn Jul 19, 2025
bdcf47a
feat: 카카오 로그인 API (#86)
rjswjddn Jul 23, 2025
2622931
refactor: Presigned URL 업로드용, 조회용 로직 분리 (#84)
chw0912 Jul 23, 2025
1980af7
merge: release 브랜치 충돌 해결
rjswjddn Jul 23, 2025
12c801a
refactor: profiles 환경 변수 주입으로 변경 (#90)
chw0912 Jul 24, 2025
65e05fd
feat: 카카오 로그인 재시도 로직, 방 참가자 관리 동시성 수정 (#91)
rjswjddn Jul 24, 2025
a0ef2c6
refactor,fix: 2회차 멘토링 기반 리팩토링 (#94)
chcch529 Jul 26, 2025
a34d680
fix: MemberController 수정 (#96)
rjswjddn Jul 27, 2025
0dc5c81
Merge branch 'release' into dev
rjswjddn Jul 27, 2025
492992a
답변 조회 기능 수정 (#98)
gffd94 Jul 28, 2025
b0bb3b1
feat: cors 설정 (#102)
rjswjddn Jul 29, 2025
12ad4ba
Refactor/101 room detail (#104)
rjswjddn Jul 30, 2025
e9fdf79
Refactor/101 room detail (#106)
rjswjddn Jul 30, 2025
bf2a942
Refactor/101 room detail (#108)
rjswjddn Jul 30, 2025
9181de9
Merge branch 'release' into dev
rjswjddn Jul 30, 2025
790be9a
Refactor/101 room detail (#110)
rjswjddn Jul 30, 2025
8145fa0
Update WebSocketConfig.java
rjswjddn Jul 30, 2025
129d08f
Refactor/101 room detail (#114)
rjswjddn Jul 30, 2025
ab1ebb5
Refactor/101 room detail (#116)
rjswjddn Jul 30, 2025
a4c92d4
Refactor/101 room detail (#118)
rjswjddn Jul 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowCredentials(true);
configuration.setAllowedOriginPatterns(List.of("*"));
configuration.setAllowedOriginPatterns(List.of("http://localhost:5173"));
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
configuration.setAllowedHeaders(List.of("*"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;

import com.oronaminc.join.global.exception.ErrorCode;
import com.oronaminc.join.global.exception.ErrorException;
import com.oronaminc.join.global.ratelimit.RateLimitService;
import com.oronaminc.join.global.ratelimit.RateLimitType;
import com.oronaminc.join.member.security.MemberDetails;
import com.oronaminc.join.question.domain.Question;
import com.oronaminc.join.question.dto.QuestionCreateResponse;
import com.oronaminc.join.question.dto.QuestionDeleteResponse;
Expand Down Expand Up @@ -41,8 +43,10 @@ public QuestionCreateResponse createQuestion(
Principal principal
) {
log.debug("수신한 메시지 = {}", request.content());
log.debug("principal = {}", principal);

Long memberId = Long.valueOf(principal.getName());
MemberDetails memberDetails = (MemberDetails)((Authentication)principal).getPrincipal();
Long memberId = Long.valueOf(memberDetails.getId());

log.debug("회원 아이디 = {}", memberId);

Expand All @@ -66,6 +70,7 @@ public QuestionUpdateResponse updateQuestion(
@Payload @Valid QuestionRequest request,
Principal principal
) {

Long memberId = Long.valueOf(principal.getName());

Question updated = questionService.update(memberId, roomId, questionId, request);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.oronaminc.join.websocket.config;

import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.messaging.support.ChannelInterceptor;
import org.springframework.messaging.support.MessageHeaderAccessor;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

@Component
public class StompAuthChannelInterceptor implements ChannelInterceptor {
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);

if (StompCommand.CONNECT.equals(accessor.getCommand())) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if (authentication != null && authentication.isAuthenticated()) {
accessor.setUser(authentication);
}
}

return message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.ChannelRegistration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketTransportRegistration;
import org.springframework.web.socket.handler.WebSocketHandlerDecoratorFactory;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;

import com.oronaminc.join.websocket.handshake.CustomHandshakeHandler;
import com.oronaminc.join.websocket.session.CustomWebSocketHandlerDecorator;
Expand All @@ -26,6 +28,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
private final StompErrorHandler stompErrorHandler;
private final WebsocketSessionManager sessionManager;
private final ApplicationEventPublisher publisher;
private final StompAuthChannelInterceptor stompAuthChannelInterceptor;

@Bean
public WebSocketHandlerDecoratorFactory webSocketHandlerDecoratorFactory(
Expand All @@ -47,9 +50,9 @@ public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOriginPatterns("*")
// websocket 연결 전 쿠키 체크
// .addInterceptors(new HttpSessionHandshakeInterceptor())
.addInterceptors(new HttpSessionHandshakeInterceptor())
// websocket 연결 후 principal 생성
// .setHandshakeHandler(handshakeHandler)
.setHandshakeHandler(handshakeHandler)
.withSockJS();

registry.addEndpoint("/ws")
Expand All @@ -65,4 +68,9 @@ public void registerStompEndpoints(StompEndpointRegistry registry) {
public void configureWebSocketTransport(WebSocketTransportRegistration registry) {
registry.setDecoratorFactories(webSocketHandlerDecoratorFactory(sessionManager, publisher));
}

@Override
public void configureClientInboundChannel(ChannelRegistration registration) {
registration.interceptors(stompAuthChannelInterceptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

import static com.oronaminc.join.global.exception.ErrorCode.*;

import com.oronaminc.join.global.exception.ErrorCode;
import java.security.Principal;
import java.util.Set;

import org.springframework.context.event.EventListener;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.messaging.SessionSubscribeEvent;

import com.oronaminc.join.global.exception.ErrorException;
import com.oronaminc.join.room.event.RoomExitEvent;
Expand All @@ -24,27 +21,27 @@ public class CurrentParticipantEventHandler {
private static final String ROOM_PREFIX = "/topic/rooms/";
private static final String JOIN_SUFFIX = "/join";

@EventListener
public void handleSubscribe(SessionSubscribeEvent event) {
StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
String destination = accessor.getDestination();
Principal principal = accessor.getUser();

if (destination == null) {
throw new ErrorException(STOMP_INVALID_DESTINATION);
}

if (!destination.startsWith(ROOM_PREFIX)) {
return;
}

Long memberId = parseMemberId(principal);
Long roomId = parseRoomId(destination);

if (!isRoomJoinPath(destination)) {
validateParticipantRoomJoin(roomId, memberId);
}
}
// @EventListener
// public void handleSubscribe(SessionSubscribeEvent event) {
// StompHeaderAccessor accessor = StompHeaderAccessor.wrap(event.getMessage());
// String destination = accessor.getDestination();
// Principal principal = accessor.getUser();
//
// if (destination == null) {
// throw new ErrorException(STOMP_INVALID_DESTINATION);
// }
//
// if (!destination.startsWith(ROOM_PREFIX)) {
// return;
// }
//
// Long memberId = parseMemberId(principal);
// Long roomId = parseRoomId(destination);
//
// if (!isRoomJoinPath(destination)) {
// validateParticipantRoomJoin(roomId, memberId);
// }
// }

@EventListener
public void handleUnsubscribe(RoomExitEvent event) {
Expand Down