httpauth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: EUPL-1.2 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOAuth2HTTPClient

func NewOAuth2HTTPClient(config OAuth2Config, baseTransport http.RoundTripper) (*http.Client, error)

NewOAuth2HTTPClient creates an http.Client that automatically handles OAuth2 client credentials authentication. It uses golang.org/x/oauth2/clientcredentials for token acquisition, caching, and automatic refresh. The baseTransport is used for both token endpoint calls and resource requests (e.g., for tracing). Pass nil to use http.DefaultTransport.

Types

type OAuth2Config

type OAuth2Config struct {
	TokenEndpoint string   `koanf:"tokenendpoint"`
	ClientID      string   `koanf:"clientid"`
	ClientSecret  string   `koanf:"clientsecret"`
	Scopes        []string `koanf:"scopes"`
}

OAuth2Config holds the configuration for OAuth2 client credentials authentication.

func (OAuth2Config) IsConfigured

func (c OAuth2Config) IsConfigured() bool

IsConfigured returns true if the OAuth2 configuration has all required fields set.

Jump to

Keyboard shortcuts

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