oauth2

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider performs the OAuth2 authorization code flow with OIDC discovery to obtain an id_token for Azure workload identity federation.

func NewProvider

func NewProvider(ctx context.Context, cfg *config.OAuth2Source, cacheDir string) (*Provider, error)

NewProvider initializes an OIDC provider via discovery and prepares a local callback listener for the authorization code flow. PKCE (S256) is enabled by default unless the config explicitly sets pkce to "disabled". The cacheDir is used to store cached id_tokens on disk.

func (*Provider) AcquireToken

func (p *Provider) AcquireToken(ctx context.Context, opts ...wif.AcquireOption) (idToken string, cached bool, err error)

AcquireToken performs the OAuth2 authorization code flow and returns the id_token from the token response. The id_token is a signed JWT suitable for use as a federated credential with Azure workload identity login (az login --federated-token).

Cached tokens are returned when available unless wif.WithForceRefresh is passed.

Jump to

Keyboard shortcuts

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