middleware

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminMiddleware

func AdminMiddleware() gin.HandlerFunc

AdminMiddleware 管理员中间件

func AuthMiddleware

func AuthMiddleware() gin.HandlerFunc

AuthMiddleware 认证中间件

func CheckPassword

func CheckPassword(password, hash string) bool

CheckPassword 检查密码

func GenerateToken

func GenerateToken(user *entity.User) (string, error)

GenerateToken 生成JWT令牌

func HashPassword

func HashPassword(password string) (string, error)

HashPassword 哈希密码

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware HTTP请求日志中间件

func PublicAPIAuth

func PublicAPIAuth() gin.HandlerFunc

PublicAPIAuth 公开API认证中间件

func SetRepositoryManager

func SetRepositoryManager(rm *repo.RepositoryManager)

SetRepositoryManager 设置Repository管理器

Types

type Claims

type Claims struct {
	UserID   uint   `json:"user_id"`
	Username string `json:"username"`
	Role     string `json:"role"`
	jwt.RegisteredClaims
}

Claims JWT声明

Jump to

Keyboard shortcuts

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