Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
FileCache handles caching oauth2 tokens.
func NewFileCache ¶
NewFileCache creates a new instance.
type KeychainCache ¶
type KeychainCache struct {
// contains filtered or unexported fields
}
KeychainCache handles caching oauth2 tokens in the keychain.
func NewKeychainCache ¶
func NewKeychainCache(keychain *secrets.Keychain) *KeychainCache
NewKeychainCache creates a new keychain cache.
func (KeychainCache) Delete ¶
func (k KeychainCache) Delete(token Tokens) error
Delete deletes the tokens from the keychain.
func (KeychainCache) Get ¶
func (k KeychainCache) Get() (Tokens, error)
Get gets the tokens from the keychain.
func (KeychainCache) Put ¶
func (k KeychainCache) Put(token Tokens) error
Put puts the tokens in the keychain.
type TokenCache ¶
type TokenCache interface { Get() (Tokens, error) Put(token Tokens) error Delete(token Tokens) error }
TokenCache defines the interface for token caches.
type Tokens ¶
type Tokens struct { AccessToken string `yaml:"access_token"` RefreshToken string `yaml:"refresh_token"` IDToken string `yaml:"id_token"` Expiry time.Time `yaml:"expiry"` }
Tokens type
func (*Tokens) HasExpired ¶
HasExpired checks if the token has expired.
type TokensRefresher ¶
type TokensRefresher interface { // refreshOAuthTokens refreshes the oauth tokens, and saves them to file. RefreshOAuthTokens(refreshToken string) (Tokens, error) }
TokensRefresher interface
type TokensResolver ¶
type TokensResolver struct {
// contains filtered or unexported fields
}
TokensResolver struct
func NewTokensResolver ¶
func NewTokensResolver(tokensCache TokenCache, tokensRefresher TokensRefresher) *TokensResolver
NewTokensResolver creates a new tokens resolver.
func (*TokensResolver) GetTokens ¶
func (r *TokensResolver) GetTokens() (Tokens, error)
GetTokens gets the tokens, refreshing if needed.
Click to show internal directories.
Click to hide internal directories.