Help us shape the future of Go! Take the 2026 Go Developer Survey

provider

package
v0.21.9 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth0Provider

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

func NewAuth0Provider

func NewAuth0Provider(config JWTConfig) (*Auth0Provider, error)

func (*Auth0Provider) KeyFunc

func (p *Auth0Provider) KeyFunc() jwt.Keyfunc

func (*Auth0Provider) SetContextValues

func (p *Auth0Provider) SetContextValues(ctx context.Context, claims jwt.MapClaims) (context.Context, error)

func (*Auth0Provider) VerifyAudience

func (p *Auth0Provider) VerifyAudience(claims jwt.MapClaims) bool

func (*Auth0Provider) VerifyIssuer

func (p *Auth0Provider) VerifyIssuer(claims jwt.MapClaims) bool

type FirebaseProvider

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

func NewFirebaseProvider

func NewFirebaseProvider(config JWTConfig) (*FirebaseProvider, error)

func (*FirebaseProvider) KeyFunc

func (p *FirebaseProvider) KeyFunc() jwt.Keyfunc

func (*FirebaseProvider) SetContextValues

func (p *FirebaseProvider) SetContextValues(ctx context.Context, claims jwt.MapClaims) (context.Context, error)

func (*FirebaseProvider) VerifyAudience

func (p *FirebaseProvider) VerifyAudience(claims jwt.MapClaims) bool

func (*FirebaseProvider) VerifyIssuer

func (p *FirebaseProvider) VerifyIssuer(claims jwt.MapClaims) bool

type GenericProvider

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

func NewGenericProvider

func NewGenericProvider(config JWTConfig) (*GenericProvider, error)

func (*GenericProvider) KeyFunc

func (p *GenericProvider) KeyFunc() jwt.Keyfunc

func (*GenericProvider) SetContextValues

func (p *GenericProvider) SetContextValues(ctx context.Context, claims jwt.MapClaims) (context.Context, error)

func (*GenericProvider) VerifyAudience

func (p *GenericProvider) VerifyAudience(claims jwt.MapClaims) bool

func (*GenericProvider) VerifyIssuer

func (p *GenericProvider) VerifyIssuer(claims jwt.MapClaims) bool

type JWKSProvider

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

func NewJWKSProvider

func NewJWKSProvider(config JWTConfig) (*JWKSProvider, error)

func (*JWKSProvider) KeyFunc

func (p *JWKSProvider) KeyFunc() jwt.Keyfunc

func (*JWKSProvider) SetContextValues

func (p *JWKSProvider) SetContextValues(ctx context.Context, claims jwt.MapClaims) (context.Context, error)

func (*JWKSProvider) VerifyAudience

func (p *JWKSProvider) VerifyAudience(claims jwt.MapClaims) bool

func (*JWKSProvider) VerifyIssuer

func (p *JWKSProvider) VerifyIssuer(claims jwt.MapClaims) bool

type JWTConfig

type JWTConfig struct {
	// Provider can be one of auth0, firebase, jwks or other
	Provider string `jsonschema:"title=JWT Provider,enum=auth0,enum=firebase,enum=jwks,enum=other"`

	// The secret key used for signing and encrypting the JWT token
	Secret string `jsonschema:"title=JWT Secret Key"`

	// Public keys can be used instead of using a secret
	// PublicKeyFile points to the file containing the public key
	PubKeyFile string `mapstructure:"public_key_file" jsonschema:"title=Public Key File"`

	// Public key file type can be one of ecdsa or rsa
	PubKeyType string `mapstructure:"public_key_type" jsonschema:"title=Public Key File Type,enum=ecdsa,enum=rsa"`

	// Audience value that the JWT token needs to match
	Audience string `mapstructure:"audience" jsonschema:"title=Match Audience Value"`

	// Issuer value that the JWT token needs to match:
	// Example: http://my-domain.auth0.com
	Issuer string `mapstructure:"issuer" jsonschema:"title=Match Issuer Value,example=http://my-domain.auth0.com"`

	// Sets the url of the JWKS endpoint.
	// Example: https://YOUR_DOMAIN/.well-known/jwks.json
	JWKSURL string `mapstructure:"jwks_url" jsonschema:"title=JWKS Endpoint URL,example=https://YOUR_DOMAIN/.well-known/jwks.json"`

	// Sets in minutes interval between refreshes, overriding the adaptive token refreshing
	JWKSRefresh int `mapstructure:"jwks_refresh" jsonschema:"title=JWKS Refresh Timeout (minutes)"`

	// JWKSMinRefresh sets in minutes fallback value when tokens are refreshed, default
	// to 60 minutes
	JWKSMinRefresh int `mapstructure:"jwks_min_refresh" jsonschema:"title=JWKS Minumum Refresh Timeout (minutes)"`
	// contains filtered or unexported fields
}

JWTConfig struct contains JWT authentication related config values used by the GraphJin service

func (*JWTConfig) SetFS

func (c *JWTConfig) SetFS(fs afero.Fs)

type JWTProvider

type JWTProvider interface {
	KeyFunc() jwt.Keyfunc
	VerifyAudience(jwt.MapClaims) bool
	VerifyIssuer(jwt.MapClaims) bool
	SetContextValues(context.Context, jwt.MapClaims) (context.Context, error)
}

JWTProvider is the interface to define providers for doing JWT authentication.

func NewProvider

func NewProvider(config JWTConfig) (JWTProvider, error)

Jump to

Keyboard shortcuts

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