alexbrainman / sspi

Windows SSPI
BSD 3-Clause "New" or "Revised" License
84 stars 27 forks source link

HTTP Transport/RoundTripper? #14

Closed sean-r-williams closed 8 months ago

sean-r-williams commented 8 months ago

Hi all,

I'm trying to call an NTLM-authenticated HTTP service in Go. I'm running on a Windows host and the default user credentials accessible via SSPI have access to this service.

I've tried using the following related modules:

I tried reading through the tests as described in #6 (comment), but I'm not well-versed in Go and didn't understand how to chain this into existing HTTP client calls. I have to provide an NTLMSSP_NEGOTIATE message to the server before getting an NTLMSSP_CHALLENGE, and I'm not sure how to build one of these using the methods provided in sspi or sspi/negotiate.

Is there some documentation available for using this package to do NTLM negotiation?

alexbrainman commented 8 months ago

Is there some documentation available for using this package to do NTLM negotiation?

If you need to call a NTLM protected http server from Windows client, try this test

https://github.com/alexbrainman/sspi/blob/1a75b4708caa219fd8d8261cd37c923ff6710a32/ntlm/http_test.go#L121-L155

This is very old code that have not been tested for a long time. So I would not be surprised that it does not work.

Alex

sean-r-williams commented 8 months ago

Thanks for the context! I was able to write a RoundTripper based on this and the one from Azure/go-ntlmssp.