permission

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: MIT Imports: 10 Imported by: 0

README

接口鉴权工具

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(v string) (string, string)

func Auth

func Auth(v bool) (string, bool)

func Permission

func Permission(v bool) (string, bool)

func Resource

func Resource(v string) (string, string)

Types

type ApiRegister

type ApiRegister struct {
	ioc.ObjectImpl
	// contains filtered or unexported fields
}

func (*ApiRegister) Init

func (a *ApiRegister) Init() error

func (*ApiRegister) Name

func (a *ApiRegister) Name() string

func (*ApiRegister) Priority

func (a *ApiRegister) Priority() int

Priority 这个 Init 一定要放在所有路由都添加完成之后运行

type Checker

type Checker struct {
	ioc.ObjectImpl
	// contains filtered or unexported fields
}

func (*Checker) Check

func (c *Checker) Check(r *restful.Request, w *restful.Response, chain *restful.FilterChain)

func (*Checker) CheckPolicy

func (c *Checker) CheckPolicy(r *restful.Request, tk *token.Token, route *endpoint.RouteEntry) error

CheckPolicy 验证策略 获取当前访问的路由

func (*Checker) CheckToken

func (c *Checker) CheckToken(r *restful.Request) (*token.Token, error)

func (*Checker) Init

func (c *Checker) Init() error

func (*Checker) Name

func (c *Checker) Name() string

func (*Checker) Priority

func (c *Checker) Priority() int

Priority 初始化的优先级,由大到小,默认是 0,此时必须比框架小一点,框架是 899 框架的 Init 函数调用完成后立马调用这个对象的 Init 函数,实现了全局中间件的功能

Jump to

Keyboard shortcuts

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