auth

package
v1.93.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBasicTokenSource

func NewBasicTokenSource(
	ctx context.Context,
	httpClient *http.Client,
	cfg config.ConfigurationOAUTH2,
	tokenURL string,
) (oauth2.TokenSource, error)

NewBasicTokenSource returns an oauth2.TokenSource that authenticates with client_secret_basic (HTTP Basic auth).

func NewPostTokenSource

func NewPostTokenSource(
	ctx context.Context,
	httpClient *http.Client,
	cfg config.ConfigurationOAUTH2,
	tokenURL string,
) (oauth2.TokenSource, error)

NewPostTokenSource returns an oauth2.TokenSource that authenticates with client_secret_post (credentials in the POST body).

func NewPrivateKeyJWTTokenSource

func NewPrivateKeyJWTTokenSource(
	ctx context.Context,
	httpClient *http.Client,
	cfg config.ConfigurationOAUTH2,
	tokenURL string,
) (oauth2.TokenSource, error)

NewPrivateKeyJWTTokenSource returns an oauth2.TokenSource that authenticates using the private_key_jwt method (RFC 7523).

func NewRemoteSignerTokenSource added in v1.78.1

func NewRemoteSignerTokenSource(
	ctx context.Context,
	httpClient *http.Client,
	cfg config.ConfigurationOAUTH2,
	tokenURL string,
) (oauth2.TokenSource, error)

NewRemoteSignerTokenSource returns an oauth2.TokenSource that authenticates using a remote signing service for private_key_jwt (RFC 7523). It calls the signing endpoint to get a signed JWT client assertion, then exchanges it at the token endpoint.

func ResolveTokenEndpoint

func ResolveTokenEndpoint(
	ctx context.Context,
	cfg config.ConfigurationOAUTH2,
) (string, error)

ResolveTokenEndpoint determines the token endpoint URL from config, using OIDC discovery if needed.

Types

type Style

type Style int

Style selects how client credentials are sent to the token endpoint.

const (
	// StyleBasic sends client_id/client_secret as HTTP Basic auth.
	StyleBasic Style = iota
	// StylePost sends client_id/client_secret in the POST body.
	StylePost
)

Jump to

Keyboard shortcuts

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