Handle missing credentials as being invalid (#1164)

In case the credentials were missing the basic authentication was just bypassed
This commit is contained in:
schroda
2024-11-23 02:00:16 +01:00
committed by GitHub
parent fb51834153
commit 38673bbff4

View File

@@ -108,7 +108,7 @@ object JavalinSetup {
app.beforeMatched { ctx ->
fun credentialsValid(): Boolean {
val basicAuthCredentials = ctx.basicAuthCredentials() ?: return true
val basicAuthCredentials = ctx.basicAuthCredentials() ?: return false
val (username, password) = basicAuthCredentials
return username == serverConfig.basicAuthUsername.value &&
password == serverConfig.basicAuthPassword.value