From 72b53ab8e4d2a363d024659054c592c84c17c61b Mon Sep 17 00:00:00 2001 From: PgmJun Date: Mon, 24 Jul 2023 15:13:56 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=94=A7:=20chore=20log=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20gitignore=20=EC=84=A4=EC=A0=95=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 404f76b..16ffc99 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build/ !gradle/wrapper/gradle-wrapper.jar !src/main/**/build/ !src/test/**/build/ +**/*.log ### STS ### .apt_generated @@ -36,4 +37,4 @@ out/ ### VS Code ### .vscode/ -firebase_service_key.json \ No newline at end of file +firebase_service_key.json!/log/ From f04101ffbc4d8ad12bfbdbbc4b6cba774df9b56c Mon Sep 17 00:00:00 2001 From: PgmJun Date: Mon, 24 Jul 2023 16:22:22 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=E2=9C=A8:=20feat=20LogBack=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lionheart-common/src/main/resources/logback-spring.xml diff --git a/lionheart-common/src/main/resources/logback-spring.xml b/lionheart-common/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..286b443 --- /dev/null +++ b/lionheart-common/src/main/resources/logback-spring.xml @@ -0,0 +1,46 @@ + + + + + + + + + + ${CONSOLE_LOG_PATTERN} + + + + + + ${FILE_LOG_PATTERN} + + + ./log/%d{yyyy-MM-dd}.%i.log + 100MB + 30 + + + + + + + + + + + + + + + + + + + + + + + + From bd51a8670d3a0aac528470c63efc24aa6f3a11eb Mon Sep 17 00:00:00 2001 From: PgmJun Date: Mon, 24 Jul 2023 21:16:46 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20fix=20=EC=9A=B4?= =?UTF-8?q?=EC=98=81=EC=84=9C=EB=B2=84=EB=8F=84=20INFO=20=EB=A0=88?= =?UTF-8?q?=EB=B2=A8=20=EC=9D=B4=EC=83=81=20=EB=A1=9C=EA=B7=B8=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lionheart-common/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lionheart-common/src/main/resources/logback-spring.xml b/lionheart-common/src/main/resources/logback-spring.xml index 286b443..4dd592d 100644 --- a/lionheart-common/src/main/resources/logback-spring.xml +++ b/lionheart-common/src/main/resources/logback-spring.xml @@ -37,7 +37,7 @@ - + From 8d102aeb98a066fbaaaa42b4b6104a29861c6fbf Mon Sep 17 00:00:00 2001 From: HyeokJoon Kong Date: Tue, 25 Jul 2023 22:45:47 +0900 Subject: [PATCH 4/9] Update README.md --- README.md | 306 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 261 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 77b50df..7c7f108 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,13 @@ API 개발 | API 개발 | API 개발 | +

+## 📝 Coding Convention, Git flow +> [Convention and flow](https://www.notion.so/efe35fa22c0044b4bd4c0dd5ff014d04?pvs=4) -
- -## 📝 Coding Convention, Git flow -- [Convention and flow](https://www.notion.so/efe35fa22c0044b4bd4c0dd5ff014d04?pvs=4) +

## 📒 Foldering @@ -48,14 +48,13 @@ API 개발 | API 개발 | API 개발 | │  │  └─ 🐞-bug.md │  ├─ PULL_REQUEST_TEMPLATE.md │  └─ workflows -│     ├─ CD-dev.yml -│     ├─ CD-prod.yml -│     ├─ CI-dev.yml -│     └─ CI-prod.yml +│     ├─ api-cd-dev.yml +│     ├─ api-ci-dev.yml +│     ├─ notification-cd-dev.yml +│     └─ notification-ci-dev.yml ├─ .gitignore ├─ .gitmessage.txt ├─ README.md -├─ appspec.yml ├─ build.gradle ├─ docker-compose.yml ├─ gradle @@ -75,14 +74,121 @@ API 개발 | API 개발 | API 개발 | │        │           └─ api │        │              ├─ ApiApplication.java │        │              ├─ config +│        │              │  ├─ WebConfig.java +│        │              │  ├─ interceptor +│        │              │  │  ├─ admin +│        │              │  │  │  ├─ Admin.java +│        │              │  │  │  ├─ AdminCheckHandler.java +│        │              │  │  │  └─ AdminInterceptor.java +│        │              │  │  └─ auth +│        │              │  │     ├─ Auth.java +│        │              │  │     ├─ AuthInterceptor.java +│        │              │  │     └─ LoginCheckHandler.java +│        │              │  ├─ redis +│        │              │  │  └─ RedisConfig.java +│        │              │  ├─ resolver +│        │              │  │  ├─ MemberId.java +│        │              │  │  └─ MemberIdResolver.java +│        │              │  ├─ sqs +│        │              │  │  ├─ SqsConfig.java +│        │              │  │  └─ producer +│        │              │  │     └─ SqsProducer.java │        │              │  └─ swagger │        │              │     └─ SwaggerConfig.java -│        │              └─ controller -│        │                 └─ advice -│        │                    └─ ControllerAdvice.java +│        │              ├─ controller +│        │              │  ├─ advice +│        │              │  │  └─ ControllerAdvice.java +│        │              │  ├─ article +│        │              │  │  └─ ArticleRetrieveController.java +│        │              │  ├─ articlebookmark +│        │              │  │  ├─ ArticleBookmarkController.java +│        │              │  │  └─ ArticleBookmarkRetrieveController.java +│        │              │  ├─ auth +│        │              │  │  └─ AuthController.java +│        │              │  ├─ challenge +│        │              │  │  └─ ChallengeRetrieveController.java +│        │              │  ├─ curriculum +│        │              │  │  └─ CurriculumRetrieveController.java +│        │              │  ├─ member +│        │              │  │  ├─ MemberController.java +│        │              │  │  └─ MemberRetrieveController.java +│        │              │  └─ notification +│        │              │     ├─ NotificationController.java +│        │              │     └─ dto +│        │              │        └─ request +│        │              │           ├─ CustomNotificationRequest.java +│        │              │           └─ SlackNotificationRequest.java +│        │              └─ service +│        │                 ├─ article +│        │                 │  ├─ ArticleRetrieveService.java +│        │                 │  ├─ ArticleServiceUtils.java +│        │                 │  ├─ articleContent +│        │                 │  │  └─ ArticleContentServiceUtils.java +│        │                 │  ├─ articleTag +│        │                 │  │  └─ ArticleTagServiceUtils.java +│        │                 │  └─ dto +│        │                 │     └─ response +│        │                 │        ├─ ArticleBookmarkSummaryDto.java +│        │                 │        ├─ ArticleContentDto.java +│        │                 │        ├─ ArticleDetailResponse.java +│        │                 │        ├─ ArticleSummaryDto.java +│        │                 │        ├─ ArticleSummaryResponse.java +│        │                 │        ├─ TodayArticleResponse.java +│        │                 │        └─ WeekArticleSummaryResponse.java +│        │                 ├─ articlebookmark +│        │                 │  ├─ ArticleBookmarkRetrieveService.java +│        │                 │  ├─ ArticleBookmarkService.java +│        │                 │  ├─ ArticleBookmarkServiceUtils.java +│        │                 │  └─ dto +│        │                 │     ├─ request +│        │                 │     │  └─ UpdateArticleBookmarkRequest.java +│        │                 │     └─ response +│        │                 │        ├─ ArticleBookmarkResponse.java +│        │                 │        └─ ArticleSummaryDto.java +│        │                 ├─ auth +│        │                 │  ├─ AuthService.java +│        │                 │  ├─ AuthServiceProvider.java +│        │                 │  ├─ CommonAuthService.java +│        │                 │  ├─ CreateTokenService.java +│        │                 │  ├─ dto +│        │                 │  │  ├─ request +│        │                 │  │  │  ├─ LoginRequest.java +│        │                 │  │  │  ├─ SignUpRequest.java +│        │                 │  │  │  └─ TokenRequest.java +│        │                 │  │  └─ response +│        │                 │  │     └─ TokenResponse.java +│        │                 │  └─ impl +│        │                 │     └─ KakaoAuthService.java +│        │                 ├─ challenge +│        │                 │  ├─ ChallengeRetrieveService.java +│        │                 │  ├─ ChallengeService.java +│        │                 │  ├─ ChallengeServiceUtils.java +│        │                 │  └─ dto +│        │                 │     └─ response +│        │                 │        └─ ChallengeProgressResponse.java +│        │                 ├─ curriculum +│        │                 │  ├─ CurriculumRetrieveService.java +│        │                 │  └─ dto +│        │                 │     └─ response +│        │                 │        └─ CurriculumProgressResponse.java +│        │                 ├─ member +│        │                 │  ├─ MemberRetrieveService.java +│        │                 │  ├─ MemberService.java +│        │                 │  ├─ MemberServiceUtils.java +│        │                 │  └─ dto +│        │                 │     ├─ request +│        │                 │     │  └─ CreateMemberRequest.java +│        │                 │     └─ response +│        │                 │        └─ ProfileResponse.java +│        │                 └─ notification +│        │                    └─ NotificationService.java │        └─ resources +│           ├─ application-dev.yml │           ├─ application-local.yml │           ├─ application.yml +│           ├─ bootstrap.yml +│           ├─ messages +│           │  └─ validation.properties │           └─ sql │              ├─ data.sql │              └─ schema.sql @@ -91,20 +197,48 @@ API 개발 | API 개발 | API 개발 | │  └─ src │     └─ main │        └─ java -│           └─ com.chiwawa.lionheart.common -│              ├─ LionHeartCommonRoot.java -│              ├─ dto -│              │  └─ ApiResponse.java -│              └─ exception -│                 ├─ BadGatewayException.java -│                 ├─ ConflictException.java -│                 ├─ ErrorCode.java -│                 ├─ ForbiddenException.java -│                 ├─ InternalServerException.java -│                 ├─ LionHeartException.java -│                 ├─ NotFoundException.java -│                 ├─ UnAuthorizedException.java -│                 └─ ValidationException.java +│           └─ com +│              └─ chiwawa +│                 └─ lionheart +│                    └─ common +│                       ├─ LionHeartCommonRoot.java +│                       ├─ constant +│                       │  ├─ Constraint.java +│                       │  ├─ JwtKey.java +│                       │  ├─ MessageType.java +│                       │  ├─ ProfileType.java +│                       │  ├─ RedisKey.java +│                       │  └─ message +│                       │     ├─ ArticleBookmarkErrorMessage.java +│                       │     ├─ ArticleErrorMessage.java +│                       │     ├─ AuthErrorMessage.java +│                       │     ├─ CategoryErrorMessage.java +│                       │     ├─ ChallengeErrorMessage.java +│                       │     ├─ FirebaseErrorMessage.java +│                       │     └─ MemberErrorMessage.java +│                       ├─ dto +│                       │  ├─ ApiResponse.java +│                       │  ├─ WeekAndDay.java +│                       │  └─ sqs +│                       │     ├─ FirebaseDto.java +│                       │     ├─ MessageDto.java +│                       │     └─ SlackDto.java +│                       ├─ exception +│                       │  ├─ ErrorCode.java +│                       │  └─ model +│                       │     ├─ BadGatewayException.java +│                       │     ├─ ConflictException.java +│                       │     ├─ ForbiddenException.java +│                       │     ├─ InternalServerException.java +│                       │     ├─ LionHeartException.java +│                       │     ├─ NotFoundException.java +│                       │     ├─ UnAuthorizedException.java +│                       │     └─ ValidationException.java +│                       └─ util +│                          ├─ DateUtils.java +│                          ├─ JwtUtils.java +│                          ├─ MessageUtils.java +│                          └─ UuidUtils.java ├─ lionheart-domain │  ├─ build.gradle │  └─ src @@ -123,29 +257,59 @@ API 개발 | API 개발 | API 개발 | │                       └─ domain │                          ├─ article │                          │  ├─ Article.java -│                          │  ├─ ArticleCategory.java -│                          │  ├─ ArticleContent.java -│                          │  ├─ ArticleContentType.java -│                          │  ├─ ArticleImage.java -│                          │  └─ Category.java +│                          │  ├─ ArticleType.java +│                          │  ├─ Category.java +│                          │  ├─ articleContent +│                          │  │  ├─ ArticleContent.java +│                          │  │  └─ ArticleContentType.java +│                          │  ├─ articleTag +│                          │  │  └─ ArticleTag.java +│                          │  └─ repository +│                          │     ├─ ArticleRepository.java +│                          │     ├─ ArticleRepositoryCustom.java +│                          │     └─ ArticleRepositoryImpl.java │                          ├─ articlebookmark -│                          │  └─ ArticleBookmark.java +│                          │  ├─ ArticleBookmark.java +│                          │  └─ repository +│                          │     ├─ ArticleBookmarkRepository.java +│                          │     ├─ ArticleBookmarkRepositoryCustom.java +│                          │     └─ ArticleBookmarkRepositoryImpl.java │                          ├─ challenge │                          │  ├─ Attendance.java │                          │  ├─ Challenge.java │                          │  ├─ ChallengeLevelType.java -│                          │  └─ ChallengePopupType.java +│                          │  └─ repository +│                          │     ├─ AttendanceRepository.java +│                          │     ├─ AttendanceRepositoryCustom.java +│                          │     ├─ AttendanceRepositoryImpl.java +│                          │     ├─ ChallengeRepository.java +│                          │     ├─ ChallengeRepositoryCustom.java +│                          │     └─ ChallengeRepositoryImpl.java │                          ├─ common │                          │  └─ BaseEntity.java -│                          └─ member -│                             ├─ Member.java -│                             ├─ MemberSocialType.java -│                             ├─ Onboarding.java -│                             ├─ SocialInfo.java +│                          ├─ member +│                          │  ├─ Member.java +│                          │  ├─ MemberRole.java +│                          │  ├─ MemberSocialType.java +│                          │  ├─ NotificationStatus.java +│                          │  ├─ Onboarding.java +│                          │  ├─ Setting.java +│                          │  ├─ SocialInfo.java +│                          │  └─ repository +│                          │     ├─ MemberRepository.java +│                          │     ├─ MemberRepositoryCustom.java +│                          │     ├─ MemberRepositoryImpl.java +│                          │     ├─ OnboardingRepository.java +│                          │     ├─ OnboardingRepositoryCustom.java +│                          │     ├─ OnboardingRepositoryImpl.java +│                          │     ├─ SettingRepository.java +│                          │     └─ SettingRepositoryCustom.java +│                          └─ notification +│                             ├─ TodayArticleNotification.java │                             └─ repository -│                                ├─ MemberRepository.java -│                                ├─ MemberRepositoryCustom.java -│                                └─ MemberRepositoryImpl.java +│                                ├─ TodayArticleNotificationRepository.java +│                                ├─ TodayArticleNotificationRepositoryCustom.java +│                                └─ TodayArticleNotificationRepositoryImpl.java ├─ lionheart-external │  ├─ build.gradle │  └─ src @@ -155,11 +319,63 @@ API 개발 | API 개발 | API 개발 | │              └─ chiwawa │                 └─ lionheart │                    └─ external -│                       └─ LionHeartExternalRoot.java +│                       ├─ LionHeartExternalRoot.java +│                       ├─ client +│                       │  ├─ auth +│                       │  │  └─ kakao +│                       │  │     ├─ KakaoApiCaller.java +│                       │  │     ├─ WebClientKakaoCaller.java +│                       │  │     └─ dto +│                       │  │        └─ response +│                       │  │           └─ KakaoProfileResponse.java +│                       │  └─ firebase +│                       │     ├─ FirebaseApiCaller.java +│                       │     └─ WebClientFirebaseCaller.java +│                       └─ config +│                          └─ webclient +│                             └─ WebClientConfig.java +├─ lionheart-notification +│  ├─ build.gradle +│  └─ src +│     └─ main +│        ├─ java +│        │  └─ com +│        │     └─ chiwawa +│        │        └─ lionheart +│        │           └─ notification +│        │              ├─ NotificationApplication.java +│        │              ├─ config +│        │              │  ├─ scheduler +│        │              │  │  ├─ SchedulerConfig.java +│        │              │  │  └─ SchedulerErrorHandler.java +│        │              │  └─ sqs +│        │              │     ├─ SqsConfig.java +│        │              │     └─ consumer +│        │              │        └─ SqsConsumer.java +│        │              └─ service +│        │                 ├─ firebase +│        │                 │  ├─ FirebaseCloudMessageService.java +│        │                 │  └─ dto +│        │                 │     └─ request +│        │                 │        └─ FcmMessageRequest.java +│        │                 ├─ scheduler +│        │                 │  └─ SchedulerService.java +│        │                 └─ slack +│        │                    └─ SlackMessageService.java +│        └─ resources +│           ├─ application-dev.yml +│           ├─ application-local.yml +│           ├─ application.yml +│           └─ bootstrap.yml ├─ naver-intellij-formatter.xml ├─ scripts -│  ├─ deploy.sh -│  └─ switch.sh +│  ├─ lionheart-api +│  │  ├─ appspec.yml +│  │  ├─ health_check.sh +│  │  ├─ run_new_was.sh +│  │  └─ switch.sh +│  └─ lionheart-notification +│     ├─ appspec.yml +│     └─ deploy.sh └─ settings.gradle ``` - From eb0baa3e665a55e27ba91b8e100cc7de26d6bbb9 Mon Sep 17 00:00:00 2001 From: PgmJun Date: Fri, 28 Jul 2023 01:27:40 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20fix=20LogBack=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20gitignore=20=EC=88=98=EC=A0=95=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 16ffc99..5761f22 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ build/ !gradle/wrapper/gradle-wrapper.jar !src/main/**/build/ !src/test/**/build/ -**/*.log ### STS ### .apt_generated @@ -37,4 +36,4 @@ out/ ### VS Code ### .vscode/ -firebase_service_key.json!/log/ +firebase_service_key.json From ce501e565e2e5877603b1144325b5a5e8dc2f2b8 Mon Sep 17 00:00:00 2001 From: PgmJun Date: Fri, 28 Jul 2023 01:28:46 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20fix=20LionHeart=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=A1=9C=EA=B7=B8=20=EB=A0=88?= =?UTF-8?q?=EB=B2=A8=20TRACE=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lionheart-common/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lionheart-common/src/main/resources/logback-spring.xml b/lionheart-common/src/main/resources/logback-spring.xml index 4dd592d..df65ccd 100644 --- a/lionheart-common/src/main/resources/logback-spring.xml +++ b/lionheart-common/src/main/resources/logback-spring.xml @@ -25,7 +25,7 @@ - + From 3c2dd4447bb26f0f51508b8d7c05a391c0776d50 Mon Sep 17 00:00:00 2001 From: PgmJun Date: Fri, 28 Jul 2023 01:56:54 +0900 Subject: [PATCH 7/9] =?UTF-8?q?=E2=9A=A1=EF=B8=8F:=20fix=20=EC=95=8C?= =?UTF-8?q?=EB=A6=BC=EC=84=9C=EB=B2=84,=20API=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EB=B6=84=EB=A6=AC=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lionheart-common/src/main/resources/logback-spring.xml b/lionheart-common/src/main/resources/logback-spring.xml index df65ccd..ddd417e 100644 --- a/lionheart-common/src/main/resources/logback-spring.xml +++ b/lionheart-common/src/main/resources/logback-spring.xml @@ -12,12 +12,23 @@ - + ${FILE_LOG_PATTERN} - ./log/%d{yyyy-MM-dd}.%i.log + /home/ubuntu/api-server/logs/%d{yyyy-MM-dd}.%i.log + 100MB + 30 + + + + + + ${FILE_LOG_PATTERN} + + + /home/ubuntu/notification-server/logs/%d{yyyy-MM-dd}.%i.log 100MB 30 @@ -25,22 +36,33 @@ - + + - + + + + + + - + + + + + + From f8a0b8606fc955fa4e7420d1d072b1bd906cbf47 Mon Sep 17 00:00:00 2001 From: PgmJun Date: Fri, 28 Jul 2023 11:43:47 +0900 Subject: [PATCH 8/9] =?UTF-8?q?=E2=99=BB=EF=B8=8F:=20refactor=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20line,=20indent=20=EC=B5=9C=EC=86=8C=ED=99=94=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/config/interceptor/admin/AdminCheckHandler.java | 8 ++++---- .../api/config/interceptor/admin/AdminInterceptor.java | 4 ++-- lionheart-common/src/main/resources/logback-spring.xml | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java index 0594b58..450a95e 100644 --- a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java +++ b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java @@ -24,17 +24,17 @@ public class AdminCheckHandler { private final JwtUtils jwtUtils; private final MemberRepository memberRepository; - public void validateMemberRole(HttpServletRequest request) { + //TODO: hasRole로 메서드명 변경하고 hasAdminAuthority를 return하도록 변경하는건 어떨까? + public boolean hasRole(HttpServletRequest request) { String bearerToken = request.getHeader("Authorization"); if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { String accessToken = bearerToken.substring("Bearer ".length()); - if (hasAdminAuthority(accessToken)) { - return; - } + return hasAdminAuthority(accessToken); } throw new ForbiddenException(ADMIN_ERROR_MESSAGE, FORBIDDEN_ADMIN_EXCEPTION); } + //TODO: null 사용하지 않고 Optional로 변하면 어떨까 private boolean hasAdminAuthority(String accessToken) { if (jwtUtils.validateToken(accessToken)) { Long memberId = jwtUtils.getMemberIdFromJwt(accessToken); diff --git a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminInterceptor.java b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminInterceptor.java index c699f63..d80b14c 100644 --- a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminInterceptor.java +++ b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminInterceptor.java @@ -27,7 +27,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons if (admin.isEmpty()) { return true; } - adminCheckHandler.validateMemberRole(request); - return true; + + return adminCheckHandler.hasRole(request); } } \ No newline at end of file diff --git a/lionheart-common/src/main/resources/logback-spring.xml b/lionheart-common/src/main/resources/logback-spring.xml index ddd417e..9ebf1ce 100644 --- a/lionheart-common/src/main/resources/logback-spring.xml +++ b/lionheart-common/src/main/resources/logback-spring.xml @@ -40,8 +40,8 @@
-
+ @@ -53,6 +53,7 @@ + From 1f34182e40fc7dcacd4ecd067c6eeecebdcb6cc6 Mon Sep 17 00:00:00 2001 From: PgmJun Date: Fri, 28 Jul 2023 11:45:58 +0900 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=94=A5:=20remove=20TODO=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20#67?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/config/interceptor/admin/AdminCheckHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java index 450a95e..c5ef9b8 100644 --- a/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java +++ b/lionheart-api/src/main/java/com/chiwawa/lionheart/api/config/interceptor/admin/AdminCheckHandler.java @@ -24,7 +24,6 @@ public class AdminCheckHandler { private final JwtUtils jwtUtils; private final MemberRepository memberRepository; - //TODO: hasRole로 메서드명 변경하고 hasAdminAuthority를 return하도록 변경하는건 어떨까? public boolean hasRole(HttpServletRequest request) { String bearerToken = request.getHeader("Authorization"); if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { @@ -34,7 +33,6 @@ public boolean hasRole(HttpServletRequest request) { throw new ForbiddenException(ADMIN_ERROR_MESSAGE, FORBIDDEN_ADMIN_EXCEPTION); } - //TODO: null 사용하지 않고 Optional로 변하면 어떨까 private boolean hasAdminAuthority(String accessToken) { if (jwtUtils.validateToken(accessToken)) { Long memberId = jwtUtils.getMemberIdFromJwt(accessToken);