fix(auth): 회원가입 시 authId의 Bearer 접두사 처리 #302
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📄 Work Description
작업 내용
회원가입(
signUp) 로직에서,Authorization헤더로 받은authId에 포함될 수 있는Bearer접두사를 제거하는 기능을 추가했습니다. 이를 통해 데이터베이스에는 항상 순수한 소셜 인증 ID만 저장되도록 보장합니다.작업 배경 (문제 상황)
기존 가입 유저가 로그인 시도 시 신규 유저로 잘못 인식되어 로그인이 불가능한 문제가 발생했습니다. 원인은 클라이언트가 전달한
Bearer {authId}값을 서버가 파싱하지 않고 그대로 DB에 저장했기 때문입니다.설계 고민
Bearer접두사를 처리하는 로직의 위치에 대해 고민했습니다.AuthService(채택): 문제 상황이signUp로직에 한정되어 있고, 비즈니스 로직과의 응집도가 높아 가장 실용적이라고 판단했습니다.Resolver객체: SRP 원칙을 지킬 수 있어 가장 이상적인 구조지만, 현 상황에서는 과엔지니어링이라고 보았습니다.Controller계층: 계층 분리 원칙은 지킬 수 있으나 코드 중복의 우려가 있었습니다.따라서 현재 구조에서 가장 효율적인
AuthService에 로직을 추가하는 것으로 결정했습니다.💬 To Reviewers
authId를 처리하는 로직의 위치에 대해 다른 의견이 있으시면 편하게 공유해주세요!Bearer접두사와 함께 잘못 저장된 유저 데이터는 수동으로 수정해야 정상 로그인이 가능합니다.⚙️ ISSUE