jwt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseToken

type BaseToken struct {
	UID       string `json:"uid"`        // id
	LoginType int32  `json:"login_type"` // 登录方式
}

type Claims

type Claims struct {
	BaseToken
	proxy.StandardClaims
}

type Handler

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

func New

func New(key []byte, issuer string, expire time.Duration) Handler

func (*Handler) CreateToken

func (h *Handler) CreateToken(claims *Claims) (signedToken string, success bool)

CreateToken create token

func (*Handler) GenToken

func (h *Handler) GenToken(t Token) (claims *Claims, signedToken string, success bool)

func (*Handler) ValidateToken

func (h *Handler) ValidateToken(signedToken string) (claims *Claims, success bool)

ValidateToken validate token

func (*Handler) VerifyToken

func (h *Handler) VerifyToken(signedToken string) (claims *Claims, success bool)

type Token

type Token struct {
	BaseToken
	Audience string `json:"aud,omitempty"`
	Subject  string `json:"sub,omitempty"`
}

Jump to

Keyboard shortcuts

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