Documentation
¶
Overview ¶
Package store provides local credential storage for OAuth tokens.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path is the path to the credentials file.
// Defaults to a namespaced file in ~/.config/panda/credentials/
Path string
// IssuerURL namespaces stored credentials by auth issuer.
IssuerURL string
// ClientID namespaces stored credentials by OAuth client.
ClientID string
// Resource namespaces stored credentials by requested resource.
Resource string
// RefreshBuffer is how long before expiry to refresh the token.
RefreshBuffer time.Duration
// AuthClient is the OAuth client for refreshing tokens.
AuthClient client.Client
}
Config configures the credential store.
type Store ¶
type Store interface {
// Path returns the resolved credentials file path.
Path() string
// Save saves tokens to the store.
Save(tokens *client.Tokens) error
// Load loads tokens from the store.
Load() (*client.Tokens, error)
// Clear removes stored tokens.
Clear() error
// GetAccessToken returns a valid access token, refreshing if needed.
GetAccessToken() (string, error)
// IsAuthenticated returns true if valid tokens are stored.
IsAuthenticated() bool
}
Store manages local credential storage.
Click to show internal directories.
Click to hide internal directories.