Skip to content

Commit

Permalink
๐Ÿ› cors์—๋Ÿฌ, ์šด์˜ ์„œ๋ฒ„ ์Šค์›จ๊ฑฐ ๊ด€๋ จ ์ฝ”๋“œ ์ˆ˜์ • (#117)
Browse files Browse the repository at this point in the history
* โœจ CrossOrigin ์–ด๋…ธํ…Œ์ด์…˜ ๋ชจ๋“  ์ปจํŠธ๋กค๋Ÿฌ์— ์ถ”๊ฐ€

* โœจ Operation -> ApiOperation ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ๋ณ€๊ฒฝ
  • Loading branch information
u-genuine authored Feb 13, 2024
1 parent 0e9e1db commit 92c8a0a
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
import aromanticcat.umcproject.security.jwt.JwtUtil;
import aromanticcat.umcproject.security.jwt.RefreshToken;
import aromanticcat.umcproject.security.jwt.RefreshTokenService;
import io.swagger.v3.oas.annotations.Operation;
import java.util.Optional;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@Slf4j
@RestController
@RequiredArgsConstructor
Expand All @@ -27,7 +30,7 @@ public class AuthController {
private final JwtUtil jwtUtil;

@PostMapping("token/logout")
@Operation(summary = "๋กœ๊ทธ์•„์›ƒ API", description = " ์—‘์„ธ์Šค ํ† ํฐ์œผ๋กœ ํ˜„์žฌ Redis ์ •๋ณด๋ฅผ ์‚ญ์ œํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiOperation(value = "๋กœ๊ทธ์•„์›ƒ API", notes = " ์—‘์„ธ์Šค ํ† ํฐ์œผ๋กœ ํ˜„์žฌ Redis ์ •๋ณด๋ฅผ ์‚ญ์ œํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
public ApiResponse<StatusResponseDto> logout(@RequestHeader("Authorization") final String accessToken) {

// ์—‘์„ธ์Šค ํ† ํฐ์œผ๋กœ ํ˜„์žฌ Redis ์ •๋ณด ์‚ญ์ œ
Expand All @@ -36,7 +39,7 @@ public ApiResponse<StatusResponseDto> logout(@RequestHeader("Authorization") fin
}

@PostMapping("/token/refresh")
@Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ ์žฌ๋ฐœ๊ธ‰ API", description = " ์—‘์„ธ์Šค ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
@ApiOperation(value = "์•ก์„ธ์Šค ํ† ํฐ ์žฌ๋ฐœ๊ธ‰ API", notes = " ์—‘์„ธ์Šค ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ํ•˜๋Š” API์ž…๋‹ˆ๋‹ค.")
public ResponseEntity<TokenResponseStatus> refresh(@RequestHeader("Authorization") final String accessToken) {

// ์•ก์„ธ์Šค ํ† ํฐ์œผ๋กœ Refresh ํ† ํฐ ๊ฐ์ฒด๋ฅผ ์กฐํšŒ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
import aromanticcat.umcproject.converter.FriendConverter;
import aromanticcat.umcproject.entity.Friend;
import aromanticcat.umcproject.service.FriendService.FriendCommandService;
import aromanticcat.umcproject.service.FriendService.FriendQueryService;
import aromanticcat.umcproject.service.MemberService;
import aromanticcat.umcproject.web.dto.Friend.FriendRequestDTO;
import aromanticcat.umcproject.web.dto.Friend.FriendResponseDTO;
import aromanticcat.umcproject.service.FriendService.FriendQueryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/address-book")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequiredArgsConstructor
@RequestMapping("/letters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequiredArgsConstructor
@RequestMapping("/letterboxes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
import aromanticcat.umcproject.entity.Member;
import aromanticcat.umcproject.service.MemberService;
import aromanticcat.umcproject.web.dto.MemberResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequiredArgsConstructor
public class MemberController {

private final MemberService service;

@PostMapping("/signUp")
@Operation(summary = "ํšŒ์›๊ฐ€์ž… API", description = "ํšŒ์›๊ฐ€์ž… API์ž…๋‹ˆ๋‹ค.")
@ApiOperation(value = "ํšŒ์›๊ฐ€์ž… API", notes = "ํšŒ์›๊ฐ€์ž… API์ž…๋‹ˆ๋‹ค.")
public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> signup(@RequestBody String nickname,
@RequestParam String email) {
try {
Expand All @@ -33,7 +31,7 @@ public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> signup(@RequestBody St
}

@PostMapping("/mypage/nickname")
@Operation(summary = "๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ API", description = "๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ API์ž…๋‹ˆ๋‹ค.")
@ApiOperation(value = "๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ API", notes = "๋‹‰๋„ค์ž„ ๋ณ€๊ฒฝ API์ž…๋‹ˆ๋‹ค.")
public ApiResponse<MemberResponseDTO.MemberJoinResultDTO> updateNickname(@RequestBody String nickname) {
try {
Member user = service.updateNickname(nickname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import aromanticcat.umcproject.service.MissionService.MissionCommandService;
import aromanticcat.umcproject.service.MissionService.MissionQueryService;
import aromanticcat.umcproject.web.dto.Mission.MissionResponseDTO;
import aromanticcat.umcproject.web.dto.nangmanLetterbox.NangmanCollectionResponseDTO;
import aromanticcat.umcproject.web.dto.store.StoreResponseDTO;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/missions")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/my-collection")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import aromanticcat.umcproject.apiPayload.ApiResponse;
import aromanticcat.umcproject.service.myCollectionService.MyDesignService;
import aromanticcat.umcproject.web.dto.Letterbox.LetterResponse;
import aromanticcat.umcproject.web.dto.MyDesign.MyDesignGetResponse;
import aromanticcat.umcproject.web.dto.MyDesign.MyDesignRequest;
import io.swagger.annotations.ApiOperation;
Expand All @@ -14,6 +13,7 @@
import java.io.IOException;
import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequiredArgsConstructor
@RequestMapping("/myDesign")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/nangman-collection")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.List;
import java.util.stream.Collectors;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/nangman-letterbox")
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package aromanticcat.umcproject.web.controller;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
public class RootController {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package aromanticcat.umcproject.web.controller;

import aromanticcat.umcproject.apiPayload.ApiResponse;
import aromanticcat.umcproject.entity.SlowLetter;
import aromanticcat.umcproject.service.slowLetter.SlowLetterService;
import aromanticcat.umcproject.web.dto.Letterbox.LetterResponse;
import aromanticcat.umcproject.web.dto.slowLetter.SlowLetterCalResponse;
import aromanticcat.umcproject.web.dto.slowLetter.SlowLetterGetResponse;
import aromanticcat.umcproject.web.dto.slowLetter.SlowLetterRequest;
import aromanticcat.umcproject.web.dto.slowLetter.SlowLetterResponse;
import io.swagger.annotations.ApiOperation;
import aromanticcat.umcproject.apiPayload.ApiResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDate;
import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequiredArgsConstructor
@RequestMapping("/slow_letters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import java.util.List;

@CrossOrigin(origins = "https://dev.nangmancat.shop")
@RestController
@RequestMapping("/store")
@RequiredArgsConstructor
Expand Down

0 comments on commit 92c8a0a

Please sign in to comment.