Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
be67dee
Test: 테스트용 application.yml 파일 추가
pjh5365 Nov 13, 2024
79b24c5
Feat: Dockerfile 작성
pjh5365 Nov 13, 2024
d88fe6d
Merge branch 'Work-Plate:main' into main
pjh5365 Nov 13, 2024
60316bf
Refactor: AI 요구사항에 맞게 코드 수정
pjh5365 Nov 15, 2024
c46795b
Fix: H2 관련 설정 삭제
pjh5365 Nov 15, 2024
d798481
Refactor: 식당 ID를 반환하도록 추가
pjh5365 Nov 15, 2024
872a080
Merge branch 'main' into main
pjh5365 Nov 15, 2024
c429fcc
Merge branch 'Work-Plate:main' into main
pjh5365 Nov 15, 2024
ed1231b
Refactor: AI 요구사항에 맞춰 수정
pjh5365 Nov 16, 2024
e2f5962
Merge branch 'main' of https://github.com/pjh5365/WorkPlate-Server
pjh5365 Nov 16, 2024
d87c576
Merge branch 'Work-Plate:main' into main
pjh5365 Nov 16, 2024
0e5796f
Refactor: AI 요구사항에 맞도록 수정
pjh5365 Nov 18, 2024
0e96d4b
Test: 테스트 코드 수정
pjh5365 Nov 18, 2024
50fba0f
Refactor: 회원 상세정보 필드 추가
pjh5365 Nov 18, 2024
1a3c142
Refactor: 테스트 환경 간 모든 요청 허용
pjh5365 Nov 19, 2024
a55e836
Feat: 에러 발생 시 CORS 설정 추가
pjh5365 Nov 19, 2024
302a239
Refactor: 회원 상세 정보 입력 로직 수정
pjh5365 Nov 19, 2024
4d47a10
Refactor: CORS 설정 추가
pjh5365 Nov 19, 2024
253373f
Merge branch 'main' into main
pjh5365 Nov 19, 2024
c93d6d0
Fix: CORS 설정 전으로 롤백 + CORS 정상 작동을 위해 모든 응답은 200을 기반으로 설정
pjh5365 Nov 19, 2024
aa5c02c
Merge remote-tracking branch 'upstream/main'
pjh5365 Nov 19, 2024
6eefff8
Merge branch 'main' of https://github.com/pjh5365/WorkPlate-Server
pjh5365 Nov 19, 2024
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 @@ -18,26 +18,16 @@
@Slf4j
@RestControllerAdvice
public class ControllerAdvice {

private void addCorsHeaders(HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
response.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type");
response.setHeader("Access-Control-Allow-Credentials", "true");
}

@ExceptionHandler(Exception.class)
public ResponseEntity<ApiResponse<String>> common(Exception e, HttpServletResponse response) {
addCorsHeaders(response); // CORS 헤더 추가
log.error("[밥상일터]: 예상치 못한 예외가 발생하였습니다. 예외내용 = {}", e.getMessage());
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
return ResponseEntity.status(HttpStatus.OK)
.body(ApiResponse.failure("관리자에게 문의해주세요."));
}

@ExceptionHandler({IllegalArgumentException.class, AccessDeniedException.class})
public ResponseEntity<ApiResponse<String>> illegalArgument(Exception e, HttpServletResponse response) {
addCorsHeaders(response); // CORS 헤더 추가
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
return ResponseEntity.status(HttpStatus.OK)
.body(ApiResponse.failure(e.getMessage()));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package workplate.workplateserver.config;

import org.springframework.boot.autoconfigure.security.servlet.PathRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
Expand Down
Loading