diff --git a/internal/acl/acl.go b/internal/acl/acl.go index 979d37b..0008193 100644 --- a/internal/acl/acl.go +++ b/internal/acl/acl.go @@ -110,8 +110,10 @@ func buildUserAcls(cfg *config.Config, user *AuthenticatedUser) { } } -func isACLRelevant(cfg *config.Config, actionAcls []string, acl config.AccessControlList, user *AuthenticatedUser) bool { +func isACLRelevantToAction(cfg *config.Config, actionAcls []string, acl config.AccessControlList, user *AuthenticatedUser) bool { if !slices.Contains(user.acls, acl.Name) { + // If the user does not have this ACL, then it is not relevant + return false } @@ -130,7 +132,7 @@ func getRelevantAcls(cfg *config.Config, actionAcls []string, user *Authenticate var ret []*config.AccessControlList for _, acl := range cfg.AccessControlLists { - if isACLRelevant(cfg, actionAcls, acl, user) { + if isACLRelevantToAction(cfg, actionAcls, acl, user) { ret = append(ret, &acl) } } diff --git a/internal/httpservers/restapi.go b/internal/httpservers/restapi.go index bbc85be..67247c8 100644 --- a/internal/httpservers/restapi.go +++ b/internal/httpservers/restapi.go @@ -23,6 +23,8 @@ func parseHttpHeaderForAuth(req *http.Request) (string, string) { username, ok := req.Header[cfg.AuthHttpHeaderUsername] if !ok { + log.Warnf("Config has AuthHttpHeaderUsername set to %v, but it was not found", cfg.AuthHttpHeaderUsername) + return "", "" } @@ -30,10 +32,16 @@ func parseHttpHeaderForAuth(req *http.Request) (string, string) { usergroup, ok := req.Header[cfg.AuthHttpHeaderUserGroup] if ok { + log.Debugf("HTTP Header Auth found a username and usergroup") + return username[0], usergroup[0] + } else { + log.Warnf("Config has AuthHttpHeaderUserGroup set to %v, but it was not found", cfg.AuthHttpHeaderUserGroup) } } + log.Debugf("HTTP Header Auth found a username, but usergroup is not being used") + return username[0], "" } @@ -54,7 +62,7 @@ func parseRequestMetadata(ctx context.Context, req *http.Request) metadata.MD { "usergroup", usergroup, ) - log.Debugf("jwt usable claims: %+v", md) + log.Debugf("api request metadata: %+v", md) return md } diff --git a/internal/httpservers/singleFrontend.go b/internal/httpservers/singleFrontend.go index 3941516..a437ee0 100644 --- a/internal/httpservers/singleFrontend.go +++ b/internal/httpservers/singleFrontend.go @@ -38,12 +38,12 @@ func StartSingleHTTPFrontend(cfg *config.Config) { }) mux.HandleFunc("/websocket", func(w http.ResponseWriter, r *http.Request) { - log.Debugf("websocket req: %q", r.URL) + log.Debugf("ws req: %q", r.URL) websocket.HandleWebsocket(w, r) }) mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - log.Debugf("ui req: %q", r.URL) + log.Debugf("ui req: %q", r.URL) webuiProxy.ServeHTTP(w, r) })