mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-06 13:36:54 +00:00
also use port number when checking https proxy for WebhookAuthenticator
This commit is contained in:
@@ -510,7 +510,7 @@ func (c *webhookCacheFillerController) validateEndpoint(endpoint string, conditi
|
||||
return nil, conditions, false, false
|
||||
}
|
||||
|
||||
usingProxyForHost, err := c.proxyDetector.UsingProxyForHost(endpointHostPort.Host)
|
||||
usingProxyForHost, err := c.proxyDetector.UsingProxyForHost(endpointHostPort.Endpoint())
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("%s: %s", "spec.endpoint URL error", err.Error())
|
||||
conditions = append(conditions, &metav1.Condition{
|
||||
|
||||
@@ -1068,7 +1068,10 @@ func TestController(t *testing.T) {
|
||||
fakeProxyDetect := fakeproxydetect.New(true, nil)
|
||||
t.Cleanup(func() {
|
||||
require.Equal(t, 1, fakeProxyDetect.NumberOfInvocations())
|
||||
require.Equal(t, "127.0.0.1", fakeProxyDetect.ReceivedHostDuringMostRecentInvocation())
|
||||
require.Equal(t,
|
||||
strings.TrimPrefix(goodWebhookAuthenticatorSpecWithCA.Endpoint, "https://"),
|
||||
fakeProxyDetect.ReceivedHostDuringMostRecentInvocation(),
|
||||
)
|
||||
})
|
||||
return fakeProxyDetect
|
||||
},
|
||||
@@ -1117,7 +1120,10 @@ func TestController(t *testing.T) {
|
||||
fakeProxyDetect := fakeproxydetect.New(false, nil)
|
||||
t.Cleanup(func() {
|
||||
require.Equal(t, 1, fakeProxyDetect.NumberOfInvocations())
|
||||
require.Equal(t, "127.0.0.1", fakeProxyDetect.ReceivedHostDuringMostRecentInvocation())
|
||||
require.Equal(t,
|
||||
strings.TrimPrefix(goodWebhookAuthenticatorSpecWithCA.Endpoint, "https://"),
|
||||
fakeProxyDetect.ReceivedHostDuringMostRecentInvocation(),
|
||||
)
|
||||
})
|
||||
return fakeProxyDetect
|
||||
},
|
||||
@@ -1160,7 +1166,10 @@ func TestController(t *testing.T) {
|
||||
fakeProxyDetect := fakeproxydetect.New(true, nil)
|
||||
t.Cleanup(func() {
|
||||
require.Equal(t, 1, fakeProxyDetect.NumberOfInvocations())
|
||||
require.Equal(t, "127.0.0.1", fakeProxyDetect.ReceivedHostDuringMostRecentInvocation())
|
||||
require.Equal(t,
|
||||
strings.TrimPrefix(goodWebhookAuthenticatorSpecWithCA.Endpoint, "https://"),
|
||||
fakeProxyDetect.ReceivedHostDuringMostRecentInvocation(),
|
||||
)
|
||||
})
|
||||
return fakeProxyDetect
|
||||
},
|
||||
@@ -1208,7 +1217,10 @@ func TestController(t *testing.T) {
|
||||
fakeProxyDetect := fakeproxydetect.New(false, errors.New("fake proxy detector error"))
|
||||
t.Cleanup(func() {
|
||||
require.Equal(t, 1, fakeProxyDetect.NumberOfInvocations())
|
||||
require.Equal(t, "127.0.0.1", fakeProxyDetect.ReceivedHostDuringMostRecentInvocation())
|
||||
require.Equal(t,
|
||||
strings.TrimPrefix(goodWebhookAuthenticatorSpecWithCA.Endpoint, "https://"),
|
||||
fakeProxyDetect.ReceivedHostDuringMostRecentInvocation(),
|
||||
)
|
||||
})
|
||||
return fakeProxyDetect
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user