Documentation ¶
Overview ¶
Package digest provides authentication strategy, to authenticate HTTP requests using the standard digest scheme as described in RFC 7616.
Index ¶
- Variables
- func SetHash(h crypto.Hash, algorithm string) auth.Option
- func SetOpaque(opaque string) auth.Option
- func SetRealm(realm string) auth.Option
- type Digest
- type FetchUser
- type Header
- func (h Header) Algorithm() string
- func (h Header) Clone() Header
- func (h Header) Cnonce() string
- func (h Header) Compare(ch Header) error
- func (h Header) NC() string
- func (h Header) Nonce() string
- func (h Header) Opaque() string
- func (h Header) Parse(authorization string) error
- func (h Header) QOP() string
- func (h Header) Realm() string
- func (h Header) Response() string
- func (h Header) SetAlgorithm(a string)
- func (h Header) SetCnonce(cn string)
- func (h Header) SetNC(n string)
- func (h Header) SetNonce(n string)
- func (h Header) SetOpaque(o string)
- func (h Header) SetQOP(q string)
- func (h Header) SetRealm(r string)
- func (h Header) SetResponse(r string)
- func (h Header) SetURI(u string)
- func (h Header) SetUserName(u string)
- func (h Header) String() string
- func (h Header) URI() string
- func (h Header) UserName() string
- func (h Header) WWWAuthenticate() string
Constants ¶
This section is empty.
Variables ¶
ErrInavlidHeader is returned by Header parse when authz header is not digest.
var ErrInvalidResponse = errors.New("strategies/digest: Invalid Response")
ErrInvalidResponse is returned by Strategy when client authz response does not match server hash.
Functions ¶
func SetHash ¶
SetHash set the hashing algorithm to hash the user password. Default md5
SetHash(crypto.SHA1, "sha1")
Types ¶
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest authentication strategy.
func New ¶
New returns digest authentication strategy. Digest strategy use MD5 as default hash. Digest use cache to store nonce.
func (*Digest) Authenticate ¶
Authenticate user request and returns user info, Otherwise error.
func (*Digest) GetChallenge ¶
GetChallenge returns string indicates the authentication scheme. Typically used to adds a HTTP WWW-Authenticate header.
type Header ¶
Header represents The Authorization Header Field, and WWW-Authenticate Response Header Field as described in RFC 7616
func (Header) Algorithm ¶
Algorithm return a string indicating an hash algorithm used to produce the digest and an unkeyed digest.
func (Header) Realm ¶
Realm return a string to be displayed to users so they know which username and password to use. See https://tools.ietf.org/html/rfc7616#section-3.3
func (Header) SetAlgorithm ¶
SetAlgorithm sets hash algorithm.
func (Header) SetResponse ¶
SetResponse sets the client response.
func (Header) URI ¶
URI return Effective Request URI See https://tools.ietf.org/html/rfc7230#section-5.5
func (Header) WWWAuthenticate ¶
WWWAuthenticate return string represents HTTP WWW-Authenticate header field with Digest scheme.