Documentation ¶
Index ¶
- func KeyringMockInit()
- func NewFakeTokenForSubject(subject string) *oauth2.Token
- 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) WithPanic(value any) *FakeTokenStore
- func (f *FakeTokenStore) WithStoreErr(err error) *FakeTokenStore
- func (f *FakeTokenStore) WithToken(cluster string, token *oauth2.Token) *FakeTokenStore
- func (f *FakeTokenStore) WithTokenForSubject(cluster, subject string) *FakeTokenStore
- type FileStore
- type Keyring
- type LoadStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyringMockInit ¶ added in v0.0.8
func KeyringMockInit()
KeyringMockInit initializes this package so that its methods may be called from a test without reading or writing external state.
func NewFakeTokenForSubject ¶ added in v0.0.11
Types ¶
type FakeTokenStore ¶ added in v0.0.3
type FakeTokenStore struct { Tokens map[string]*oauth2.Token // Error values to be returned by Load, Store, and Delete, if not nil. LoadErr, StoreErr, DeleteErr error // Value to panic with in Load, Store, and Delete, if not nil. // Used to test that a method is NOT called. PanicValue any }
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) WithPanic ¶ added in v0.0.11
func (f *FakeTokenStore) WithPanic(value any) *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
func (*FakeTokenStore) WithTokenForSubject ¶ added in v0.0.11
func (f *FakeTokenStore) WithTokenForSubject(cluster, subject string) *FakeTokenStore
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 NewKeyring ¶
func NewKeyring() (LoadStorer, error)