Documentation
¶
Overview ¶
Package httpauth contains call-scoped HTTP request authorizers. It depends only on secrets and deliberately does not import the credentials root, keeping the protocol boundary usable by sources and transports alike.
Index ¶
Constants ¶
const MaxHeaderNameLength = 256
Variables ¶
var ( ErrInvalidHeaderName = errors.New("httpauth: invalid header name") ErrInvalidHeaderValue = errors.New("httpauth: invalid header value") ErrZeroSecret = errors.New("httpauth: zero secret") ErrNilRequest = errors.New("httpauth: nil request") ErrNilContext = errors.New("httpauth: nil context") ErrCanceled = errors.New("httpauth: authorization canceled") )
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
Authorizer applies one immutable authority snapshot to one concrete request attempt.
func Bearer ¶
func Bearer(value secrets.Secret) (Authorizer, error)
Bearer constructs an immutable Authorization: Bearer authorizer.
func Header ¶
func Header(name string, value secrets.Secret) (Authorizer, error)
Header constructs an immutable authorizer that sets one HTTP field. The authority is copied from Secret.Bytes only at construction, never retained in a caller-owned mutable buffer.
func NewBearer ¶
func NewBearer(value secrets.Secret) (Authorizer, error)
NewBearer is an explicit constructor alias for callers that prefer the New naming convention.
func NewHeader ¶
func NewHeader(name string, value secrets.Secret) (Authorizer, error)
NewHeader is an explicit constructor alias for callers that prefer the conventional New prefix.
func None ¶
func None() Authorizer
None returns an immutable no-op authorizer for explicitly unauthenticated local transports.
type InvalidHeaderNameError ¶
type InvalidHeaderNameError = invalidHeaderNameError
InvalidHeaderNameError reports a malformed HTTP field name without retaining the caller's input.
type InvalidHeaderValueError ¶
type InvalidHeaderValueError = invalidHeaderValueError
InvalidHeaderValueError reports an authority that cannot safely become an HTTP header value.
type NilRequestError ¶
type NilRequestError = nilRequestError
NilRequestError reports an attempt to authorize a nil request.
type ZeroSecretError ¶
type ZeroSecretError = zeroSecretError
ZeroSecretError reports use of an invalid zero secrets.Secret.