authorizationcode

package
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 17 Imported by: 0

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