Only log user ID, not user name/groups.
Signed-off-by: Margo Crawford <margaretc@vmware.com>
This commit is contained in:
parent
1299231a48
commit
64aff7b983
@ -103,10 +103,7 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, "not authenticated", http.StatusUnauthorized)
|
http.Error(w, "not authenticated", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log = log.WithValues(
|
log = log.WithValues("userID", userInfo.GetUID())
|
||||||
"user", userInfo.GetName(),
|
|
||||||
"groups", userInfo.GetGroups(),
|
|
||||||
)
|
|
||||||
|
|
||||||
newHeaders := getProxyHeaders(userInfo, r.Header)
|
newHeaders := getProxyHeaders(userInfo, r.Header)
|
||||||
r.Header = newHeaders
|
r.Header = newHeaders
|
||||||
|
@ -190,13 +190,17 @@ func TestImpersonator(t *testing.T) {
|
|||||||
URL: validURL,
|
URL: validURL,
|
||||||
},
|
},
|
||||||
expectMockToken: func(t *testing.T, recorder *mocktokenauthenticator.MockTokenMockRecorder) {
|
expectMockToken: func(t *testing.T, recorder *mocktokenauthenticator.MockTokenMockRecorder) {
|
||||||
userInfo := user.DefaultInfo{Name: "test-user", Groups: []string{"test-group-1", "test-group-2"}}
|
userInfo := user.DefaultInfo{
|
||||||
|
Name: "test-user",
|
||||||
|
Groups: []string{"test-group-1", "test-group-2"},
|
||||||
|
UID: "test-uid",
|
||||||
|
}
|
||||||
response := &authenticator.Response{User: &userInfo}
|
response := &authenticator.Response{User: &userInfo}
|
||||||
recorder.AuthenticateToken(gomock.Any(), "test-token").Return(response, true, nil)
|
recorder.AuthenticateToken(gomock.Any(), "test-token").Return(response, true, nil)
|
||||||
},
|
},
|
||||||
wantHTTPBody: "successful proxied response",
|
wantHTTPBody: "successful proxied response",
|
||||||
wantHTTPStatus: http.StatusOK,
|
wantHTTPStatus: http.StatusOK,
|
||||||
wantLogs: []string{"\"level\"=0 \"msg\"=\"proxying authenticated request\" \"authenticator\"={\"apiGroup\":null,\"kind\":\"\",\"name\":\"authenticator-one\"} \"authenticatorNamespace\"=\"foo\" \"groups\"=[\"test-group-1\",\"test-group-2\"] \"method\"=\"GET\" \"url\"=\"http://pinniped.dev/blah\" \"user\"=\"test-user\""},
|
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\""},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user