auth

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// FormatText is the default format: one "username<space>password" pair
	// per line, "#" starting a comment.
	FormatText = "text"
	// FormatJSON is a JSON document with an "auths" array of
	// {"username": ..., "password": ...} objects.
	FormatJSON = "json"
	// FormatYAML is a YAML document with an "auths" sequence of
	// {username: ..., password: ...} mappings.
	FormatYAML = "yaml"
)

Supported auth file formats.

Variables

This section is empty.

Functions

func AuthenticatorGroup added in v0.0.3

func AuthenticatorGroup(authers ...auth.Authenticator) auth.Authenticator

func NewAuthenticator

func NewAuthenticator(opts ...Option) auth.Authenticator

NewAuthenticator creates an Authenticator that authenticates client by pre-defined user mapping.

func ValidateFormat added in v0.28.1

func ValidateFormat(format string) error

ValidateFormat reports whether format is a supported auth file format. The empty format is valid and means FormatText.

func WhitelistedAuthenticator added in v0.28.1

func WhitelistedAuthenticator(auther auth.Authenticator, patterns []string) auth.Authenticator

WhitelistedAuthenticator returns an Authenticator that skips the underlying auther when the client's IP address matches one of the given patterns. Patterns may be IP addresses (e.g. "192.168.1.1") or CIDR ranges (e.g. "10.0.0.0/8"). Invalid patterns are silently ignored.

Types

type Option

type Option func(opts *options)

func AuthsOption

func AuthsOption(auths map[string]string) Option

func FileFormatOption added in v0.28.1

func FileFormatOption(format string) Option

func FileLoaderOption

func FileLoaderOption(fileLoader loader.Loader) Option

func HTTPFormatOption added in v0.28.1

func HTTPFormatOption(format string) Option

func HTTPLoaderOption

func HTTPLoaderOption(httpLoader loader.Loader) Option

func LoggerOption

func LoggerOption(logger logger.Logger) Option

func RedisLoaderOption

func RedisLoaderOption(redisLoader loader.Loader) Option

func ReloadPeriodOption

func ReloadPeriodOption(period time.Duration) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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