extends

package
v0.0.0-...-95af3ef Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenImp

type AccessTokenImp struct {
	runtime.BaseIntercepter
	// contains filtered or unexported fields
}

func (*AccessTokenImp) Add

func (this *AccessTokenImp) Add(tb TokenCreator)

func (*AccessTokenImp) Before

func (this *AccessTokenImp) Before(api *meta.Api, ctx *fasthttp.RequestCtx) (bool, error)

func (*AccessTokenImp) Call

func (this *AccessTokenImp) Call(req *fasthttp.Request) *fasthttp.Response

func (*AccessTokenImp) Init

func (this *AccessTokenImp) Init(addr string, db int, expire int64, rmm core.RoleMetaManager)

type BalancePlugin

type BalancePlugin struct {
	LuaPlugin
}

func (*BalancePlugin) Config

func (this *BalancePlugin) Config(p string)

func (*BalancePlugin) Select

func (this *BalancePlugin) Select(req *fasthttp.RequestCtx, servers *[]*meta.Server) *meta.Server

type LuaPlugin

type LuaPlugin struct {
	// contains filtered or unexported fields
}

func (*LuaPlugin) GetType

func (this *LuaPlugin) GetType() runtime.PluginType

func (*LuaPlugin) Init

func (this *LuaPlugin) Init(catalog, code, ptype string)

type PluginCore

type PluginCore interface {
	GetFromContext(key string) interface{} //获取信息
	SetContext(key string, v interface{})  //设置信息
}

*

插件
基于lua脚本的插件
1、内部的方法
2、功能的扩展

type RedisTokenStore

type RedisTokenStore struct {
	// contains filtered or unexported fields
}

func (*RedisTokenStore) GetToken

func (this *RedisTokenStore) GetToken(id string) *core.AccessToken

获取token

func (*RedisTokenStore) Init

func (this *RedisTokenStore) Init(addr string, db int)

func (*RedisTokenStore) SaveToken

func (this *RedisTokenStore) SaveToken(id string, t *core.AccessToken, expire int64)

保存token

type TokenCreator

type TokenCreator interface {
	GetGrandType() string
	BuildToken(user string, secret string) (bool, string)
	SetTokenManager(tm *core.TokenManager)
}

*

基本的Access toke 实现
参数:grandtype ==access_token ,user==分配的用户或应用id,secret==秘钥

创建token的creator

Jump to

Keyboard shortcuts

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