middleware

package
v0.0.0-...-7c3836c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 17 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 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

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