auth

package
v2.1.4-rc.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKCEChallengeMethodS256 = "S256"
)

Variables

View Source
var ErrNotLoggedIn = errors.New("not logged in")

Functions

func EnsureLoggedIn

func EnsureLoggedIn(ctx context.Context, executor LoginExecutor) (connector.LoginResult_Code, error)

EnsureLoggedIn will check if the user is logged in and if not initiate the login flow.

Types

type CodeVerifier

type CodeVerifier string

func NewCodeVerifier

func NewCodeVerifier() (CodeVerifier, error)

func (CodeVerifier) CodeChallengePlain

func (v CodeVerifier) CodeChallengePlain() string

func (CodeVerifier) CodeChallengeS256

func (v CodeVerifier) CodeChallengeS256() string

func (CodeVerifier) String

func (v CodeVerifier) String() string

type LoginExecutor

type LoginExecutor interface {
	Worker(ctx context.Context) error
	Login(ctx context.Context) error
	Logout(ctx context.Context) error
	GetToken(ctx context.Context) (string, error)
	GetAPIKey(ctx context.Context, description string) (string, error)
	GetUserInfo(ctx context.Context) (*authdata.UserInfo, error)
}

LoginExecutor controls the execution of a login flow

func NewLoginExecutor

func NewLoginExecutor(
	env client.Env,
	saveTokenFunc func(context.Context, *oauth2.Token) error,
	saveUserInfoFunc func(context.Context, *authdata.UserInfo) error,
	openURLFunc func(string) error,
	stdout io.Writer,
	scout chan<- scout.ScoutReport,
) LoginExecutor

NewLoginExecutor returns an instance of LoginExecutor

func NewStandardLoginExecutor

func NewStandardLoginExecutor(env client.Env, stdout io.Writer, scout chan<- scout.ScoutReport) LoginExecutor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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