resolver

package
v0.2.65 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	// Exchange obtains a downscoped access (and optional id) token for the given audience with at least minTTL.
	Exchange(ctx context.Context, k tokens.Key, minTTL time.Duration) (access scyauth.Token, id string, err error)
	// Refresh refreshes tokens to satisfy minTTL without changing audience.
	Refresh(ctx context.Context, k tokens.Key, minTTL time.Duration) (access scyauth.Token, id string, err error)
}

Broker provides access/ID tokens via exchange or refresh using BFF-backed flows.

type MinTTL

type MinTTL struct {
	Access time.Duration
	ID     time.Duration
}

MinTTL constraints for tokens.

type Options

type Options struct {
	MinTTL  MinTTL
	Tracer  obs.Tracer
	Metrics obs.Metrics
}

Options control resolver behavior.

type Resolver

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

Resolver ensures valid tokens are available with required TTLs using a token Store and Broker.

func New

func New(store *tokens.Store, broker Broker, opts Options) (*Resolver, error)

func (*Resolver) EnsureAccess

func (r *Resolver) EnsureAccess(ctx context.Context, key tokens.Key) (scyauth.Token, error)

EnsureAccess returns an access token with at least MinTTL.Access remaining. If missing or expiring, it uses the broker to exchange or refresh and updates the store.

func (*Resolver) EnsureAccessAndID

func (r *Resolver) EnsureAccessAndID(ctx context.Context, key tokens.Key) (access scyauth.Token, id string, err error)

EnsureAccessAndID ensures both access and ID tokens meet MinTTL thresholds.

func (*Resolver) InvalidateAccess

func (r *Resolver) InvalidateAccess(key tokens.Key)

InvalidateAccess forces the next EnsureAccess() to obtain a fresh token.

Jump to

Keyboard shortcuts

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