Documentation
¶
Overview ¶
Package tokenstore persists the OIDC refresh token between runs so a new certificate can be requested without an interactive login.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyPath = errors.New("token store path was empty")
ErrEmptyPath is returned by NewFileStore when no path is given
Functions ¶
This section is empty.
Types ¶
type DiscardStore ¶
type DiscardStore struct{}
DiscardStore is a Store that does not persist the token, so a login is needed on each run
func NewDiscardStore ¶
func NewDiscardStore() (*DiscardStore, error)
NewDiscardStore creates a new DiscardStore however, new(DiscardStore) (or just declaring a DiscardStore variable) is sufficient to initialize a DiscardStore.
func (*DiscardStore) Delete ¶
func (s *DiscardStore) Delete() error
Delete does nothing and always succeeds
func (*DiscardStore) Set ¶
func (s *DiscardStore) Set(v string) error
Set discards v and always succeeds
type FileStore ¶ added in v0.24.0
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is a Store that keeps the token in a plain file, for systems without a keyring such as servers. The token is not encrypted, so it is only protected by the permissions on the file, which is created readable and writable only by its owner. On Windows those permissions are not applied, so the file is protected only by the access control list it inherits.
func NewFileStore ¶ added in v0.24.0
NewFileStore creates a FileStore that keeps the token in the file at path. The file does not need to exist until FileStore.Set is called.
func (*FileStore) Delete ¶ added in v0.24.0
Delete removes the token file. Nothing is done if the file does not exist.
func (*FileStore) Get ¶ added in v0.24.0
Get returns the token from the file, or an empty string if the file does not exist or could not be read. Surrounding whitespace, such as a trailing newline added when the file was edited by hand, is removed.
type KeyringStore ¶
type KeyringStore struct {
// contains filtered or unexported fields
}
KeyringStore is a Store that keeps the token in the system keyring (such as Windows Credential Manager, macOS Keychain or the Secret Service on Linux) under an entry for the current user.
func NewKeyringStore ¶
func NewKeyringStore() (*KeyringStore, error)
NewKeyringStore creates a KeyringStore for the current user
func (*KeyringStore) Delete ¶
func (s *KeyringStore) Delete() error
Delete removes the token from the keyring. Nothing is done if the keyring holds no token.
func (*KeyringStore) Get ¶
func (s *KeyringStore) Get() string
Get returns the token from the keyring, or an empty string if there is none or the keyring could not be read
func (*KeyringStore) Set ¶
func (s *KeyringStore) Set(v string) error
Set stores v in the keyring, replacing any existing token
type Store ¶
type Store interface {
// Delete removes the stored token. Deleting when no token is stored is
// not an error.
Delete() error
// Get returns the stored token, or an empty string if no token is
// stored or it could not be read.
Get() string
// Set stores v, replacing any existing token.
Set(v string) error
}
Store persists a single refresh token