token

package
v1.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

ProviderSet is a provider set for wire

Functions

This section is empty.

Types

type Factory

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

Factory declare token's factory

func New

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

New serve caller to create zap.Logger

func (*Factory) NewToken

func (f *Factory) NewToken(id int64, email string) (string, error)

NewToken serve caller new a json web token

func (*Factory) ValidateToken

func (f *Factory) ValidateToken(signedToken string) (claims *JwtTokenClaims, err error)

ValidateToken serve caller to given signed token to validate token

type JwtTokenClaims

type JwtTokenClaims struct {
	ID    int64  `json:"id"`
	Email string `json:"email"`
	jwt.StandardClaims
}

JwtTokenClaims declare custom claims

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

Jump to

Keyboard shortcuts

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