-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: 토큰 Interceptor 및 Authenticator 구현 #676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
f8dbc6e
refactor: 패키지 수정
s9hn e59830d
refactor: 반환타입 추가
s9hn d8e2460
refactor: 시그니처 수정
s9hn f3e24ef
feat: 토큰 api 통신 및 저장 로직 구현
s9hn 8f492d1
build: resolve merge conflict
s9hn 95ea494
refactor: 로그인 뷰 로직 수정
s9hn 4515e37
feat: AccountTokenProvider 구현
s9hn 57270d1
refactor: network 모듈 가시성제어자 수정
s9hn 3a20765
refactor: app 모듈 사용하지 않는 파일 및 코드 제거
s9hn b80380e
feat: AuthorizationInterceptor 구현
s9hn 300f13e
refactor: datastore 모듈 가시성 제어자 수정
s9hn faef7c0
refactor: DefaultAccountDataSource 싱글톤 어노테이션 제거
s9hn 84eb2f2
refactor: AuthorizationInterceptor 로직 수정 및 순환참조 문제 해결
s9hn bb2b401
feat: AuthorizationAuthenticator 구현
s9hn 8f750c5
refactor: common 의존성 추가
s9hn 38b0942
refactor: common 의존성 추가
s9hn cf55bd9
refactor: 토큰엔티티 추가 및 적용
s9hn 9a483dd
refactor: 리이슈api 모듈 분리 및 미사용 코드 제거
s9hn c5d3c73
refactor: AuthorizationInterceptor 함수 네이밍 수정 및 디스패처 생성자 주입
s9hn 0f4e106
feat: AuthSessionManager 생성
s9hn 454c204
feat: DispatchersModule 생성
s9hn a527172
feat: NavigatorProvider 구현
s9hn 86de330
refactor: DefaultAccountDataSource 반환 함수 수정
s9hn d8389d8
refactor: 네비게이터 SignInScreen 주입
s9hn 4c0b977
feat: WebsosoAuthSessionManager 구현
s9hn 8cf130a
refactor: AuthorizationAuthenticator 리프레시 로직 구현
s9hn 19a426b
feat: WebsosoApp subscribeSessionState 함수 구현
s9hn 119fd05
feat: ThrottleHelper 구현
s9hn b0163a3
refactor: maxRequestsPerHost 20으로 수정
s9hn 5c90e3f
refactor: AuthorizationAuthenticator에 스로틀링 추가 및 이벤트 전파 로직 수정
s9hn 4a920ba
refactor: 불필요한 파일 제거
s9hn 4f828a4
refactor: 누락 코드 추가, DefaultAccountDataSource 모듈등록
s9hn 82c36ca
refactor: AuthorizationInterceptor 토큰이 빈값인 경우 리턴 로직 추가
s9hn 0daf45e
refactor: AuthorizationAuthenticator 토큰 재발급 실패인 경우 얼리 리턴 로직 추가
s9hn da36020
refactor: 불필요한 리프레시 토큰 빈값 로직 제거 및 when문 적용
s9hn 7dcfe82
refactor: WebsosoAuthSessionManager replay 1 추가
s9hn 462d300
refactor: renewToken delay 함수 제거
s9hn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/into/websoso/core/common/util/navigator/WebsosoNavigator.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.into.websoso.core.common.util.navigator | ||
|
|
||
| import android.content.Context | ||
| import com.into.websoso.core.common.navigator.NavigatorProvider | ||
| import com.into.websoso.ui.login.LoginActivity | ||
| import com.into.websoso.ui.main.MainActivity | ||
| import com.into.websoso.ui.onboarding.OnboardingActivity | ||
| import dagger.Binds | ||
| import dagger.Module | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.android.qualifiers.ApplicationContext | ||
| import dagger.hilt.components.SingletonComponent | ||
| import javax.inject.Inject | ||
| import javax.inject.Singleton | ||
|
|
||
| internal class WebsosoNavigator | ||
| @Inject | ||
| constructor( | ||
| @ApplicationContext private val context: Context, | ||
| ) : NavigatorProvider { | ||
| override fun navigateToLoginActivity() { | ||
| val intent = LoginActivity.getIntent(context) | ||
| context.startActivity(intent) | ||
| } | ||
|
|
||
| override fun navigateToMainActivity() { | ||
| val intent = MainActivity.getIntent(context, true) | ||
| context.startActivity(intent) | ||
| } | ||
|
|
||
| override fun navigateToOnboardingActivity() { | ||
| val intent = OnboardingActivity.getIntent(context) | ||
| context.startActivity(intent) | ||
| } | ||
| } | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| internal interface NavigatorModule { | ||
| @Binds | ||
| @Singleton | ||
| fun bindWebsosoNavigator(websosoNavigator: WebsosoNavigator): NavigatorProvider | ||
| } |
31 changes: 31 additions & 0 deletions
31
...c/main/java/com/into/websoso/core/common/util/sessionManager/WebsosoAuthSessionManager.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package com.into.websoso.core.common.util.sessionManager | ||
|
|
||
| import com.into.websoso.core.auth.AuthSessionManager | ||
| import dagger.Binds | ||
| import dagger.Module | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.components.SingletonComponent | ||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
| import kotlinx.coroutines.flow.SharedFlow | ||
| import kotlinx.coroutines.flow.asSharedFlow | ||
| import javax.inject.Inject | ||
| import javax.inject.Singleton | ||
|
|
||
| internal class WebsosoAuthSessionManager | ||
| @Inject | ||
| constructor() : AuthSessionManager { | ||
| private val _sessionExpired = MutableSharedFlow<Unit>(replay = 1, extraBufferCapacity = 1) | ||
| override val sessionExpired: SharedFlow<Unit> get() = _sessionExpired.asSharedFlow() | ||
|
|
||
| override suspend fun onSessionExpired() { | ||
| _sessionExpired.emit(Unit) | ||
| } | ||
| } | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| internal interface WebsosoAuthSessionManagerModule { | ||
| @Binds | ||
| @Singleton | ||
| fun bindWebsosoAuthSessionManager(websosoAuthSessionManager: WebsosoAuthSessionManager): AuthSessionManager | ||
| } | ||
56 changes: 0 additions & 56 deletions
56
app/src/main/java/com/into/websoso/data/authenticator/WebsosoAuthenticator.kt
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 0 additions & 115 deletions
115
app/src/main/java/com/into/websoso/data/di/NetworkModule.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c: Unit을 가진 SharedFlow가 있는 이유가 있으실까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthSessionManager는 단발성 트리거로 '세션이 만료되었음' 만을 전파합니다.
해당 이벤트는 단 1회만 수신해야하며, 별 다른 상태를 가질 필요가 없습니다!
추후 해당 이벤트 분기가 추가된다면, 이벤트 상태 객체가 추가될테지만 현재로썬 달리 추가될 기능이 없어보입니다!