brokers

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: GPL-3.0, LGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package brokers contains the broker object definitions, implementations and manager that will be used by the daemon for authentication.

Index

Constants

View Source
const (
	// DbusBaseInterface is the expected interface that should be implemented by the brokers.
	DbusBaseInterface string = "com.ubuntu.authd.Broker"

	// LatestAPIVersion is the latest API version supported by authd.
	LatestAPIVersion = 3
)
View Source
const LocalBrokerName = "local"

LocalBrokerName is the name of the local broker.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {
	ID            string
	Name          string
	BrandIconPath string
	// contains filtered or unexported fields
}

Broker represents a broker object that can be used for authentication.

func (Broker) DeleteUser added in v0.7.0

func (b Broker) DeleteUser(ctx context.Context, username, providerID string) error

DeleteUser calls the broker to delete any broker side data associated with the user. providerID is the stable provider identifier; v3 brokers use it to locate the provider ID-keyed cache directory. Pass an empty string when the provider ID is not available.

func (*Broker) GetAuthenticationModes

func (b *Broker) GetAuthenticationModes(ctx context.Context, sessionID string, supportedUILayouts []map[string]string) (authenticationModes []map[string]string, err error)

GetAuthenticationModes calls the broker corresponding method, stripping broker ID prefix from sessionID.

func (Broker) IsAuthenticated

func (b Broker) IsAuthenticated(ctx context.Context, sessionID, authenticationData string) (access string, data string, err error)

IsAuthenticated calls the broker corresponding method, stripping broker ID prefix from sessionID.

func (Broker) SelectAuthenticationMode

func (b Broker) SelectAuthenticationMode(ctx context.Context, sessionID, authenticationModeName string) (uiLayoutInfo map[string]string, err error)

SelectAuthenticationMode calls the broker corresponding method, stripping broker ID prefix from sessionID.

func (Broker) UserPreCheck

func (b Broker) UserPreCheck(ctx context.Context, username string) (userinfo string, err error)

UserPreCheck calls the broker corresponding method.

type Manager

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

Manager is the object that manages the available brokers and the session->broker and user->broker relationships.

func NewManager

func NewManager(ctx context.Context, brokersConfPath string, configuredBrokers []string) (m *Manager, err error)

NewManager creates a new broker manager object.

func (*Manager) AvailableBrokers

func (m *Manager) AvailableBrokers() (r []*Broker)

AvailableBrokers returns currently loaded and available brokers in preference order.

func (*Manager) BrokerExists

func (m *Manager) BrokerExists(brokerID string) bool

BrokerExists returns true if the brokerID is known by the manager.

func (*Manager) BrokerForUser

func (m *Manager) BrokerForUser(username string) (broker *Broker)

BrokerForUser returns any previously selected broker for a given user, if any.

func (*Manager) BrokerFromID added in v0.7.0

func (m *Manager) BrokerFromID(id string) (broker *Broker, err error)

BrokerFromID returns the broker matching this brokerID.

func (*Manager) BrokerFromSessionID

func (m *Manager) BrokerFromSessionID(id string) (broker *Broker, err error)

BrokerFromSessionID returns broker currently in use for a given transaction sessionID.

func (*Manager) EndSession

func (m *Manager) EndSession(sessionID string) error

EndSession signals the end of the session to the broker associated with the sessionID and then removes the session -> broker mapping.

func (*Manager) NewSession

func (m *Manager) NewSession(brokerID, username, lang, mode, providerID, serviceName string) (sessionID string, encryptionKey string, err error)

NewSession create a new session for the broker and store the sessionID on the manager.

func (*Manager) ServiceNameFromSessionID added in v0.7.0

func (m *Manager) ServiceNameFromSessionID(sessionID string) string

ServiceNameFromSessionID returns the PAM service name associated with the given session ID.

func (*Manager) SetBroker added in v0.7.0

func (m *Manager) SetBroker(brokerID, username string) error

SetBroker memorizes which broker was used for which user.

func (*Manager) Stop

func (m *Manager) Stop()

Stop is a no-op in production code.

func (*Manager) UsernameFromSessionID added in v0.7.0

func (m *Manager) UsernameFromSessionID(sessionID string) string

UsernameFromSessionID returns the username associated with the given session ID.

Directories

Path Synopsis
Package auth contains the authentication related code.
Package auth contains the authentication related code.
Package layouts lists all the broker UI layouts we support.
Package layouts lists all the broker UI layouts we support.
entries
Package entries lists all the broker entries we support.
Package entries lists all the broker entries we support.

Jump to

Keyboard shortcuts

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