Documentation ¶
Overview ¶
Package oauthutil provides helpers for working with OAuth 2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingOAuthConfig is returned when OAuth configuration has not been provided. ErrMissingOAuthConfig = errors.New("missing OAuth config") )
View Source
var ( // ErrMissingOAuthToken is returned when OAuth token has not been provided. ErrMissingOAuthToken = errors.New("missing OAuth token") )
Functions ¶
func Login ¶
func Login(opts *LoginOptions) (code string, err error)
Login prompts users to authenticate with a browser.
Types ¶
type FileStore ¶
type FileStore struct { // Directory credentials are stored. Directory string // Filename of credential being used. Filename string }
FileStore manages credentials locally.
func (*FileStore) Claims ¶
func (s *FileStore) Claims() (*oidcclaims.Claims, error)
Claims related to current token.
func (*FileStore) Login ¶
func (s *FileStore) Login(ctx context.Context, loginOpts *LoginOptions) error
Login authorizes the user and writes their token to the FileStore.
type LoginOptions ¶
LoginOptions contain the configuration for the Authorize command.
func NewLoginOptions ¶
func NewLoginOptions() *LoginOptions
NewLoginOptions returns LoginOptions with defaults set.
type Store ¶
type Store interface { oauth2.TokenSource Name() string Login(ctx context.Context, loginOpts *LoginOptions) error Claims() (*oidcclaims.Claims, error) UpdateUserInfo(ctx context.Context) error }
Store allows for login and accessing Tokens.
Click to show internal directories.
Click to hide internal directories.