Documentation
¶
Overview ¶
Package auth decides whether the local X session is usable, and runs the interactive login when it is not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLoginRequired = errors.New("no X session; run start_login and sign in")
ErrLoginRequired reports that no usable session exists.
Functions ¶
This section is empty.
Types ¶
type Lease ¶ added in v0.0.5
Lease borrows a browser session and returns a function that hands it back.
type LoginLauncher ¶
LoginLauncher opens a visible browser for the user to sign in with. It returns the running process so its exit can be observed.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the session verdict and the login lifecycle.
Verdicts are cached because every uncached check drives a real browser at X, and checking more often makes losing the session likelier, not less.
func (*Manager) Invalidate ¶
func (m *Manager) Invalidate()
Invalidate drops any cached verdict, so the next Status re-probes.
func (*Manager) StartLogin ¶
StartLogin opens a visible browser for the user to sign in with.
It returns the deadline by which the login must be completed. If one is already open, its deadline is returned rather than opening a second window onto the same profile.
type Options ¶
type Options struct {
ProfileDir string
StatusTTL time.Duration
LoginTimeout time.Duration
Lease Lease
Reserve Reserver
LaunchLogin LoginLauncher
}
Options configures a Manager.
type Reserver ¶ added in v0.0.5
type Reserver interface {
Reserve(ctx context.Context) (pool.Reservation, error)
}
Reserver takes exclusive use of the profile.
Only one Chrome may hold a user-data-dir. The login window needs it for as long as the user is signing in, so the reservation is held until that window closes rather than released as soon as it opens.