Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // request attempt ErrUnauthorized = errors.New("unauthorized") )
Functions ¶
Types ¶
type Provider ¶
type Provider interface { // Authenticate takes the context of a HTTP // request and returns an object which should // describe the authenticated user/account and // and error if the authentication failes. Authenticate(ctx *routing.Context) (interface{}, error) }
Provider describes which functions an Authentication provider must provide.
type TokenAuthProvider ¶
type TokenAuthProvider struct {
// contains filtered or unexported fields
}
TokenAuthProvider provides an authentication method using basic header based authentication tokens.
func NewTokenAuthProvider ¶
func NewTokenAuthProvider(tokenHash string) *TokenAuthProvider
NewTokenAuthProvider creates a new instance of TokenAuthProvider passing the token to be used for authentication as bcrypt hash.
func (*TokenAuthProvider) Authenticate ¶
func (tap *TokenAuthProvider) Authenticate(ctx *routing.Context) (interface{}, error)
Authenticate checks the Authorization header for a Basic token and checks equality to the defined reference API token.
Click to show internal directories.
Click to hide internal directories.