auth

package
v3.36.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 12 Imported by: 5

Documentation

Overview

Package auth provides configuration fields and implementations of HTTP request authentication strategies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthFieldSpec added in v3.9.0

func BasicAuthFieldSpec() docs.FieldSpec

BasicAuthFieldSpec returns a basic authentication field spec.

func FieldSpecs added in v3.9.0

func FieldSpecs() docs.FieldSpecs

FieldSpecs returns a map of field specs for an auth type.

func FieldSpecsExpanded added in v3.30.0

func FieldSpecsExpanded() docs.FieldSpecs

FieldSpecsExpanded includes OAuth2 fields that might not be appropriate for all components.

Types

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 Config

type Config struct {
	OAuth     OAuthConfig     `json:"oauth" yaml:"oauth"`
	BasicAuth BasicAuthConfig `json:"basic_auth" yaml:"basic_auth"`
}

Config contains configuration params for various HTTP auth strategies.

func NewConfig

func NewConfig() Config

NewConfig creates a new Config with default values.

func (Config) Sign

func (c Config) Sign(req *http.Request) error

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

type OAuth2Config added in v3.30.0

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"`
}

OAuth2Config holds the configuration parameters for an OAuth2 exchange.

func NewOAuth2Config added in v3.30.0

func NewOAuth2Config() OAuth2Config

NewOAuth2Config returns a new OAuth2Config with default values.

func (OAuth2Config) Client added in v3.30.0

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"`
	RequestURL        string `json:"request_url" yaml:"request_url"`
}

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 WebsocketConfig added in v3.30.0

type WebsocketConfig struct {
	OAuth     OAuthConfig     `json:"oauth" yaml:"oauth"`
	BasicAuth BasicAuthConfig `json:"basic_auth" yaml:"basic_auth"`
}

WebsocketConfig contains configuration params for various HTTP auth strategies suitable for websockets.

func NewWebsocketConfig added in v3.30.0

func NewWebsocketConfig() WebsocketConfig

NewWebsocketConfig creates a new WebsocketConfig with default values.

func (WebsocketConfig) Sign added in v3.30.0

func (c WebsocketConfig) Sign(req *http.Request) error

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

Jump to

Keyboard shortcuts

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