Documentation ¶
Index ¶
- type CacheAlert
- type DebugPrint
- type FakeTokenStore
- func (f *FakeTokenStore) Delete(cluster string) error
- func (f *FakeTokenStore) Load(cluster string) (*oauth2.Token, error)
- func (f *FakeTokenStore) Store(cluster string, token *oauth2.Token) error
- func (f *FakeTokenStore) WithDeleteErr(err error) *FakeTokenStore
- func (f *FakeTokenStore) WithLoadErr(err error) *FakeTokenStore
- func (f *FakeTokenStore) WithStoreErr(err error) *FakeTokenStore
- func (f *FakeTokenStore) WithToken(cluster string, token *oauth2.Token) *FakeTokenStore
- type Fallback
- type FileStore
- type Keyring
- type LoadStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheAlert ¶
type CacheAlert struct { LoadStorer // contains filtered or unexported fields }
CacheAlert is a tokenLoadStorer that detects when a token's subject for a different cluster is changing, and produces a warning over an appropriate communication channel.
type FakeTokenStore ¶ added in v0.0.3
FakeTokenStore is a test implementation of LoadStorer that stores tokens in memory instead of the system keychain.
func NewFakeTokenStore ¶ added in v0.0.3
func NewFakeTokenStore() *FakeTokenStore
func (*FakeTokenStore) Delete ¶ added in v0.0.3
func (f *FakeTokenStore) Delete(cluster string) error
func (*FakeTokenStore) Load ¶ added in v0.0.3
func (f *FakeTokenStore) Load(cluster string) (*oauth2.Token, error)
func (*FakeTokenStore) Store ¶ added in v0.0.3
func (f *FakeTokenStore) Store(cluster string, token *oauth2.Token) error
func (*FakeTokenStore) WithDeleteErr ¶ added in v0.0.5
func (f *FakeTokenStore) WithDeleteErr(err error) *FakeTokenStore
func (*FakeTokenStore) WithLoadErr ¶ added in v0.0.5
func (f *FakeTokenStore) WithLoadErr(err error) *FakeTokenStore
func (*FakeTokenStore) WithStoreErr ¶ added in v0.0.5
func (f *FakeTokenStore) WithStoreErr(err error) *FakeTokenStore
func (*FakeTokenStore) WithToken ¶ added in v0.0.5
func (f *FakeTokenStore) WithToken(cluster string, token *oauth2.Token) *FakeTokenStore
type Fallback ¶ added in v0.0.5
type Fallback struct {
// contains filtered or unexported fields
}
Fallback composes multiple backends into a single backend that:
- delegates Store() operations to a single specific backend
- delegates Load() operations to each backend of a list in turn, returning the token from the first backend to succeed
- delegates Delete() operations to all backends
func (*Fallback) Delete ¶ added in v0.0.5
Delete attempts to delete credentials for the named cluster from every `backend` (but not `storeBackend` explicitly, which should also be present in the list of all backends).
If any delete succeeded, then the entire operation is successful. Otherwise, if all errors are "not found", an error that compares to `fs.ErrNotFound` is returned. Otherwise, one of the errors could be a backend where the token was found but not successfully deleted; these errors are propagated as-is.
type FileStore ¶ added in v0.0.5
type FileStore struct {
// contains filtered or unexported fields
}
FileStore persists tokens in JSON files in a directory, one file per token. The tokens are stored unecrypted. This implementation may be used when Keyring cannot be used, for example, in a CI environment when there is no encrypted keyring.
func NewFileTokenStore ¶ added in v0.0.5
type Keyring ¶
type Keyring struct {
// contains filtered or unexported fields
}
Keyring stores a JWT token on the user's keyring via the OS-specific keyring mechanism of the current platform.
type LoadStorer ¶
type LoadStorer interface { // Load loads a token for a cluster, specified by hostname. It returns // fs.ErrNotFound if the token isn't present, or an unspecified non-nil // error for any other error conditions. Load(cluster string) (*oauth2.Token, error) // Store stores a token for a cluster, specified by hostname. It returns an // unspecified non-nil error if the operation fails; in this case, the state // of the token storage for the specified cluster is not specified (token // storage for other clusters is unaffected). Store(cluster string, token *oauth2.Token) error // Delete deletes a token for a cluster, specified by hostname. It returns // fs.ErrNotFound if there is currently no token stored for the specified // cluster, or an unspecified non-nil error for any other error conditions // (although the storage backend should make a best-effort attempt to delete // the token). Delete(string) error }
LoadStorer provides access to a token via some backend implementation/policy.
func NewCacheAlert ¶
func NewCacheAlert(impl LoadStorer, stderr io.Writer) LoadStorer
func NewFallback ¶ added in v0.0.5
func NewFallback(storeBackend LoadStorer, backends ...LoadStorer) LoadStorer
NewFallback returns a backend that delegates Store() operations to `storeBackend` and Load()/Delete() operations to `backends` (see docs for Fallback). `storeBackend` should be repeated as an element of `backends` if it should be used for Load()/Delete() operations (which is the common case), though it does not need to be the first element.
func NewKeyring ¶
func NewKeyring() (LoadStorer, error)