jwt

package
v0.0.0-...-8170b65 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAbsent  = "token absent"  // 令牌不存在
	ErrInvalid = "token invalid" // 令牌无效
	ErrExpired = "token expired" // 令牌过期
	ErrOther   = "other error"   // 其他错误
)

Functions

func GenerateAppToken

func GenerateAppToken(m *models.YshopUser, d time.Time) (string, error)

func GenerateToken

func GenerateToken(m *models.SysUser, d time.Duration) (string, error)

func GetAdminDetailUser

func GetAdminDetailUser(c *gin.Context) *models.SysUser

返回 detail user

func GetAdminUser

func GetAdminUser(c *gin.Context) (*vo.JwtUser, error)

返回user

func GetAdminUserId

func GetAdminUserId(c *gin.Context) (int64, error)

返回id

func GetAppDetailUser

func GetAppDetailUser(c *gin.Context) (*models.YshopUser, error)

返回 detail user

func GetAppUser

func GetAppUser(c *gin.Context) (*vo.JwtUser, error)

返回user

func GetAppUserId

func GetAppUserId(c *gin.Context) (int64, error)

返回id

func RemoveAppUser

func RemoveAppUser(c *gin.Context) error

func RemoveUser

func RemoveUser(c *gin.Context) error

func Setup

func Setup()

func ValidateToken

func ValidateToken(tokenString string) (*vo.JwtUser, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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