More debug info for auth
This commit is contained in:
parent
00927f3ba3
commit
6b0e414932
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue