[IGN-4258]Digest auth with httpClient


Has anyone done a http request using digest auth as authentication method?
I've tried using httpClient(), but without any results. Would be super nice if someone could share some knowledge/code on this.

This'll probably be tricky to do from client code, although if you have a fixed target you might be able to manually encode the right authorization headers. It depends on which form of digest auth the server is expecting; more modern forms pass a nonce back to an initial request, so you'd have to issue multiple requests to properly authenticate.

We have plans to support this directly, but no timeline.

I recall having to create a module that would bring in Apache HttpComponents/HttpClient library to help facilitate Digest Auth interactions.. That was back in the 8.0 timeframe...

@kcollins1 is correct. We were trying to reach an HTTP client that uses Digest Auth in Ignition 7.9.8. At the time, we were not using any built-in system.http.x functions and were instead trying to use the urllib2 library. We kept bricking the test unit (fixed by reboot thankfully) because of a bug in urllib2 that failed to close one of the sockets on the digest auth chain and our unit can only handle 10 concurrent connections. We were polling for 26 tables worth of data (so 26 connections subsequently). Our way around it was to write an external module and use Apache HTTP outside of Jython 2.5. I think with newer versions of Ignition, you might be able to importurllib3 or even the requests module to facilitate your needs.

If you aren't familiar with how Digest Auth works behind the scenes, I'd encourage a read. Summary, it opens a socket, sends the request without authentication information, gets the failure, then re-transmits the request with authentication. Each of those attempts should open (and close) it's socket on completion (successful or not).

I'd be happy to answer any other questions you might have. :slight_smile:

Thanks for the replies! So basically, there is no way without external libraries?

Have you examined the error response headers for the nonce you need? So you can compute the digest yourself?

I'll have to look into how to do that, but thanks for the idea. I'll check I can do that.

Did you end up figuring this out? I am working on a project that requires Digest Auth and I haven't found a way to do it in Ignition. I can read from the IO-Link device I am working without Digest Auth, but I haven't found a way to write the data I need since authentication is blocking me.

I haven't found how to do it...