agent

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 14 Imported by: 0 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 agent answers polkitd's BeginAuthentication and CancelAuthentication: one request at a time, first in first out, each a PAM conversation through polkit's helper shown in the shell's authentication dialog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent is the exported org.freedesktop.PolicyKit1.AuthenticationAgent.

func New

func New(cfg Config) *Agent

New makes an Agent; Close ends its requests.

func (*Agent) BeginAuthentication

func (a *Agent) BeginAuthentication(actionID, message, iconName string, details map[string]string, cookie string, identities []polkit.Identity) *dbus.Error

BeginAuthentication authenticates one of identities for cookie and returns once the helper reported success to polkitd, the user or polkitd cancelled, or it failed.

func (*Agent) CancelAuthentication

func (a *Agent) CancelAuthentication(cookie string) *dbus.Error

CancelAuthentication cancels the request for cookie, queued or running.

func (*Agent) Close

func (a *Agent) Close()

Close cancels every request, refuses new ones, and returns once each has ended and its helper is released.

type Config

type Config struct {
	Dialogs   Dialogs
	Transport helper.Transport
	// UserName is the login name of a uid, which the helper is given.
	UserName func(context.Context, polkit.UID) (string, error)
	// SessionUser is the uid of the session's user, the identity chosen
	// first when it is offered.
	SessionUser polkit.UID
	Actions     interface {
		Lookup(ctx context.Context, id string) (libpolkit.ActionDescription, error)
	}
	ProcessName func(polkit.PID) (string, error)
	Catalog     locale.Catalog
	Authorized  func()
}

Config is what an Agent needs.

type Dialogs

type Dialogs interface {
	Authenticate(context.Context, portaldialogs.Caller, portaldialogs.AuthRequest) (portaldialogs.AuthReply, error)
	ShowAuthentication(context.Context, portaldialogs.Caller, portaldialogs.AuthRequest) error
	WatchAuthentication(ctx context.Context, handle string) (*portaldialogs.AuthWatch, error)
	Dismiss(ctx context.Context, handle string) error
}

Dialogs is the shell's authentication dialog (portaldialogs.Client).

Jump to

Keyboard shortcuts

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