jwt

package
v0.0.0-...-7dcfe9a Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 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  int   `json:"uid"`  // id
	OID  int   `json:"oid"`  // organization
	Type int32 `json:"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 tokenApi

func (*Handler) GenToken

func (h *Handler) GenToken(t TokenReq) (claims *Claims, expire time.Duration, signedToken string, success bool)

func (*Handler) ValidateToken

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

ValidateToken validate tokenApi

func (*Handler) VerifyToken

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

type TokenReq

type TokenReq struct {
	BaseToken
	Audience string
	Subject  string
	Expire   time.Duration
}

Jump to

Keyboard shortcuts

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