Skip to content

GitHub 인증을 서버 callback과 공통 OAuth 모델 기반으로 전환한다 #718

Description

@opficdev

문제

현재 GithubAuthenticationServiceImpl은 다음 책임을 직접 수행합니다.

  • GitHub 인증 URL과 state 생성
  • authorization code callback 처리
  • GitHub access token 수신
  • /user, /user/emails 직접 호출
  • Firebase provider 직접 연결
  • Firestore access token 저장·삭제
  • GitHub grant 폐기 요청 구성

Apple 인증 전환에서 만든 REST 모델 중 Firebase custom token과 계정 작업 응답은 공급자와 무관하지만 Apple 전용 이름을 사용하고 있습니다.

GitHub와 이후 Apple·Google 웹 인증 전환이 각각 별도 모델을 만들면 동일한 Firebase session bootstrap 계약이 중복됩니다.

결정 사항

  • GitHub 인증은 서버 callback 방식으로 전환합니다.
  • GitHub 전환에서 공급자 공통 iOS OAuth 모델과 helper를 도입합니다.
  • AppleCustomTokenResponseFirebaseCustomTokenResponse로 변경합니다.
  • AppleOperationResponse는 기존 EmptyAPIResponse로 대체합니다.
  • 다음 공통 모델을 추가합니다.
    • OAuthAuthenticationSessionRequest
    • OAuthAuthenticationSessionResponse
    • OAuthAuthenticationTicketRequest
    • FirebaseCustomTokenResponse
  • app verifier, SHA-256 challenge, ticket callback 검증을 OAuthWebAuthenticationProof로 공통화합니다.
  • ASWebAuthenticationSession 표시와 취소 처리를 공급자 공통 helper로 구성합니다.
  • provider service 사이에 같은 계층 dependency injection을 추가하지 않습니다.
  • provider별 endpoint와 오류 변환은 각 service에 유지합니다.

기대 동작

  • iOS가 서버에서 GitHub 인증 URL을 받습니다.
  • ASWebAuthenticationSession에는 서버 URL만 전달합니다.
  • callback에서 ticket만 추출합니다.
  • ticket과 app verifier를 custom token endpoint에 전달합니다.
  • FirebaseCustomTokenResponse.customTokensignIn(withCustomToken:)에 즉시 사용합니다.
  • 계정 연결은 같은 ticket 계약과 Firebase bearer를 사용합니다.
  • 계정 연결·해제 후 currentUser.reload()을 호출합니다.
  • 로그인 취소는 nil, 계정 연결 취소는 false를 유지합니다.

수정 방향

  • GithubAuthenticationServiceImpl에서 GitHub API client와 token 처리를 제거합니다.
  • FunctionAPIClient의 Apple 전용 공통 응답 이름을 변경합니다.
  • Apple endpoint도 FirebaseCustomTokenResponseEmptyAPIResponse를 사용하도록 갱신합니다.
  • AuthDataResponse.accessToken을 제거합니다.
  • UserServiceImplgithubAccessToken 저장 분기를 제거합니다.
  • Info.plistGITHUB_CLIENT_ID, APP_REDIRECT_URL을 제거합니다.
  • DevLog URL scheme은 ticket callback 용도로 유지합니다.

수용 기준

  • iOS가 GitHub authorization code와 access token을 받지 않습니다.
  • GitHub API를 iOS에서 직접 호출하지 않습니다.
  • Firebase custom token만 HTTPS 응답으로 받고 즉시 사용합니다.
  • AppleCustomTokenResponse, AppleOperationResponse가 남지 않습니다.
  • 공통 OAuth 모델에 provider별 선택 값이 추가되지 않습니다.
  • Apple 로그인 동작이 공통 모델 이름 변경 이후에도 유지됩니다.
  • 기존 모듈 의존 방향이 유지됩니다.
  • 변경된 Swift 파일이 SwiftLint를 통과합니다.
  • iOS 프로젝트 build가 통과합니다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions