tokencache

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenFetcher

type TokenFetcher interface {
	FetchToken(ctx context.Context) (token string, expiry time.Time, err error)
}

TokenFetcher is the interface for fetching fresh tokens from an external source (e.g., Databricks CLI, OAuth provider, etc.).

type TokenProvider

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

TokenProvider caches tokens obtained via a TokenFetcher, refreshing them when they are within 5 minutes of expiry.

func NewTokenProvider

func NewTokenProvider(fetcher TokenFetcher) *TokenProvider

NewTokenProvider creates a new TokenProvider backed by the given fetcher.

func (*TokenProvider) CachedToken

func (tp *TokenProvider) CachedToken() string

CachedToken returns the currently cached token (for testing).

func (*TokenProvider) SetCache

func (tp *TokenProvider) SetCache(token string, expiry time.Time)

SetCache directly seeds the token cache. Useful for testing or pre-warming.

func (*TokenProvider) Token

func (tp *TokenProvider) Token(ctx context.Context) (string, error)

Token returns a valid access token, refreshing if necessary.

Jump to

Keyboard shortcuts

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