brokers

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: GPL-3.0 Imports: 19 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 DbusInterface string = "com.ubuntu.authd.Broker"

DbusInterface is the expected interface that should be implemented by the brokers.

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) 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. It can happen that a broker which was stored in the database is not available anymore because the user removed the configuration file.

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) 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 string) (sessionID string, encryptionKey string, err error)

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

func (*Manager) SetDefaultBrokerForUser

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

SetDefaultBrokerForUser memorizes which broker was used for which user.

func (*Manager) Stop

func (m *Manager) Stop()

Stop is a no-op in production code.

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