-
Notifications
You must be signed in to change notification settings - Fork 0
[Release] v2.0.6 릴리즈 #230
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
[Release] v2.0.6 릴리즈 #230
Conversation
* refactor: amount rating, taste rating 제거 * refactor: 안쓰는 메서드 제거 * docs: local yml 규칙 추가 * fix: 평균 별점 계산 안되는 문제 수정 * docs: local yml 제거 * chore: beer->pub
* fix: Security Filter Chain 수정 선택적으로 토큰을 받을 수 있돌고 수정 * fix: yml 하드 코딩 제거 --------- Co-authored-by: 나용준 <[email protected]>
Co-authored-by: 나용준 <[email protected]>
Summary of ChangesHello @yongjun0511, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 v2.0.6 릴리즈를 위한 변경사항을 포함하며, 핵심적으로 리뷰 평점 시스템을 '메인 평점' 하나로 간소화하여 코드 복잡성을 줄였습니다. 또한, 제휴 정보 표시 로직을 개선하고, 리뷰 가능한 메뉴 목록에 메뉴 ID를 추가하여 사용자 경험을 향상시켰습니다. JWT 인증 필터의 동작 방식도 조정되었으며, 개발 환경 설정 파일이 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. 평점은 하나로, 코드도 간결해졌네, 릴리즈의 기쁨. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
v2.0.6 릴리즈를 위한 PR로 보입니다. 리뷰 시스템에서 tasteRating과 amountRating을 제거하고 mainRating으로 단일화하는 대규모 리팩토링, '총학' 제휴 로직 개선, 화이트리스트 API에 대한 선택적 인증 허용, API 응답 DTO 개선 등 여러 변경 사항이 포함되어 있습니다. 전반적으로 변경 사항들은 잘 적용된 것으로 보입니다. 특히 리뷰 시스템 리팩토링은 여러 파일에 걸쳐 일관성 있게 수정되었습니다. 리뷰에서는 새로 추가된 선택적 인증 로직의 잠재적인 문제점과 제휴 DTO의 가독성 개선에 대한 제안을 포함했습니다.
| String token = resolveToken(httpRequest); | ||
| if (token != null && jwtTokenProvider.validateToken(token)) { | ||
| Authentication authentication = jwtTokenProvider.getAuthentication(token); | ||
| SecurityContextHolder.getContext().setAuthentication(authentication); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
화이트리스트에 포함된 URL의 경우, 인증이 선택적이어야 합니다. 즉, 유효한 토큰이 있으면 인증된 사용자로 처리하고, 토큰이 없거나 유효하지 않으면 비로그인 사용자로 처리하여 요청을 계속 진행해야 합니다.
현재 코드는 jwtTokenProvider.validateToken(token)이 true를 반환하더라도 jwtTokenProvider.getAuthentication(token)에서 예외(예: JsonProcessingException)가 발생할 수 있습니다. 이 경우, 예외가 처리되지 않아 서버 오류(500)가 발생하여 비로그인 상태로도 접근 가능해야 할 화이트리스트 URL에 접근하지 못하는 문제가 생길 수 있습니다.
선택적 인증 로직을 try-catch 블록으로 감싸서 예외 발생 시에도 요청이 중단되지 않도록 하는 것이 안전합니다.
String token = resolveToken(httpRequest);
if (token != null && jwtTokenProvider.validateToken(token)) {
try {
Authentication authentication = jwtTokenProvider.getAuthentication(token);
SecurityContextHolder.getContext().setAuthentication(authentication);
} catch (Exception e) {
log.warn("JWT 토큰 인증 중 오류가 발생했으나, 화이트리스트 경로이므로 비로그인 상태로 계속 진행합니다. URI: {}", requestURI, e);
}
}| .collegeName(partnership.getPartnershipCollege() == null && partnership.getPartnershipDepartment() == null | ||
| ? "총학" | ||
| : (partnership.getPartnershipCollege() != null ? partnership.getPartnershipCollege().getName() : null)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collegeName을 결정하는 로직이 중첩된 삼항 연산자로 구현되어 있어 가독성이 떨어집니다. 코드를 더 명확하게 만들기 위해 이 로직을 별도의 private static 메서드로 추출하는 것을 고려해 보세요.
예를 들어, PartnershipInfo 클래스 내에 다음과 같은 헬퍼 메서드를 추가할 수 있습니다.
private static String getCollegeName(Partnership partnership) {
if (partnership.getPartnershipCollege() == null && partnership.getPartnershipDepartment() == null) {
return "총학";
}
if (partnership.getPartnershipCollege() != null) {
return partnership.getPartnershipCollege().getName();
}
return null;
}그리고 fromEntity 메서드에서는 다음과 같이 호출합니다.
.collegeName(getCollegeName(partnership))
No description provided.