Documentation
¶
Overview ¶
Package auth authenticates named broker clients from shared secrets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissing means no usable credential was presented. ErrMissing = errors.New("authentication required") // ErrInvalid means a credential was presented but matched no client. ErrInvalid = errors.New("invalid credentials") )
Functions ¶
func SecretFromAuthorization ¶
SecretFromAuthorization extracts a broker secret from Bearer or Basic auth.
Types ¶
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator resolves Authorization headers to named clients.
func New ¶
func New(secrets map[string]string, opts Options) (*Authenticator, error)
New builds an Authenticator from client id to shared secret.
func (*Authenticator) AuthenticateHeader ¶
func (a *Authenticator) AuthenticateHeader(header string) (string, error)
AuthenticateHeader authenticates one raw Authorization header value.
func (*Authenticator) AuthenticateRequest ¶
func (a *Authenticator) AuthenticateRequest(r *http.Request) (string, error)
AuthenticateRequest authenticates the Authorization header from r.
Click to show internal directories.
Click to hide internal directories.