middlewares

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UsernameKey = "username"
	KeyUserID   = "userID"
	UserIP      = "ip"
)

Variables

View Source
var Middlewares = defaultMiddlewares()

Functions

func Context

func Context() gin.HandlerFunc

Context 请求上下文中间件,用于将一些常用的信息放入到gin.Context中

func Cors

func Cors() gin.HandlerFunc

func TracingHandler

func TracingHandler(service string) gin.HandlerFunc

Types

type AuthOperator

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

AuthOperator 认证实体工厂类

func (*AuthOperator) AuthFunc

func (ao *AuthOperator) AuthFunc() gin.HandlerFunc

AuthFunc 返回一个 gin.HandlerFunc 中间件接口函数

func (*AuthOperator) SetStrategy

func (ao *AuthOperator) SetStrategy(s AuthStrategy)

type AuthStrategy

type AuthStrategy interface {
	// AuthFunc 相当于是实现了一个名为 AuthFunc 的中间件
	AuthFunc() gin.HandlerFunc
}

AuthStrategy 认证策略

Directories

Path Synopsis
Package auth defines authentication strategy like Basic, Bearer.
Package auth defines authentication strategy like Basic, Bearer.

Jump to

Keyboard shortcuts

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