tokenrefresh

package
v1.261026.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MPL-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthRefresher

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

OAuthRefresher handles periodic OAuth token refresh with jitter to distribute load across multiple instances

func NewTokenRefresher

func NewTokenRefresher(opts ...RefresherOption) *OAuthRefresher

NewTokenRefresher creates a new token refresher.

func (*OAuthRefresher) CheckAndRefreshTokens

func (tr *OAuthRefresher) CheckAndRefreshTokens()

CheckAndRefreshTokens checks all OAuth providers and refreshes tokens if needed

func (*OAuthRefresher) Running

func (tr *OAuthRefresher) Running() bool

Running returns true if the refresher is currently running

func (*OAuthRefresher) SetCheckInterval

func (tr *OAuthRefresher) SetCheckInterval(interval time.Duration)

SetCheckInterval sets the check interval

func (*OAuthRefresher) SetRefreshBuffer

func (tr *OAuthRefresher) SetRefreshBuffer(buffer time.Duration)

SetRefreshBuffer sets the refresh buffer

func (*OAuthRefresher) Start

func (tr *OAuthRefresher) Start(ctx context.Context)

Start begins the background token refresh loop

func (*OAuthRefresher) Stop

func (tr *OAuthRefresher) Stop()

Stop stops the background token refresh loop

type RefresherOption

type RefresherOption func(*refresherOptions)

RefresherOption configures an OAuth token refresher.

func WithCheckInterval

func WithCheckInterval(interval time.Duration) RefresherOption

WithCheckInterval sets how often the refresher checks for expiring tokens.

func WithProviderConfig

func WithProviderConfig(config providerConfig) RefresherOption

WithProviderConfig sets the provider config used for persisted OAuth providers.

func WithRandSource

func WithRandSource(rng *rand.Rand) RefresherOption

WithRandSource sets the random generator used for interval jitter.

func WithRefreshBuffer

func WithRefreshBuffer(buffer time.Duration) RefresherOption

WithRefreshBuffer sets how soon before expiry a token should be refreshed.

func WithTokenManager

func WithTokenManager(manager tokenManager) RefresherOption

WithTokenManager sets the token manager used for refresh operations.

Jump to

Keyboard shortcuts

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