Documentation
¶
Overview ¶
Package auth computes the Authorization headers of the HTTP authentication schemes beyond Basic: AWS Signature Version 4, Digest, NTLM and Negotiate (SPNEGO). It only builds header values; the client sends them and runs the challenge exchanges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoTicket = errors.New("negotiate: no Kerberos ticket (run kinit, or set KRB5CCNAME)")
ErrNoTicket reports that Negotiate has no Kerberos credentials to use.
Functions ¶
func NTLMAuthenticate ¶
NTLMAuthenticate answers the server's Type-2 challenge among the WWW-Authenticate values with an NTLMv2 Type-3 message, for user ("DOMAIN\user", or a user alone) and password; both may be empty, as with curl's -u ":". The target name is not read, and no session key is exchanged, as curl does.
func NTLMNegotiate ¶
NTLMNegotiate returns the Authorization value that opens an NTLM exchange: the Type-1 message, with curl's flags and no domain or workstation.
Types ¶
type Digest ¶
type Digest struct {
Realm, Nonce, Opaque, Algorithm string
// QOP is the protection chosen among the offered ones: "auth",
// "auth-int", or "" for none (RFC 2069).
QOP string
// UserHash asks for the hashed user name (RFC 7616).
UserHash bool
}
Digest is a Digest challenge (RFC 7616) from a WWW-Authenticate header.
func ParseDigest ¶
ParseDigest reads the Digest challenge among WWW-Authenticate values.
func (*Digest) Authorization ¶
func (d *Digest) Authorization(user, password, method, uri string, body []byte, cnonce string, nc int) string
Authorization returns the Authorization header value answering the challenge for a request (method, request-target uri, body), with client nonce cnonce and nonce count nc.
type Negotiator ¶
type Negotiator struct {
// contains filtered or unexported fields
}
Negotiator makes Negotiate (SPNEGO) tokens from the Kerberos credential cache (KRB5CCNAME, else the default file cache) and configuration (KRB5_CONFIG, else /etc/krb5.conf); service tickets are cached.
func NewNegotiator ¶
func NewNegotiator() (*Negotiator, error)
NewNegotiator loads the configuration and the credential cache.
type SigV4 ¶
type SigV4 struct {
Provider1, Provider2, Region, Service string
}
SigV4 is a parsed --aws-sigv4 value: provider1[:provider2[:region[:service]]], as curl reads it.
func ParseSigV4 ¶
ParseSigV4 reads spec; a missing region or service is taken from host (service.region.provider.tld, as curl infers them).
type SigV4Request ¶
type SigV4Request struct {
Method string
URL *url.URL
Host string // the Host header sent
// Headers are signed with Host and the date header, names lower-case.
Headers []exchange.Header
Body []byte
// AccessKey and SecretKey sign. A session token is a header of the
// request (x-amz-security-token), signed with the others.
AccessKey, SecretKey string
Time time.Time
}
SigV4Request is what a signature covers.