-
Notifications
You must be signed in to change notification settings - Fork 10
[6주차] 박승주/[feat] KAKAO OAuth2 인증/인가 구현 추가 #118
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
base: 박승주/main
Are you sure you want to change the base?
The head ref may contain hidden characters: "\uBC15\uC2B9\uC8FC/6\uC8FC\uCC28"
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.
OAuth2 인증 후 처리 흐름을 SuccessHandler로 잘 분리해, 구조적으로 안정적인 설계를 하셨다는 부분이 인상 깊었습니다!
특히 Refresh Token을 보안 쿠키로 세심하게 설정하신 걸 보면서, 작은 디테일까지 잘 챙기신 코드라는 느낌이 들어서 많이 배우고 갑니다 😊
| Object acc = attr.get("kakao_account"); | ||
| if (acc instanceof Map) { | ||
| Object profile = ((Map<?, ?>) acc).get("profile"); | ||
| if (profile instanceof Map) nickname = (String) ((Map<?, ?>) profile).get("nickname"); | ||
| else { | ||
| nickname = null; | ||
| } | ||
| } else { | ||
| nickname = 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.
kakao_account → profile → nickname 으로 이어지는 중첩 구조를
단순히 캐스팅하지 않고, instanceof 로 한 단계씩 꼼꼼하게 체크해준 점이 좋은 것 같습니다!
또, 카카오 OAuth 응답은 종종 필드가 빠져 있거나 null이 내려오는 경우가 있다고 하는데,
이런 구조적 불확실성을 잘 고려해 NPE를 사전에 확실히 방지한 안전한 파싱 로직이 인상적이었습니다!! 👍🏻👍🏻
| u.setId(userId); // 레퍼런스만 set | ||
| u.setNickname(profile_nickname); |
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.
User객체를 생성하고 내부 필드값을 세팅을 하고 있지만 이후 해당 생성된 객체를 사용하지 않는 것으로 보이는데 이렇게 작성하신 이유가 있을까요?
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.
해당 정적 메서드는 향후에 기존 User에 저장되어 있는 사용자와 UserSocial을 연동할 때 사용될 것으로 생각되어 제작한 메서드입니다. 아직 해당 기능은 구현하지 못해 참조없음으로 남겨두었습니다.
어떤 위험이나 장애를 발견했나요?
관련 스크린샷을 첨부해주세요.