authsession

package
v0.83.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: BSD-3-Clause Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package authsession holds the UI-side domain logic for the SSO session-extend feature. The Wails facades in client/ui/services/session*.go are thin adapters over these types.

Index

Constants

Re-exported from sessionwatch so UI-side consumers don't import the daemon-internal package directly.

Variables

This section is empty.

Functions

func ParseExpiresAt

func ParseExpiresAt(s string) (time.Time, error)

ParseExpiresAt re-exports sessionwatch.ParseExpiresAt so UI-side call sites don't import the daemon-internal package.

Types

type DaemonConn

type DaemonConn interface {
	Client() (proto.DaemonServiceClient, error)
}

DaemonConn duplicates services.DaemonConn to avoid an import cycle.

type ExtendResult

type ExtendResult struct {
	ExpiresAt *time.Time `json:"sessionExpiresAt,omitempty"`
	Preempted bool       `json:"preempted,omitempty"`
}

ExtendResult: ExpiresAt is nil when the peer is ineligible for extension. Preempted means a newer WaitExtend took over the IdP poll — a no-op, not a failure.

type ExtendStartParams

type ExtendStartParams struct {
	// Hint is the OIDC login_hint, typically the user's email.
	Hint string `json:"hint"`
}

type ExtendStartResult

type ExtendStartResult struct {
	VerificationURI         string `json:"verificationUri"`
	VerificationURIComplete string `json:"verificationUriComplete"`
	UserCode                string `json:"userCode"`
	DeviceCode              string `json:"deviceCode"`
	ExpiresIn               int64  `json:"expiresIn"`
}

type ExtendWaitParams

type ExtendWaitParams struct {
	DeviceCode string `json:"deviceCode"`
	UserCode   string `json:"userCode"`
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session bundles the session-auth daemon RPCs the UI drives.

func NewSession

func NewSession(conn DaemonConn) *Session

func (*Session) DismissWarning

func (s *Session) DismissWarning(ctx context.Context) error

DismissWarning suppresses the daemon's T-FinalWarningLead fallback dialog for the current deadline. Best-effort: a stale call is silently swallowed daemon-side.

func (*Session) RequestExtend

func (s *Session) RequestExtend(ctx context.Context, p ExtendStartParams) (ExtendStartResult, error)

RequestExtend starts the SSO session-extension flow on the daemon.

func (*Session) WaitExtend

func (s *Session) WaitExtend(ctx context.Context, p ExtendWaitParams) (ExtendResult, error)

WaitExtend blocks until the user completes the SSO flow started by RequestExtend.

type Warning

type Warning struct {
	// Absolute UTC deadline; best-effort, stays zero when metadata is
	// missing or malformed (e.g. an older daemon) and the UI falls back
	// to the Status snapshot.
	ExpiresAt time.Time `json:"sessionExpiresAt"`
	// Configured lead time, so the UI need not hardcode the constant.
	LeadMinutes int `json:"leadMinutes"`
	// True on the final-warning fallback event.
	Final bool `json:"final"`
}

Warning is the typed payload emitted on the session-warning Wails events.

func WarningFromMetadata

func WarningFromMetadata(meta map[string]string) (*Warning, bool)

WarningFromMetadata parses SystemEvent metadata into a Warning, or returns (nil, false) when the event is not a session-warning. A field that fails to parse stays zero; the event is still surfaced.

Jump to

Keyboard shortcuts

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