diff --git a/internal/distributed/proxy/httpserver/constant.go b/internal/distributed/proxy/httpserver/constant.go index 2bb14d9cd3..326b1bd946 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 bff790bdde..b3a7231430 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 201cc34383..e23686ba46 100644 --- a/internal/proxy/accesslog/info/restful_info.go +++ b/internal/proxy/accesslog/info/restful_info.go @@ -32,6 +32,7 @@ const ( ContextReturnCode = "code" ContextReturnMessage = "message" ContextRequest = "request" + ContextToken = "token" ) type RestfulInfo struct {