auth

package
v2.2.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 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 LicenseInfo added in v2.2.0

type LicenseInfo struct {
	ID             string      `json:"id"`             // License ID, used to identify the license
	Description    string      `json:"description"`    // Description for which the license should be used
	Audiences      []string    `json:"audiences"`      // Cluster IDs that this license can be used with
	ExpirationDate string      `json:"expirationDate"` // ($date-time) the license will expire on
	Limits         interface{} `json:"limits"`         // Map of limits determining bound to the license
}

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)
	GetLicense(ctx context.Context, id string) (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