Documentation ¶
Index ¶
Constants ¶
View Source
const ( CredsFieldName = "server.http.auth.creds" TokensFieldName = "server.http.auth.tokens" HeaderNameFieldName = "server.http.auth.header_name" HeaderNameDefault = "X-Auth-Token" )
Variables ¶
View Source
var ( BasicAuthComponent = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, router.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewCredConfig, NewBasicReConfigurationWithConfigurator, func(auth *BasicReConfiguration) BasicAuth { return auth }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *CredConfig) { flagSet.StringSliceVar(&config.Creds, CredsFieldName, nil, "pairs login:password for basic authorization via http") }) }), Run: app.Run(func(c container.Container) error { return c.Invoke(func( basic *BasicReConfiguration, reConfiguration reConfiguration.ReConfiguration, informer logger.Informer, router router.Router, ) { reConfiguration.Registration(basic) informer.Info("http.client.middleware.auth.basic: registration in the reConfigurator") }) }), } TokenAuthComponent = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, router.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewTokenConfig, NewTokenReConfigurationWithConfigurator, func(auth *TokenReConfiguration) TokenAuth { return auth }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *TokenConfig) { flagSet.StringSliceVar(&config.Tokens, TokensFieldName, nil, "list of access tokens") flagSet.StringVar(&config.HeaderName, HeaderNameFieldName, HeaderNameDefault, "header name with token") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( token *TokenReConfiguration, reConfiguration reConfiguration.ReConfiguration, informer logger.Informer, router router.Router, ) { reConfiguration.Registration(token) informer.Info("http.client.middleware.auth.token: registration in the reConfigurator") }) }), } )
Functions ¶
This section is empty.
Types ¶
type Basic ¶
type Basic struct {
// contains filtered or unexported fields
}
func NewBasicWithConfigurator ¶
func NewBasicWithConfigurator(config *CredConfig, configurator configurator.Configurator) *Basic
type BasicAuth ¶ added in v1.9.14
type BasicAuth router.Middleware
type BasicReConfiguration ¶
type BasicReConfiguration struct {
// contains filtered or unexported fields
}
func NewBasicReConfiguration ¶
func NewBasicReConfiguration(informer logger.Informer, config *CredConfig) *BasicReConfiguration
func NewBasicReConfigurationWithConfigurator ¶
func NewBasicReConfigurationWithConfigurator(informer logger.Informer, config *CredConfig, configurator configurator.Configurator) *BasicReConfiguration
func (*BasicReConfiguration) Middleware ¶
func (reConfiguration *BasicReConfiguration) Middleware(next http.Handler) http.Handler
func (*BasicReConfiguration) ReConfiguration ¶
func (reConfiguration *BasicReConfiguration) ReConfiguration(configurator configurator.Configurator) error
type CredConfig ¶
type CredConfig struct {
Creds []string `info:"secret"`
}
func BasicConfiguration ¶
func BasicConfiguration(config *CredConfig, configurator configurator.Configurator) *CredConfig
func NewCredConfig ¶
func NewCredConfig() *CredConfig
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func NewToken ¶
func NewToken(config *TokenConfig) *Token
func NewTokenWithConfigurator ¶
func NewTokenWithConfigurator(config *TokenConfig, configurator configurator.Configurator) *Token
type TokenAuth ¶ added in v1.9.14
type TokenAuth router.Middleware
type TokenConfig ¶
func NewTokenConfig ¶
func NewTokenConfig() *TokenConfig
func TokenConfiguration ¶
func TokenConfiguration(config *TokenConfig, configurator configurator.Configurator) *TokenConfig
type TokenReConfiguration ¶
type TokenReConfiguration struct {
// contains filtered or unexported fields
}
func NewTokenReConfiguration ¶
func NewTokenReConfiguration(informer logger.Informer, config *TokenConfig) *TokenReConfiguration
func NewTokenReConfigurationWithConfigurator ¶
func NewTokenReConfigurationWithConfigurator(informer logger.Informer, config *TokenConfig, configurator configurator.Configurator) *TokenReConfiguration
func (*TokenReConfiguration) Middleware ¶
func (reConfiguration *TokenReConfiguration) Middleware(next http.Handler) http.Handler
func (*TokenReConfiguration) ReConfiguration ¶
func (reConfiguration *TokenReConfiguration) ReConfiguration(configurator configurator.Configurator) error
Click to show internal directories.
Click to hide internal directories.