Documentation
¶
Index ¶
- Constants
- func AuthenticatorGroup(authers ...auth.Authenticator) auth.Authenticator
- func NewAuthenticator(opts ...Option) auth.Authenticator
- func ValidateFormat(format string) error
- func WhitelistedAuthenticator(auther auth.Authenticator, patterns []string) auth.Authenticator
- type Option
- func AuthsOption(auths map[string]string) Option
- func FileFormatOption(format string) Option
- func FileLoaderOption(fileLoader loader.Loader) Option
- func HTTPFormatOption(format string) Option
- func HTTPLoaderOption(httpLoader loader.Loader) Option
- func LoggerOption(logger logger.Logger) Option
- func RedisLoaderOption(redisLoader loader.Loader) Option
- func ReloadPeriodOption(period time.Duration) Option
Constants ¶
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
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)