NTLM transport for go http client that supports insecure TLS connections.

José González Krause 23b779ef0f Added insecure TLS transport support 1 year ago
.gitignore 23b779ef0f Added insecure TLS transport support 1 year ago
LICENSE 8b649f8acd Initial commit 3 years ago
httpntlm_test.go e85b1939e9 Tests cleanup 3 years ago
negotiator.go 8b649f8acd Initial commit 3 years ago
ntlmtransport.go 23b779ef0f Added insecure TLS transport support 1 year ago
readme.md 23b779ef0f Added insecure TLS transport support 1 year ago

readme.md

ntlmTransport

This is a fork from https://github.com/vadimi/go-http-ntlm modified to support insecure TLS connections.

go-http-ntlm

go-http-ntlm is a Go package that contains NTLM transport (http.RoundTripper implementation) for http.Client to make NTLM auth protected http requests.

It is based on https://github.com/ThomsonReutersEikon/go-ntlm library.

Usage example

package main

import (
    "io/ioutil"
    "log"
    "net/http"
    "strings"

    "github.com/vadimi/go-http-ntlm"
)

func main() {

    // configure http client
    client := http.Client{
        Transport: &httpntlm.NtlmTransport{
            Domain:   "mydomain",
            User:     "testuser",
            Password: "fish",
        },
    }

    req, err := http.NewRequest("GET", "http://server/ntlm-auth-resource", strings.NewReader(""))
    resp, err := client.Do(req)

    if err != nil {
        log.Fatal(err)
    }

    defer func() {
        err := resp.Body.Close()
        if err != nil {
            log.Fatal(err)
        }
    }()

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatal(err)
    }

    log.Println(body)
}