middlewares

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 Allows

func Allows(ips ...string) gateway.Middleware

Allows 过滤白名单外的全部请求

func Blocks

func Blocks(ips ...string) gateway.Middleware

Blocks 拦截黑名单内的全部IP地址发出的请求

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.

Jump to

Keyboard shortcuts

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