feat/auth-hook: add post auth hook [CR]

This commit is contained in:
HEUDavid
2026-02-10 22:11:41 +08:00
parent 6a9e3a6b84
commit 3caadac003
2 changed files with 20 additions and 5 deletions

View File

@@ -2286,19 +2286,19 @@ func PopulateAuthContext(ctx context.Context, c *gin.Context) context.Context {
Headers: make(map[string]string),
}
// Capture all query parameters
// Capture all query parameters, joining multiple values with a comma.
for k, v := range c.Request.URL.Query() {
if len(v) > 0 {
info.Query[k] = v[0]
info.Query[k] = strings.Join(v, ",")
}
}
// Capture all headers
// Capture all headers, joining multiple values with a comma.
for k, v := range c.Request.Header {
if len(v) > 0 {
info.Headers[k] = v[0]
info.Headers[k] = strings.Join(v, ",")
}
}
return context.WithValue(ctx, "request_info", info)
return coreauth.WithRequestInfo(ctx, info)
}