jwt

package
v0.0.0-...-726a85d Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenAccessTokenAndRefreshToken

func GenAccessTokenAndRefreshToken(info UserAuthInfo) (string, string, error)

func ValidateToken

func ValidateToken(tokenStr string, signed string) (*jwt.Token, error)

Types

type UserAuthInfo

type UserAuthInfo struct {
	UserID        int64     `json:"UserID,string"`
	UserType      int       `json:"UserType"`
	Email         string    `json:"Email"`
	NickName      string    `json:"NickName"`
	LicenseNumber string    `json:"LicenseNumber"`
	CreatedAt     time.Time `json:"CreatedAt"`
	LastLoginAt   time.Time `json:"LastLoginAt"`
	Addr          string    `json:"Addr"`
	AddrName      string    `json:"AddrName"`
}

func GetUserAuthInfo

func GetUserAuthInfo(context *gin.Context) UserAuthInfo

func GetUserAuthInfoWS

func GetUserAuthInfoWS(accessToken string) UserAuthInfo

func GetUserInfoFromJwt

func GetUserInfoFromJwt(token *jwt.Token) (*UserAuthInfo, error)

GetUserInfoFromJwt 解析token

func ParseUserInfo

func ParseUserInfo(tokenStr string) (*UserAuthInfo, error)

ParseUserInfo 解析token

func ToUserAuthInfo

func ToUserAuthInfo(user interface{}) (UserAuthInfo, error)

Jump to

Keyboard shortcuts

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