jwt

package
v0.0.0-...-724633c Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewOptions, New)

ProviderSet is a provider set for wire

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// NewToken serve caller new a json web token
	NewToken(id, name, picture, email string) (string, error)

	// ValidateToken serve caller to given signed token to validate token
	ValidateToken(signedToken string) (claims *TokenClaims, err error)
}

Factory declare token factory functions

func New

func New(o *Options, logger *zap.Logger) (Factory, error)

New a token factory

type Options

type Options struct {
	Name      string `json:"name" yaml:"name"`
	Signature string `json:"signature" yaml:"signature"`
}

Options declare token's configuration

func NewOptions

func NewOptions(v *viper.Viper) (*Options, error)

NewOptions serve caller to create Options

type TokenClaims

type TokenClaims struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Picture string `json:"picture"`
	Email   string `json:"email"`
	jwt.StandardClaims
}

TokenClaims declare custom claims

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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