diff --git a/internal/api/handlers/management/auth_files.go b/internal/api/handlers/management/auth_files.go index 5d4e98ec..39c04fff 100644 --- a/internal/api/handlers/management/auth_files.go +++ b/internal/api/handlers/management/auth_files.go @@ -2282,23 +2282,8 @@ func (h *Handler) GetAuthStatus(c *gin.Context) { // PopulateAuthContext extracts request info and adds it to the context func PopulateAuthContext(ctx context.Context, c *gin.Context) context.Context { info := &coreauth.RequestInfo{ - Query: make(map[string]string), - Headers: make(map[string]string), + Query: c.Request.URL.Query(), + Headers: c.Request.Header, } - - // 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] = strings.Join(v, ",") - } - } - - // Capture all headers, joining multiple values with a comma. - for k, v := range c.Request.Header { - if len(v) > 0 { - info.Headers[k] = strings.Join(v, ",") - } - } - return coreauth.WithRequestInfo(ctx, info) } diff --git a/sdk/cliproxy/auth/types.go b/sdk/cliproxy/auth/types.go index 29b4a560..1c98d411 100644 --- a/sdk/cliproxy/auth/types.go +++ b/sdk/cliproxy/auth/types.go @@ -5,6 +5,8 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" + "net/http" + "net/url" "strconv" "strings" "sync" @@ -21,8 +23,8 @@ type PostAuthHook func(context.Context, *Auth) error // RequestInfo holds information extracted from the HTTP request. // It is injected into the context passed to PostAuthHook. type RequestInfo struct { - Query map[string]string - Headers map[string]string + Query url.Values + Headers http.Header } type requestInfoKey struct{}