Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownCache is returned when a cache implementation is // requested that has not been registered to the server. ErrUnknownCache = errors.New("requested cache is not known") // ErrNoCachedToken is returned for a cache miss when asking // for a specific owner. This error should generally prompt // the token to be obtained from the server, but may handle // terminal failures in the event that a cached token was // specifically requested. ErrNoCachedToken = errors.New("no cached token for that owner") )
Functions ¶
func GetTokenCacheList ¶
func GetTokenCacheList() []string
GetTokenCacheList returns a list of token caches that are currently registered to the system.
func RegisterTokenCacheFactory ¶
func RegisterTokenCacheFactory(name string, f TokenCacheFactory)
RegisterTokenCacheFactory can be used by token caches on import to register themselves. Names must be unique.
Types ¶
type TokenCache ¶
type TokenCache interface { PutToken(string, string) error GetToken(string) (string, error) DelToken(string) error }
The TokenCache is an interface that allows many possible token caches to be used to improve token efficiency.
func NewTokenCache ¶
func NewTokenCache(name string) (TokenCache, error)
NewTokenCache returns a token cache that's setup and ready for use. While its not expected that this function will be called outside of this package, there are some rare circumstances that it would be useful to initialize a cache for private use.
type TokenCacheFactory ¶
type TokenCacheFactory func() (TokenCache, error)
A TokenCacheFactory is a function that returns a TokenCache. This should generally not be an exported function in the implementation, and is instead registered here on import.