tokenstore

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("auth token not found")
)

Functions

func WithKeyring

func WithKeyring(k keyring.Keyring) func(o *Opts)

WithKeyring specifies a custom keyring to use.

Types

type Opts

type Opts struct {
	// Keyring is a custom keyring to use rather than
	// the default one, which is configured with
	// environment variables.
	Keyring keyring.Keyring
}

type Storage

type Storage struct {
	Context string
	// contains filtered or unexported fields
}

func New

func New(context string, opts ...func(*Opts)) Storage

New creates a new token storage driver. The context is the authentication context to use. This is usually 'default' and in future can be expanded to allow CLI users to switch between separate Common Fate tenancies.

func (*Storage) Clear

func (s *Storage) Clear() error

Clear the token

func (*Storage) Save

func (s *Storage) Save(token *oauth2.Token) error

Save the token

func (*Storage) Token

func (s *Storage) Token() (*oauth2.Token, error)

Token returns the OAuth2.0 token. It meets the TokenSource interface in the oauth2 package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL