jwt

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorize

func Authorize() gin.HandlerFunc

func InitAuth

func InitAuth(conf Config)

Types

type Authority

type Authority struct {
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func New

func New(conf Config) *Authority

func NewIdentify

func NewIdentify(conf Config) *Authority

func (*Authority) Gen

func (a *Authority) Gen(xtype string, info CustomerInfo, ttl int64) (string, error)

func (*Authority) Parse

func (a *Authority) Parse(tokenStr string) (*CustomClaims, error)

type Config

type Config struct {
	PrivateKeyPath string `toml:"private_key_path"`
	PublicKeyPath  string `toml:"public_key_path"`
}

type CustomClaims

type CustomClaims struct {
	*jwt.StandardClaims
	TokenType string
	CustomerInfo
}

type CustomerInfo

type CustomerInfo struct {
	Uid     string `json:"uid"`
	LoginAt int64  `json:"login_at"`
}

Jump to

Keyboard shortcuts

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