broker

package
v0.0.0-...-5eda4f8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package broker is the generic oidc business code.

Index

Constants

View Source
const (
	// AuthGranted is the response when the authentication is granted.
	AuthGranted = "granted"
	// AuthDenied is the response when the authentication is denied.
	AuthDenied = "denied"
	// AuthCancelled is the response when the authentication is cancelled.
	AuthCancelled = "cancelled"
	// AuthRetry is the response when the authentication needs to be retried (another chance).
	AuthRetry = "retry"
	// AuthNext is the response when another MFA (including changing password) authentication is necessary.
	AuthNext = "next"
)

Broker responses.

View Source
const (
	// AuthDataSecret is the key for the secret in the authentication data.
	AuthDataSecret = "secret"
	// AuthDataSecretOld is the old key for the secret in the authentication data, which is now deprecated
	// TODO(UDENG-5844): Remove this once all authd installations use "secret" instead of "challenge".
	AuthDataSecretOld = "challenge"
)

Variables

AuthReplies is the list of all possible authentication replies.

Functions

func GetDropInDir

func GetDropInDir(cfgPath string) string

GetDropInDir takes the broker configuration path and returns the drop in dir path.

Types

type Broker

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

Broker is the real implementation of the broker to track sessions and process oidc calls.

func New

func New(cfg Config, args ...Option) (b *Broker, err error)

New returns a new oidc Broker with the providers listed in the configuration file.

func (*Broker) CancelIsAuthenticated

func (b *Broker) CancelIsAuthenticated(sessionID string)

CancelIsAuthenticated cancels the IsAuthenticated call for the user.

func (*Broker) EndSession

func (b *Broker) EndSession(sessionID string) error

EndSession ends the session for the user.

func (*Broker) GetAuthenticationModes

func (b *Broker) GetAuthenticationModes(sessionID string, supportedUILayouts []map[string]string) (authModesWithLabels []map[string]string, err error)

GetAuthenticationModes returns the authentication modes available for the user.

func (*Broker) IsAuthenticated

func (b *Broker) IsAuthenticated(sessionID, authenticationData string) (string, string, error)

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

func (*Broker) NewSession

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

NewSession creates a new session for the user.

func (*Broker) SelectAuthenticationMode

func (b *Broker) SelectAuthenticationMode(sessionID, authModeID string) (uiLayoutInfo map[string]string, err error)

SelectAuthenticationMode selects the authentication mode for the user.

func (*Broker) UserPreCheck

func (b *Broker) UserPreCheck(username string) (string, error)

UserPreCheck checks if the user is valid and can be allowed to authenticate.

type Config

type Config struct {
	ConfigFile            string
	DataDir               string
	OldEncryptedTokensDir string
	// contains filtered or unexported fields
}

Config is the configuration for the broker.

type Option

type Option func(*option)

Option is a func that allows to override some of the broker default settings.

Directories

Path Synopsis
Package authmodes lists the authentication modes that providers can support.
Package authmodes lists the authentication modes that providers can support.
Package sessionmode defines the session modes supported by the broker.
Package sessionmode defines the session modes supported by the broker.

Jump to

Keyboard shortcuts

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