Help us shape the future of Go! Take the 2026 Go Developer Survey

oauth2

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 1

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