Skip to content

refactor: DI pattern 적용으로 OAuth 아키텍처 개선#75

Merged
Roy-wonji merged 7 commits intomainfrom
refaotor/Token
Feb 10, 2026
Merged

refactor: DI pattern 적용으로 OAuth 아키텍처 개선#75
Roy-wonji merged 7 commits intomainfrom
refaotor/Token

Conversation

@Roy-wonji
Copy link
Contributor

Summary

  • DI pattern을 적용하여 KeychainManager 의존성 주입 구현
  • OAuth 프로바이더 아키텍처 개선 및 DI 적용
  • 토큰 만료 리스너 추가로 인증 시스템 강화

Changes

  • KeychainManager protocol 및 DI container 추가
  • OAuth provider들에 DI 패턴 적용
  • AccessTokenAuthenticator, AuthSessionManager, TokenRefreshManager 리팩토링
  • 통합 테스트 및 단위 테스트 개선

- 기본 OAuthProviderProtocol을 제공자별 전용 프로토콜로 분리
- Apple, Google 전용 프로토콜 인터페이스 추가
- 생성자 주입을 통한 의존성 주입 방식으로 제공자 업데이트
- 테스트 및 개발을 위한 Mock 구현체 작성
- 제공자 메서드에서 repository 파라미터 제거
Copy link
Contributor

@Peter1119 Peter1119 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 ~!

Comment on lines +15 to +17
public final class InMemoryKeychainManager: KeychainManaging, @unchecked Sendable {
private var accessTokenStorage: String?
private var refreshTokenStorage: String?
Copy link
Contributor

Choose a reason for hiding this comment

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

actor로 사용하지 않으신 이유가 있으신가요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Peter1119 아 여기 구현하다가 통일을 안해서 여기는 수정 바로 할께요!

Comment on lines +12 to +33
public protocol KeychainManaging: Sendable {
/// Save access token to keychain
func saveAccessToken(_ token: String)

/// Save refresh token to keychain
func saveRefreshToken(_ token: String)

/// Save both tokens atomically
func saveTokens(accessToken: String?, refreshToken: String?)

/// Load access token from keychain
func loadAccessToken() -> String?

/// Load refresh token from keychain
func loadRefreshToken() -> String?

/// Load both tokens
func loadTokens() -> (accessToken: String?, refreshToken: String?)

/// Clear all stored tokens
func clearAll()
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

간격 컨벤션 안맞춰진것같은데 흠 .. pre hook에서 swift format 돌리는 것도 좋을 것 같네ㅐ요

Copy link
Contributor

@minneee minneee left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@Roy-wonji Roy-wonji merged commit ecac664 into main Feb 10, 2026
@Roy-wonji Roy-wonji deleted the refaotor/Token branch February 10, 2026 12:28
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.

3 participants