Skip to content

feat(auth): 애플 로그인(Sign in with Apple) — 웹 OAuth 4번째 공급자 + 탈퇴 revoke#62

Merged
bbbang105 merged 9 commits into
devfrom
session2-apple-login
Jul 13, 2026
Merged

feat(auth): 애플 로그인(Sign in with Apple) — 웹 OAuth 4번째 공급자 + 탈퇴 revoke#62
bbbang105 merged 9 commits into
devfrom
session2-apple-login

Conversation

@bbbang105

Copy link
Copy Markdown
Member

요약

iOS App Store 4.8 대응 — 애플을 4번째 소셜 OAuth 공급자로 추가(카카오·구글·네이버 유지). 기존 `SocialOAuthClient` 파이프라인에 `@Component("APPLE")`로 편입되어 AuthService는 무변경(provider 자동 디스패치).

변경

  • 크립토: `AppleClientSecretGenerator`(ES256 .p8 서명) · `AppleIdTokenVerifier`(JWKS RS256 + iss/aud/exp) — jjwt 0.12.6 재사용, 신규 의존성 0
  • 엔드포인트: `AppleOAuthClientImpl` + `AppleOAuthRequest`{code,redirectUri} + `POST /auth/oauth/apple`(구글과 동일 형태)
  • 저장: `users.apple_refresh_token`(AES-GCM 암호화, billing 키 재사용) + `apple_pending_credentials` 신규 테이블(신규 유저 온보딩 이관용, PK=sub)
  • revoke: 탈퇴 시 `AppleTokenRevoker` best-effort(실패해도 탈퇴 진행) + `ApplePendingCredentialSweeper`(@scheduled, 30일)
  • `TenantIsolationGuardTest`에 pending sweep 화이트리스트(계정생성 전·user_id 없음 → 전역 정당)

검증

  • `./gradlew build test` ✅ (ktlint·detekt·JaCoCo 80%·전체 테스트)
  • SDD 태스크별 리뷰 + opus whole-branch 최종 리뷰 = Ready to merge(Important/Minor 3건 fix 반영: sweep 1→30일·aud-null 401가드·주석)

🔴 배포 전 필수 (사용자 액션)

  1. dev DDL 선적용(머지 전 — ddl-auto validate): `docs/sql/migration/26-07-13-users-apple-refresh-token.sql`
  2. dev env: `APPLE_CLIENT_ID`=kr.ai.flori.web · `APPLE_TEAM_ID`=A9DQNX6532 · `APPLE_KEY_ID`=74H3MWK8C4 · `APPLE_PRIVATE_KEY`(.p8)
  3. web PR과 함께 배포 (DDL→api→web 순서)

설계/계획: web `docs/superpowers/{specs,plans}/2026-07-13-apple-login*`

🤖 Generated with Claude Code

bbbang105 and others added 9 commits July 13, 2026 15:20
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- ApplePendingCredentialSweeper: 1일→30일. 애플은 refresh_token을 최초
  인가 시에만 내려주므로, 스윕 윈도가 너무 짧으면 온보딩 중도이탈 후
  뒤늦게 돌아온 유저의 pending 행이 먼저 삭제되어 토큰이 영구 유실되고
  탈퇴 시 revoke가 조용히 no-op 된다. 30일로 넓혀 지연 온보딩을 커버.
- AppleIdTokenVerifier: aud 클레임이 없는(claims.audience == null) 기형
  토큰이 try/catch 밖 NPE로 500을 내던 것을, null을 불일치로 취급해
  기존 AppException(INVALID_TOKEN) 401 경로로 흡수. 회귀 테스트 추가.
- AuthService: 기존 애플 유저 로그인 분기 주석이 "매 로그인마다 새
  refresh token 갱신"이라 잘못 서술하고 있었음(애플은 최초 동의 때만
  발급, 보통 null → 기존값 유지). 코드는 원래도 맞았고 주석만 정정.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@bbbang105 bbbang105 added 📄 docs 문서 추가 및 수정 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 🚨 fix 버그 수정 / 에러 해결 labels Jul 13, 2026
@bbbang105
bbbang105 merged commit 1ecfd98 into dev Jul 13, 2026
3 checks passed
@bbbang105
bbbang105 deleted the session2-apple-login branch July 13, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📄 docs 문서 추가 및 수정 🚀 feat 새로운 기능 추가 / 일부 코드 추가 / 일부 코드 수정 (리팩토링과 구분) / 디자인 요소 수정 🚨 fix 버그 수정 / 에러 해결

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant