Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAuthConfig ¶
BasicAuthConfig represents basic auth config.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is auth config.
func Generate ¶
func Generate(filterOptions ...ConfigOptions) (*Config, error)
Generate returns Config based on the given params
func (*Config) GetAuthHeader ¶
GetAuthHeader returns optional `Authorization: ...` http header.
type ConfigOptions ¶
type ConfigOptions func(config *HTTPClientConfig)
ConfigOptions options which helps build Config
func WithBasicAuth ¶
func WithBasicAuth(username, password string) ConfigOptions
WithBasicAuth returns AuthConfigOptions and initialized BasicAuthConfig based on given params
func WithBearer ¶
func WithBearer(token string) ConfigOptions
WithBearer returns AuthConfigOptions and set BearerToken or BearerTokenFile based on given params
func WithHeaders ¶
func WithHeaders(headers string) ConfigOptions
WithHeaders returns AuthConfigOptions and set Headers based on the given params
type HTTPClientConfig ¶
type HTTPClientConfig struct { BasicAuth *BasicAuthConfig BearerToken string Headers string }
HTTPClientConfig represents http client config.
func (*HTTPClientConfig) NewConfig ¶
func (hcc *HTTPClientConfig) NewConfig() (*Config, error)
NewConfig creates auth config for the given hcc.
type Options ¶
type Options struct { // BasicAuth contains optional BasicAuthConfig. BasicAuth *BasicAuthConfig // BearerToken contains optional bearer token. BearerToken string // Headers contains optional http request headers in the form 'Foo: bar'. Headers string }
Options contain options, which must be passed to NewConfig.