middleware

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Masked session invalid
	Masked = "masked"
	// Guest no session
	Guest = "guest"
)
View Source
const (
	SessionName = "session"
)

Variables

This section is empty.

Functions

func AddMiddlewares

func AddMiddlewares(es ...Entry)

Types

type Authorizer

type Authorizer struct{}

func (*Authorizer) Init

func (a *Authorizer) Init() ([]gin.HandlerFunc, error)

type BasicAuthorizer

type BasicAuthorizer struct{}

func (*BasicAuthorizer) Abort

func (a *BasicAuthorizer) Abort(c *gin.Context, code int, msg string)

func (*BasicAuthorizer) CheckPermission

func (a *BasicAuthorizer) CheckPermission(r *http.Request, id int64) (bool, error)

func (*BasicAuthorizer) GetUser

func (a *BasicAuthorizer) GetUser(c *gin.Context) (id int64, state bool, role string)

func (*BasicAuthorizer) RequireLogIn

func (a *BasicAuthorizer) RequireLogIn(c *gin.Context)

func (*BasicAuthorizer) RequirePermission

func (a *BasicAuthorizer) RequirePermission(c *gin.Context)

func (*BasicAuthorizer) RequireReLogIn

func (a *BasicAuthorizer) RequireReLogIn(c *gin.Context)

func (*BasicAuthorizer) TryAgainLater

func (a *BasicAuthorizer) TryAgainLater(c *gin.Context)

type Cors

type Cors struct{}

func (*Cors) Init

func (c *Cors) Init() ([]gin.HandlerFunc, error)

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

func Entries

func Entries() []Entry

func NewEntry

func NewEntry(m Middleware, orders ...int) Entry

func (*Entry) Middleware

func (e *Entry) Middleware() Middleware

func (*Entry) Order

func (e *Entry) Order() int

type Limiter

type Limiter struct{}

func (*Limiter) Init

func (l *Limiter) Init() ([]gin.HandlerFunc, error)

type Log

type Log struct{}

func (*Log) Init

func (l *Log) Init() ([]gin.HandlerFunc, error)

type Middleware

type Middleware interface {
	Init() ([]gin.HandlerFunc, error)
}

type Session

type Session struct{}

func (*Session) Init

func (s *Session) Init() ([]gin.HandlerFunc, error)

Jump to

Keyboard shortcuts

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