auth_interceptor

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "auth_interceptor_redis"
)

Variables

This section is empty.

Functions

func Create

func Create(id, name string, conf *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

Create 初始化插件执行实例

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

func Register

func Register(register eosc.IExtenderDriverRegister)

Types

type Auth

type Auth struct {
	drivers.WorkerBase
	// contains filtered or unexported fields
}

func (*Auth) CheckSkill

func (a *Auth) CheckSkill(skill string) bool

func (*Auth) Destroy

func (a *Auth) Destroy()

func (*Auth) DoFilter

func (a *Auth) DoFilter(ctx eocontext.EoContext, next eocontext.IChain) (err error)

DoFilter 拦截请求过滤,内部转换为http类型再处理

func (*Auth) DoHttpFilter

func (a *Auth) DoHttpFilter(ctx http_service.IHttpContext, next eocontext.IChain) error

DoHttpFilter 核心http处理方法

func (*Auth) Reset

func (a *Auth) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) error

Reset 当类型为插件时,Reset方法不会执行

func (*Auth) Start

func (a *Auth) Start() error

Start 插件添加时执行

func (*Auth) Stop

func (a *Auth) Stop() error

Stop 插件删除时间执行

type Config

type Config struct {
	SysKey       string       `json:"sys_key" label:"认证系统在Redis存储中的KEY值"`
	AuthKey      string       `json:"auth_key" label:"认证参数KEY名"`
	AuthPosition string       `json:"auth_position" enum:"header,query,body" label:"认证参数追加位置"`
	RedisConfig  *RedisConfig `json:"redis" label:"Redis连接配置"`
	RedisConn    string       `json:"redis_conn" label:"Redis连接名称"`
	RetryCount   int          `json:"retry_count" label:"认证失败重试次数"`
	RetryPeriod  int          `json:"retry_period" label:"认证失败重试间隔"`
}

Config 参数配置属性

type RedisConfig

type RedisConfig struct {
	Addr     string `json:"addr" label:"Redis连接地址"`
	Username string `json:"username" label:"Redis连接用户名"`
	Password string `json:"password" label:"Redis连接密码"`
	DB       int    `json:"db" label:"Redis db序号"`
	Mode     string `json:"mode" label:"Redis连接模式"`
}

Jump to

Keyboard shortcuts

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