feat(02-06): wire auth session into koin
- provide authModule singletons for store, OIDC, MeClient, AuthSession, and HttpClient - include authModule from appModule bootstrap
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.ulfrx.recipe.auth
|
||||||
|
|
||||||
|
import io.ktor.client.HttpClient
|
||||||
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
val authModule =
|
||||||
|
module {
|
||||||
|
single<SecureAuthStateStore> { SecureAuthStateStore() }
|
||||||
|
single<OidcClient> { OidcClient() }
|
||||||
|
single<MeClient> { MeClient() }
|
||||||
|
single<AuthSession> {
|
||||||
|
AuthSession(
|
||||||
|
oidcClient = get<OidcClient>(),
|
||||||
|
store = get<SecureAuthStateStore>(),
|
||||||
|
meClient = get<MeClient>(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
single<HttpClient> { AuthHttpClient.create(get()) }
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package dev.ulfrx.recipe.di
|
package dev.ulfrx.recipe.di
|
||||||
|
|
||||||
|
import dev.ulfrx.recipe.auth.authModule
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
// Phase 2 adds authModule; Phase 4 adds syncModule; Phase 5 adds catalogModule; etc.
|
// Phase 2 adds authModule; Phase 4 adds syncModule; Phase 5 adds catalogModule; etc.
|
||||||
val appModule =
|
val appModule =
|
||||||
module {
|
module {
|
||||||
// intentionally empty in Phase 1
|
includes(authModule)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user