Documentation
¶
Overview ¶
Package apikey is a provider for services that issue a static API key or token, driven by configuration: where the token goes in a request, which endpoint verifies it, and where the account is in the response.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotJSON = errors.New("apikey: response is not JSON")
ErrNotJSON is returned when a validation response is not JSON.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Manifest is the provider's manifest. It needs an auth method with key
// Method whose fields include Field.
Manifest provider.Manifest
// Method is the auth method's key. Default "api_token".
Method string
// Field is the credential field holding the token. Default "token".
Field string
// Header is the request header that carries the token. Default
// "Authorization".
Header string
// Prefix precedes the token in the header. Default "Bearer " when Header
// is Authorization, otherwise none.
Prefix string
// Verify is the request that validates the token. Required.
Verify Request
// Account, if set, is a second request that discovers the account, for
// providers whose verification response does not name it.
Account *Request
}
Config describes a static-token provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a static-token provider.
func (*Provider) Authenticate ¶
Authenticate implements provider.Provider.
func (*Provider) Manifest ¶
Manifest implements provider.Provider.
type Request ¶
type Request struct {
Path string
AccountIDPath string
AccountLabelPath string
// ScopesPath, if set, names an array of strings.
ScopesPath string
}
Request is a GET to a path under the manifest's first base URL, and where to find the account in its JSON response. Paths are dot-separated keys and array indexes, for example "result.0.id".
Click to show internal directories.
Click to hide internal directories.