oauth2x

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Overview

Package oauth2x provides shared functions for setting up an oauth2 client configuration

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrTokenEndpointMissing is returned when the issuers .well-known/openid-configuration is missing the token_endpoint key.
	ErrTokenEndpointMissing = errors.New("token endpoint missing from issuer well-known openid-configuration")
)

Functions

func MustViperFlags

func MustViperFlags(v *viper.Viper, flags *pflag.FlagSet)

MustViperFlags adds oidc oauth2 client credentials config to the provided flagset and binds to viper

func NewClient

func NewClient(_ context.Context, tokenSrc oauth2.TokenSource) *http.Client

NewClient returns a http client using requested token source

func NewClientCredentialsTokenSrc

func NewClientCredentialsTokenSrc(ctx context.Context, cfg Config) (oauth2.TokenSource, error)

NewClientCredentialsTokenSrc returns an oauth2 client credentials token source

Types

type Config

type Config struct {
	ID     string `mapstructure:"id"`
	Secret string `mapstructure:"secret"`
	Issuer string `mapstructure:"issuer"`
}

Config handles reading in all the config values available for setting up an oauth2 configuration

Jump to

Keyboard shortcuts

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