middleware

package
v0.0.0-...-385473e Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authn

func Authn() gin.HandlerFunc

func Authz

func Authz(a Auther) gin.HandlerFunc

Authz 是 Gin 中间件,用来进行请求授权.

func Cors

func Cors(c *gin.Context)

Cors 是一个 Gin 中间件,用来设置 options 请求的返回头,然后退出中间件链,并结束请求(浏览器跨域设置).

func NoCache

func NoCache(c *gin.Context)

NoCache 是一个 Gin 中间件,用来禁止客户端缓存 HTTP 请求的返回结果.

func RequestID

func RequestID() gin.HandlerFunc

RequestID 是一个 Gin 中间件,用来在每一个 HTTP 请求的 context, response 中注入 `X-Request-ID` 键值对.

func Secure

func Secure(c *gin.Context)

Secure 是一个 Gin 中间件,用来添加一些安全和资源访问相关的 HTTP 头.

Types

type Auther

type Auther interface {
	Authorize(sub, obj, act string) (bool, error)
}

Auther 用来定义授权接口实现. sub: 操作主题,obj:操作对象, act:操作

Jump to

Keyboard shortcuts

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