From 6512ab1351030b984b65bbca3dca4b0eb593f5fc Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Thu, 11 Feb 2021 17:27:27 -0500 Subject: [PATCH] internal/concierge/impersonator: don't care about namespace Concierge APIs are no longer namespaced (see f015ad58528). Signed-off-by: Andrew Keesler --- internal/concierge/impersonator/impersonator.go | 1 - internal/concierge/impersonator/impersonator_test.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/concierge/impersonator/impersonator.go b/internal/concierge/impersonator/impersonator.go index 0ded0510..409ae60f 100644 --- a/internal/concierge/impersonator/impersonator.go +++ b/internal/concierge/impersonator/impersonator.go @@ -95,7 +95,6 @@ func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { } log = log.WithValues( "authenticator", tokenCredentialReq.Spec.Authenticator, - "authenticatorNamespace", tokenCredentialReq.Namespace, ) userInfo, err := p.cache.AuthenticateTokenCredentialRequest(r.Context(), tokenCredentialReq) diff --git a/internal/concierge/impersonator/impersonator_test.go b/internal/concierge/impersonator/impersonator_test.go index 72f38e17..449a2419 100644 --- a/internal/concierge/impersonator/impersonator_test.go +++ b/internal/concierge/impersonator/impersonator_test.go @@ -146,7 +146,7 @@ func TestImpersonator(t *testing.T) { request: newRequest(map[string][]string{"Authorization": {"Bearer " + makeTestTokenRequest("", "", "")}}), wantHTTPBody: "invalid token\n", wantHTTPStatus: http.StatusUnauthorized, - wantLogs: []string{"\"error\"=\"no such authenticator\" \"msg\"=\"received invalid token\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"\"} \"authenticatorNamespace\"=\"\" \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\""}, + wantLogs: []string{"\"error\"=\"no such authenticator\" \"msg\"=\"received invalid token\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"\"} \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\""}, }, { name: "token authenticates as nil", @@ -157,7 +157,7 @@ func TestImpersonator(t *testing.T) { }, wantHTTPBody: "not authenticated\n", wantHTTPStatus: http.StatusUnauthorized, - wantLogs: []string{"\"level\"=0 \"msg\"=\"received token that did not authenticate\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"authenticator-one\"} \"authenticatorNamespace\"=\"foo\" \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\""}, + wantLogs: []string{"\"level\"=0 \"msg\"=\"received token that did not authenticate\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"authenticator-one\"} \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\""}, }, // happy path { @@ -179,7 +179,7 @@ func TestImpersonator(t *testing.T) { }, wantHTTPBody: "successful proxied response", wantHTTPStatus: http.StatusOK, - wantLogs: []string{"\"level\"=0 \"msg\"=\"proxying authenticated request\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"authenticator-one\"} \"authenticatorNamespace\"=\"foo\" \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\" \"userID\"=\"test-uid\""}, + wantLogs: []string{"\"level\"=0 \"msg\"=\"proxying authenticated request\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"authenticator-one\"} \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\" \"userID\"=\"test-uid\""}, }, }