mw

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	JwtType   string = "Bearer"
	JwtKey    string = "xxx"
	HeaderTag string = "Authorization"
)
View Source
var (
	AppName         = ""
	Username        = ""
	Password        = ""
	SmtpServer      = ""
	SmtpPort        = 25
	Tls             = false
	OpsMailReceiver []string
)

Functions

func AesEncDec added in v1.10.2

func AesEncDec() gin.HandlerFunc

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

func CookieData

func CookieData()

func Cors

func Cors() gin.HandlerFunc

func Cors2

func Cors2() gin.HandlerFunc

func ErrorLogHandler

func ErrorLogHandler() gin.HandlerFunc

func JoinRouter

func JoinRouter(method, path string) string

JoinRouter 拼接路由

func NewCookie

func NewCookie()

func NewSession

func NewSession(c *gin.Context, userData map[string]interface{}) error

func NoCache

func NoCache(c *gin.Context)

NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.

func NoMethodHandler

func NoMethodHandler() gin.HandlerFunc

NoMethodHandler 未找到请求方法的处理函数

func NoRouteHandler

func NoRouteHandler() gin.HandlerFunc

NoRouteHandler 未找到请求路由的处理函数

func Options

func Options(c *gin.Context)

Options is a middleware function that appends headers for options requests and aborts then exits the middleware chain and ends the request.

func PermissionMiddleware

func PermissionMiddleware(skipper ...SkipperFunc) gin.HandlerFunc

PermissionMiddleware 权限中间件

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

RecoveryMiddleware 崩溃恢复中间件

func Secure

func Secure(c *gin.Context)

Secure is a middleware function that appends security and resource access headers.

func SessionData

func SessionData(c *gin.Context) (map[string]interface{}, error)

func TokenData

func TokenData(c *gin.Context) (map[string]interface{}, error)

func UserAuthMiddleware

func UserAuthMiddleware(skipper ...SkipperFunc) gin.HandlerFunc

UserAuthMiddleware 用户授权中间件

Types

type SkipperFunc

type SkipperFunc func(*gin.Context) bool

SkipperFunc 定义中间件跳过函数

func AllowMethodAndPathPrefixSkipper

func AllowMethodAndPathPrefixSkipper(prefixes ...string) SkipperFunc

AllowMethodAndPathPrefixSkipper 检查请求方法和路径是否包含指定的前缀,如果包含则跳过

func AllowPathPrefixNoSkipper

func AllowPathPrefixNoSkipper(prefixes ...string) SkipperFunc

AllowPathPrefixNoSkipper 检查请求路径是否包含指定的前缀,如果包含则不跳过

func AllowPathPrefixSkipper

func AllowPathPrefixSkipper(prefixes ...string) SkipperFunc

AllowPathPrefixSkipper 检查请求路径是否包含指定的前缀,如果包含则跳过

Jump to

Keyboard shortcuts

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