auth_ui

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotURLSafe = errors.New("not a valid url safe string")
	ErrRequired   = errors.New("can not be empty")
)

Functions

func Sanitize added in v2.5.0

func Sanitize(workspace string) (string, error)

Sanitize takes a workspace name or URL and returns the workspace name.

Types

type CLI

type CLI struct{}

CLI is the archaic fallback UI for auth.

func (*CLI) ConfirmationCode added in v2.5.2

func (*CLI) ConfirmationCode(email string) (code int, err error)

func (*CLI) RequestCreds added in v2.5.15

func (*CLI) RequestCreds(w io.Writer, workspace string) (email string, passwd string, err error)

func (*CLI) RequestLoginType added in v2.5.0

func (cl *CLI) RequestLoginType(w io.Writer) (LoginType, error)

func (*CLI) RequestWorkspace

func (cl *CLI) RequestWorkspace(w io.Writer) (string, error)

func (*CLI) Stop

func (*CLI) Stop()

type Huh added in v2.5.0

type Huh struct{}

Huh is the Auth UI that uses the huh library to provide a terminal UI.

func (*Huh) ConfirmationCode added in v2.5.2

func (*Huh) ConfirmationCode(email string) (int, error)

ConfirmationCode asks the user to input the confirmation code, does some validation on it and returns it as an int.

func (*Huh) RequestCreds added in v2.5.1

func (*Huh) RequestCreds(w io.Writer, workspace string) (email string, passwd string, err error)

func (*Huh) RequestLoginType added in v2.5.0

func (*Huh) RequestLoginType(w io.Writer, workspace string) (LoginOpts, error)

func (*Huh) RequestWorkspace added in v2.5.0

func (h *Huh) RequestWorkspace(w io.Writer) (string, error)

func (*Huh) Stop added in v2.5.0

func (*Huh) Stop()

type LoginOpts added in v2.6.0

type LoginOpts struct {
	Workspace   string
	Type        LoginType
	BrowserPath string
}

type LoginType added in v2.5.3

type LoginType int8

LoginType is the login type, that is used to choose the authentication flow, for example login headlessly or interactively.

const (
	// LInteractive is the SSO login type (Google, Apple, etc).
	LInteractive LoginType = iota
	// LHeadless is the email/password login type.
	LHeadless
	// LUserBrowser is the google auth option
	LUserBrowser
	// LCancel should be returned if the user cancels the login intent.
	LCancel
)

Jump to

Keyboard shortcuts

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