authorizationcode

package
v0.114.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

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

Overview

Package authorizationcode provides OAuth2 authorization code flow authentication for Canton gRPC connections. This flow is intended for local development where a browser-based login is available; it is not suitable for CI.

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 implements authentication.Provider using the OAuth2 authorization code flow with PKCE (S256).

func NewDiscoveryProvider

func NewDiscoveryProvider(
	ctx context.Context,
	authorizationServerURL, clientID string,
	options ...ProviderOption,
) (*Provider, error)

NewDiscoveryProvider creates a provider using OAuth2 Authorization Server Metadata discovery (RFC 8414). PKCE with the S256 challenge method is required.

func NewProvider

func NewProvider(
	ctx context.Context,
	authURL, tokenURL, clientID string,
	options ...ProviderOption,
) (*Provider, error)

NewProvider creates a provider that performs the OAuth2 authorization code flow with PKCE (S256).

func (Provider) PerRPCCredentials

func (p Provider) PerRPCCredentials() credentials.PerRPCCredentials

func (Provider) TokenSource

func (p Provider) TokenSource() oauth2.TokenSource

func (Provider) TransportCredentials

func (p Provider) TransportCredentials() credentials.TransportCredentials

type ProviderOption

type ProviderOption func(*authorizationCodeProviderConfig)

ProviderOption configures the authorization code Provider.

func WithCallbackURL

func WithCallbackURL(callbackURL string) ProviderOption

WithCallbackURL configures the local redirect URI used by the authorization server.

func WithOpenBrowser

func WithOpenBrowser(openBrowser bool) ProviderOption

WithOpenBrowser controls whether the default browser is opened automatically.

func WithScopes

func WithScopes(scopes ...string) ProviderOption

WithScopes configures the scopes requested from the authorization server.

func WithTimeout

func WithTimeout(timeout time.Duration) ProviderOption

WithTimeout configures a timeout for the overall authorization flow.

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) ProviderOption

WithTransportCredentials configures transport credentials for gRPC connections.

Jump to

Keyboard shortcuts

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