middleware

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdentityKey = "id"
)

Variables

View Source
var CacheStore persist.CacheStore
View Source
var JWTAuthMiddleware *jwt.GinJWTMiddleware

Functions

func CheckKey

func CheckKey(ctx *gin.Context)

func GetCacheDuration added in v0.60.0

func GetCacheDuration(route string) time.Duration

func Init

func Init()

func JWTInitParamas

func JWTInitParamas() *jwt.GinJWTMiddleware

func KeyRequired

func KeyRequired(ctx *gin.Context)

func OptionalJWTMiddleware

func OptionalJWTMiddleware(ctx *gin.Context)

用在一些可选登录接口上.

如果登录了, 则会在 ctx 中设置 "logged" 为 true, 并设置 "claims" 为 jwt.MapClaims.

func ValidateParamObjectID

func ValidateParamObjectID(ctx *gin.Context)

func ValidatePictureID

func ValidatePictureID(ctx *gin.Context)

Types

type Login

type Login struct {
	Username   string `json:"username" binding:"min=4,max=20"`
	TelegramID int64  `json:"telegram_id" binding:"omitempty"`
	Email      string `json:"email" binding:"omitempty,email"`
	Password   string `json:"password" binding:"required"`
}

type User

type User struct {
	UserName string
}

Jump to

Keyboard shortcuts

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