feat: add event emission for blocked requests and provider changes

- Emit ACL blocked events with matched rule information
- Emit HTTP blocked events from CIDR whitelist, ForwardAuth, and OIDC middlewares
- Emit global events for provider file/docker changes
- Add MatchedIndex method to ACL matchers for rule identification
- Update goutils submodule for events package update
This commit is contained in:
yusing
2026-02-15 16:48:39 +08:00
parent 1244af0e38
commit 0acedb034a
8 changed files with 69 additions and 24 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/yusing/godoxy/internal/auth"
httpevents "github.com/yusing/goutils/events/http"
"github.com/yusing/goutils/http/httpheaders"
)
@@ -118,6 +119,10 @@ func (amw *oidcMiddleware) before(w http.ResponseWriter, r *http.Request) (proce
return true
}
if r.Method != http.MethodHead {
defer httpevents.Blocked(r, "OIDC", err.Error())
}
isGet := r.Method == http.MethodGet
isWS := httpheaders.IsWebsocket(r.Header)
switch {