Skip to content

Commit

Permalink
[feat] 테스트를 위해 잠시 /ws-stomp 허용
Browse files Browse the repository at this point in the history
  • Loading branch information
khee2 committed Jun 7, 2024
1 parent e7ac2f0 commit 04d70ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; // 로깅을 위해 추가
import org.springframework.http.ResponseEntity;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;
Expand All @@ -21,7 +22,7 @@

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Controller
@Tag(name = "Message", description = "Message API")
Expand All @@ -37,6 +38,16 @@ public class MessageController {
public void message(@RequestHeader(name = "ACCESS_TOKEN", required = false) String accessToken,
@RequestHeader(name = "REFRESH_TOKEN", required = false) String refreshToken,
MessageDto messageDto) {

// 로깅 추가
log.info("Received message:");
log.info(" - sender: {}", messageDto.getSender());
log.info(" - roomId: {}", messageDto.getRoomId());
log.info(" - message: {}", messageDto.getMessage());
log.info(" - sentTime: {}", messageDto.getSentTime());
log.info("ACCESS_TOKEN: {}", accessToken);
log.info("REFRESH_TOKEN: {}", refreshToken);

// 클라이언트 채팅방(topic) 입장, 대화를 위해 리스너와 연동
messageRoomService.enterMessageRoom(messageDto.getRoomId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.exceptionHandling(exception -> exception
.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))) // 인증 실패시 HTTP 401 반환
.authorizeHttpRequests(auth -> auth
.requestMatchers("/", "/api/auth/**", "/swagger-ui/**", "/v3/api-docs/**", "/s3/test").permitAll() // 특정 경로에 대한 접근 허용
.requestMatchers("/", "/api/auth/**", "/swagger-ui/**", "/v3/api-docs/**", "/s3/test", "/ws-stomp/**").permitAll() // 특정 경로에 대한 접근 허용
// .requestMatchers(HttpMethod.GET,"/api/v2/posts/{postId}").permitAll() // GET 요청 허용
.anyRequest().authenticated()) // 나머지 요청은 인증 필요
//.formLogin(form -> form
Expand Down

0 comments on commit 04d70ab

Please sign in to comment.