auth

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenCredentials

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

TokenCredentials is a gRPC PerRPCCredentials that attaches a bearer token produced by fetchToken to each outbound RPC. It does no caching; the provider behind fetchToken owns the lifecycle (rotation, expiry-aware refresh, stampede protection). RequireTransportSecurity returns true per RFC 9700.

func NewTokenCredentials

func NewTokenCredentials(
	headerName string,
	fetchToken func(context.Context) (string, error),
) *TokenCredentials

func (*TokenCredentials) GetRequestMetadata

func (c *TokenCredentials) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error)

func (*TokenCredentials) RequireTransportSecurity

func (c *TokenCredentials) RequireTransportSecurity() bool

RequireTransportSecurity returns true so the bearer never attaches to plaintext dials, per RFC 9700.

type TokenProvider

type TokenProvider interface {
	GetToken(ctx context.Context, rpcAddress string) (token string, err error)
}

TokenProvider supplies auth tokens for outbound remote-cluster RPCs. rpcAddress is the receiver's host:port. Implementations are responsible for their own caching: GetToken is called on every outbound RPC, so a provider that incurs IdP round-trips must cache internally. A nil TokenProvider means no auth header is sent; downstream consumers (RPCFactory) handle this case directly.

Directories

Path Synopsis
Package authtest provides shared test helpers for the auth package.
Package authtest provides shared test helpers for the auth package.

Jump to

Keyboard shortcuts

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