middleware

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProjectNotExists      = errors.New("项目可能不存在")
	ErrCronJobNotExists      = errors.New("定时任务可能不存在")
	ErrNotPermission         = errors.New("没有权限")
	ErrCheckPermissionFailed = errors.New("校验权限失败")
)
View Source
var ErrLimitExceed = errors.New("Rate limit exceed!")
View Source
var ErrorASD = errors.New("权限验证失败!")

Functions

func AllowCors

func AllowCors() http.ServerResponseFunc

func CasbinToContext

func CasbinToContext() http.RequestFunc

func CheckAuthMiddleware

func CheckAuthMiddleware(logger log.Logger) endpoint.Middleware

func CookieToContext

func CookieToContext() http.RequestFunc

func CronJobMiddleware

func CronJobMiddleware(logger log.Logger, cronjobRepository repository.CronjobRepository, groupsRepository repository.GroupsRepository) endpoint.Middleware

func GroupIdToContext

func GroupIdToContext() http.RequestFunc

func NamespaceMiddleware

func NamespaceMiddleware(logger log.Logger) endpoint.Middleware

func NamespaceToContext

func NamespaceToContext() http.RequestFunc

func NewEnforcer

func NewEnforcer(
	subject string, object interface{}, action string,
) endpoint.Middleware

func ProjectMiddleware

func ProjectMiddleware(logger log.Logger, projectRepository repository.ProjectRepository, groupsRepository repository.GroupsRepository) endpoint.Middleware

func RequestIdToContext

func RequestIdToContext() http.RequestFunc

func RequestIdToResponse

func RequestIdToResponse() http.ServerResponseFunc

func TokenBucketLimitter added in v0.2.9

func TokenBucketLimitter(bkt *rate.Limiter) endpoint.Middleware

Types

type ASDContext

type ASDContext string
const (
	UserIdContext     ASDContext = "userId"
	EmailContext      ASDContext = "email"
	NamespaceContext  ASDContext = "namespace"
	NameContext       ASDContext = "name"
	RoleIdsContext    ASDContext = "roleIds"
	GroupIdsContext   ASDContext = "groupIds"
	NamespacesContext ASDContext = "namespaces"
	ProjectContext    ASDContext = "project"
	GroupIdContext    ASDContext = "groupId"
	IsAdmin           ASDContext = "isAdmin"
	CronJobContext    ASDContext = "cronJob"
	StartTime         ASDContext = "start-time"
)

Jump to

Keyboard shortcuts

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