chore(infra): Network/Auth – DoD schließen
- Entfernen/Deprecaten: `frontend/features/auth-feature/.../AuthenticatedHttpClient.kt` und alle manuellen `Authorization`‑Header‑Setzungen.
- Stattdessen: DI‑`apiClient` via Koin injizieren (`single(named("apiClient"))`) und Token‑Anreicherung über Ktor `Auth` Plugin (Bearer) verdrahten.
- Build‑Guard ergänzen: Auch Vorkommen von `HttpHeaders.Authorization` erkennen.
This commit is contained in:
@@ -6,8 +6,8 @@ import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import at.mocode.clients.shared.navigation.AppScreen
|
||||
import at.mocode.clients.authfeature.AuthenticatedHttpClient
|
||||
import at.mocode.clients.authfeature.AuthTokenManager
|
||||
import org.koin.core.context.GlobalContext
|
||||
import at.mocode.clients.pingfeature.PingScreen
|
||||
import at.mocode.clients.pingfeature.PingViewModel
|
||||
import at.mocode.shared.core.AppConstants
|
||||
@@ -29,7 +29,8 @@ fun MainApp() {
|
||||
) {
|
||||
var currentScreen by remember { mutableStateOf<AppScreen>(AppScreen.Home) }
|
||||
|
||||
val authTokenManager = remember { AuthenticatedHttpClient.getAuthTokenManager() }
|
||||
// Resolve AuthTokenManager from Koin
|
||||
val authTokenManager = remember { GlobalContext.get().koin.get<AuthTokenManager>() }
|
||||
val pingViewModel = remember { PingViewModel() }
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import kotlinx.browser.document
|
||||
import org.w3c.dom.HTMLElement
|
||||
import at.mocode.shared.di.initKoin
|
||||
import at.mocode.frontend.core.network.networkModule
|
||||
import at.mocode.clients.authfeature.di.authFeatureModule
|
||||
import at.mocode.frontend.core.localdb.localDbModule
|
||||
import at.mocode.frontend.core.localdb.DatabaseProvider
|
||||
import kotlinx.coroutines.MainScope
|
||||
@@ -19,8 +20,8 @@ fun main() {
|
||||
console.log("[WebApp] main() entered")
|
||||
// Initialize DI (Koin) with shared modules + network + local DB modules
|
||||
try {
|
||||
initKoin { modules(networkModule, localDbModule) }
|
||||
console.log("[WebApp] Koin initialized with networkModule + localDbModule")
|
||||
initKoin { modules(networkModule, localDbModule, authFeatureModule) }
|
||||
console.log("[WebApp] Koin initialized with networkModule + localDbModule + authFeatureModule")
|
||||
} catch (e: dynamic) {
|
||||
console.warn("[WebApp] Koin initialization warning:", e)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@ import androidx.compose.ui.window.WindowState
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.shared.di.initKoin
|
||||
import at.mocode.frontend.core.network.networkModule
|
||||
import at.mocode.clients.authfeature.di.authFeatureModule
|
||||
|
||||
fun main() = application {
|
||||
// Initialize DI (Koin) with shared modules + network module
|
||||
try {
|
||||
initKoin { modules(networkModule) }
|
||||
println("[DesktopApp] Koin initialized with networkModule")
|
||||
initKoin { modules(networkModule, authFeatureModule) }
|
||||
println("[DesktopApp] Koin initialized with networkModule + authFeatureModule")
|
||||
} catch (e: Exception) {
|
||||
println("[DesktopApp] Koin initialization warning: ${e.message}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user