auth

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

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

Claims JWT声明

type JWTManager

type JWTManager struct {
	// contains filtered or unexported fields
}

JWTManager JWT管理器

func NewJWTManager

func NewJWTManager(secretKey string) *JWTManager

NewJWTManager 创建JWT管理器

func (*JWTManager) GenerateToken

func (j *JWTManager) GenerateToken(userID uint, username string) (string, error)

GenerateToken 生成JWT token

func (*JWTManager) ValidateToken

func (j *JWTManager) ValidateToken(tokenString string) (*Claims, error)

ValidateToken 验证JWT token

Jump to

Keyboard shortcuts

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