plugin

package
v0.0.0-...-6c6375f Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuth

func NewAuth(
	subject func(ctx *koa.Context) any,
	environment func(ctx *koa.Context) any,
	objects map[reflect.Type]AuthMap,
	policies map[reflect.Type]AuthPolicy,
) koa.PluginMultiArg

* ABAC * 该架构完美解耦游客和登录用户的权限,同时可以支持为游客设置权限,酷!

func NewConfig

func NewConfig[T any](filename string, config T) (koa.PluginMultiArg, *T)

* 读取yaml配置文件

func NewJsonParser

func NewJsonParser(maxLenBytes int) koa.PluginMultiArg

* JSONParser

func NewLogger

func NewLogger(debug bool) koa.PluginMultiArg

* 最简日志实现

func NewProxy

func NewProxy(mappings map[string][]string) koa.PluginMultiArg

func NewRouter

func NewRouter(mapping map[string]koa.Plugin) koa.PluginMultiArg

* 最简路由实现

func NewSecure

func NewSecure(CSRF bool, CORS bool, XSS bool) koa.PluginMultiArg

func NewSqlite

func NewSqlite(app *koa.Koa, filename string) (koa.PluginMultiArg, *sql.DB)

func NewStatic

func NewStatic(prefix string, dir string) koa.PluginSingleArg

prefix : path prefix dir: directory in host TODO: 增加缓存选项

Types

type Auth

type Auth = func(object any, operation any) bool

type AuthMap

type AuthMap = func(object any) any

type AuthPolicy

type AuthPolicy = func(subject any, environment any, object any, operation any) bool

Jump to

Keyboard shortcuts

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