refactor(auth): TokenService 추출 (P0-1 단계 4)#109
Conversation
AuthService 의 토큰 발급·회전·해싱·쿠키 책임을 신규 TokenService 로 분리.
플랜의 단계 4 (issueAuthTokens, sha256Hex, signAccessToken 등) 를 수행하면서
중복되던 cookie option / request meta 헬퍼도 함께 추출.
- 신규 헬퍼
- AuthCookieOptions (cookie domain/secure/sameSite getters) — TokenService 와
AuthService 가 공유
- auth-request-meta helper (getUserAgent, getIp) — 동일 사유로 공유
- 신규 TokenService (interface + impl + spec, DI Token 패턴)
- public: signAccessToken, getAccessExpiresSeconds, issueAuthTokens,
rotateRefresh, sha256Hex, clearRefreshCookie
- private: generateRefreshToken, getRefreshDays
- AuthService 변경
- JwtService 직접 의존 제거 (TokenService 위임)
- 토큰 관련 8 곳을 this.tokens.* 로 위임
- extracted 5 개 private helper 제거 (signAccessToken, issueAuthTokens,
rotateRefresh, sha256Hex, getAccessExpires/RefreshDays/CookieDomain/...)
- AuthModule: TokenService 를 TOKEN_SERVICE 토큰으로 등록
- AuthService spec / AuthService (seller) spec: TokenService 를 실제 인스턴스로
주입 (기존 refreshSessions / jwt mock 그대로 사용, 회귀 없음)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1177 tests passing in 134 suites. Report generated by 🧪jest coverage report action from 98905fa |
Summary
AuthService 와 TokenService 가 공유.
Scope
extracted 5+ private helper 제거. AuthService 줄 수: 824 → 약 580.
기존 refreshSessions/jwt mock 으로 회귀 없음.
P0-1 진행 상황
Impact
Test plan