enhance: remain raw token for audit log (#40637) (#40867)

pr: https://github.com/milvus-io/milvus/pull/40637

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
aoiasd 2025-03-26 14:54:18 +08:00 committed by GitHub
parent 9c41636a95
commit 182b3c17d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 0 deletions

View File

@ -81,6 +81,7 @@ const (
const ( const (
ContextRequest = "request" ContextRequest = "request"
ContextUsername = "username" ContextUsername = "username"
ContextToken = "token"
VectorCollectionsPath = "/vector/collections" VectorCollectionsPath = "/vector/collections"
VectorCollectionsCreatePath = "/vector/collections/create" VectorCollectionsCreatePath = "/vector/collections/create"
VectorCollectionsDescribePath = "/vector/collections/describe" VectorCollectionsDescribePath = "/vector/collections/describe"

View File

@ -139,6 +139,7 @@ func authenticate(c *gin.Context) {
user, err := proxy.VerifyAPIKey(rawToken) user, err := proxy.VerifyAPIKey(rawToken)
if err == nil { if err == nil {
c.Set(httpserver.ContextUsername, user) c.Set(httpserver.ContextUsername, user)
c.Set(httpserver.ContextToken, rawToken)
return return
} }
log.Ctx(context.TODO()).Warn("fail to verify apikey", zap.Error(err)) log.Ctx(context.TODO()).Warn("fail to verify apikey", zap.Error(err))

View File

@ -32,6 +32,7 @@ const (
ContextReturnCode = "code" ContextReturnCode = "code"
ContextReturnMessage = "message" ContextReturnMessage = "message"
ContextRequest = "request" ContextRequest = "request"
ContextToken = "token"
) )
type RestfulInfo struct { type RestfulInfo struct {