Skip to content

Commit ac2f7de

Browse files
authored
[key-auth] record consumer name once the consumer name is determined (#2978)
1 parent 742b949 commit ac2f7de

File tree

1 file changed

+2
-1
lines changed
  • plugins/wasm-go/extensions/key-auth

1 file changed

+2
-1
lines changed

plugins/wasm-go/extensions/key-auth/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config KeyAuthConfig, log log
291291
return deniedUnauthorizedConsumer()
292292
}
293293

294+
proxywasm.AddHttpRequestHeader("X-Mse-Consumer", name)
295+
294296
// 全局生效:
295297
// - global_auth == true 且 当前 domain/route 未配置该插件
296298
// - global_auth 未设置 且 没有任何一个 domain/route 配置该插件
@@ -343,7 +345,6 @@ func deniedUnauthorizedConsumer() types.Action {
343345
}
344346

345347
func authenticated(name string) types.Action {
346-
_ = proxywasm.AddHttpRequestHeader("X-Mse-Consumer", name)
347348
return types.ActionContinue
348349
}
349350

0 commit comments

Comments
 (0)