oauth

package
v1.107.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Unlicense Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAudience for OAuth.
	ErrInvalidAudience = errors.New("invalid audience")

	// ErrInvalidIssuer for OAuth.
	ErrInvalidIssuer = errors.New("invalid issuer")

	// ErrInvalidAlgorithm for OAuth.
	ErrInvalidAlgorithm = errors.New("invalid algorithm")
)
View Source
var ErrInvalidResponse = errors.New("invalid response")

ErrInvalidResponse from OAuth.

View Source
var ErrMissingCertificate = errors.New("missing certificate")

ErrMissingCertificate from OAuth.

Functions

func NewGenerator

func NewGenerator(params GeneratorParams) (token.Generator, error)

NewGenerator for OAuth.

func NewVerifier

func NewVerifier(cfg *Config, cert Certificator) token.Verifier

NewVerifier for OAuth.

Types

type Certificator

type Certificator interface {
	Certificate(ctx context.Context, token *jwt.Token) (crypto.PublicKey, error)
}

Certificator for OAuth.

func NewCertificator

func NewCertificator(params CertificatorParams) (Certificator, error)

NewCertificator for OAuth.

type CertificatorParams

type CertificatorParams struct {
	fx.In

	Config     *Config
	HTTPConfig *http.Config
	Logger     *zap.Logger
	Cache      *ristretto.Cache
	Tracer     tracer.Tracer
	Meter      metric.Meter
}

CertificatorParams for OAuth.

type Config

type Config struct {
	URL           string `yaml:"url" json:"url" toml:"url"`
	ClientID      string `yaml:"client_id" json:"client_id" toml:"client_id"`
	ClientSecret  string `yaml:"client_secret" json:"client_secret" toml:"client_secret"`
	Audience      string `yaml:"audience" json:"audience" toml:"audience"`
	Issuer        string `yaml:"issuer" json:"issuer" toml:"issuer"`
	Algorithm     string `yaml:"algorithm" json:"algorithm" toml:"algorithm"`
	JSONWebKeySet string `yaml:"json_web_key_set" json:"json_web_key_set" toml:"json_web_key_set"`
}

Config for OAuth.

func (*Config) CacheKey

func (c *Config) CacheKey(prefix string) string

CacheKey for config.

type GeneratorParams

type GeneratorParams struct {
	fx.In

	Config     *Config
	HTTPConfig *http.Config
	Logger     *zap.Logger
	Cache      *ristretto.Cache
	Tracer     tracer.Tracer
	Meter      metric.Meter
}

GeneratorParams for OAuth.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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