Repository navigation
Fix Proxy requiring Authentication usage - #137
Conversation
|
I think my issue is related. When I use the proxyAuthentication parameter, an After comparing with a curl --proxy --proxy-user, it seems that the |
…tication are combined CredentialBasicAuthentication.addCredentials() stored the target credential instead of the passed proxy credential, so requests through an authenticating proxy offered the wrong Basic credentials and the proxy kept answering 407. Store the credential that was passed in. Adds a socket-level fake authenticating proxy and regression tests covering proxyAuthentication alone and combined with basic authentication (the case that was broken). Fixes jenkinsci#314
4ca1abf to
286fbc4
Compare
|
finally taking a proper look, sorry for the wait. a lot changed under this PR: master moved to Apache HttpClient 5 (#197), which rewrote the whole auth flow your patch was fixing. I rebased the branch onto master (force-pushed, so your original commits are replaced) and ported what's still needed:
I also added a socket-level fake authenticating proxy and regression tests for both configurations. Full build green, SpotBugs clean. thanks for the Squid testing back when you opened this — it made checking the ported fix against the original report easy. — h3nr1-d14z |
h3nr1-d14z
left a comment
There was a problem hiding this comment.
ported and verified, see my comment above. the extra-credentials fix is the surviving core of the original PR, plus regression tests behind a fake authenticating proxy.
Hello there,
This PR intends to fix proxy requiring authentication usage and wrong documentation about it.
I could not find a way to use proxy requiring an authentication with preemptive authentication enabled, even in a simple out-of-this-PR context.
Java is not my main language so there may be a more elegant / efficient way to fix this issue.
Kind regards,
Tested against both authenticated and unauthenticaded Squid
mysquid.confRunning the Squids
Tests
pipeline { agent any stages { stage('Test') { steps { // No proxy httpRequest url: 'https://httpbin.org/' httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin' // Proxy without authentication httpRequest url: 'https://httpbin.org/', httpProxy: 'http://127.0.0.1:3129' httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin', httpProxy: 'http://127.0.0.1:3129' // Proxy with authentication httpRequest url: 'https://httpbin.org/', httpProxy: 'http://127.0.0.1:3128', proxyAuthentication: 'proxy-auth' httpRequest url: 'https://httpbin.org/basic-auth/user/passwd', authentication: 'httpbin', httpProxy: 'http://127.0.0.1:3128', proxyAuthentication: 'proxy-auth' } } } }