-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom authentication (in particular NTLM) to proxies #1582
Comments
It's not obvious what the syntax should look like. This is the current API (string based)
Will want to preserve that, but also allow user to specify an HtmlAuth object if they want to. How about, define a new Proxy class, which is permissible as a value in the
|
Does proxying happen in Edit: Urllib3 only does Basic auth. Asked there if there's any plan to support custom auth. I don't know if it would be possible since AuthBase is in Requests. urllib3/urllib3#242 |
This is a good idea @matt-hickford. I see three ways of doing this:
I'm generally in favour of TAs. In particular, Transport Adapters are really the only thing that knows anything about HTTPS over proxy (the CONNECT verb), which needs to be differently handled from other kinds of messages. To that end, it seems more natural to provide proxy authentication solutions at the Transport Adapter level. Potentially TAs could take pluggable auth modules, just like individual requests? /cc @sigmavirus24 |
I would think Transport Adapters would take Proxy Adapters which handle using proxies in much the same way Transport Adapters handle the protocols (even though by default we only handle two). That said, Proxy Adapters could contain all the logic for pluggable auth "modules". This would then factor out the Proxy logic from the Transport Adapters and make things far more testable as well and allow people to configure crazy proxies however they like. |
I don't think we want to be adding a further Transport Adapter layer. Best to just say 'a Transport Adapter knows what to do'. |
Until urllib3 has this as an option there's not much we can do, so I'll close this until that time. |
Cool I've offered a bounty on the upstream issue urllib3/urllib3#242 You could label this 'blocked' or something |
Hello gents. I apologize to wake the sleeping giant. However Ive been trying to track down a viable workaround to request https: with NTLM proxy authentication and have come up short. @Lukasa et al I appreciate all the work to date. As of what is currently available it doesn't look like this is supported in urllib3, requests-ntlm or request. What does one do? Any suggestions? |
I believe requests-ntlm does have support for this in the code: have you tried it? |
Thanks for the reply. I have tried requests-ntlm if i have my creds correct this is what I get.
ConnectionError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /get (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))) |
@Lukasa. From what I can tell requests-ntlm will let you do NTLM auth with a proxy when using HTTP, but not with HTTPS. Am I missing something? Thanks again for your time. |
Ah, yes, @ryandebruyn that's correct. Unfortunately, httplib makes it very difficult to authenticate to proxies when setting up a TLS tunnel because for any non-200 response to the CONNECT it will throw an exception and lose the response data. We can in principle work around that but it's extremely difficult to do and potentially breaks quite a few behaviours. Sadly, this is just something that is very, very difficult to do. |
Requests can do many kinds of authentication—basic, digest, OAuth1. Even better, the great API allows users to specify a custom authentication class
However for proxies, the only authentication presently supported is Basic. The API doesn't allow you to specify other or custom classes. http://docs.python-requests.org/en/latest/user/advanced/#proxies
Please could you expand the API to allow custom authentication for proxies too?
This would be mega useful. NTLM proxies are common in Windows corporate networks. Python development can't get off the ground in my office because the package manager (and everything else) falls over at the proxy. Examples
The text was updated successfully, but these errors were encountered: