Documentation
¶
Index ¶
Constants ¶
const Prefix = "Digest "
Prefix for digest authentication headers
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Challenge ¶
type Challenge struct {
Realm string
Domain []string
Nonce string
Opaque string
Stale bool
Algorithm string
QOP []string
Charset string
Userhash bool
}
Challenge is a challange sent in the WWW-Authenticate header
func FindChallenge ¶
FindChallenge returns the first supported challenge in the headers
func ParseChallenge ¶
ParseChallenge parses the WWW-Authenticate header challenge
func (*Challenge) SupportsQOP ¶
SupportsQOP returns true if the challenge advertises support for the provided qop value
type Credentials ¶
type Credentials struct {
Username string
Realm string
Nonce string
URI string
Response string
Algorithm string
Cnonce string
Opaque string
QOP string
Nc int
Userhash bool
}
Credentials is a parsed version of the Authorization header
func Digest ¶
func Digest(c *Challenge, o Options) (*Credentials, error)
Digest creates credentials from a challenge and request options. Note: if you want to re-use a challenge, you must increment the Count.
func ParseCredentials ¶
func ParseCredentials(s string) (*Credentials, error)
ParseCredentials parses the Authorization header value into credentials
func (*Credentials) String ¶
func (c *Credentials) String() string
String formats the credentials into the header format
type Options ¶
type Options struct {
Method string
URI string
Count int
Username string
Password string
// used for testing
Cnonce string
}
Options for creating a credentials