plugins

package
v0.0.0-...-c58336e Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OriginField      = "Origin"
	AllowOrigin      = "Access-Control-Allow-Origin"
	AllowMethods     = "Access-Control-Allow-Methods"
	AllowHeaders     = "Access-Control-Allow-Headers"
	AllowCredentials = "Access-Control-Allow-Credentials"
	ExposeHeaders    = "Access-Control-Expose-Headers"
)

Variables

This section is empty.

Functions

func Cors

func Cors() gin.HandlerFunc

Cors 跨域处理中间件

func InitOption

func InitOption(opts ...Option)

InitOption 初始化传入Option

func JWTAuthMiddleware

func JWTAuthMiddleware() gin.HandlerFunc

JWTAuthMiddleware 基于JWT的认证中间件

func ZapTraceLogger

func ZapTraceLogger() gin.HandlerFunc

ZapTraceLogger 创建一个ZapTraceLogger中间件

Types

type Option

type Option func(*Options)

func WithSecret

func WithSecret(secret string) Option

WithSecret jwt的secret

func WithSkipPaths

func WithSkipPaths(path string) Option

WithSkipPaths 跳过验证的请求path

type Options

type Options struct {
	SkipPaths []string // 跳过token校验的方法
	Secret    string   // jwt的secret
}

Jump to

Keyboard shortcuts

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