access

package
v6.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoCredentials indicates no recognizable credentials were supplied.
	ErrNoCredentials = errors.New("access: no credentials provided")
	// ErrInvalidCredential signals that supplied credentials were rejected by a provider.
	ErrInvalidCredential = errors.New("access: invalid credential")
	// ErrNotHandled tells the manager to continue trying other providers.
	ErrNotHandled = errors.New("access: not handled")
)

Functions

func RegisterProvider

func RegisterProvider(typ string, factory ProviderFactory)

RegisterProvider registers a provider factory for a given type identifier.

Types

type Manager

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

Manager coordinates authentication providers.

func NewManager

func NewManager() *Manager

NewManager constructs an empty manager.

func (*Manager) Authenticate

func (m *Manager) Authenticate(ctx context.Context, r *http.Request) (*Result, error)

Authenticate evaluates providers until one succeeds.

func (*Manager) Providers

func (m *Manager) Providers() []Provider

Providers returns a snapshot of the active providers.

func (*Manager) SetProviders

func (m *Manager) SetProviders(providers []Provider)

SetProviders replaces the active provider list.

type Provider

type Provider interface {
	Identifier() string
	Authenticate(ctx context.Context, r *http.Request) (*Result, error)
}

Provider validates credentials for incoming requests.

func BuildProvider added in v6.0.10

func BuildProvider(cfg *config.AccessProvider, root *config.SDKConfig) (Provider, error)

func BuildProviders

func BuildProviders(root *config.SDKConfig) ([]Provider, error)

BuildProviders constructs providers declared in configuration.

type ProviderFactory

type ProviderFactory func(cfg *config.AccessProvider, root *config.SDKConfig) (Provider, error)

ProviderFactory builds a provider from configuration data.

type Result

type Result struct {
	Provider  string
	Principal string
	Metadata  map[string]string
}

Result conveys authentication outcome.

Jump to

Keyboard shortcuts

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