Documentation
¶
Index ¶
- func AuthnBypasswMiddleware() gin.HandlerFunc
- func AuthnMiddleware(retriever UserRetriever) gin.HandlerFunc
- func AuthzMiddleware(authorizer Authorizer) gin.HandlerFunc
- func Cors(c *gin.Context)
- func NoCache(c *gin.Context)
- func RequestIDMiddleware() gin.HandlerFunc
- func Secure(c *gin.Context)
- type Authorizer
- type UserRetriever
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthnBypasswMiddleware ¶
func AuthnBypasswMiddleware() gin.HandlerFunc
AuthnBypasswMiddleware 是一个认证中间件, 用于从 gin.Context 的 Header 中提取用户 ID,模拟所有请求认证通过。
func AuthnMiddleware ¶
func AuthnMiddleware(retriever UserRetriever) gin.HandlerFunc
AuthnMiddleware 是一个认证中间件,用于从 gin.Context 中提取 token 并验证 token 是否合法.
func AuthzMiddleware ¶
func AuthzMiddleware(authorizer Authorizer) gin.HandlerFunc
AuthzMiddleware 是一个 Gin 中间件,用于进行请求授权.
func RequestIDMiddleware ¶
func RequestIDMiddleware() gin.HandlerFunc
RequestIDMiddleware 是一个 Gin 中间件,用于在每个 HTTP 请求的上下文和 响应中注入 `x-request-id` 键值对.
Types ¶
type Authorizer ¶
Authorizer 用于定义授权接口的实现.
Click to show internal directories.
Click to hide internal directories.