Clone this repo:
  1. c84ca69 Modify the ordering of 'digest-response' by Nathan Mulcahey · 6 years ago main master
  2. 9da83de Merge pull request #6 from paul-hoehne/master by xinsnake · 7 years ago v0.4.0
  3. 11167a6 Adding ability to execute requests when there are defects in the cert. by US\paul.hoehne · 7 years ago
  4. 82e6967 Adding headers to request and fixing case on URI name by paul-hoehne · 7 years ago
  5. 5ccd624 Adding headers to request and fixing case on URI name by paul-hoehne · 7 years ago

go-http-digest-auth-client

Golang Http Digest Authentication Client

This client implements RFC7616 HTTP Digest Access Authentication and by now the basic features should work.

Usage

// import
import dac "github.com/xinsnake/go-http-digest-auth-client"

// create a new digest authentication request
dr := dac.NewRequest(username, password, method, uri, payload)
response1, err := dr.Execute()

// check error, get response

// reuse the existing digest authentication request so no extra request is needed
dr.UpdateRequest(username, password, method, uri, payload)
response2, err := dr.Execute()

// check error, get response

Or you can use it with http.Request

t := dac.NewTransport(username, password)
req, err := http.NewRequest(method, uri, payload)

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

resp, err := t.RoundTrip(req)
if err != nil {
    log.Fatalln(err)
}
defer resp.Body.Close()

fmt.Println(resp)