CalAnonSync/src/calanonsync/vendor/github.com/vadimi/go-http-ntlm
Andreas Schneider a739a9b4bb Fixed negotiation offsets 2018-04-03 12:02:23 +02:00
..
LICENSE Added modified ntlm vendor lib (with fixed negotiation message) 2018-04-03 11:56:26 +02:00
negotiator.go Fixed negotiation offsets 2018-04-03 12:02:23 +02:00
ntlmtransport.go Added modified ntlm vendor lib (with fixed negotiation message) 2018-04-03 11:56:26 +02:00
readme.md Added modified ntlm vendor lib (with fixed negotiation message) 2018-04-03 11:56:26 +02:00

readme.md

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)
}