From fa6e6bd1422f24d64dcfd68b2269ab75f4581b4b Mon Sep 17 00:00:00 2001 From: Bennett Wetters Date: Tue, 16 Jan 2024 01:37:54 +0100 Subject: [PATCH] Set WWW-Authenticate header directly and change realm to spaceapid for consistency --- handlers/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/util.go b/handlers/util.go index ffc4801..f29e8cc 100644 --- a/handlers/util.go +++ b/handlers/util.go @@ -19,7 +19,7 @@ func updateEndpointValidator( // Check BasicAuth credentials username, password, ok := r.BasicAuth() if !ok || !util.CheckCredentials(authDB, validCredentials, username, password) { - w.Header().Set("WWW-Authenticate", "Basic realm=\"space-api\"") + w.Header()["WWW-Authenticate"] = []string{"Basic realm=\"spaceapid\""} http.Error(w, "", http.StatusUnauthorized) return []byte{}, errors.New(fmt.Sprintf("Unauthorized request from %s Username: %s Password: %s", r.RemoteAddr, username, password)) }