From 6dc57ddf0fc938d41e5124878039819b8b9d5777 Mon Sep 17 00:00:00 2001 From: Stavros Date: Sun, 6 Jul 2025 01:02:08 +0300 Subject: [PATCH] refactor: change basic auth label to username instead of user --- internal/handlers/handlers.go | 12 ++++++------ internal/types/config.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 6b23c42d..f8de26f1 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -154,9 +154,9 @@ func (h *Handlers) AuthHandler(c *gin.Context) { log.Debug().Str("key", key).Msg("Setting header") c.Header(key, value) } - if labels.Basic.User != "" && labels.Basic.Password != "" { - log.Debug().Str("username", labels.Basic.User).Msg("Setting basic auth headers") - c.Header("Authorization", fmt.Sprintf("Basic %s", utils.GetBasicAuth(labels.Basic.User, labels.Basic.Password))) + if labels.Basic.Username != "" && labels.Basic.Password != "" { + log.Debug().Str("username", labels.Basic.Username).Msg("Setting basic auth headers") + c.Header("Authorization", fmt.Sprintf("Basic %s", utils.GetBasicAuth(labels.Basic.Username, labels.Basic.Password))) } c.JSON(200, gin.H{ "status": 200, @@ -283,9 +283,9 @@ func (h *Handlers) AuthHandler(c *gin.Context) { } // Set basic auth headers if configured - if labels.Basic.User != "" && labels.Basic.Password != "" { - log.Debug().Str("username", labels.Basic.User).Msg("Setting basic auth headers") - c.Header("Authorization", fmt.Sprintf("Basic %s", utils.GetBasicAuth(labels.Basic.User, labels.Basic.Password))) + if labels.Basic.Username != "" && labels.Basic.Password != "" { + log.Debug().Str("username", labels.Basic.Username).Msg("Setting basic auth headers") + c.Header("Authorization", fmt.Sprintf("Basic %s", utils.GetBasicAuth(labels.Basic.Username, labels.Basic.Password))) } // The user is allowed to access the app diff --git a/internal/types/config.go b/internal/types/config.go index 74c6571f..8e2e202e 100644 --- a/internal/types/config.go +++ b/internal/types/config.go @@ -108,7 +108,7 @@ type OAuthLabels struct { // Basic auth labels for a tinyauth protected container type BasicLabels struct { - User string + Username string Password string }