-
Notifications
You must be signed in to change notification settings - Fork 7
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
AuthenticationPrinciple 어노테이션에 required 속성 추가 #747
AuthenticationPrinciple 어노테이션에 required 속성 추가 #747
Conversation
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.
고생했어요 짱수~!! 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
리뷰 남겼으니 확인 부탁드려욥
backend/src/main/java/codezap/auth/manager/CookieCredentialManager.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/provider/PlainCredentialProvider.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/provider/PlainCredentialProvider.java
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
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.
짱수 수고하셨어요 !!!! 짱 ~! 몇가지 의견 남겨뒀어요 ~ 확인 부탁드려요 ~~
backend/src/main/java/codezap/auth/manager/CookieCredentialManager.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/codezap/template/controller/TemplateController.java
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/configuration/AuthArgumentResolverTest.java
Outdated
Show resolved
Hide resolved
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.
required 옵션을 사용해서 문제를 해결하려고는 아무도 생각하지 못했는데 창의적이고 멋지네요 👍👍👍
코드잽에서 처음으로 하위 호완성을 고려한 API 설계가 등장했네요.
@Deprecated
도입한 짱수 멋져요~~~!
backend/src/main/java/codezap/auth/configuration/AuthArgumentResolver.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/codezap/auth/manager/CookieCredentialManager.java
Outdated
Show resolved
Hide resolved
backend/src/main/java/codezap/auth/manager/CredentialManager.java
Outdated
Show resolved
Hide resolved
if (member == null) { | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable) | ||
); | ||
} | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable, member) | ||
); |
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.
여기선 삼항연산자를 사용하는게 더 보기 좋을 것 같은데, 짱수 생각은 다를 수 있으니 자유롭게 반영해주세요.
삼항연산자는 컨벤션에 반하는 문법이지만 컨벤션이라는 것도 코드를 더 잘 관리하기 위해 존재하는 것이라, 이렇게 코드가 긴 경우에는 예외적으로 사용해도 좋을 것 같아 제안해요~
TO-BE
if (member == null) { | |
return ResponseEntity.ok( | |
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable) | |
); | |
} | |
return ResponseEntity.ok( | |
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable, member) | |
); | |
FindAllTemplatesResponse response = (member == null) | |
? templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable) | |
: templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable, member); | |
return ResponseEntity.ok(response); |
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.
오! 저는 꽤나 만족스러운 결과로 보이는데요!!!
다만 이 부분은 컨벤션과 관련된 부분이라서 다른 크루들의 의견도 묻고 싶어요. (괜히 수정했다가 롤백 하게 될까봐... 😅 )
@jminkkk @kyum-q @HoeSeong123 다들 어떻게 생각하시나용??
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.
저는 좋다고 생각해요. 삼항연산자를 안 쓰는 이유는 코드의 가독성이 떨어지기 때문이라고 생각하는데, 이 경우는 오히려 올라가지 않았나...라고 생각합니닷
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.
저도 동의합니답~~
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.
모두 동의한다면 반박할 이유가 없어용~!! 굿 쟞!
if (member == null) { | ||
return ResponseEntity.ok(templateApplicationService.findById(id)); | ||
} | ||
return ResponseEntity.ok(templateApplicationService.findById(id, member)); |
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.
여기도 위와 같은 내용입니다~
if (member == null) { | |
return ResponseEntity.ok(templateApplicationService.findById(id)); | |
} | |
return ResponseEntity.ok(templateApplicationService.findById(id, member)); | |
FindTemplateResponse response = (member == null) | |
? templateApplicationService.findById(id) | |
: templateApplicationService.findById(id, member); | |
return ResponseEntity.ok(response); |
backend/src/main/java/codezap/template/controller/TemplateController.java
Show resolved
Hide resolved
backend/src/test/java/codezap/auth/provider/PlainCredentialProvider.java
Show resolved
Hide resolved
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.
열심히 읽어봤는데 이미 폭풍 리뷰가 많이 달려서 제가 추가할만한 부분이 거의 없는 것 같아요.
삼항연산자 관련해서는 정말 많이 고민해봤는데 아무리 생각해도 저게 최선일 것 같네요....
고생하셨습니다 짱수!!
if (member == null) { | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable) | ||
); | ||
} | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable, member) | ||
); |
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.
저는 좋다고 생각해요. 삼항연산자를 안 쓰는 이유는 코드의 가독성이 떨어지기 때문이라고 생각하는데, 이 경우는 오히려 올라가지 않았나...라고 생각합니닷
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.
required 아이디어 너무 좋았습니다 짱수 굳~
수고했어요
if (member == null) { | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable) | ||
); | ||
} | ||
return ResponseEntity.ok( | ||
templateApplicationService.findAllBy(memberId, keyword, categoryId, tagIds, pageable, member) | ||
); |
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.
저도 동의합니답~~
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.
대 짱 수
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.
귯쟙
⚡️ 관련 이슈
close #745
📍주요 변경 사항
AuthenticationPrinciple
어노테이션에required
속성 추가AuthArgumentResolver
로직 변경 및 테스트 추가🎸기타
/login
을 사용하는 분기는@Deprecated
처리해 두었습니다.XXXWithMember
를 사용하는 서비스 메서드 이름을 오버로딩으로 변경하였습니다.Member loginMember
라고만 적어 두어도 간결한 메서드 이름으로 더 명확하게 동작을 나타낼 수 있을 것으로 판단하였습니다.null
로 들어오는 것을 예상할 수 있는 가장 빠른 곳에서 분기를 해 주는 것이 인지 부조화가 가장 적다고 판단하였습니다.