jwt

package
v0.0.0-...-f683405 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hash *jwt.HMACSHA

Functions

func Generate

func Generate(data map[string]interface{}, extend ...time.Duration) (string, error)

Generate generates jwt map

func Register

func Register(c string)

Register register jwt with given config

Types

type Config

type Config struct {
	Secret   string        `yaml:"secret"`
	Issuer   string        `yaml:"issuer"`
	Audience []string      `yaml:"audience"`
	Age      time.Duration `yaml:"age"`
	Subject  string        `yaml:"subject"`
}

Config jwt configuration

type Payload

type Payload struct {
	jwt.Payload
	Data  map[string]interface{} `json:"data,omitempty"`
	Empty bool                   `json:"empty,omitempty"`
}

Payload jwt payload

func Verify

func Verify(token string) (Payload, error)

Verify verifies jwt token

func (*Payload) ExtendPeriod

func (p *Payload) ExtendPeriod(d time.Duration)

ExtendPeriod extends jwt validity to given duration

func (*Payload) Get

func (p *Payload) Get(key string) (interface{}, bool)

Get get jwt parameter

func (*Payload) Remove

func (p *Payload) Remove(key string)

Remove removes jwt parameter

func (*Payload) Set

func (p *Payload) Set(key string, value interface{})

Set set jwt parameter

Jump to

Keyboard shortcuts

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