Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidConfig is returned when the config is invalid. ErrInvalidConfig = errors.New("invalid config") )
Functions ¶
func WithConfig ¶
func WithConfig(c Config) optionFunc
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is a struct that holds the auth middleware.
type Config ¶
type Config struct { // Disable is a flag that if set to true, will disable all auth. If this // is not set and no other auth is configured, then an error will be returned. Disable bool // Basic is a map of usernames to passwords. If this is set, then basic auth // will be enabled. // If JWT is also set, then JWT will take precedence and basic auth will be ignored. Basic Basic // JWT holds the configuration for JWT based auth. JWT JWT }
Config is a struct that holds the configuration for the Auth middleware.
type JWT ¶
type JWT struct { // KeyProvider holds the configuration for the key provider. KeyProvider Provider // RequiredServiceCapabilities is a list of capabilities that are required // to be present to accept the token. If any one of these capabilities are // present will allow the token to be accepted. RequiredServiceCapabilities []string }
JWT is a struct that holds the configuration for JWT based auth.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an interface that is used to apply options to the Auth struct.
type Provider ¶
type Provider struct { // URL is the URL to get the public keys from. URL string // RefreshInterval is the interval to refresh the public keys. RefreshInterval time.Duration // HTTPClient is the configuration for the http client to use to get the public keys. HTTPClient arrangehttp.ClientConfig // DisableAutoAddMissingAlgorithm is a flag that if set to true, will disable // the automatic addition of missing algorithms to keys that are missing them. // If this is not set, then the default is to add missing algorithms to keys // that are missing the "alg" field. Sometimes the public key provider does // not provide the "alg" field, and this function can be used to add it. DisableAutoAddMissingAlgorithm bool }
Provider contains the configuration for accessing the public keys for JWT verification.
Click to show internal directories.
Click to hide internal directories.