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

[FEAT] 카카오 로그인 구현 및 사용자 인증 방식 개선 #179

Merged
merged 79 commits into from
Sep 21, 2024

Conversation

Kim-TaeUk
Copy link
Contributor

@Kim-TaeUk Kim-TaeUk commented Sep 10, 2024

Related Issue

Key Changes

  • 리프레시 토큰 도입
    • 최초 인증(로그인) 시, 엑세스와 리프레시 발급. 이 때 서버측 저장소(레디스)에 리프레시 저장
    • 이후 매 요청마다 엑세스로 인증
    • 만료된 엑세스일 경우 401
    • 엑세스 재발급을 위해 리프레시로 요청(reissue)
    • 유효한 리프레시인 경우 엑세스와 리프레시 재발급. 한 번 사용한 리프레시는 다시 사용하지 않고 재발급(Refresh Token Rotation; RTR)
    • 등록되지 않은 경우 401
    • 만료된 리프레시일 경우 401
  • 온보딩 진행 여부 판단
    • 소셜 로그인 후, 온보딩은 진행하지 않고 이탈하는 경우 등의 케이스에 대해 온보딩을 진행했는 지 여부를 파악해야 합니다.
    • nickname을 분석하여 isRegister로 분류합니다.

To Reviewers

  • 플로우가 어색한 부분이나 개선할 부분 있으면 말씀해주세요.

JWT를 parsing하여 claim 부분을 반환하는 메서드이기 때문에 적절한 메서드명으로 rename
HS256을 명시적으로 지정하여 사용, secret key의 길이에 따라 선택되는 알고리즘이 달라지는 현상 방지
userId를 return하는 메서드이기때문에 역할에 맞는 메서드명으로 rename
PostConstruct를 통해 인코딩했음에도 다시 인코딩하는 중복 작업 제거
템플릿 메서드 패턴을 통해 공통 로직은 generateJWT에서 정의,
만료 시간(세부 구현)은 generateAccessToken와 generateRefreshToken에 위임
from generateJWT to generateAccessToken
만료 시 filter chain은 중단: return;
401 UNAUTHORIZED, reissue 요구하는 message로 응답
build.gradle Show resolved Hide resolved
@Kim-TaeUk Kim-TaeUk changed the title [FEAT] to be cont... [FEAT] 사용자 인증 방식 개선 Sep 14, 2024
Copy link
Member

@ChaeAg ChaeAg left a comment

Choose a reason for hiding this comment

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

어렵네요 .. 고생많으셨을 것 같습니다
코멘트 조금 달았지만 소소해서 확인만 해주시와요 ~ 🤭

Copy link
Contributor

@rinarina0429 rinarina0429 left a comment

Choose a reason for hiding this comment

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

복잡하네요,,, 수고 많으셨습니다 리뷰 한번만 확인해주세요!

@Kim-TaeUk Kim-TaeUk changed the title [FEAT] 사용자 인증 방식 개선 [FEAT] 카카오 로그인 구현 및 사용자 인증 방식 개선 Sep 20, 2024
@Kim-TaeUk Kim-TaeUk merged commit c7b2e07 into dev Sep 21, 2024
1 check 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.

[FEAT] 유저 인증 방식 보완
3 participants