authentication

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterAuthentication

func RegisterAuthentication(reg AuthenticationRegistration)

func RegisteredAuthenticationNames

func RegisteredAuthenticationNames() []string

Types

type Authentication

type Authentication interface {
	CheckAuthentication(ctx context.Context, req *http.Request) bool
}

type AuthenticationDeps added in v0.11.0

type AuthenticationDeps struct {
	ErrorMessages config.ErrorMessages
	ClientConfig  config.ClientConfig
	Datastores    datastore.DatastoreRegistry
	// Built from the TLS profiles ClientConfig references. Nil means http.DefaultTransport
	Transport http.RoundTripper
	// Builds the transport for a client overriding ClientConfig, from the TLS profiles it references
	ClientTransport func(config.ClientConfig) (http.RoundTripper, error)
}

New dependencies are added as fields so the Initialize signature stays stable

type AuthenticationRegistration

type AuthenticationRegistration interface {
	Name() string
	Initialize(config any, deps AuthenticationDeps) (Authentication, error)
	InitializeConfig() any
}

func RegisteredAuthentication

func RegisteredAuthentication(name string) (AuthenticationRegistration, bool)

type ValidationResult added in v0.12.0

type ValidationResult struct {
	// Whether the request should proceed
	Pass bool
	// When validate should be called again. Pass should be false for already-expired tokens
	Expiration time.Time
	// By default only used for logging
	UserID string
	// The user's tenant or organization. By default only used for logging and analytics
	TenantID string
	// Layer IDs this token may access. Empty allows all layers
	AllowedLayers []string
}

Returned by a custom auth script's validate. New fields avoid breaking the validate signature again

Jump to

Keyboard shortcuts

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