Skip to content

Commit 10030fd

Browse files
authored
Merge pull request #81 from FixLog/develop
토큰 검사 추가
2 parents 524e680 + 027499b commit 10030fd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/com/example/FixLog/controller/PostController.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@
44
import com.example.FixLog.dto.Response;
55
import com.example.FixLog.dto.post.PostResponseDto;
66
import com.example.FixLog.service.PostService;
7-
import com.example.FixLog.service.S3Service;
87
import org.springframework.web.bind.annotation.*;
98
import org.springframework.web.multipart.MultipartFile;
109

1110
@RestController
1211
@RequestMapping("/posts")
1312
public class PostController {
1413
private final PostService postService;
15-
private final S3Service s3Service;
1614

17-
public PostController(PostService postService, S3Service s3Service){
15+
public PostController(PostService postService){
1816
this.postService = postService;
19-
this.s3Service = s3Service;
2017
}
2118

2219
@PostMapping

src/main/java/com/example/FixLog/service/PostService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import com.example.FixLog.repository.post.PostRepository;
2020
import com.example.FixLog.repository.tag.TagRepository;
2121
import jakarta.transaction.Transactional;
22+
import org.springframework.security.core.Authentication;
23+
import org.springframework.security.core.context.SecurityContextHolder;
2224
import org.springframework.stereotype.Service;
2325
import org.springframework.web.multipart.MultipartFile;
2426

@@ -99,6 +101,8 @@ public void createPost(PostRequestDto postRequestDto){
99101

100102
// 이미지 파일 마크다운으로 변경
101103
public String uploadImage(MultipartFile imageFile){
104+
SecurityContextHolder.getContext().getAuthentication();
105+
102106
if (imageFile == null || imageFile.isEmpty()){
103107
throw new CustomException(ErrorCode.IMAGE_UPLOAD_FAILED);
104108
}

0 commit comments

Comments
 (0)