Documentation ¶
Overview ¶
Package cache defines the Credentials tokensource which allows caching of oauth2 tokens
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(tc TokenCache, ts oauth2.TokenSource, op ...TokenSourceParam) (oauth2.TokenSource, error)
New creates a caching tokensource for uses as an oauth2.TokenSource and ctxclient.Func
Types ¶
type FileCache ¶
type FileCache struct { Filename string // Don't report save error so not stopping program IgnorePersistsErr bool // contains filtered or unexported fields }
FileCache creates a file based cache
type TokenCache ¶
type TokenCache interface { Save(context.Context, *oauth2.Token) error Get(context.Context) (*oauth2.Token, error) }
TokenCache provides the methods for saving and retreiving tokens
type TokenSourceParam ¶
type TokenSourceParam func(*tokenSource)
TokenSourceParam update a clientFunc
func InitialToken ¶
func InitialToken(tk *oauth2.Token) TokenSourceParam
InitialToken is a TokenSourceParam used for setting the initial token for a TokenSource object
func TokenCacheDuration ¶
func TokenCacheDuration(dur time.Duration) TokenSourceParam
TokenCacheDuration is a TokenSourceParam used to set the duration time for a new token
Click to show internal directories.
Click to hide internal directories.