jwt

package
v0.0.0-...-cd4d371 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClaims

type AuthClaims struct {
	ID    uint64 `json:"i,omitempty"`
	Uid   uint64 `json:"u,omitempty"`
	Iss   string `json:"s,omitempty"`
	R     string `json:"r,omitempty"`
	Exp   int64  `json:"e,omitempty"`
	Nonce string `json:"j,omitempty"`
}

func (AuthClaims) Valid

func (a AuthClaims) Valid() error

type Config

type Config struct {
	SecretKey string `json:"secret_key" toml:"secret_key" yaml:"secret_key"`
	Method    string `json:"method" toml:"method" yaml:"method"`
}

func (*Config) Default

func (opt *Config) Default()

type Service

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

func New

func New(ctx context.Context, config *config.Service) (*Service, error)

func (*Service) Create

func (s *Service) Create(claims AuthClaims) (string, error)

func (*Service) FromContext

func (s *Service) FromContext(ctx context.Context) *AuthClaims

func (*Service) SetContext

func (s *Service) SetContext(ctx context.Context, c *AuthClaims) context.Context

func (*Service) Validate

func (s *Service) Validate(tokenString string, claims *AuthClaims) error

Jump to

Keyboard shortcuts

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