[management] Match account ids from the request and service config (#8386)

* match account ids from the request and service config

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>

* match account ids from the request and service config

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>

* add tests

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>

---------

Signed-off-by: Dmitri Dolguikh <dmitri.external@netbird.io>
This commit is contained in:
dmitri-netbird
2026-10-28 17:38:42 +01:00
committed by GitHub
parent 42418448d8
commit 4ff3267542
6 changed files with 114 additions and 5 deletions
+9 -3
View File
@@ -48,10 +48,16 @@ func (l *Logger) Middleware(next http.Handler) http.Handler {
// Create a mutable struct to capture data from downstream handlers.
// We pass a pointer in the context - the pointer itself flows down immutably,
// but the struct it points to can be mutated by inner handlers.
capturedData := proxy.NewCapturedData(requestID)
capturedData.SetClientIP(sourceIp)
ctx := proxy.WithCapturedData(r.Context(), capturedData)
ctx := r.Context()
capturedData := proxy.CapturedDataFromContext(r.Context())
if capturedData == nil {
capturedData = &proxy.CapturedData{}
ctx = proxy.WithCapturedData(ctx, capturedData)
}
capturedData.SetRequestID(requestID)
capturedData.SetClientIP(sourceIp)
start := time.Now()
next.ServeHTTP(sw, r.WithContext(ctx))