auth

package
v0.0.0-...-743d0d0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware() gin.HandlerFunc

AuthMiddleware 登录中间件

func GenerateToken

func GenerateToken(c *gin.Context, user *user.User) (string, error)

GenerateToken 生成jwt

func GetAuthUser

func GetAuthUser(c *gin.Context) *user.User

GetAuthUser 获取已经验证的用户

Types

type MyCustomClaims

type MyCustomClaims struct {
	ID       int64
	Username string
	jwt.StandardClaims
}

func ParseToken

func ParseToken(c *gin.Context, token string) (*MyCustomClaims, error)

ParseToken 解析jwt

Jump to

Keyboard shortcuts

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