Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth(af AuthFunc) gin.HandlerFunc
授权中间件,注册使用中间件后,如果授权未通过(af() return nil, false) 请求会被在此拦截并响应 301,反之, 如果授权通过,会在请求上下文对象 context 中添加一个 user 字段,保存授权的用户信息,授权后可以使用 ctx.Get("user") 经过类型转换后获取到该 User 对象
func Permiter ¶
func Permiter(license PermiterFunc) gin.HandlerFunc
鉴权中间件, 注册该中间件后, 如果 license 返回 true 则表示 有权限访问该组(个)接口, 否则响应 403
Types ¶
type PermiterFunc ¶
Click to show internal directories.
Click to hide internal directories.