oldconfig

package
v4.11.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	OAuth     OAuthConfig     `json:"oauth" yaml:"oauth"`
	BasicAuth BasicAuthConfig `json:"basic_auth" yaml:"basic_auth"`
	JWT       JWTConfig       `json:"jwt" yaml:"jwt"`
}

AuthConfig contains configuration params for various HTTP auth strategies.

func NewAuthConfig

func NewAuthConfig() AuthConfig

NewAuthConfig creates a new Config with default values.

func (AuthConfig) Sign

func (c AuthConfig) Sign(f ifs.FS, req *http.Request) error

Sign method to sign an HTTP request for configured auth strategies.

type BasicAuthConfig

type BasicAuthConfig struct {
	Enabled  bool   `json:"enabled" yaml:"enabled"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

BasicAuthConfig contains fields for setting basic authentication in HTTP requests.

func NewBasicAuthConfig

func NewBasicAuthConfig() BasicAuthConfig

NewBasicAuthConfig returns a default configuration for basic authentication in HTTP client requests.

func (BasicAuthConfig) Sign

func (basic BasicAuthConfig) Sign(req *http.Request) error

Sign method to sign an HTTP request for an OAuth exchange.

type JWTConfig

type JWTConfig struct {
	Enabled        bool           `json:"enabled" yaml:"enabled"`
	Claims         jwt.MapClaims  `json:"claims" yaml:"claims"`
	Headers        map[string]any `json:"headers" yaml:"headers"`
	SigningMethod  string         `json:"signing_method" yaml:"signing_method"`
	PrivateKeyFile string         `json:"private_key_file" yaml:"private_key_file"`
	// contains filtered or unexported fields
}

JWTConfig holds the configuration parameters for an JWT exchange.

func NewJWTConfig

func NewJWTConfig() JWTConfig

NewJWTConfig returns a new JWTConfig with default values.

func (JWTConfig) Sign

func (j JWTConfig) Sign(f ifs.FS, req *http.Request) error

Sign method to sign an HTTP request for an JWT exchange.

type OAuth2Config

type OAuth2Config struct {
	Enabled      bool     `json:"enabled" yaml:"enabled"`
	ClientKey    string   `json:"client_key" yaml:"client_key"`
	ClientSecret string   `json:"client_secret" yaml:"client_secret"`
	TokenURL     string   `json:"token_url" yaml:"token_url"`
	Scopes       []string `json:"scopes" yaml:"scopes"`
}

OAuth2Config holds the configuration parameters for an OAuth2 exchange.

func NewOAuth2Config

func NewOAuth2Config() OAuth2Config

NewOAuth2Config returns a new OAuth2Config with default values.

func (OAuth2Config) Client

func (oauth OAuth2Config) Client(ctx context.Context) *http.Client

Client returns an http.Client with OAuth2 configured.

type OAuthConfig

type OAuthConfig struct {
	Enabled           bool   `json:"enabled" yaml:"enabled"`
	ConsumerKey       string `json:"consumer_key" yaml:"consumer_key"`
	ConsumerSecret    string `json:"consumer_secret" yaml:"consumer_secret"`
	AccessToken       string `json:"access_token" yaml:"access_token"`
	AccessTokenSecret string `json:"access_token_secret" yaml:"access_token_secret"`
}

OAuthConfig holds the configuration parameters for an OAuth exchange.

func NewOAuthConfig

func NewOAuthConfig() OAuthConfig

NewOAuthConfig returns a new OAuthConfig with default values.

func (OAuthConfig) Sign

func (oauth OAuthConfig) Sign(req *http.Request) error

Sign method to sign an HTTP request for an OAuth exchange.

type OldConfig

type OldConfig struct {
	URL             string                       `json:"url" yaml:"url"`
	Verb            string                       `json:"verb" yaml:"verb"`
	Headers         map[string]string            `json:"headers" yaml:"headers"`
	Metadata        metadata.IncludeFilterConfig `json:"metadata" yaml:"metadata"`
	ExtractMetadata metadata.IncludeFilterConfig `json:"extract_headers" yaml:"extract_headers"`
	RateLimit       string                       `json:"rate_limit" yaml:"rate_limit"`
	Timeout         string                       `json:"timeout" yaml:"timeout"`
	Retry           string                       `json:"retry_period" yaml:"retry_period"`
	MaxBackoff      string                       `json:"max_retry_backoff" yaml:"max_retry_backoff"`
	NumRetries      int                          `json:"retries" yaml:"retries"`
	BackoffOn       []int                        `json:"backoff_on" yaml:"backoff_on"`
	DropOn          []int                        `json:"drop_on" yaml:"drop_on"`
	SuccessfulOn    []int                        `json:"successful_on" yaml:"successful_on"`
	TLS             tls.Config                   `json:"tls" yaml:"tls"`
	ProxyURL        string                       `json:"proxy_url" yaml:"proxy_url"`
	AuthConfig      `json:",inline" yaml:",inline"`
	OAuth2          OAuth2Config `json:"oauth2" yaml:"oauth2"`
}

OldConfig is a configuration struct for an HTTP client.

func NewOldConfig

func NewOldConfig() OldConfig

NewOldConfig creates a new Config with default values.

Jump to

Keyboard shortcuts

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