jwt

package
v0.0.0-...-c622313 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoRouteHandler

func NoRouteHandler(c *gin.Context)

NoRouteHandler 404 handler

Types

type AdminAuthorizator

type AdminAuthorizator struct {
}

AdminAuthorizator 管理员授权规则

func (*AdminAuthorizator) HandleAuthorizator

func (*AdminAuthorizator) HandleAuthorizator(data interface{}, c *gin.Context) bool

HandleAuthorizator 处理管理员授权规则

type AllUserAuthorizator

type AllUserAuthorizator struct {
}

AllUserAuthorizator 普通用户授权规则

func (*AllUserAuthorizator) HandleAuthorizator

func (*AllUserAuthorizator) HandleAuthorizator(data interface{}, c *gin.Context) bool

HandleAuthorizator 处理普通用户授权规则

type IAuthorizator

type IAuthorizator interface {
	HandleAuthorizator(data interface{}, c *gin.Context) bool
}

IAuthorizator 授权规则接口

type JWT

type JWT struct {
	UserService service.IUserService `inject:""`
	RoleService service.IRoleService `inject:""`
}

JWT 注入IService

func (*JWT) GinJWTMiddlewareInit

func (j *JWT) GinJWTMiddlewareInit(jwtAuthorizator IAuthorizator) (authMiddleware *jwt.GinJWTMiddleware)

GinJWTMiddlewareInit 初始化中间件

type TestAuthorizator

type TestAuthorizator struct {
}

TestAuthorizator 测试用户授权规则

func (*TestAuthorizator) HandleAuthorizator

func (*TestAuthorizator) HandleAuthorizator(data interface{}, c *gin.Context) bool

HandleAuthorizator 处理测试用户授权规则

Jump to

Keyboard shortcuts

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