provider

package
v0.16.80 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 14 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 auth0, firebase, jwks or other
	Provider string

	// Secret used for signing and encrypting the JWT token
	Secret string

	// 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"`

	// PubKeyType can be ecdsa or rsa
	PubKeyType string `mapstructure:"public_key_type"`

	// Audience value that the JWT token needs to match
	Audience string `mapstructure:"audience"`

	// Issuer value that the JWT token needs to match:
	// Example: http://my-domain.auth0.com
	Issuer string `mapstructure:"issuer"`

	// JWKSURL sets the url of the JWKS endpoint.
	// Example: https://YOUR_DOMAIN/.well-known/jwks.json
	JWKSURL string `mapstructure:"jwks_url"`

	// JWKSRefresh sets in minutes interval between refreshes,
	// overriding the adaptive token refreshing
	JWKSRefresh int `mapstructure:"jwks_refresh"`

	// JWKSMinRefresh sets in minutes fallback value when tokens
	// are refreshed, default to 60 minutes
	JWKSMinRefresh int `mapstructure:"jwks_min_refresh"`
}

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

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