oauth2auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(name string, tokenSource oauth2.TokenSource) tokenauth.Source

New constructs Oauth2 tokenauth that returns valid access token. It is up to token source to do login or not.

func NewGCP

func NewGCP(name string, userName string, configPath string, initialConfig Config) (tokenauth.Source, error)

NewGCP constructs Oauth2 for Google provider tokenauth.Source which returns valid access tokens. Since saving and loading config is complainant with kube/config you are free to reuse that by putting kube config path inside `configPath` variable. This config file will be also used for caching valid tokens.

Types

type AuthCache

type AuthCache interface {
	Save(Config) error
}

AuthCache allows to save configuration info for just itself.

type Config

type Config struct {
	CmdPath string `json:"cmd-path,omitempty"`
	CmdArgs string `json:"cmd-args,omitempty"`

	TokenKey    string `json:"token-key,omitempty"`
	ExpiryKey   string `json:"expiry-key,omitempty"`
	TimeFmt     string `json:"time-fmt,omitempty"`
	AccessToken string `json:"access-token,omitempty"`
	Expiry      string `json:"expiry,omitempty"`
}

Config represents Oauth2 config with additional CLI configuration to get access token. Compliant with k8s config.

func NewConfigFromMap

func NewConfigFromMap(m map[string]string) (Config, error)

NewConfigFromMap constructs Oauth2 config but from generic map[string]string. Useful when used with kube config.

Jump to

Keyboard shortcuts

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