From acc016cf58c50bd92a7d2fbbae15a39e038f351d Mon Sep 17 00:00:00 2001
From: jano3 <jano@uafrica.com>
Date: Thu, 24 Nov 2022 11:27:02 +0200
Subject: [PATCH] Allow uncapitalized authorization header

---
 auth/api_key.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/auth/api_key.go b/auth/api_key.go
index f9e938a..7f6c6ef 100644
--- a/auth/api_key.go
+++ b/auth/api_key.go
@@ -22,7 +22,10 @@ func GenerateNewApiKey() string {
 
 // GetApiKeyFromHeaders checks if a bearer token is passed as part of the Authorization header and returns that key
 func GetApiKeyFromHeaders(headers map[string]string) string {
-	key := headers["Authorization"]
+	key := headers["authorization"]
+	if key == "" {
+		key = headers["Authorization"]
+	}
 	if strings.HasPrefix(strings.ToLower(key), "bearer ") {
 		key = strings.TrimPrefix(strings.ToLower(key), "bearer")
 		return strings.TrimSpace(key)
-- 
GitLab