From c269a8cbb31273f0b88824feb50e48e23b604968 Mon Sep 17 00:00:00 2001 From: Tuan Vuong Date: Thu, 9 Jan 2025 17:28:54 +0700 Subject: [PATCH] fix: adding key hashed information when api key invalid --- gateway/mw_auth_key.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gateway/mw_auth_key.go b/gateway/mw_auth_key.go index aa2cf767c03..cb14ea5f97c 100644 --- a/gateway/mw_auth_key.go +++ b/gateway/mw_auth_key.go @@ -184,7 +184,10 @@ func (k *AuthKey) ProcessRequest(_ http.ResponseWriter, r *http.Request, _ inter } func (k *AuthKey) reportInvalidKey(key string, r *http.Request, msg string, errMsg string) (error, int) { - k.Logger().WithField("key", k.Gw.obfuscateKey(key)).Info(msg) + k.Logger(). + WithField("key", k.Gw.obfuscateKey(key)). + WithField("key_hashed", storage.HashKey(key, k.Gw.GetConfig().HashKeys)). + Info(msg) // Fire Authfailed Event AuthFailed(k, r, key) @@ -196,7 +199,6 @@ func (k *AuthKey) reportInvalidKey(key string, r *http.Request, msg string, errM } func (k *AuthKey) validateSignature(r *http.Request, key string) (error, int) { - _, authConfig := k.getAuthToken(k.getAuthType(), r) logger := k.Logger().WithField("key", k.Gw.obfuscateKey(key))