Documentation ¶
Index ¶
- Constants
- Variables
- func AllowClients(clients []string, ignores ...string) gateway.Middleware
- func Allows(ips ...string) gateway.Middleware
- func Blocks(ips ...string) gateway.Middleware
- func RolesInspector(enforcer *casbin.Enforcer) gateway.Middleware
- func ScopeInspector(rules auth.Rules) gateway.Middleware
- func TokenInspector(tokens auth.Tokens) gateway.Middleware
Constants ¶
View Source
const ( HttpJSONContent = "application/json" HttpFormContent = "application/x-www-form-urlencoded" HttpFormDataContent = "application/form-data" )
Variables ¶
View Source
var ( ErrBadAuthorizedToken = errors.New("非法的访问令牌") ErrAuthorizedTokenNotFound = errors.New("未提供访问令牌") )
Functions ¶
func AllowClients ¶
func AllowClients(clients []string, ignores ...string) gateway.Middleware
AllowClients 用于过滤不包含在指定范围内的所有请求 如果成功过滤可通过XClientKey读取当访问的ClientID
func RolesInspector ¶
func RolesInspector(enforcer *casbin.Enforcer) gateway.Middleware
RolesInspector 基于Casbin进行RBAC角色验证
func ScopeInspector ¶
func ScopeInspector(rules auth.Rules) gateway.Middleware
ScopeInspector Scopes 检查
func TokenInspector ¶
func TokenInspector(tokens auth.Tokens) gateway.Middleware
TokenInspector 用户访问令牌读取中间件,从 Authorization 请求头中获取当前用户身份 如果成功读取 auth.IsAuth(ctx) 将会返回True
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.