examplebroker

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0, LGPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

Package examplebroker implements an example broker that will be used by the authentication daemon.

Index

Constants

View Source
const (
	// UserIntegrationPrefix is the prefix for a user for integration tests.
	UserIntegrationPrefix = "user-integration-"
	// UserIntegrationMfaPrefix is the prefix for an mfa user for integration tests.
	UserIntegrationMfaPrefix = "user-mfa-integration-"
	// UserIntegrationMfaNeedsResetPrefix is the prefix for an mfa-needs-reset user for integration tests.
	UserIntegrationMfaNeedsResetPrefix = "user-mfa-needs-reset-integration-"
	// UserIntegrationMfaWithResetPrefix is the prefix for an mfa-with-reset user for integration tests.
	UserIntegrationMfaWithResetPrefix = "user-mfa-with-reset-integration-"
	// UserIntegrationNeedsResetPrefix is the prefix for a needs-reset user for integration tests.
	UserIntegrationNeedsResetPrefix = "user-needs-reset-integration-"
	// UserIntegrationCanResetPrefix is the prefix for a can-reset user for integration tests.
	UserIntegrationCanResetPrefix = "user-can-reset-integration-"
	// UserIntegrationLocalGroupsPrefix is the prefix for a local-groups user for integration tests.
	UserIntegrationLocalGroupsPrefix = "user-local-groups-integration-"
	// UserIntegrationQRcodeStaticPrefix is the prefix for a static qrcode user for integration tests.
	UserIntegrationQRcodeStaticPrefix = "user-integration-qrcode-static-"
	// UserIntegrationPreCheckValue is the value for a pre-check user for integration tests.
	UserIntegrationPreCheckValue = "pre-check"
	// UserIntegrationPreCheckPrefix is the prefix for a pre-check user for integration tests.
	UserIntegrationPreCheckPrefix = UserIntegrationPrefix + UserIntegrationPreCheckValue + "-"
	// UserIntegrationUnexistent is an unexistent user leading to a non-existent user error.
	UserIntegrationUnexistent = "user-unexistent@example.com"
	// UserIntegrationAuthModesPrefix is the prefix for a user listing for supported auth modes.
	// The modes can be exposed as list, in the form: `user-auth-modes-id1,id2,id3-integration-whatever`.
	UserIntegrationAuthModesPrefix = "user-auth-modes-"
)

Variables

This section is empty.

Functions

func StartBus

func StartBus(cfgPath string) (conn *dbus.Conn, err error)

StartBus starts the D-Bus service and exports it on the system bus.

Types

type Broker

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

Broker represents an examplebroker object.

func New

func New(name string) (b *Broker, fullName, brandIcon string)

New creates a new examplebroker object.

func (*Broker) CancelIsAuthenticated

func (b *Broker) CancelIsAuthenticated(ctx context.Context, sessionID string)

CancelIsAuthenticated cancels the IsAuthenticated request for the specified session. If there is no pending IsAuthenticated call for the session, this is a no-op.

func (*Broker) EndSession

func (b *Broker) EndSession(ctx context.Context, sessionID string) error

EndSession ends the requested session and triggers the necessary clean up steps, if any.

func (*Broker) GetAuthenticationModes

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

GetAuthenticationModes returns the list of supported authentication modes for the selected broker depending on session info.

func (*Broker) IsAuthenticated

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

IsAuthenticated evaluates the provided authenticationData and returns the authentication status for the user.

func (*Broker) NewSession

func (b *Broker) NewSession(ctx context.Context, username, lang, mode string) (sessionID, encryptionKey string, err error)

NewSession creates a new session for the specified user.

func (*Broker) SelectAuthenticationMode

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

SelectAuthenticationMode returns the UI layout information for the selected authentication mode.

func (*Broker) UserPreCheck

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

UserPreCheck checks if the user is known to the broker. It returns the user info in JSON format if the user is valid, or an empty string if the user is not allowed.

type Bus

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

Bus is the D-Bus object that will answer calls for the broker.

func (*Bus) CancelIsAuthenticated

func (b *Bus) CancelIsAuthenticated(sessionID string) (dbusErr *dbus.Error)

CancelIsAuthenticated is the method through which the broker and the daemon will communicate once dbusInterface.CancelIsAuthenticated is called.

func (*Bus) EndSession

func (b *Bus) EndSession(sessionID string) (dbusErr *dbus.Error)

EndSession is the method through which the broker and the daemon will communicate once dbusInterface.EndSession is called.

func (*Bus) GetAuthenticationModes

func (b *Bus) GetAuthenticationModes(sessionID string, supportedUILayouts []map[string]string) (authenticationModes []map[string]string, dbusErr *dbus.Error)

GetAuthenticationModes is the method through which the broker and the daemon will communicate once dbusInterface.GetAuthenticationModes is called.

func (*Bus) IsAuthenticated

func (b *Bus) IsAuthenticated(sessionID, authenticationData string) (access, data string, dbusErr *dbus.Error)

IsAuthenticated is the method through which the broker and the daemon will communicate once dbusInterface.IsAuthenticated is called.

func (*Bus) NewSession

func (b *Bus) NewSession(username, lang, mode string) (sessionID, encryptionKey string, dbusErr *dbus.Error)

NewSession is the method through which the broker and the daemon will communicate once dbusInterface.NewSession is called.

func (*Bus) SelectAuthenticationMode

func (b *Bus) SelectAuthenticationMode(sessionID, authenticationModeName string) (uiLayoutInfo map[string]string, dbusErr *dbus.Error)

SelectAuthenticationMode is the method through which the broker and the daemon will communicate once dbusInterface.SelectAuthenticationMode is called.

func (*Bus) UserPreCheck

func (b *Bus) UserPreCheck(username string) (userinfo string, dbusErr *dbus.Error)

UserPreCheck is the method through which the broker and the daemon will communicate once dbusInterface.UserPreCheck is called.

Jump to

Keyboard shortcuts

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