diff --git a/infra/terraform/main.tf b/infra/terraform/main.tf index 1817677f..2ef40255 100644 --- a/infra/terraform/main.tf +++ b/infra/terraform/main.tf @@ -125,17 +125,51 @@ resource "aws_security_group" "sg_1" { Name = "team5-sg-1" } + # SSH ingress { - from_port = 0 - to_port = 0 - protocol = "all" # 모든 프로토콜 - cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용 + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] # 필요 시 특정 IP로 제한 가능 + } + + # HTTP + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # HTTPS + ingress { + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # WebRTC UDP + ingress { + from_port = 10000 + to_port = 20000 + protocol = "udp" + cidr_blocks = ["0.0.0.0/0"] } + # NPM (port 81) + ingress { + from_port = 81 + to_port = 81 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # 아웃바운드 모든 프로토콜 egress { from_port = 0 to_port = 0 - protocol = "all" # 모든 프로토콜 + protocol = "all" cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용 } } diff --git a/src/main/java/com/back/domain/file/entity/EntityType.java b/src/main/java/com/back/domain/file/entity/EntityType.java index 3c5a4f49..9f4bf77a 100644 --- a/src/main/java/com/back/domain/file/entity/EntityType.java +++ b/src/main/java/com/back/domain/file/entity/EntityType.java @@ -1,5 +1,5 @@ package com.back.domain.file.entity; public enum EntityType { - POST, COMMENT + POST, AVATAR, PROFILE } \ No newline at end of file diff --git a/src/main/java/com/back/domain/file/service/FileService.java b/src/main/java/com/back/domain/file/service/FileService.java index 74b03023..dd55d6a5 100644 --- a/src/main/java/com/back/domain/file/service/FileService.java +++ b/src/main/java/com/back/domain/file/service/FileService.java @@ -7,12 +7,8 @@ import com.back.domain.file.dto.FileReadResponseDto; import com.back.domain.file.dto.FileUpdateResponseDto; import com.back.domain.file.dto.FileUploadResponseDto; -import com.back.domain.file.entity.AttachmentMapping; -import com.back.domain.file.entity.EntityType; import com.back.domain.file.entity.FileAttachment; -import com.back.domain.file.repository.AttachmentMappingRepository; import com.back.domain.file.repository.FileAttachmentRepository; -import com.back.domain.file.util.EntityValidator; import com.back.domain.user.entity.User; import com.back.domain.user.repository.UserRepository; import com.back.global.exception.CustomException; @@ -21,8 +17,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; diff --git a/src/main/java/com/back/domain/file/util/EntityValidator.java b/src/main/java/com/back/domain/file/util/EntityValidator.java deleted file mode 100644 index 7167bc1c..00000000 --- a/src/main/java/com/back/domain/file/util/EntityValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.back.domain.file.util; - -import com.back.domain.board.comment.repository.CommentRepository; -import com.back.domain.board.post.repository.PostRepository; -import com.back.domain.file.entity.EntityType; -import com.back.global.exception.CustomException; -import com.back.global.exception.ErrorCode; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - * EntityType, EntityId를 통해 매핑되는 데이터 존재 확인 - */ -@Component -@RequiredArgsConstructor -public class EntityValidator { - private final PostRepository postRepository; - private final CommentRepository commentRepository; - - public void validate(EntityType entityType, Long entityId) { - switch (entityType) { - case POST: - if(!postRepository.existsById(entityId)) throw new CustomException(ErrorCode.POST_NOT_FOUND); - break; - - case COMMENT: - if(!commentRepository.existsById(entityId)) throw new CustomException(ErrorCode.COMMENT_NOT_FOUND); - break; - } - } -} diff --git a/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java b/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java index 7c0ba157..a5fff504 100644 --- a/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java +++ b/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java @@ -15,6 +15,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.stereotype.Component; @@ -40,6 +41,8 @@ public class OAuth2LoginSuccessHandler implements AuthenticationSuccessHandler { private final UserTokenRepository userTokenRepository; private final ObjectMapper objectMapper; + @Value("${frontend.base-url}") + private String FRONTEND_BASE_URL; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, @@ -73,7 +76,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, ); // 프론트엔드 리다이렉트 - response.sendRedirect("http://localhost:3000/login/oauth2"); + response.sendRedirect(FRONTEND_BASE_URL + "/login/oauth2"); } catch (CustomException e) { handleException(response, e); } catch (Exception e) {