Azure / go-ntlmssp

NTLM/Negotiate authentication over HTTP
MIT License
189 stars 67 forks source link

How to do it over https #15

Open vk18vk opened 6 years ago

vk18vk commented 6 years ago

it works fine for http but how do we get it done for https

budavariam commented 5 years ago

In my case I got an error for https connection in go: stream error: stream ID 1; HTTP_1_1_REQUIRED

According to https://golang.org/pkg/net/http/

Starting with Go 1.6, the http package has transparent support for the HTTP/2 protocol when using HTTPS. Programs that must disable HTTP/2 can do so by setting Transport.TLSNextProto (for clients) or Server.TLSNextProto (for servers) to a non-nil, empty map.

After I set TLSNextProto to a non-nil empty map it worked with https.

client := &http.Client{
  Transport: ntlmssp.Negotiator{
    RoundTripper: &http.Transport{
      TLSNextProto: map[string]func(authority string, c *tls.Conn) http.RoundTripper{},
    },
  },
}