Socket
Socket
Sign inDemoInstall

github.com/vadimi/go-http-ntlm/v2

Package Overview
Dependencies
1
Maintainers
0
Alerts
File Explorer

Install Socket

Protect your apps from supply chain attacks

Install

github.com/vadimi/go-http-ntlm/v2

    v2.4.1

Version published
Maintainers
0

Readme

# 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.

## Usage example

```go
package main

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

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

func main() {

    // configure http client
    client := http.Client{
        Transport: &httpntlm.NtlmTransport{
            Domain:   "mydomain",
            User:     "testuser",
            Password: "fish",
            // Configure RoundTripper if necessary, otherwise DefaultTransport is used
            RoundTripper: &http.Transport{
                // provide tls config
                TLSClientConfig: &tls.Config{},
                // other properties RoundTripper, see http.DefaultTransport
            },
        },
    }

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

FAQs

Last updated on 06 May 2021

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc