aboutsummaryrefslogtreecommitdiff
path: root/internal/authz/middleware.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/authz/middleware.go')
-rw-r--r--internal/authz/middleware.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/authz/middleware.go b/internal/authz/middleware.go
index 3c029b0..9031c99 100644
--- a/internal/authz/middleware.go
+++ b/internal/authz/middleware.go
@@ -5,7 +5,7 @@ import (
"context"
"encoding/hex"
"fmt"
- "log"
+ "log/slog"
"net/http"
"git.ofmax.li/go-git-server/internal/admin"
@@ -60,16 +60,16 @@ func Authorization(adminSvc *admin.Servicer, next http.Handler) http.Handler {
action := req.Method
ok, err := adminSvc.Enforce(urn, repo, action)
if err != nil {
- log.Printf("error running enforce %s", err)
+ slog.Info("error unning enforce", "error", err)
http.Error(rw, "Bad Request", http.StatusBadRequest)
return
}
if !ok {
- log.Printf("Not Authorized - %s attempted access %s", urn, repo)
+ slog.Info("Not Authorized", "urn", urn, "repo", repo)
http.Error(rw, "Access denied", http.StatusForbidden)
return
}
- log.Printf("Method %s Url %s", action, repo)
+ slog.Debug("Access Attempt", "action", action, "repo", repo)
next.ServeHTTP(rw, req.WithContext(ctx))
})
}