[key-auth] record consumer name once the consumer name is determined (#2978)

This commit is contained in:
rinfx
2025-10-09 11:22:09 +08:00
committed by GitHub
parent 742b9498e4
commit ac2f7dedaa

View File

@@ -291,6 +291,8 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config KeyAuthConfig, log log
return deniedUnauthorizedConsumer()
}
proxywasm.AddHttpRequestHeader("X-Mse-Consumer", name)
// 全局生效:
// - global_auth == true 且 当前 domain/route 未配置该插件
// - global_auth 未设置 且 没有任何一个 domain/route 配置该插件
@@ -343,7 +345,6 @@ func deniedUnauthorizedConsumer() types.Action {
}
func authenticated(name string) types.Action {
_ = proxywasm.AddHttpRequestHeader("X-Mse-Consumer", name)
return types.ActionContinue
}