woowacourse / prolog

우아한테크코스 크루들이 배운 내용을 기록하는 학습로그 저장소입니다.
https://prolog.techcourse.co.kr/
MIT License
192 stars 28 forks source link

로그인 Interceptor 개선 #1616

Closed BGuga closed 9 months ago

BGuga commented 9 months ago

️⃣연관된 이슈

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 두 가지가 만족해야 검증하도록 변경했습니다.

sonarcloud[bot] commented 9 months ago

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