jwt

package
v0.0.63 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenToken

func GenToken(userId string, username string) (string, error)

GenToken 生成 access token

func GenTokens added in v0.0.42

func GenTokens(userId string, username string) (aToken, rToken string, err error)

GenTokens 生成 access token 和 refresh token

func RefreshTokens added in v0.0.42

func RefreshTokens(aToken, rToken string) (newAToken, newRToken string, err error)

RefreshTokens 通过 refresh token 刷新一个新的 AccessToken

Types

type Claims

type Claims struct {
	UserId   string `json:"user_id"`
	Username string `json:"username"`
	jwt.RegisteredClaims
}

func ParseToken

func ParseToken(tokenStr string) (*Claims, error)

ParseToken

Jump to

Keyboard shortcuts

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