serviceclient

package
v2.0.44 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package serviceclient builds HTTP clients for service-to-service requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(ctx context.Context, base *http.Client, cfg ServiceConfig) (*http.Client, error)

NewHTTPClient returns an HTTP client configured for the service.

Types

type AuthConfig

type AuthConfig struct {
	Type             AuthType `json:"type" pflag:",Service authentication type"`
	IssuerURL        string   `json:"issuerUrl" pflag:",OAuth 2.0 authorization server issuer URL"`
	ClientID         string   `json:"clientId" pflag:",OAuth 2.0 client ID"`
	ClientSecret     string   `json:"clientSecret" pflag:",OAuth 2.0 client secret"`
	ClientSecretFile string   `json:"clientSecretFile" pflag:",File containing the OAuth 2.0 client secret"`
	Scopes           []string `json:"scopes" pflag:",OAuth 2.0 scopes to request"`
	Audience         string   `json:"audience" pflag:",OAuth 2.0 token audience"`
}

AuthConfig configures authentication for service requests.

type AuthType

type AuthType string

AuthType identifies the authentication mechanism used for service requests.

const (
	// AuthTypeNone disables authentication.
	AuthTypeNone AuthType = ""
	// AuthTypeOAuth2ClientCredentials uses the OAuth 2.0 client credentials grant.
	AuthTypeOAuth2ClientCredentials AuthType = "OAuth2ClientCredentials"
)

type ServiceConfig

type ServiceConfig struct {
	URL  string     `json:"url" pflag:",Service base URL"`
	Auth AuthConfig `json:"auth" pflag:",Service authentication"`
}

ServiceConfig describes a downstream service and how to authenticate to it.

Jump to

Keyboard shortcuts

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