middleware

package
v0.0.0-...-1fffc49 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoginStandard = 1
	LoginOAuth    = 2
)

login type

Functions

func AdminRequired

func AdminRequired() gin.HandlerFunc

AdminRequired admin required

func Authenticator

func Authenticator(c *gin.Context) (interface{}, errors.WTError)

func CurrentUser

func CurrentUser(ctx *gin.Context)

func JwtAuth

func JwtAuth(LoginType int) *jwt.GinJWTMiddleware

todo : 用单独的claims model去掉user model

func LoginResponse

func LoginResponse(c *gin.Context, code int, token string, expire time.Time)

Types

type LoginDto

type LoginDto struct {
	LoginToken string `form:"loginToken" json:"loginToken" binding:"required"`
}

type LoginOAuthDto

type LoginOAuthDto struct {
	Code  string `form:"code" binding:"required"`
	State string `form:"state" binding:"required"`
}

LoginOAuthDto - oauth login

Jump to

Keyboard shortcuts

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