From af3fe957f5795385436f5a4a1ea41933112c92a7 Mon Sep 17 00:00:00 2001 From: JaeSeo Yang <96044622+psychology50@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:50:01 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20#109=20accessToken=20=E2=86=92=20Auth?= =?UTF-8?q?orization=20header=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/apis/auth/controller/AuthApi.java | 9 ++++---- .../api/apis/oauth/controller/OauthApi.java | 7 +++---- .../src/main/resources/application.yml | 5 +++++ .../src/main/resources/application-infra.yml | 21 ++++++++++++++++--- proxy/conf.d/default.conf | 2 +- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/auth/controller/AuthApi.java b/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/auth/controller/AuthApi.java index a25fa06d..2db21a11 100644 --- a/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/auth/controller/AuthApi.java +++ b/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/auth/controller/AuthApi.java @@ -42,8 +42,7 @@ import java.util.Map; -import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.ACCESS_TOKEN; -import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.REFRESH_TOKEN; +import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.*; @Tag(name = "유저 관리 API", description = "유저 인증과 관련된 API") @@ -98,7 +97,7 @@ else if (token.refreshToken() == null) return ResponseEntity.ok() .header(HttpHeaders.SET_COOKIE, cookie.toString()) - .header(ACCESS_TOKEN.getValue(), token.accessToken()) + .header(AUTH_HEADER.getValue(), token.accessToken()) .body(SuccessResponse.from(Map.of("member", "등록된 oauth 계정 연동 성공"))); } @@ -183,7 +182,7 @@ public ResponseEntity refresh(@CookieValue("refreshToken") @Valid String refr return ResponseEntity.ok() .header(HttpHeaders.SET_COOKIE, cookie.toString()) - .header(ACCESS_TOKEN.getValue(), tokens.accessToken()) + .header(AUTH_HEADER.getValue(), tokens.accessToken()) .body(SuccessResponse.noContent()); } @@ -205,7 +204,7 @@ private ResponseEntity getResponseEntity(Long userId, Jwt tokens) { return ResponseEntity.ok() .header(HttpHeaders.SET_COOKIE, cookie.toString()) - .header(ACCESS_TOKEN.getValue(), tokens.accessToken()) + .header(AUTH_HEADER.getValue(), tokens.accessToken()) .body(SuccessResponse.from(Map.of("userId", userId))); } } diff --git a/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/oauth/controller/OauthApi.java b/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/oauth/controller/OauthApi.java index 4871dfac..646b6ebe 100644 --- a/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/oauth/controller/OauthApi.java +++ b/fitapet-app-external-api/src/main/java/kr/co/fitapet/api/apis/oauth/controller/OauthApi.java @@ -29,8 +29,7 @@ import java.util.Map; import java.util.Optional; -import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.ACCESS_TOKEN; -import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.REFRESH_TOKEN; +import static kr.co.fitapet.api.common.security.jwt.consts.AuthConstants.*; @Tag(name = "OAuth API") @RestController @@ -109,7 +108,7 @@ public ResponseEntity signUpSmsAuthorization( return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); else if (token.getValue().refreshToken() == null) return ResponseEntity.ok() - .header(ACCESS_TOKEN.getValue(), token.getValue().accessToken()) + .header(AUTH_HEADER.getValue(), token.getValue().accessToken()) .body(SuccessResponse.from(Map.of("member", "신규 회원"))); return getJwtResponseEntity(token.getKey(), token.getValue()); @@ -120,7 +119,7 @@ private ResponseEntity getJwtResponseEntity(Long userId, Jwt jwt) { return ResponseEntity.ok() .header(HttpHeaders.SET_COOKIE, cookie.toString()) - .header(ACCESS_TOKEN.getValue(), jwt.accessToken()) + .header(AUTH_HEADER.getValue(), jwt.accessToken()) .body(SuccessResponse.from(Map.of("userId", userId))); } } diff --git a/fitapet-app-external-api/src/main/resources/application.yml b/fitapet-app-external-api/src/main/resources/application.yml index 04ea6e84..42b4ece4 100644 --- a/fitapet-app-external-api/src/main/resources/application.yml +++ b/fitapet-app-external-api/src/main/resources/application.yml @@ -52,12 +52,17 @@ spring: server: port: 8080 forward-headers-strategy: framework + http2: + enabled: true spring: config: activate: on-profile: prod + main: + allow-bean-definition-overriding: true + mvc: throw-exception-if-no-handler-found: true web: diff --git a/fitapet-infra/src/main/resources/application-infra.yml b/fitapet-infra/src/main/resources/application-infra.yml index e258ee73..2046aceb 100644 --- a/fitapet-infra/src/main/resources/application-infra.yml +++ b/fitapet-infra/src/main/resources/application-infra.yml @@ -108,8 +108,23 @@ oauth2: client-name: Apple ncp: - api-key: ${NCP_API_ACCESS_KEY} - secret-key: ${NCP_SECRET_KEY} + credentials: + api-key: ${NCP_API_ACCESS_KEY} + secret-key: ${NCP_SECRET_KEY} sms: service-key: ${NCP_SMS_KEY} - sender-phone: ${SENDER_PHONE} \ No newline at end of file + sender-phone: ${SENDER_PHONE} + +cloud: + aws: + s3: + endpoint: ${NCP_OBJECT_STORAGE_URI} + bucket: ${NCP_OBJECT_STORAGE_BUCKET} + credentials: + access-key: ${NCP_API_ACCESS_KEY} + secret-key: ${NCP_SECRET_KEY} + region: + static: ${NCP_OBJECT_STORAGE_REGION} + auto: false + stack: + auto: false \ No newline at end of file diff --git a/proxy/conf.d/default.conf b/proxy/conf.d/default.conf index be5e5bb0..6fb2419e 100644 --- a/proxy/conf.d/default.conf +++ b/proxy/conf.d/default.conf @@ -28,7 +28,7 @@ server { ssl_certificate_key /etc/letsencrypt/live/fitapet.co.kr/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - + ssl_protocols TLSv1.2 TLSv1.3; access_log /var/log/nginx/access.log;