tokenrefresh

package
v0.260806.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MPL-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 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