auth

package
v2.8.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKCEChallengeMethodS256 = "S256"
)

Variables

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

Functions

func GetCloudAPIKey added in v2.7.0

func GetCloudAPIKey(ctx context.Context, l LoginExecutor, desc string, autoLogin bool) (string, error)

func GetCloudUserInfo added in v2.7.0

func GetCloudUserInfo(ctx context.Context, l LoginExecutor, refresh, autoLogin bool) (*authdata.UserInfo, error)

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

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         any      `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
	LoginAPIKey(ctx context.Context, key string) (bool, error)
	Logout(ctx context.Context) error
	GetAPIKey(ctx context.Context, description string) (string, error)
	GetLicense(ctx context.Context, id string) (string, string, error)
	GetUserInfo(ctx context.Context, refresh bool) (*authdata.UserInfo, error)
}

LoginExecutor controls the execution of a login flow.

func NewLoginExecutor

func NewLoginExecutor(
	saveTokenFunc func(context.Context, *oauth2.Token) error,
	saveUserInfoFunc func(context.Context, *authdata.UserInfo) error,
	openURLFunc func(string) error,
	stdout io.Writer,
	scout *scout.Reporter,
) LoginExecutor

NewLoginExecutor returns an instance of LoginExecutor.

func NewStandardLoginExecutor

func NewStandardLoginExecutor(stdout io.Writer, scout *scout.Reporter) LoginExecutor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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