oauth2

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 15 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCredentialsFromJSONFile added in v1.16.6

func LoadCredentialsFromJSONFile(filePath string) (clientID, clientSecret, issuerURL string, err error)

LoadCredentialsFromJSONFile reads client_id, client_secret, and issuer_url from a JSON file.

Types

type ClientCredentials

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

ClientCredentials is an OAuth2 Token Source that uses the client_credentials grant type to fetch a token.

func (*ClientCredentials) Token

func (c *ClientCredentials) Token() (string, error)

type ClientCredentialsMetadata

type ClientCredentialsMetadata struct {
	TokenCAPEM          string   `mapstructure:"oauth2TokenCAPEM"`
	TokenURL            string   `mapstructure:"oauth2TokenURL"`
	ClientID            string   `mapstructure:"oauth2ClientID"`
	ClientSecret        string   `mapstructure:"oauth2ClientSecret"`
	ClientSecretPath    string   `mapstructure:"oauth2ClientSecretPath"`
	CredentialsFilePath string   `mapstructure:"oauth2CredentialsFile"`
	Audiences           []string `mapstructure:"oauth2Audiences"`
	Scopes              []string `mapstructure:"oauth2Scopes"`
}

ClientCredentialsMetadata is the metadata fields which can be used by a component to configure an OIDC client_credentials token source.

func (*ClientCredentialsMetadata) ResolveCredentials added in v1.16.6

func (m *ClientCredentialsMetadata) ResolveCredentials() error

ResolveCredentials loads client_id and client_secret from files if configured.

func (*ClientCredentialsMetadata) ToOptions added in v1.16.6

ToOptions converts ClientCredentialsMetadata to ClientCredentialsOptions.

type ClientCredentialsOptions

type ClientCredentialsOptions struct {
	Logger       logger.Logger
	TokenURL     string
	ClientID     string
	ClientSecret string
	Scopes       []string
	Audiences    []string
	CAPEM        []byte
}

type CredentialsFile added in v1.16.6

type CredentialsFile struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	IssuerURL    string `json:"issuer_url"`
}

CredentialsFile represents a JSON credentials file.

Jump to

Keyboard shortcuts

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