From 4741e742105a7d0ccfa0f884577046b630bcd988 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 21 Feb 2024 16:41:56 +0300 Subject: [PATCH] [#318] Log successfully authenticated accessKeyIDs Signed-off-by: Denis Kirillov --- api/middleware/auth.go | 1 + internal/logs/logs.go | 1 + 2 files changed, 2 insertions(+) diff --git a/api/middleware/auth.go b/api/middleware/auth.go index 2f5381f1..08e3d750 100644 --- a/api/middleware/auth.go +++ b/api/middleware/auth.go @@ -72,6 +72,7 @@ func Auth(center Center, log *zap.Logger) Func { if box.AccessBox.Gate.BearerToken != nil { reqInfo.User = bearer.ResolveIssuer(*box.AccessBox.Gate.BearerToken).String() } + reqLogOrDefault(ctx, log).Debug(logs.SuccessfulAuth, zap.String("accessKeyID", box.AuthHeaders.AccessKeyID)) } h.ServeHTTP(w, r.WithContext(ctx)) diff --git a/internal/logs/logs.go b/internal/logs/logs.go index 42b9cda7..0561b4a9 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -146,4 +146,5 @@ const ( BucketOwnerKeyIsMissing = "bucket owner key is missing" SettingsNodeInvalidOwnerKey = "settings node: invalid owner key" FailedToSendTransaction = "failed to send transaction" + SuccessfulAuth = "successful auth" )