jwt

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSingKey

func InitSingKey(singKey1 string)

修改签名秘钥

Types

type JwtUtil

type JwtUtil struct {
	ExpiresAt            int64   //过期时间,秒
	ExpiresRenewalTimeAt int64   //续签过期时间
	RenewalTime          float64 //续签时间
}

func NewJwtUtil

func NewJwtUtil() *JwtUtil

func (*JwtUtil) Hs256Parse

func (j *JwtUtil) Hs256Parse(token_ string) (*jwt.Token, error)

func (*JwtUtil) Hs256RefreshToken

func (j *JwtUtil) Hs256RefreshToken(token_ string) (string, error)

续签token

func (*JwtUtil) Hs256Verify

func (j *JwtUtil) Hs256Verify(token_ string) bool

func (*JwtUtil) NewHs256Token

func (j *JwtUtil) NewHs256Token(user User) (string, error)

生成一个sh256加密的jwt

func (*JwtUtil) ParseUserFromToken

func (j *JwtUtil) ParseUserFromToken(token_ string) (*User, error)

type User

type User struct {
	Id   int64
	Data any
}

type UserClaims

type UserClaims struct {
	User
	jwt.RegisteredClaims
}

Jump to

Keyboard shortcuts

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