userInfo

package
v0.0.0-...-86e89f0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: MulanPSL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildJWT

func BuildJWT(userName string, password string) (string, error)

func CheckJWT

func CheckJWT(token string) (string, error)

CheckJWT 解码Token,获取用户信息;当error不为空时,说明token有问题

func Init

func Init()

Types

type Claims

type Claims struct {
	UserInfo
	jwt.StandardClaims
}

type JWTConfig

type JWTConfig struct {
	Issuer     string //token发行人的名称
	ExpireTime int    //有效期,单位时间
	Secret     []byte //采用的密钥
}

func (*JWTConfig) GetConfig

func (j *JWTConfig) GetConfig()

func (*JWTConfig) SetDefaultConfig

func (j *JWTConfig) SetDefaultConfig()

type UserInfo

type UserInfo struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*UserInfo) CheckUserInfo

func (u *UserInfo) CheckUserInfo() (bool, error)

func (*UserInfo) Publish

func (u *UserInfo) Publish() error

func (*UserInfo) SaveToken

func (u *UserInfo) SaveToken(token string) error

Jump to

Keyboard shortcuts

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