Versions in this module Expand all Collapse all v0 v0.13.1 Oct 16, 2014 v0.13.0 Oct 9, 2014 Changes in this version + var ErrBewitExpired = AuthError("bewit expired") + var ErrInvalidBewitMethod = AuthError("bewit only allows HEAD and GET requests") + var ErrInvalidMAC = AuthError("invalid MAC") + var ErrMissingServerAuth = AuthError("missing Server-Authentication header") + var ErrNoAuth = AuthError("no Authorization header or bewit parameter found") + var ErrReplay = AuthError("request nonce is being replayed") + var ErrTimestampSkew = AuthError("timestamp skew too high") + var MaxTimestampSkew = time.Minute + var Now = time.Now + type Auth struct + ActualTimestamp time.Time + Credentials Credentials + Ext string + Hash []byte + Host string + IsBewit bool + MAC []byte + Method string + Nonce string + Port string + ReqHash bool + RequestURI string + Timestamp time.Time + func NewAuthFromRequest(req *http.Request, creds CredentialsLookupFunc, nonce NonceCheckFunc) (*Auth, error) + func NewRequestAuth(req *http.Request, creds *Credentials, tsOffset time.Duration) *Auth + func NewURLAuth(uri string, creds *Credentials, tsOffset time.Duration) (*Auth, error) + func ParseBewit(bewit string) (*Auth, error) + func ParseRequestHeader(header string) (*Auth, error) + func (auth *Auth) Bewit() string + func (auth *Auth) NormalizedString(t AuthType) string + func (auth *Auth) ParseHeader(header string, t AuthType) error + func (auth *Auth) PayloadHash(contentType string) hash.Hash + func (auth *Auth) RequestHeader() string + func (auth *Auth) ResponseHeader(ext string) string + func (auth *Auth) SetHash(h hash.Hash) + func (auth *Auth) StaleTimestampHeader() string + func (auth *Auth) UpdateOffset(header string) (time.Duration, error) + func (auth *Auth) Valid() error + func (auth *Auth) ValidHash(h hash.Hash) bool + func (auth *Auth) ValidResponse(header string) error + type AuthError string + func (e AuthError) Error() string + type AuthFormatError struct + Err string + Field string + func (e AuthFormatError) Error() string + type AuthType int + const AuthBewit + const AuthHeader + const AuthResponse + func (a AuthType) String() string + type CredentialError struct + Credentials *Credentials + Type CredentialErrorType + func (e *CredentialError) Error() string + type CredentialErrorType int + const IDAppMismatch + const UnknownApp + const UnknownID + func (t CredentialErrorType) String() string + type Credentials struct + App string + Data interface{} + Delegate string + Hash func() hash.Hash + ID string + Key string + func (creds *Credentials) MAC() hash.Hash + type CredentialsLookupFunc func(*Credentials) error + type NonceCheckFunc func(string, time.Time, *Credentials) bool