Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AllValidClaims is a list of the claims expected from a JWT token AllValidClaims = []string{ apiProductListClaim, audienceClaim, clientIDClaim, applicationNameClaim, scopeClaim, expClaim, developerEmailClaim, } )
var ErrBadAuth = errors.New("permission denied")
ErrBadAuth is an error because of incorrect auth
var ErrInternalError = errors.New("internal error")
ErrInternalError is an error because of internal error
var ErrNoAuth = errors.New("missing authentication")
ErrNoAuth is an error because of missing auth
Functions ¶
This section is empty.
Types ¶
type APIKeyRequest ¶
type APIKeyRequest struct {
APIKey string `json:"apiKey"`
}
APIKeyRequest is the request to Apigee's verifyAPIKey API
type APIKeyResponse ¶
type APIKeyResponse struct {
Token string `json:"token"`
}
APIKeyResponse is the response from Apigee's verifyAPIKey API
type Context ¶
type Context struct { context.Context ClientID string AccessToken string Application string APIProducts []string Expires time.Time DeveloperEmail string Scopes []string APIKey string }
A Context wraps all the various information that is needed to make requests through the Apigee adapter.
type Manager ¶
type Manager interface { Close() Authenticate(ctx context.Context, apiKey string, claims map[string]interface{}, apiKeyClaimKey string) (*Context, error) }
A Manager wraps all things related to auth processing
func NewManager ¶
NewManager constructs a new Manager and begins an update loop to periodically refresh JWT credentials if options.pollInterval > 0. Call Close() when done.
type Options ¶
type Options struct { // PollInterval sets refresh rate of JWT credentials, disabled if = 0 PollInterval time.Duration // Client is a configured HTTPClient Client *http.Client // APIKeyCacheDuration is the length of time APIKeys are cached when unable to refresh APIKeyCacheDuration time.Duration }
Options allows us to specify options for how this auth manager will run