[#1349] Basic Cookie Authentication (#1498)

* [#1349] Stub basic cookie authentication

* [#1349] Basic login page

Also adjusts WebView header color and shadow to match WebUI. WebUI uses
a background-image gradient to change the perceived color, which was not
noticed originally.

* [#1349] Handle login post

* [#1349] Redirect to previous URL

* [#1349] Return a basic 401 for api endpoints

Instead of redirecting to a visual login page, API should just indicate
the bad state

* Use more appropriate 303 redirect

* Update server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Update server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

* Lint

* Transition to AuthMode enum with migration path

* Make basicAuthEnabled auto property, Lint

* ConfigManager: Make sure to re-parse the config after migration

* basicAuth{Username,Password} -> auth{Username,Password}

* Lint

* Update server settings backup model

* Update comment

* Minor cleanup

* Improve backup legacy settings fix

* Lint

* Simplify config value migration

---------

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
Constantin Piber
2025-07-06 18:08:29 +02:00
committed by GitHub
parent 1411c02e18
commit 68a131dbeb
15 changed files with 432 additions and 34 deletions

View File

@@ -155,6 +155,9 @@ class SettingsMutation {
updateSetting(settings.updateMangas, serverConfig.updateMangas)
// Authentication
updateSetting(settings.authMode, serverConfig.authMode)
updateSetting(settings.authUsername, serverConfig.authUsername)
updateSetting(settings.authPassword, serverConfig.authPassword)
updateSetting(settings.basicAuthEnabled, serverConfig.basicAuthEnabled)
updateSetting(settings.basicAuthUsername, serverConfig.basicAuthUsername)
updateSetting(settings.basicAuthPassword, serverConfig.basicAuthPassword)

View File

@@ -0,0 +1,13 @@
package suwayomi.tachidesk.graphql.types
enum class AuthMode {
NONE,
BASIC_AUTH,
SIMPLE_LOGIN,
// TODO: ACCOUNT for #623
;
companion object {
fun from(channel: String): AuthMode = entries.find { it.name.lowercase() == channel.lowercase() } ?: NONE
}
}

View File

@@ -63,8 +63,17 @@ interface Settings : Node {
val updateMangas: Boolean?
// Authentication
val authMode: AuthMode?
val authUsername: String?
val authPassword: String?
@GraphQLDeprecated("Removed - prefer authMode")
val basicAuthEnabled: Boolean?
@GraphQLDeprecated("Removed - prefer authUsername")
val basicAuthUsername: String?
@GraphQLDeprecated("Removed - prefer authPassword")
val basicAuthPassword: String?
// misc
@@ -144,8 +153,14 @@ data class PartialSettingsType(
override val globalUpdateInterval: Double?,
override val updateMangas: Boolean?,
// Authentication
override val authMode: AuthMode?,
override val authUsername: String?,
override val authPassword: String?,
@GraphQLDeprecated("Removed - prefer authMode")
override val basicAuthEnabled: Boolean?,
@GraphQLDeprecated("Removed - prefer authUsername")
override val basicAuthUsername: String?,
@GraphQLDeprecated("Removed - prefer authPassword")
override val basicAuthPassword: String?,
// misc
override val debugLogsEnabled: Boolean?,
@@ -219,8 +234,14 @@ class SettingsType(
override val globalUpdateInterval: Double,
override val updateMangas: Boolean,
// Authentication
override val authMode: AuthMode,
override val authUsername: String,
override val authPassword: String,
@GraphQLDeprecated("Removed - prefer authMode")
override val basicAuthEnabled: Boolean,
@GraphQLDeprecated("Removed - prefer authUsername")
override val basicAuthUsername: String,
@GraphQLDeprecated("Removed - prefer authPassword")
override val basicAuthPassword: String,
// misc
override val debugLogsEnabled: Boolean,
@@ -289,6 +310,9 @@ class SettingsType(
config.globalUpdateInterval.value,
config.updateMangas.value,
// Authentication
config.authMode.value,
config.authUsername.value,
config.authPassword.value,
config.basicAuthEnabled.value,
config.basicAuthUsername.value,
config.basicAuthPassword.value,