cliauth

package
v0.13.2 Latest Latest
Warning

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

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

Documentation

Overview

Package cliauth owns browser OAuth login and durable, machine-local credentials.

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthenticationRequired = errors.New("authentication required")

ErrAuthenticationRequired means the selected organization needs a new login.

Functions

This section is empty.

Types

type LoginStage

type LoginStage string

LoginStage is a non-secret progress event, not evidence that a browser page opened.

const (
	LoginConnecting LoginStage = "Connecting to server"
	LoginWaiting    LoginStage = "Waiting for browser approval"
	LoginSaving     LoginStage = "Saving authentication"
)

type LogoutResult

type LogoutResult struct {
	LocalRemoved              bool `json:"local_removed"`
	RemoteRevocationConfirmed bool `json:"remote_revocation_confirmed"`
}

LogoutResult distinguishes local removal from confirmed server revocation.

type Manager

type Manager struct {
	// LoginProgress receives bounded, non-secret stages, synchronously during login.
	LoginProgress func(LoginStage)
}

Manager uses the machine's home directory; its zero value is ready for use. It never uses an automatic token source or writes repo configuration.

func (Manager) Authorize

func (Manager) Authorize(ctx context.Context, org cloudapi.Org) (func(*http.Request) error, error)

Authorize checks credentials now and resolves them again before every request, so prompts or another process's refresh cannot leave a captured access token stale.

func (Manager) Login

func (m Manager) Login(ctx context.Context, origin, hint string, openBrowser func(context.Context, string) error) (cloudapi.Org, error)

Login performs browser loopback login, saving the authoritative returned org, which may differ from hint. openBrowser must honor its context and never log the URL.

func (Manager) Logout

func (Manager) Logout(ctx context.Context, org cloudapi.Org) (LogoutResult, error)

Logout removes only the selected local entry even when remote revocation fails.

func (Manager) StoredLogins

func (Manager) StoredLogins(ctx context.Context) ([]StoredLogin, error)

StoredLogins is local inventory only, not proof of a usable remote grant.

type StoredLogin

type StoredLogin struct {
	Org        cloudapi.Org
	Name       string
	LocalState string
}

StoredLogin exposes only local display metadata, never credential material.

Jump to

Keyboard shortcuts

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