adapter

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Package adapter is the package for the PAM library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoSelectForUser

func AutoSelectForUser(client authd.PAMClient, username string) tea.Cmd

AutoSelectForUser requests if any previous broker was used by this user to automatically selects it.

func IsSSHSession

func IsSSHSession(mTx pam.ModuleTransaction) bool

IsSSHSession checks if the module transaction is currently handling a SSH session.

func TeaHeadlessOptions

func TeaHeadlessOptions() ([]tea.ProgramOption, error)

TeaHeadlessOptions gets the options to run a bubbletea program in headless mode.

Types

type AuthModeSelected

type AuthModeSelected struct {
	ID string
}

AuthModeSelected is triggered when the authentication mode has been chosen.

type BrokerListReceived

type BrokerListReceived struct{}

BrokerListReceived is received when we got the broker list.

type BrokerSelected

type BrokerSelected struct {
	BrokerID string
}

BrokerSelected signifies that the broker has been chosen.

type ChangeStage

type ChangeStage struct {
	Stage pam_proto.Stage
}

ChangeStage signals that the model requires a stage change.

type GetAuthenticationModesRequested

type GetAuthenticationModesRequested struct{}

GetAuthenticationModesRequested signals that a model needs to get the broker authentication modes.

type PamClientType

type PamClientType int

PamClientType indicates the type of the PAM client we're handling.

const (
	// Native indicates a PAM Client that is not supporting any special protocol.
	Native PamClientType = iota
	// InteractiveTerminal indicates an interactive terminal we can directly write our interface to.
	InteractiveTerminal
	// Gdm is a gnome-shell client via GDM display manager.
	Gdm
)

type PamIgnore

type PamIgnore struct {
	LocalBrokerID string // Only set for local broker to store it globally.
	// contains filtered or unexported fields
}

PamIgnore signals PAM module to return pam.Ignore and Quit tea.Model.

func (PamIgnore) Message

func (p PamIgnore) Message() string

Message returns the message that should be sent to pam as info message.

func (PamIgnore) Status

func (p PamIgnore) Status() pam.Error

Status returns pam.ErrIgnore.

type PamReturnError

type PamReturnError interface {
	PamReturnStatus
	Status() pam.Error
}

PamReturnError is an interface that PAM errors return types should implement.

type PamReturnStatus

type PamReturnStatus interface {
	Message() string
}

PamReturnStatus is the interface that all PAM return types should implement.

type PamSuccess

type PamSuccess struct {
	BrokerID string
	// contains filtered or unexported fields
}

PamSuccess signals PAM module to return with provided pam.Success and Quit tea.Model.

func (PamSuccess) Message

func (p PamSuccess) Message() string

Message returns the message that should be sent to pam as info message.

type SessionEnded

type SessionEnded struct{}

SessionEnded signals that the session is done and closed from the broker.

type SessionStarted

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

SessionStarted signals that we started a session with a given broker.

type UILayoutReceived

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

UILayoutReceived means that we got the ui layout to display by the broker.

type UIModel

type UIModel struct {
	// PamMTx is the [pam.ModuleTransaction] used to communicate with PAM.
	PamMTx pam.ModuleTransaction
	// Client is the [authd.PAMClient] handle used to communicate with authd.
	Client authd.PAMClient
	// NssClient is the [authd.NSSClient] handle used to communicate with authd.
	NssClient authd.NSSClient
	// PamClientType is the kind of the PAM client we're handling.
	ClientType PamClientType
	// SessionMode is the mode of the session invoked by the module.
	SessionMode authd.SessionMode
	// contains filtered or unexported fields
}

UIModel is the global models orchestrator.

func (*UIModel) ExitStatus

func (m *UIModel) ExitStatus() PamReturnStatus

ExitStatus exposes the PamReturnStatus externally.

func (*UIModel) Init

func (m *UIModel) Init() tea.Cmd

Init initializes the main model orchestrator.

func (*UIModel) MsgFilter

func (m *UIModel) MsgFilter(model tea.Model, msg tea.Msg) tea.Msg

MsgFilter is the handler for the UI model.

func (*UIModel) Update

func (m *UIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles events and actions to be done from the main model orchestrator.

func (*UIModel) View

func (m *UIModel) View() string

View renders a text view of the whole UI.

type UsernameSelected

type UsernameSelected struct{}

UsernameSelected is received when the user name is filled (from pam or manually).

Jump to

Keyboard shortcuts

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