Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

로그인 Interceptor 개선 #1616

Merged
merged 4 commits into from
Nov 23, 2023
Merged

Conversation

BGuga
Copy link
Contributor

@BGuga BGuga commented Nov 22, 2023

#️⃣연관된 이슈

#1612

📝작업 내용

@GetMapping("/sessions/{sessionId}/keywords/{keywordId}/quizs/{quizId}")
    public ResponseEntity<QuizResponse> findQuizById(@PathVariable Long quizId,
        @AuthMemberPrincipal LoginMember member) {
        return ResponseEntity.ok(quizService.findById(quizId, member.getId()));
    }

@DeleteMapping("/sessions/{sessionId}/keywords/{keywordId}/quizs/{quizId}")
    public ResponseEntity<Void> deleteQuiz(@PathVariable Long sessionId,
                                           @PathVariable Long keywordId,
                                           @PathVariable Long quizId) {
        quizService.deleteQuiz(quizId);
        return ResponseEntity.noContent().build();
    }

위와 같은 상황에서 Delete method에서도 로그인 검증이 일어나는 문제가 있었습니다.
이를 MethodPattern 이란 객체를 생성하여 메서드와 uri 두 가지가 만족해야 검증하도록 변경했습니다.

@BGuga BGuga changed the base branch from main to develop November 22, 2023 08:47
@BGuga BGuga self-assigned this Nov 22, 2023
@BGuga BGuga changed the base branch from develop to main November 22, 2023 08:48
Copy link

sonarcloud bot commented Nov 23, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

67.6% 67.6% Coverage
0.0% 0.0% Duplication

warning The version of Java (11.0.21) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more here

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

Copy link
Contributor

@amaran-th amaran-th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 푸우!
아까 설명해주신 덕분에 코드 이해가 한 결 쉬웠습니다ㅎㅎ
어려운 작업이었을텐데 수고 많으셨어요.
전체적으로 크게 수정할만한 부분은 보이지 않는 것 같습니다. 테스트코드도 꼼꼼하게 작성해주셨구요.
그러니 approve하도록 하겠습니다!

@@ -46,7 +46,7 @@ public class KeywordRecommendedPostStepDefinitions extends AcceptanceSteps {
public void 추천_포스트가_수정된다() {
int statusCode = context.response.statusCode();

assertThat(statusCode).isEqualTo(HttpStatus.OK.value());
assertThat(statusCode).isEqualTo(HttpStatus.NO_CONTENT.value());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 상태코드도 적절하게 수정해주셨네요! 굿입니다^^*

@BGuga BGuga merged commit 0b3f5b2 into main Nov 23, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LoginMember 의 토큰 검증 로직시 발생하는 URI 중복 문제를 해결한다.
2 participants