Documentation ¶
Index ¶
- Variables
- type AuthClient
- func (a *AuthClient) GetHealthLive(ctx context.Context) (_ bool, err error)
- func (a *AuthClient) Resolve(ctx context.Context, accessKeyID string, clientIP string) (_ AuthServiceResponse, err error)
- func (a *AuthClient) ResolveWithCache(ctx context.Context, accessKeyID string, clientIP string) (_ AuthServiceResponse, err error)
- type AuthServiceCacheConfig
- type AuthServiceResponse
- type Config
Constants ¶
This section is empty.
Variables ¶
var AuthServiceError = errs.Class("auth service")
AuthServiceError wraps all the errors returned when resolving an access key.
Functions ¶
This section is empty.
Types ¶
type AuthClient ¶
type AuthClient struct { Config // Cache is used for caching authservice's responses. Cache *lrucache.ExpiringLRU // contains filtered or unexported fields }
AuthClient communicates with the Auth Service.
func (*AuthClient) GetHealthLive ¶
func (a *AuthClient) GetHealthLive(ctx context.Context) (_ bool, err error)
GetHealthLive returns the auth service health live status.
func (*AuthClient) Resolve ¶
func (a *AuthClient) Resolve(ctx context.Context, accessKeyID string, clientIP string) (_ AuthServiceResponse, err error)
Resolve maps an access key into an auth service response. clientIP is the IP of the client that originated the request and it's required to be sent to the Auth Service.
func (*AuthClient) ResolveWithCache ¶
func (a *AuthClient) ResolveWithCache(ctx context.Context, accessKeyID string, clientIP string) (_ AuthServiceResponse, err error)
ResolveWithCache is like Resolve, but it uses the underlying LRU cache to cache and returns cached authservice's successful responses if caching is enabled.
type AuthServiceCacheConfig ¶
type AuthServiceCacheConfig struct { Expiration time.Duration `user:"true" help:"how long to keep cached access grants in cache" default:"24h"` Capacity int `user:"true" help:"how many cached access grants to keep in cache" default:"10000"` }
AuthServiceCacheConfig describes configuration necessary to cache the results of auth service lookups.
type AuthServiceResponse ¶
type AuthServiceResponse struct { AccessGrant string `json:"access_grant"` SecretKey string `json:"secret_key"` Public bool `json:"public"` PublicProjectID string `json:"public_project_id,omitempty"` }
AuthServiceResponse is the struct representing the response from the auth service.
type Config ¶
type Config struct { BaseURL string `user:"true" help:"base url to use for resolving access key ids" releaseDefault:"" devDefault:"http://localhost:20000"` Token string `user:"true" help:"auth token for giving access to the auth service" releaseDefault:"" devDefault:"super-secret"` Timeout time.Duration `user:"true" help:"how long to wait for a single auth service connection" default:"10s"` BackOff backoff.ExponentialBackoff Cache AuthServiceCacheConfig }
Config describes configuration necessary to interact with the auth service.