oauth

package
v0.15.16 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Configs = configset.Set[Config]{
	Default: &Config{},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Address string `koanf:"address"` // Prefix: webhooks
}

type OAuth

type OAuth struct {
	BaseURL string
	// contains filtered or unexported fields
}

func New

func New(c *Config, l *zap.Logger, v sdkservices.Vars) *OAuth

func (*OAuth) FreshToken

func (o *OAuth) FreshToken(ctx context.Context, l *zap.Logger, i sdktypes.Integration, vs sdktypes.Vars) *oauth2.Token

FreshToken returns the OAuth token stored in the connection variables. If it's stale, this function refreshes it first. A token without an expiry is considered fresh forever, so time-limited tokens with a missing timestamp need to add it. Refreshed tokens are saved back to the connection variables.

func (*OAuth) GetConfig

func (o *OAuth) GetConfig(ctx context.Context, integration string, cid sdktypes.ConnectionID) (*oauth2.Config, map[string]string, error)

GetConfig returns the OAuth 2.0 configuration for the given integration. The connection ID may be nil, but if it's not, this function tries to use private OAuth app settings from the connection's variables instead of the integration's defaults. This function must be called only by trusted code, as it may return sensitive information!

func (*OAuth) Start

func (o *OAuth) Start(m *muxes.Muxes) error

Jump to

Keyboard shortcuts

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