Back to

Package jwt

Latest Go to latest

The highest tagged major version is .

Published: Sep 18, 2020 | License: MIT | Module:



const (
	Bearer    = "Bearer "
	XTseToken = "X-Ts-Token"
	CookieKey = "ts-token"

func EchoAuth

func EchoAuth() echo.MiddlewareFunc

func EchoEnforcer

func EchoEnforcer() echo.MiddlewareFunc

func EchoJwt

func EchoJwt(u IUser) echo.MiddlewareFunc

EchoAuth jwt注入鉴定

func GetAuthority

func GetAuthority(c echo.Context) (data string)

func ReadTimeout

func ReadTimeout() (timeout int64)

func SetTimeout

func SetTimeout(timeout int64) int64

type IUser

type IUser interface {
	New() IUser
	GetByID(null.UUID) error
	ID() null.UUID
	HasAdmin() bool
	OnlineExtend(*TsClaims) error
	OnlineCheck(*TsClaims, net.IP) error

type TsClaims

type TsClaims struct {
	UserID null.UUID `json:"usi,omitempty"`

func GenerateToken

func GenerateToken(id null.UUID, ct time.Time) (claims *TsClaims, t string)

GenerateToken 生成Token

func (*TsClaims) Extend

func (c *TsClaims) Extend(ct time.Time) *TsClaims

Extend 延期Token

func (*TsClaims) SignedString

func (c *TsClaims) SignedString() (t string)

Extend 延期Token

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier