promauth

package
v1.73.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 15 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization added in v1.58.0

type Authorization struct {
	Type            string  `yaml:"type,omitempty"`
	Credentials     *Secret `yaml:"credentials,omitempty"`
	CredentialsFile string  `yaml:"credentials_file,omitempty"`
}

Authorization represents generic authorization config.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/

type BasicAuthConfig

type BasicAuthConfig struct {
	Username     string  `yaml:"username"`
	Password     *Secret `yaml:"password,omitempty"`
	PasswordFile string  `yaml:"password_file,omitempty"`
}

BasicAuthConfig represents basic auth config.

type Config

type Config struct {
	// Optional TLS config
	TLSRootCA             *x509.CertPool
	TLSServerName         string
	TLSInsecureSkipVerify bool
	// contains filtered or unexported fields
}

Config is auth config.

func NewConfig

func NewConfig(baseDir string, az *Authorization, basicAuth *BasicAuthConfig, bearerToken, bearerTokenFile string, o *OAuth2Config, tlsConfig *TLSConfig) (*Config, error)

NewConfig creates auth config from the given args.

func (*Config) GetAuthHeader added in v1.60.0

func (ac *Config) GetAuthHeader() string

GetAuthHeader returns optional `Authorization: ...` http header.

func (*Config) NewTLSConfig

func (ac *Config) NewTLSConfig() *tls.Config

NewTLSConfig returns new TLS config for the given ac.

func (*Config) String added in v1.35.1

func (ac *Config) String() string

String returns human-readable representation for ac.

type HTTPClientConfig added in v1.58.0

type HTTPClientConfig struct {
	Authorization   *Authorization   `yaml:"authorization,omitempty"`
	BasicAuth       *BasicAuthConfig `yaml:"basic_auth,omitempty"`
	BearerToken     *Secret          `yaml:"bearer_token,omitempty"`
	BearerTokenFile string           `yaml:"bearer_token_file,omitempty"`
	OAuth2          *OAuth2Config    `yaml:"oauth2,omitempty"`
	TLSConfig       *TLSConfig       `yaml:"tls_config,omitempty"`
}

HTTPClientConfig represents http client config.

func (*HTTPClientConfig) NewConfig added in v1.58.0

func (hcc *HTTPClientConfig) NewConfig(baseDir string) (*Config, error)

NewConfig creates auth config for the given hcc.

type OAuth2Config added in v1.60.0

type OAuth2Config struct {
	ClientID         string            `yaml:"client_id"`
	ClientSecret     *Secret           `yaml:"client_secret,omitempty"`
	ClientSecretFile string            `yaml:"client_secret_file,omitempty"`
	Scopes           []string          `yaml:"scopes,omitempty"`
	TokenURL         string            `yaml:"token_url"`
	EndpointParams   map[string]string `yaml:"endpoint_params,omitempty"`
}

OAuth2Config represent OAuth2 configuration

func (*OAuth2Config) String added in v1.60.0

func (o *OAuth2Config) String() string

String returns string representation of o.

type ProxyClientConfig added in v1.58.0

type ProxyClientConfig struct {
	Authorization   *Authorization   `yaml:"proxy_authorization,omitempty"`
	BasicAuth       *BasicAuthConfig `yaml:"proxy_basic_auth,omitempty"`
	BearerToken     *Secret          `yaml:"proxy_bearer_token,omitempty"`
	BearerTokenFile string           `yaml:"proxy_bearer_token_file,omitempty"`
	TLSConfig       *TLSConfig       `yaml:"proxy_tls_config,omitempty"`
}

ProxyClientConfig represents proxy client config.

func (*ProxyClientConfig) NewConfig added in v1.58.0

func (pcc *ProxyClientConfig) NewConfig(baseDir string) (*Config, error)

NewConfig creates auth config for the given pcc.

type Secret added in v1.69.0

type Secret struct {
	// contains filtered or unexported fields
}

Secret represents a string secret such as password or auth token.

It is marshaled to "<secret>" string in yaml.

This is needed for hiding secret strings in /config page output. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1764

func NewSecret added in v1.69.0

func NewSecret(s string) *Secret

NewSecret returns new secret for s.

func (*Secret) MarshalYAML added in v1.69.0

func (s *Secret) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

It substitutes the secret with "<secret>" string.

func (*Secret) String added in v1.69.0

func (s *Secret) String() string

String returns the secret in plaintext.

func (*Secret) UnmarshalYAML added in v1.69.0

func (s *Secret) UnmarshalYAML(f func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type TLSConfig

type TLSConfig struct {
	CAFile             string `yaml:"ca_file,omitempty"`
	CertFile           string `yaml:"cert_file,omitempty"`
	KeyFile            string `yaml:"key_file,omitempty"`
	ServerName         string `yaml:"server_name,omitempty"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify,omitempty"`
}

TLSConfig represents TLS config.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#tls_config

Jump to

Keyboard shortcuts

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