aboutsummaryrefslogtreecommitdiff
path: root/internal/authz/middleware.go
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2024-08-24 17:09:03 -0700
committerMax Resnick <max@ofmax.li>2024-08-24 17:09:03 -0700
commit71ba0cd9b988813da1b5c7101f8bf5918df0f795 (patch)
tree5fb2e195a24a91dcd5997d8f3dfa346b8e73c998 /internal/authz/middleware.go
parent6889411b014b39a440b7cbe52b482b28415ed829 (diff)
downloadgo-git-server-71ba0cd9b988813da1b5c7101f8bf5918df0f795.tar.gz
chore: add env var for log level, fix bug, cleanup push target
Diffstat (limited to '')
-rw-r--r--internal/authz/middleware.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/authz/middleware.go b/internal/authz/middleware.go
index 3ba95ad..31f7bf3 100644
--- a/internal/authz/middleware.go
+++ b/internal/authz/middleware.go
@@ -27,6 +27,7 @@ func Authentication(authMap TokenMap, next http.Handler) http.Handler {
u = "anon"
ctx := context.WithValue(req.Context(), AuthzUrnKey, u)
next.ServeHTTP(rw, req.WithContext(ctx))
+ return
}
urn := fmt.Sprintf("uid:%s", u)
hash, ok := authMap[urn]
@@ -76,6 +77,7 @@ func Authorization(adminSvc *admin.Servicer, next http.Handler) http.Handler {
slog.Info("Not Authorized", "urn", urn, "repo", repo)
http.Error(rw, "Access denied", http.StatusForbidden)
return
+
}
slog.Debug("Access Attempt", "action", action, "repo", repo)
next.ServeHTTP(rw, req.WithContext(ctx))