diff --git a/internal/distributed/proxy/httpserver/constant.go b/internal/distributed/proxy/httpserver/constant.go index 9cdd98c65a..a8e1a185ad 100644 --- a/internal/distributed/proxy/httpserver/constant.go +++ b/internal/distributed/proxy/httpserver/constant.go @@ -81,6 +81,7 @@ const ( const ( ContextRequest = "request" ContextUsername = "username" + ContextToken = "token" VectorCollectionsPath = "/vector/collections" VectorCollectionsCreatePath = "/vector/collections/create" VectorCollectionsDescribePath = "/vector/collections/describe" diff --git a/internal/distributed/proxy/service.go b/internal/distributed/proxy/service.go index 5b4d16be31..fcf85179d9 100644 --- a/internal/distributed/proxy/service.go +++ b/internal/distributed/proxy/service.go @@ -139,6 +139,7 @@ func authenticate(c *gin.Context) { user, err := proxy.VerifyAPIKey(rawToken) if err == nil { c.Set(httpserver.ContextUsername, user) + c.Set(httpserver.ContextToken, rawToken) return } log.Ctx(context.TODO()).Warn("fail to verify apikey", zap.Error(err)) diff --git a/internal/proxy/accesslog/info/restful_info.go b/internal/proxy/accesslog/info/restful_info.go index 69e7742cdd..8e807e2ecf 100644 --- a/internal/proxy/accesslog/info/restful_info.go +++ b/internal/proxy/accesslog/info/restful_info.go @@ -34,6 +34,7 @@ const ( ContextReturnCode = "code" ContextReturnMessage = "message" ContextRequest = "request" + ContextToken = "token" ) type RestfulInfo struct {