auth

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProvider added in v1.3.12

type AuthProvider func(ctx context.Context) (*AuthSnapshot, error)

AuthProvider returns a currently-valid authentication snapshot. It is called whenever the cached token goes stale, in place of the client-credentials exchange. Token and EnvironmentID must be resolved atomically from the same credential state. Implementations must not call back into the client that owns this Manager; they are invoked while its lock is held.

type AuthSnapshot added in v1.3.12

type AuthSnapshot struct {
	Token         *serverv1.GetTokenResponse
	EnvironmentID string
}

AuthSnapshot is the bearer token and effective environment that must be sent together on an authenticated request.

type Inputs added in v1.2.94

type Inputs struct {
	// Token is a pre-issued JWT to authenticate with, instead of exchanging client
	// credentials
	Token *serverv1.GetTokenResponse

	// AuthProvider supplies a token and effective environment whenever the cached
	// token goes stale, instead of running the client-credentials exchange.
	// Sufficient on its own -- the first snapshot is obtained from it if Token is
	// unset. See AuthProvider.
	AuthProvider AuthProvider

	// HttpClient is used as the underlying http.client. Connect provides an interface for abstracting over the
	// standard library version of the auth client
	HttpClient connect.HTTPClient

	// Manager holds the credentials for this client to use. Non-optional.
	Config *config.Manager

	Timeout *time.Duration

	// SkipEnvironmentNameMapping controls whether to skip validating and mapping
	// environment names to IDs. If true, the EnvironmentId will be used verbatim.
	SkipEnvironmentNameMapping bool

	// SkipEngineMapping controls whether to skip setting the query server based
	// on the token's engine maps. If true, the query server will not be
	// automatically resolved from the token.
	SkipEngineMapping bool
}

type Manager added in v1.2.94

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

func NewManager added in v1.2.94

func NewManager(ctx context.Context, opts *Inputs) (*Manager, error)

func (*Manager) GetAuth added in v1.3.12

func (r *Manager) GetAuth(
	ctx context.Context,
	newerThan time.Time,
) (*AuthSnapshot, error)

GetAuth returns a token and effective environment from the same credential snapshot, refreshing both atomically when the token goes stale.

func (*Manager) GetConfig added in v1.2.97

func (r *Manager) GetConfig() *config.Manager

func (*Manager) GetJWT added in v1.2.94

func (r *Manager) GetJWT(
	ctx context.Context,
	newerThan time.Time,
) (*serverv1.GetTokenResponse, error)

GetJWT is a token-only convenience wrapper. Authenticated request paths should use GetAuth so the token cannot be paired with a stale environment.

Jump to

Keyboard shortcuts

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