Documentation
¶
Overview ¶
Package cliauth owns browser OAuth login and durable, machine-local credentials.
Index ¶
- Variables
- type LoginStage
- type LogoutResult
- type Manager
- func (Manager) Authorize(ctx context.Context, org cloudapi.Org) (func(*http.Request) error, error)
- func (m Manager) Login(ctx context.Context, origin, hint string, ...) (cloudapi.Org, error)
- func (Manager) Logout(ctx context.Context, org cloudapi.Org) (LogoutResult, error)
- func (Manager) StoredLogins(ctx context.Context) ([]StoredLogin, error)
- type StoredLogin
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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.