From bcbbed7836ab8c7cbe7bcb7b34e7b436b83b976f Mon Sep 17 00:00:00 2001 From: cotton <72211340+kimeunsom@users.noreply.github.com> Date: Wed, 6 Aug 2025 04:17:24 +0900 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95=20-=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=ED=94=84=EB=A1=9C=ED=95=84=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EB=94=94=ED=8F=B4=ED=8A=B8=EA=B0=92=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/efub/cpbr/crumble/auth/service/AuthService.java | 6 +++--- src/main/java/efub/cpbr/crumble/user/entity/User.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/efub/cpbr/crumble/auth/service/AuthService.java b/src/main/java/efub/cpbr/crumble/auth/service/AuthService.java index 30111d4..398f2c5 100644 --- a/src/main/java/efub/cpbr/crumble/auth/service/AuthService.java +++ b/src/main/java/efub/cpbr/crumble/auth/service/AuthService.java @@ -57,9 +57,9 @@ public User signup(SignUpRequestDto signUpRequestDto) { .password(encodedPassword) .email(signUpRequestDto.getEmail()) .nickname(signUpRequestDto.getNickname()) - .role(RoleType.USER) // 기본 역할 USER로 설정 - .point(0) // 초기 포인트 0으로 설정 - .isActive(true) // 계정 활성화 상태로 설정 + .role(RoleType.USER) + .point(0) + .isActive(true) .build(); User savedUser = userRepository.save(newUser); diff --git a/src/main/java/efub/cpbr/crumble/user/entity/User.java b/src/main/java/efub/cpbr/crumble/user/entity/User.java index c7f7ad0..29f60c4 100644 --- a/src/main/java/efub/cpbr/crumble/user/entity/User.java +++ b/src/main/java/efub/cpbr/crumble/user/entity/User.java @@ -60,7 +60,7 @@ public void addPoint(Long point) { @Builder public User(Long userId, String username, String password, String email, String nickname, - int point, boolean isActive, LocalDateTime createdAt, LocalDateTime updatedAt, RoleType role, int profileImageId) { + int point, boolean isActive, RoleType role, Integer profileImageId) { this.userId = userId; this.username = username; this.password = password; @@ -69,7 +69,7 @@ public User(Long userId, String username, String password, String email, String this.point = (point == 0) ? 0 : point; // 기본값 처리 this.isActive = isActive; this.role = (role == null) ? RoleType.USER : role; // 기본 역할 처리 - this.profileImageId = profileImageId; + this.profileImageId = (profileImageId == null) ? 1 : profileImageId; // 기본값 1로 } /*public void deactivate() { // 사용자 탈퇴 From fc58f817029d6b431382043ae9381503df5afc97 Mon Sep 17 00:00:00 2001 From: cotton <72211340+kimeunsom@users.noreply.github.com> Date: Wed, 6 Aug 2025 04:27:56 +0900 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95=20-=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8,=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85,=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EB=93=B1=EC=9D=98=20=EC=9A=94=EC=B2=AD=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=EB=8A=94=20jwt=20=EA=B2=80=EC=A6=9D=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=20=EA=B1=B4=EB=84=88=EB=9C=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../efub/cpbr/crumble/jwt/JwtAuthenticationFilter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/efub/cpbr/crumble/jwt/JwtAuthenticationFilter.java b/src/main/java/efub/cpbr/crumble/jwt/JwtAuthenticationFilter.java index b22e4c2..95b8025 100644 --- a/src/main/java/efub/cpbr/crumble/jwt/JwtAuthenticationFilter.java +++ b/src/main/java/efub/cpbr/crumble/jwt/JwtAuthenticationFilter.java @@ -23,6 +23,14 @@ public JwtAuthenticationFilter(JwtTokenProvider jwtTokenProvider) { // 생성자 protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + String path = request.getRequestURI(); + + // 인증이 필요 없는 API 경로들을 건너뜀. + if (path.startsWith("/auth/login") || path.startsWith("/auth/signup") || path.startsWith("/auth/token")) { + filterChain.doFilter(request, response); + return; + } + try { String token = resolveToken(request); From 933fa7b700176748533f1ad0d5b2033256a989c2 Mon Sep 17 00:00:00 2001 From: cotton <72211340+kimeunsom@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:50:50 +0900 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20C?= =?UTF-8?q?ORS=20=EC=97=90=EB=9F=AC=20=EA=B4=80=EB=A0=A8,=20nginx=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20=ED=8C=8C=EC=9D=BC=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?-=20if=20=EB=B8=94=EB=A1=9D=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EB=B0=8F=20=ED=97=A4=EB=8D=94=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/default.conf | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/nginx/default.conf b/nginx/default.conf index a72d792..e1bde3c 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -10,29 +10,19 @@ server { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + # 모든 요청에 대해 CORS 헤더를 한 번만 추가 + add_header 'Access-Control-Allow-Origin' 'https://qrumble.vercel.app' always; + add_header 'Access-Control-Allow-Credentials' 'true' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept' always; + # OPTIONS (Preflight) 요청에 대한 처리 if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true' always; - add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always; - add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept' always; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain; charset=UTF-8'; add_header 'Content-Length' 0; return 204; } - - if ($http_origin ~* ^(https://qrumble.vercel.app)$) { - add_header 'Access-Control-Allow-Origin' "$http_origin" always; - add_header 'Access-Control-Allow-Credentials' 'true' always; - } - - # add_header 'Access-Control-Allow-Origin' "$http_origin" always; - # add_header 'Access-Control-Allow-Credentials' 'true' always; - # add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE, OPTIONS' always; - # add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept' always; - - } }