refactor: change basic auth label to username instead of user

This commit is contained in:
Stavros
2025-07-06 01:02:08 +03:00
parent f780e81ec2
commit 6dc57ddf0f
2 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -108,7 +108,7 @@ type OAuthLabels struct {
// Basic auth labels for a tinyauth protected container
type BasicLabels struct {
User string
Username string
Password string
}